From d41b7ccd081884a58fb812fc795ddf8d27ae918d Mon Sep 17 00:00:00 2001 From: Asapanna Rakesh Date: Tue, 26 Mar 2024 05:11:23 +0530 Subject: [PATCH 1/4] chore: (no code changes) formatting --- streamlit_image_select/frontend/public/styles.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/streamlit_image_select/frontend/public/styles.css b/streamlit_image_select/frontend/public/styles.css index 3214eb3..921da77 100644 --- a/streamlit_image_select/frontend/public/styles.css +++ b/streamlit_image_select/frontend/public/styles.css @@ -32,9 +32,11 @@ label { flex-wrap: wrap; gap: 0.5rem; } + .item { width: 10rem; } + .item.stretch { flex: 1; } @@ -90,5 +92,5 @@ label { } .caption.dark { - color:rgba(250, 250, 250, 0.6); -} + color: rgba(250, 250, 250, 0.6); +} \ No newline at end of file From 5148b22249cab61ae43349592fad9459f5832d7d Mon Sep 17 00:00:00 2001 From: Asapanna Rakesh Date: Tue, 26 Mar 2024 05:12:03 +0530 Subject: [PATCH 2/4] center captions --- streamlit_image_select/frontend/public/styles.css | 1 + 1 file changed, 1 insertion(+) diff --git a/streamlit_image_select/frontend/public/styles.css b/streamlit_image_select/frontend/public/styles.css index 921da77..e0be288 100644 --- a/streamlit_image_select/frontend/public/styles.css +++ b/streamlit_image_select/frontend/public/styles.css @@ -89,6 +89,7 @@ label { font-weight: 400; font-size: 14px; color: rgba(49, 51, 63, 0.6); + text-align: center; } .caption.dark { From 94384681a2ab3953f990a956597d384cd59da3a2 Mon Sep 17 00:00:00 2001 From: Asapanna Rakesh Date: Tue, 26 Mar 2024 05:19:23 +0530 Subject: [PATCH 3/4] include build --- .../frontend/build/asset-manifest.json | 19 ++++ .../frontend/build/index.html | 1 + ...nifest.a3ed1e0789f7e4b715083db6f7d3fcad.js | 22 +++++ .../frontend/build/service-worker.js | 39 ++++++++ .../build/static/js/2.761ae6da.chunk.js | 3 + .../static/js/2.761ae6da.chunk.js.LICENSE.txt | 42 ++++++++ .../build/static/js/2.761ae6da.chunk.js.map | 1 + .../build/static/js/main.f9f36653.chunk.js | 2 + .../static/js/main.f9f36653.chunk.js.map | 1 + .../build/static/js/runtime-main.fce4c018.js | 2 + .../static/js/runtime-main.fce4c018.js.map | 1 + .../frontend/build/styles.css | 97 +++++++++++++++++++ 12 files changed, 230 insertions(+) create mode 100644 streamlit_image_select/frontend/build/asset-manifest.json create mode 100644 streamlit_image_select/frontend/build/index.html create mode 100644 streamlit_image_select/frontend/build/precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js create mode 100644 streamlit_image_select/frontend/build/service-worker.js create mode 100644 streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js create mode 100644 streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js.LICENSE.txt create mode 100644 streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js.map create mode 100644 streamlit_image_select/frontend/build/static/js/main.f9f36653.chunk.js create mode 100644 streamlit_image_select/frontend/build/static/js/main.f9f36653.chunk.js.map create mode 100644 streamlit_image_select/frontend/build/static/js/runtime-main.fce4c018.js create mode 100644 streamlit_image_select/frontend/build/static/js/runtime-main.fce4c018.js.map create mode 100644 streamlit_image_select/frontend/build/styles.css diff --git a/streamlit_image_select/frontend/build/asset-manifest.json b/streamlit_image_select/frontend/build/asset-manifest.json new file mode 100644 index 0000000..db93e36 --- /dev/null +++ b/streamlit_image_select/frontend/build/asset-manifest.json @@ -0,0 +1,19 @@ +{ + "files": { + "main.js": "./static/js/main.f9f36653.chunk.js", + "main.js.map": "./static/js/main.f9f36653.chunk.js.map", + "runtime-main.js": "./static/js/runtime-main.fce4c018.js", + "runtime-main.js.map": "./static/js/runtime-main.fce4c018.js.map", + "static/js/2.761ae6da.chunk.js": "./static/js/2.761ae6da.chunk.js", + "static/js/2.761ae6da.chunk.js.map": "./static/js/2.761ae6da.chunk.js.map", + "index.html": "./index.html", + "precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js": "./precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js", + "service-worker.js": "./service-worker.js", + "static/js/2.761ae6da.chunk.js.LICENSE.txt": "./static/js/2.761ae6da.chunk.js.LICENSE.txt" + }, + "entrypoints": [ + "static/js/runtime-main.fce4c018.js", + "static/js/2.761ae6da.chunk.js", + "static/js/main.f9f36653.chunk.js" + ] +} \ No newline at end of file diff --git a/streamlit_image_select/frontend/build/index.html b/streamlit_image_select/frontend/build/index.html new file mode 100644 index 0000000..620bcf4 --- /dev/null +++ b/streamlit_image_select/frontend/build/index.html @@ -0,0 +1 @@ +streamlit-image-select \ No newline at end of file diff --git a/streamlit_image_select/frontend/build/precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js b/streamlit_image_select/frontend/build/precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js new file mode 100644 index 0000000..e79aa60 --- /dev/null +++ b/streamlit_image_select/frontend/build/precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js @@ -0,0 +1,22 @@ +self.__precacheManifest = (self.__precacheManifest || []).concat([ + { + "revision": "1fef722a5012cd02cd1c8dc8836c1c7e", + "url": "./index.html" + }, + { + "revision": "e9a1e852f972414fe4f0", + "url": "./static/js/2.761ae6da.chunk.js" + }, + { + "revision": "b5321db7731dbb9a09b1fc4c60b61213", + "url": "./static/js/2.761ae6da.chunk.js.LICENSE.txt" + }, + { + "revision": "405aa8fa5573cfcf836e", + "url": "./static/js/main.f9f36653.chunk.js" + }, + { + "revision": "08bfe9a8f9db97a558b1", + "url": "./static/js/runtime-main.fce4c018.js" + } +]); \ No newline at end of file diff --git a/streamlit_image_select/frontend/build/service-worker.js b/streamlit_image_select/frontend/build/service-worker.js new file mode 100644 index 0000000..cf58957 --- /dev/null +++ b/streamlit_image_select/frontend/build/service-worker.js @@ -0,0 +1,39 @@ +/** + * Welcome to your Workbox-powered service worker! + * + * You'll need to register this file in your web app and you should + * disable HTTP caching for this file too. + * See https://goo.gl/nhQhGp + * + * The rest of the code is auto-generated. Please don't update this file + * directly; instead, make changes to your Workbox build configuration + * and re-run your build process. + * See https://goo.gl/2aRDsh + */ + +importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); + +importScripts( + "./precache-manifest.a3ed1e0789f7e4b715083db6f7d3fcad.js" +); + +self.addEventListener('message', (event) => { + if (event.data && event.data.type === 'SKIP_WAITING') { + self.skipWaiting(); + } +}); + +workbox.core.clientsClaim(); + +/** + * The workboxSW.precacheAndRoute() method efficiently caches and responds to + * requests for URLs in the manifest. + * See https://goo.gl/S9QRab + */ +self.__precacheManifest = [].concat(self.__precacheManifest || []); +workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); + +workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), { + + blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/], +}); diff --git a/streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js b/streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js new file mode 100644 index 0000000..160c7cc --- /dev/null +++ b/streamlit_image_select/frontend/build/static/js/2.761ae6da.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 2.761ae6da.chunk.js.LICENSE.txt */ +(this.webpackJsonpstreamlit_image_select=this.webpackJsonpstreamlit_image_select||[]).push([[2],[function(t,e,n){"use strict";t.exports=n(7)},function(t,e,n){"use strict";n.d(e,"a",(function(){return Gf}));var r={};n.r(r),n.d(r,"memcpy",(function(){return Rt})),n.d(r,"joinUint8Arrays",(function(){return zt})),n.d(r,"toArrayBufferView",(function(){return Gt})),n.d(r,"toInt8Array",(function(){return Yt})),n.d(r,"toInt16Array",(function(){return Wt})),n.d(r,"toInt32Array",(function(){return Ht})),n.d(r,"toBigInt64Array",(function(){return $t})),n.d(r,"toUint8Array",(function(){return Kt})),n.d(r,"toUint16Array",(function(){return qt})),n.d(r,"toUint32Array",(function(){return Jt})),n.d(r,"toBigUint64Array",(function(){return Zt})),n.d(r,"toFloat32Array",(function(){return Qt})),n.d(r,"toFloat64Array",(function(){return Xt})),n.d(r,"toUint8ClampedArray",(function(){return te})),n.d(r,"toArrayBufferViewIterator",(function(){return ne})),n.d(r,"toInt8ArrayIterator",(function(){return re})),n.d(r,"toInt16ArrayIterator",(function(){return ie})),n.d(r,"toInt32ArrayIterator",(function(){return oe})),n.d(r,"toUint8ArrayIterator",(function(){return ae})),n.d(r,"toUint16ArrayIterator",(function(){return ue})),n.d(r,"toUint32ArrayIterator",(function(){return se})),n.d(r,"toFloat32ArrayIterator",(function(){return ce})),n.d(r,"toFloat64ArrayIterator",(function(){return fe})),n.d(r,"toUint8ClampedArrayIterator",(function(){return le})),n.d(r,"toArrayBufferViewAsyncIterator",(function(){return he})),n.d(r,"toInt8ArrayAsyncIterator",(function(){return pe})),n.d(r,"toInt16ArrayAsyncIterator",(function(){return de})),n.d(r,"toInt32ArrayAsyncIterator",(function(){return ve})),n.d(r,"toUint8ArrayAsyncIterator",(function(){return be})),n.d(r,"toUint16ArrayAsyncIterator",(function(){return ge})),n.d(r,"toUint32ArrayAsyncIterator",(function(){return me})),n.d(r,"toFloat32ArrayAsyncIterator",(function(){return we})),n.d(r,"toFloat64ArrayAsyncIterator",(function(){return ke})),n.d(r,"toUint8ClampedArrayAsyncIterator",(function(){return _e})),n.d(r,"rebaseValueOffsets",(function(){return xe})),n.d(r,"compareArrayLike",(function(){return Le}));var i={};n.r(i),n.d(i,"getBool",(function(){return an})),n.d(i,"getBit",(function(){return un})),n.d(i,"setBool",(function(){return sn})),n.d(i,"truncateBitmap",(function(){return cn})),n.d(i,"packBools",(function(){return fn})),n.d(i,"iterateBits",(function(){return ln})),n.d(i,"popcnt_bit_range",(function(){return hn})),n.d(i,"popcnt_array",(function(){return yn})),n.d(i,"popcnt_uint32",(function(){return pn}));var o={};n.r(o),n.d(o,"uint16ToFloat64",(function(){return Pr})),n.d(o,"float64ToUint16",(function(){return Cr}));var a={};n.r(a),n.d(a,"isArrowBigNumSymbol",(function(){return $r})),n.d(a,"bignumToString",(function(){return Wr})),n.d(a,"bignumToBigInt",(function(){return Hr})),n.d(a,"BN",(function(){return ei}));var u={};n.r(u),n.d(u,"clampIndex",(function(){return Vi})),n.d(u,"clampRange",(function(){return Ri})),n.d(u,"createElementComparator",(function(){return Yi}));var s={};n.r(s),n.d(s,"BaseInt64",(function(){return ha})),n.d(s,"Uint64",(function(){return ya})),n.d(s,"Int64",(function(){return pa})),n.d(s,"Int128",(function(){return da}));n(2);var c=n(0),f=n.n(c),l=new WeakMap,h=new WeakMap;function y(t){var e=l.get(t);return console.assert(null!=e,"'this' is expected an Event object, but got",t),e}function p(t){null==t.passiveListener?t.event.cancelable&&(t.canceled=!0,"function"===typeof t.event.preventDefault&&t.event.preventDefault()):"undefined"!==typeof console&&"function"===typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener)}function d(t,e){l.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});for(var n=Object.keys(e),r=0;r0){for(var t=new Array(arguments.length),e=0;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function A(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(c){return void n(c)}u.done?e(s):Promise.resolve(s).then(r,i)}function B(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){A(o,r,i,a,u,"next",t)}function u(t){A(o,r,i,a,u,"throw",t)}a(void 0)}))}}function F(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function D(t,e){for(var n=0;n>>0)+4294967296*this.high},R.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},R.Long.ZERO=new R.Long(0,0),R.Builder=function(t){if(t)e=t;else var e=1024;this.bb=R.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},R.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},R.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},R.Builder.prototype.dataBuffer=function(){return this.bb},R.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},R.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var n=1+~(this.bb.capacity()-this.space+e)&t-1;this.space=0&&0==this.vtable[e];e--);for(var n=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(n+2)*R.SIZEOF_SHORT;this.addInt16(r);var i=0,o=this.space;t:for(e=0;e=0;r--)this.writeInt8(n.charCodeAt(r))}this.prep(this.minalign,R.SIZEOF_INT),this.addOffset(t),this.bb.setPosition(this.space)},R.Builder.prototype.requiredField=function(t,e){var n=this.bb.capacity()-t,r=n-this.bb.readInt32(n);if(!(0!=this.bb.readInt16(r+e)))throw new Error("FlatBuffers: field "+e+" must be set")},R.Builder.prototype.startVector=function(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(R.SIZEOF_INT,t*e),this.prep(n,t*e)},R.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},R.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var n=0;n=56320)r=i;else r=(i<<10)+t.charCodeAt(n++)+-56613888;r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);n=0;for(var o=this.space,a=this.bb.bytes();n>24},R.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},R.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},R.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},R.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},R.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},R.ByteBuffer.prototype.readInt64=function(t){return new R.Long(this.readInt32(t),this.readInt32(t+4))},R.ByteBuffer.prototype.readUint64=function(t){return new R.Long(this.readUint32(t),this.readUint32(t+4))},R.ByteBuffer.prototype.readFloat32=function(t){return R.int32[0]=this.readInt32(t),R.float32[0]},R.ByteBuffer.prototype.readFloat64=function(t){return R.int32[R.isLittleEndian?0:1]=this.readInt32(t),R.int32[R.isLittleEndian?1:0]=this.readInt32(t+4),R.float64[0]},R.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},R.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},R.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},R.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},R.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},R.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},R.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},R.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},R.ByteBuffer.prototype.writeFloat32=function(t,e){R.float32[0]=e,this.writeInt32(t,R.int32[0])},R.ByteBuffer.prototype.writeFloat64=function(t,e){R.float64[0]=e,this.writeInt32(t,R.int32[R.isLittleEndian?0:1]),this.writeInt32(t+4,R.int32[R.isLittleEndian?1:0])},R.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&o)))}return r},R.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},R.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+R.SIZEOF_INT},R.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},R.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=R.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+R.FILE_IDENTIFIER_LENGTH);for(var e=0;e>6*n)+r];n>0;){var o=e>>6*(n-1);i.push(128|63&o),n-=1}return i}}H.prototype={decode:function(t,e){var n;n="object"===typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"===typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=G(e),this._streaming||(this._decoder=new K({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var r,i=new Y(n),o=[];!i.endOfStream()&&-1!==(r=this._decoder.handler(i,i.read()));)null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));if(!this._streaming){do{if(-1===(r=this._decoder.handler(i,i.read())))break;null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(t){for(var e="",n=0;n>10),56320+(1023&r)))}return e}(o)}},$.prototype={encode:function(t,e){t=t?String(t):"",e=G(e),this._streaming||(this._encoder=new q(this._options)),this._streaming=Boolean(e.stream);for(var n,r=[],i=new Y(function(t){for(var e=String(t),n=e.length,r=0,i=[];r57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var a=t.charCodeAt(r+1);if(56320<=a&&a<=57343){var u=1023&o,s=1023&a;i.push(65536+(u<<10)+s),r+=1}else i.push(65533)}r+=1}return i}(t));!i.endOfStream()&&-1!==(n=this._encoder.handler(i,i.read()));)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;-1!==(n=this._encoder.handler(i,i.read()));)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};var J="function"===typeof Buffer?Buffer:null,Z="function"===typeof TextDecoder&&"function"===typeof TextEncoder,Q=function(t){if(Z||!J){var e=new t("utf-8");return function(t){return e.decode(t)}}return function(t){var e=Kt(t),n=e.buffer,r=e.byteOffset,i=e.length;return J.from(n,r,i).toString()}}("undefined"!==typeof TextDecoder?TextDecoder:H),X=function(t){if(Z||!J){var e=new t;return function(t){return e.encode(t)}}return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Kt(J.from(t,"utf8"))}}("undefined"!==typeof TextEncoder?TextEncoder:$);function tt(t,e){return(tt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function et(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&tt(t,e)}function nt(t){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function rt(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function it(t){return(it="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return!e||"object"!==it(e)&&"function"!==typeof e?ot(t):e}function ut(t){return function(){var e,n=nt(t);if(rt()){var r=nt(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return at(this,e)}}function st(){st=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var ct=Object.freeze({done:!0,value:void 0}),ft=function(){function t(e){F(this,t),this._json=e}return N(t,[{key:"schema",get:function(){return this._json.schema}},{key:"batches",get:function(){return this._json.batches||[]}},{key:"dictionaries",get:function(){return this._json.dictionaries||[]}}]),t}(),lt=function(){function t(){F(this,t)}return N(t,[{key:"tee",value:function(){return this._getDOMStream().tee()}},{key:"pipe",value:function(t,e){return this._getNodeStream().pipe(t,e)}},{key:"pipeTo",value:function(t,e){return this._getDOMStream().pipeTo(t,e)}},{key:"pipeThrough",value:function(t,e){return this._getDOMStream().pipeThrough(t,e)}},{key:"_getDOMStream",value:function(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}},{key:"_getNodeStream",value:function(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}]),t}(),ht=function(t,e){et(r,t);var n=ut(r);function r(){var t;return F(this,r),(t=n.call(this))._values=[],t.resolvers=[],t._closedPromise=new Promise((function(e){return t._closedPromiseResolve=e})),t}return N(r,[{key:"closed",get:function(){return this._closedPromise}},{key:"cancel",value:function(){var t=B(st().mark((function t(e){return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.return(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"write",value:function(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}},{key:"abort",value:function(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}},{key:"close",value:function(){if(this._closedPromiseResolve){for(var t=this.resolvers;t.length>0;)t.shift().resolve(ct);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}},{key:e,value:function(){return this}},{key:"toDOMStream",value:function(t){return Ee.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}},{key:"toNodeStream",value:function(t){return Ee.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}},{key:"throw",value:function(){var t=B(st().mark((function t(e){return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.abort(e);case 2:return t.abrupt("return",ct);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=B(st().mark((function t(e){return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.close();case 2:return t.abrupt("return",ct);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"read",value:function(){var t=B(st().mark((function t(e){return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"read");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"peek",value:function(){var t=B(st().mark((function t(e){return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"peek");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=this;return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((function(e,n){t.resolvers.push({resolve:e,reject:n})})):Promise.resolve(ct)}},{key:"_ensureOpen",value:function(){if(this._closedPromiseResolve)return!0;throw new Error("".concat(this," is closed"))}}]),r}(lt,Symbol.asyncIterator),yt=j(function(){var t=function(){throw new Error("BigInt is not available in this environment")};function e(){throw t()}return e.asIntN=function(){throw t()},e.asUintN=function(){throw t()},"undefined"!==typeof BigInt?[BigInt,!0]:[e,!1]}(),2),pt=yt[0],dt=yt[1],vt=j(function(){var t=function(){throw new Error("BigInt64Array is not available in this environment")};return"undefined"!==typeof BigInt64Array?[BigInt64Array,!0]:[function(){function e(){throw F(this,e),t()}return N(e,null,[{key:"BYTES_PER_ELEMENT",get:function(){return 8}},{key:"of",value:function(){throw t()}},{key:"from",value:function(){throw t()}}]),e}(),!1]}(),2),bt=vt[0],gt=(vt[1],j(function(){var t=function(){throw new Error("BigUint64Array is not available in this environment")};return"undefined"!==typeof BigUint64Array?[BigUint64Array,!0]:[function(){function e(){throw F(this,e),t()}return N(e,null,[{key:"BYTES_PER_ELEMENT",get:function(){return 8}},{key:"of",value:function(){throw t()}},{key:"from",value:function(){throw t()}}]),e}(),!1]}(),2)),mt=gt[0],wt=(gt[1],function(t){return"number"===typeof t}),kt=function(t){return"boolean"===typeof t},_t=function(t){return"function"===typeof t},xt=function(t){return null!=t&&Object(t)===t},Lt=function(t){return xt(t)&&_t(t.then)},It=function(t){return xt(t)&&_t(t[Symbol.iterator])},St=function(t){return xt(t)&&_t(t[Symbol.asyncIterator])},Et=function(t){return xt(t)&&xt(t.schema)},Ot=function(t){return xt(t)&&"done"in t&&"value"in t},Tt=function(t){return xt(t)&&_t(t.stat)&&wt(t.fd)},At=function(t){return xt(t)&&Ft(t.body)},Bt=function(t){return xt(t)&&_t(t.abort)&&_t(t.getWriter)&&!(t instanceof lt)},Ft=function(t){return xt(t)&&_t(t.cancel)&&_t(t.getReader)&&!(t instanceof lt)},Dt=function(t){return xt(t)&&_t(t.end)&&_t(t.write)&&kt(t.writable)&&!(t instanceof lt)},Nt=function(t){return xt(t)&&_t(t.read)&&_t(t.pipe)&&kt(t.readable)&&!(t instanceof lt)},jt=Mt().mark(ne);function Mt(){Mt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Ut(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Pt(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Pt(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Pt=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Pt(t)}var Ct=R.ByteBuffer,Vt="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function Rt(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.byteLength,i=t.byteLength,o=new Uint8Array(t.buffer,t.byteOffset,i),a=new Uint8Array(e.buffer,e.byteOffset,Math.min(r,i));return o.set(a,n),t}function zt(t,e){for(var n,r,i,o=function(t){for(var e,n,r,i,o,a,u=t[0]?[t[0]]:[],s=0,c=0,f=t.length;++s0)do{if(t[n]!==e[n])return!1}while(++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var Se=Ie().mark(Te),Ee={fromIterable:function(t){return Oe(Te(t))},fromAsyncIterable:function(t){return Oe(function(t){return Ae.apply(this,arguments)}(t))},fromDOMStream:function(t){return Oe(function(t){return Be.apply(this,arguments)}(t))},fromNodeStream:function(t){return Oe(function(t){return Me.apply(this,arguments)}(t))},toDOMStream:function(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream:function(t,e){throw new Error('"toNodeStream" not available in this environment')}},Oe=function(t){return t.next(),t};function Te(t){var e,n,r,i,o,a,u,s,c,f,l,h;return Ie().wrap((function(y){for(;;)switch(y.prev=y.next){case 0:return s=function(){if("peek"===o)return zt(r,a)[0];var t=j(zt(r,a),3);return i=t[0],r=t[1],u=t[2],i},n=!1,r=[],u=0,y.next=6,null;case 6:c=y.sent,o=c.cmd,a=c.size,f=ae(t)[Symbol.iterator](),y.prev=10;case 11:if(l=isNaN(a-u)?f.next(void 0):f.next(a-u),e=l.done,i=l.value,!e&&i.byteLength>0&&(r.push(i),u+=i.byteLength),!(e||a<=u)){y.next=22;break}case 16:return y.next=18,s();case 18:h=y.sent,o=h.cmd,a=h.size;case 21:if(a0&&(i.push(o),s+=o.byteLength),!(n||u<=s)){t.next=31;break}case 25:return t.next=27,c();case 27:y=t.sent,a=y.cmd,u=y.size;case 30:if(u0&&(i.push(Kt(o)),s+=o.byteLength),!(n||u<=s)){t.next=31;break}case 25:return t.next=27,c();case 27:y=t.sent,a=y.cmd,u=y.size;case 30:if(u=i)){t.next=2;break}return t.abrupt("return",{done:!1,value:new Uint8Array(n,0,i)});case 2:return t.next=4,e.read(new Uint8Array(n,r,i-r));case 4:if(o=t.sent,a=o.done,u=o.value,!((r+=u.byteLength)0&&(c.push(f),s+=f.byteLength)),!(i||u<=s)){t.next=36;break}case 30:return t.next=32,l();case 32:d=t.sent,a=d.cmd,u=d.size;case 35:if(u=0;n--)t.addInt32(e[n]);return t.endVector()}},{key:"startTypeIdsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endUnion",value:function(t){return t.endObject()}},{key:"createUnion",value:function(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}}]),e}();e.Union=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"bitWidth",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"isSigned",value:function(){var t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsInt",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startInt",value:function(t){t.startObject(2)}},{key:"addBitWidth",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"addIsSigned",value:function(t,e){t.addFieldInt8(1,+e,0)}},{key:"endInt",value:function(t){return t.endObject()}},{key:"createInt",value:function(e,n,r){return t.startInt(e),t.addBitWidth(e,n),t.addIsSigned(e,r),t.endInt(e)}}]),t}();t.Int=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"precision",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Precision.HALF}}],[{key:"getRootAsFloatingPoint",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startFloatingPoint",value:function(t){t.startObject(1)}},{key:"addPrecision",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.Precision.HALF)}},{key:"endFloatingPoint",value:function(t){return t.endObject()}},{key:"createFloatingPoint",value:function(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}}]),e}();e.FloatingPoint=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsUtf8",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startUtf8",value:function(t){t.startObject(0)}},{key:"endUtf8",value:function(t){return t.endObject()}},{key:"createUtf8",value:function(e){return t.startUtf8(e),t.endUtf8(e)}}]),t}();t.Utf8=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startBinary",value:function(t){t.startObject(0)}},{key:"endBinary",value:function(t){return t.endObject()}},{key:"createBinary",value:function(e){return t.startBinary(e),t.endBinary(e)}}]),t}();t.Binary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsLargeUtf8",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startLargeUtf8",value:function(t){t.startObject(0)}},{key:"endLargeUtf8",value:function(t){return t.endObject()}},{key:"createLargeUtf8",value:function(e){return t.startLargeUtf8(e),t.endLargeUtf8(e)}}]),t}();t.LargeUtf8=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsLargeBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startLargeBinary",value:function(t){t.startObject(0)}},{key:"endLargeBinary",value:function(t){return t.endObject()}},{key:"createLargeBinary",value:function(e){return t.startLargeBinary(e),t.endLargeBinary(e)}}]),t}();t.LargeBinary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"byteWidth",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}}],[{key:"getRootAsFixedSizeBinary",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startFixedSizeBinary",value:function(t){t.startObject(1)}},{key:"addByteWidth",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"endFixedSizeBinary",value:function(t){return t.endObject()}},{key:"createFixedSizeBinary",value:function(e,n){return t.startFixedSizeBinary(e),t.addByteWidth(e,n),t.endFixedSizeBinary(e)}}]),t}();t.FixedSizeBinary=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}}],[{key:"getRootAsBool",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startBool",value:function(t){t.startObject(0)}},{key:"endBool",value:function(t){return t.endObject()}},{key:"createBool",value:function(e){return t.startBool(e),t.endBool(e)}}]),t}();t.Bool=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"precision",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"scale",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}}],[{key:"getRootAsDecimal",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startDecimal",value:function(t){t.startObject(2)}},{key:"addPrecision",value:function(t,e){t.addFieldInt32(0,e,0)}},{key:"addScale",value:function(t,e){t.addFieldInt32(1,e,0)}},{key:"endDecimal",value:function(t){return t.endObject()}},{key:"createDecimal",value:function(e,n,r){return t.startDecimal(e),t.addPrecision(e,n),t.addScale(e,r),t.endDecimal(e)}}]),t}();t.Decimal=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.DateUnit.MILLISECOND}}],[{key:"getRootAsDate",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDate",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.DateUnit.MILLISECOND)}},{key:"endDate",value:function(t){return t.endObject()}},{key:"createDate",value:function(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}}]),e}();e.Date=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}},{key:"bitWidth",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}}],[{key:"getRootAsTime",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startTime",value:function(t){t.startObject(2)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}},{key:"addBitWidth",value:function(t,e){t.addFieldInt32(1,e,32)}},{key:"endTime",value:function(t){return t.endObject()}},{key:"createTime",value:function(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}}]),e}();e.Time=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.SECOND}},{key:"timezone",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}}],[{key:"getRootAsTimestamp",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startTimestamp",value:function(t){t.startObject(2)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.SECOND)}},{key:"addTimezone",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"endTimestamp",value:function(t){return t.endObject()}},{key:"createTimestamp",value:function(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}}]),e}();e.Timestamp=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}}],[{key:"getRootAsInterval",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startInterval",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}},{key:"endInterval",value:function(t){return t.endObject()}},{key:"createInterval",value:function(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}}]),e}();e.Interval=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"unit",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}}],[{key:"getRootAsDuration",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDuration",value:function(t){t.startObject(1)}},{key:"addUnit",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}},{key:"endDuration",value:function(t){return t.endObject()}},{key:"createDuration",value:function(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}}]),e}();e.Duration=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"key",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"value",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}}],[{key:"getRootAsKeyValue",value:function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startKeyValue",value:function(t){t.startObject(2)}},{key:"addKey",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addValue",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"endKeyValue",value:function(t){return t.endObject()}},{key:"createKeyValue",value:function(e,n,r){return t.startKeyValue(e),t.addKey(e,n),t.addValue(e,r),t.endKeyValue(e)}}]),t}();t.KeyValue=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"id",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"indexType",value:function(e){var n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"isOrdered",value:function(){var t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsDictionaryEncoding",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDictionaryEncoding",value:function(t){t.startObject(3)}},{key:"addId",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addIndexType",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addIsOrdered",value:function(t,e){t.addFieldInt8(2,+e,0)}},{key:"endDictionaryEncoding",value:function(t){return t.endObject()}},{key:"createDictionaryEncoding",value:function(t,n,r,i){return e.startDictionaryEncoding(t),e.addId(t,n),e.addIndexType(t,r),e.addIsOrdered(t,i),e.endDictionaryEncoding(t)}}]),e}();e.DictionaryEncoding=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"nullable",value:function(){var t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"typeType",value:function(){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.Type.NONE}},{key:"type",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}},{key:"dictionary",value:function(e){var n=this.bb.__offset(this.bb_pos,12);return n?(e||new t.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"children",value:function(e,n){var r=this.bb.__offset(this.bb_pos,14);return r?(n||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"childrenLength",value:function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"customMetadata",value:function(e,n){var r=this.bb.__offset(this.bb_pos,16);return r?(n||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsField",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startField",value:function(t){t.startObject(7)}},{key:"addName",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addNullable",value:function(t,e){t.addFieldInt8(1,+e,0)}},{key:"addTypeType",value:function(e,n){e.addFieldInt8(2,n,t.apache.arrow.flatbuf.Type.NONE)}},{key:"addType",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"addDictionary",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"addChildren",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"createChildrenVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startChildrenVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(6,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endField",value:function(t){return t.endObject()}},{key:"createField",value:function(t,n,r,i,o,a,u,s){return e.startField(t),e.addName(t,n),e.addNullable(t,r),e.addTypeType(t,i),e.addType(t,o),e.addDictionary(t,a),e.addChildren(t,u),e.addCustomMetadata(t,s),e.endField(t)}}]),e}();e.Field=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"offset",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"length",value:function(){return this.bb.readInt64(this.bb_pos+8)}}],[{key:"createBuffer",value:function(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}]),t}();t.Buffer=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"endianness",value:function(){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Endianness.Little}},{key:"fields",value:function(e,n){var r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"fieldsLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"customMetadata",value:function(e,n){var r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsSchema",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startSchema",value:function(t){t.startObject(3)}},{key:"addEndianness",value:function(e,n){e.addFieldInt16(0,n,t.apache.arrow.flatbuf.Endianness.Little)}},{key:"addFields",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"createFieldsVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startFieldsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endSchema",value:function(t){return t.endObject()}},{key:"finishSchemaBuffer",value:function(t,e){t.finish(e)}},{key:"createSchema",value:function(t,n,r,i){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.endSchema(t)}}]),e}();e.Schema=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Re||(Re={})),function(t){!function(t){!function(t){!function(t){t.Schema=Re.apache.arrow.flatbuf.Schema}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(He||(He={})),function(t){!function(t){!function(t){!function(t){!function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(t.MessageHeader||(t.MessageHeader={}))}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(He||(He={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"length",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"nullCount",value:function(){return this.bb.readInt64(this.bb_pos+8)}}],[{key:"createFieldNode",value:function(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}]),t}();t.FieldNode=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(He||(He={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"length",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"nodes",value:function(e,n){var r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+r)+16*e,this.bb):null}},{key:"nodesLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"buffers",value:function(t,e){var n=this.bb.__offset(this.bb_pos,8);return n?(e||new Re.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}},{key:"buffersLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsRecordBatch",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startRecordBatch",value:function(t){t.startObject(3)}},{key:"addLength",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addNodes",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"startNodesVector",value:function(t,e){t.startVector(16,e,8)}},{key:"addBuffers",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"startBuffersVector",value:function(t,e){t.startVector(16,e,8)}},{key:"endRecordBatch",value:function(t){return t.endObject()}},{key:"createRecordBatch",value:function(t,n,r,i){return e.startRecordBatch(t),e.addLength(t,n),e.addNodes(t,r),e.addBuffers(t,i),e.endRecordBatch(t)}}]),e}();e.RecordBatch=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(He||(He={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"id",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"data",value:function(e){var n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}},{key:"isDelta",value:function(){var t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}}],[{key:"getRootAsDictionaryBatch",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startDictionaryBatch",value:function(t){t.startObject(3)}},{key:"addId",value:function(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}},{key:"addData",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addIsDelta",value:function(t,e){t.addFieldInt8(2,+e,0)}},{key:"endDictionaryBatch",value:function(t){return t.endObject()}},{key:"createDictionaryBatch",value:function(t,n,r,i){return e.startDictionaryBatch(t),e.addId(t,n),e.addData(t,r),e.addIsDelta(t,i),e.endDictionaryBatch(t)}}]),e}();e.DictionaryBatch=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(He||(He={})),function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"version",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Re.apache.arrow.flatbuf.MetadataVersion.V1}},{key:"headerType",value:function(){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.MessageHeader.NONE}},{key:"header",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}},{key:"bodyLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}},{key:"customMetadata",value:function(t,e){var n=this.bb.__offset(this.bb_pos,12);return n?(e||new Re.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}},{key:"customMetadataLength",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsMessage",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startMessage",value:function(t){t.startObject(5)}},{key:"addVersion",value:function(t,e){t.addFieldInt16(0,e,Re.apache.arrow.flatbuf.MetadataVersion.V1)}},{key:"addHeaderType",value:function(e,n){e.addFieldInt8(1,n,t.apache.arrow.flatbuf.MessageHeader.NONE)}},{key:"addHeader",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"addBodyLength",value:function(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}},{key:"addCustomMetadata",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"createCustomMetadataVector",value:function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}},{key:"startCustomMetadataVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endMessage",value:function(t){return t.endObject()}},{key:"finishMessageBuffer",value:function(t,e){t.finish(e)}},{key:"createMessage",value:function(t,n,r,i,o,a){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,a),e.endMessage(t)}}]),e}();e.Message=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(He||(He={}));Re.apache.arrow.flatbuf.Type;var Ke,qe,Je=Re.apache.arrow.flatbuf.DateUnit,Ze=Re.apache.arrow.flatbuf.TimeUnit,Qe=Re.apache.arrow.flatbuf.Precision,Xe=Re.apache.arrow.flatbuf.UnionMode,tn=Re.apache.arrow.flatbuf.IntervalUnit,en=He.apache.arrow.flatbuf.MessageHeader,nn=Re.apache.arrow.flatbuf.MetadataVersion;function rn(){rn=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(Ke||(Ke={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(qe||(qe={}));var on=rn().mark(ln);function an(t,e,n,r){return 0!==(n&1<>r}function sn(t,e,n){return n?!!(t[e>>3]|=1<>3]&=~(1<0||n.byteLength>3):fn(ln(n,t,e,null,an)).subarray(0,r)),i}return n}function fn(t){var e,n=[],r=0,i=0,o=0,a=T(t);try{for(a.s();!(e=a.n()).done;){e.value&&(o|=1<0)&&(n[r++]=o);var u=new Uint8Array(n.length+7&-8);return u.set(n),u}function ln(t,e,n,r,i){var o,a,u,s,c;return rn().wrap((function(f){for(;;)switch(f.prev=f.next){case 0:o=e%8,a=e>>3,u=0,s=n;case 3:if(!(s>0)){f.next=11;break}c=t[a++];case 5:return f.next=7,i(r,u++,c,o);case 7:if(--s>0&&++o<8){f.next=5;break}case 8:o=0,f.next=3;break;case 11:case"end":return f.stop()}}),on)}function hn(t,e,n){if(n-e<=0)return 0;if(n-e<8){var r,i=0,o=T(ln(t,e,n-e,t,un));try{for(o.s();!(r=o.n()).done;){i+=r.value}}catch(s){o.e(s)}finally{o.f()}return i}var a=n>>3<<3,u=e+(e%8===0?0:8-e%8);return hn(t,e,u)+hn(t,a,n)+yn(t,u>>3,a-u>>3)}function yn(t,e,n){for(var r=0,i=0|e,o=new DataView(t.buffer,t.byteOffset,t.byteLength),a=void 0===n?t.byteLength:i+n;a-i>=4;)r+=pn(o.getUint32(i)),i+=4;for(;a-i>=2;)r+=pn(o.getUint16(i)),i+=2;for(;a-i>=1;)r+=pn(o.getUint8(i)),i+=1;return r}function pn(t){var e=0|t;return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}function dn(t){return function(t){if(Array.isArray(t))return E(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||O(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var vn=function(){function t(){F(this,t)}return N(t,[{key:"visitMany",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1&&void 0!==arguments[1])||arguments[1];return bn(this,t,e)}},{key:"visitNull",value:function(t){return null}},{key:"visitBool",value:function(t){return null}},{key:"visitInt",value:function(t){return null}},{key:"visitFloat",value:function(t){return null}},{key:"visitUtf8",value:function(t){return null}},{key:"visitBinary",value:function(t){return null}},{key:"visitFixedSizeBinary",value:function(t){return null}},{key:"visitDate",value:function(t){return null}},{key:"visitTimestamp",value:function(t){return null}},{key:"visitTime",value:function(t){return null}},{key:"visitDecimal",value:function(t){return null}},{key:"visitList",value:function(t){return null}},{key:"visitStruct",value:function(t){return null}},{key:"visitUnion",value:function(t){return null}},{key:"visitDictionary",value:function(t){return null}},{key:"visitInterval",value:function(t){return null}},{key:"visitFixedSizeList",value:function(t){return null}},{key:"visitMap",value:function(t){return null}}]),t}();function bn(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=null,i=Ke.NONE;switch(e instanceof hr||e instanceof $e?i=gn(e.type):e instanceof Bn?i=gn(e):"number"!==typeof(i=e)&&(i=Ke[e]),i){case Ke.Null:r=t.visitNull;break;case Ke.Bool:r=t.visitBool;break;case Ke.Int:r=t.visitInt;break;case Ke.Int8:r=t.visitInt8||t.visitInt;break;case Ke.Int16:r=t.visitInt16||t.visitInt;break;case Ke.Int32:r=t.visitInt32||t.visitInt;break;case Ke.Int64:r=t.visitInt64||t.visitInt;break;case Ke.Uint8:r=t.visitUint8||t.visitInt;break;case Ke.Uint16:r=t.visitUint16||t.visitInt;break;case Ke.Uint32:r=t.visitUint32||t.visitInt;break;case Ke.Uint64:r=t.visitUint64||t.visitInt;break;case Ke.Float:r=t.visitFloat;break;case Ke.Float16:r=t.visitFloat16||t.visitFloat;break;case Ke.Float32:r=t.visitFloat32||t.visitFloat;break;case Ke.Float64:r=t.visitFloat64||t.visitFloat;break;case Ke.Utf8:r=t.visitUtf8;break;case Ke.Binary:r=t.visitBinary;break;case Ke.FixedSizeBinary:r=t.visitFixedSizeBinary;break;case Ke.Date:r=t.visitDate;break;case Ke.DateDay:r=t.visitDateDay||t.visitDate;break;case Ke.DateMillisecond:r=t.visitDateMillisecond||t.visitDate;break;case Ke.Timestamp:r=t.visitTimestamp;break;case Ke.TimestampSecond:r=t.visitTimestampSecond||t.visitTimestamp;break;case Ke.TimestampMillisecond:r=t.visitTimestampMillisecond||t.visitTimestamp;break;case Ke.TimestampMicrosecond:r=t.visitTimestampMicrosecond||t.visitTimestamp;break;case Ke.TimestampNanosecond:r=t.visitTimestampNanosecond||t.visitTimestamp;break;case Ke.Time:r=t.visitTime;break;case Ke.TimeSecond:r=t.visitTimeSecond||t.visitTime;break;case Ke.TimeMillisecond:r=t.visitTimeMillisecond||t.visitTime;break;case Ke.TimeMicrosecond:r=t.visitTimeMicrosecond||t.visitTime;break;case Ke.TimeNanosecond:r=t.visitTimeNanosecond||t.visitTime;break;case Ke.Decimal:r=t.visitDecimal;break;case Ke.List:r=t.visitList;break;case Ke.Struct:r=t.visitStruct;break;case Ke.Union:r=t.visitUnion;break;case Ke.DenseUnion:r=t.visitDenseUnion||t.visitUnion;break;case Ke.SparseUnion:r=t.visitSparseUnion||t.visitUnion;break;case Ke.Dictionary:r=t.visitDictionary;break;case Ke.Interval:r=t.visitInterval;break;case Ke.IntervalDayTime:r=t.visitIntervalDayTime||t.visitInterval;break;case Ke.IntervalYearMonth:r=t.visitIntervalYearMonth||t.visitInterval;break;case Ke.FixedSizeList:r=t.visitFixedSizeList;break;case Ke.Map:r=t.visitMap}if("function"===typeof r)return r;if(!n)return function(){return null};throw new Error("Unrecognized type '".concat(Ke[i],"'"))}function gn(t){switch(t.typeId){case Ke.Null:return Ke.Null;case Ke.Int:var e=t.bitWidth,n=t.isSigned;switch(e){case 8:return n?Ke.Int8:Ke.Uint8;case 16:return n?Ke.Int16:Ke.Uint16;case 32:return n?Ke.Int32:Ke.Uint32;case 64:return n?Ke.Int64:Ke.Uint64}return Ke.Int;case Ke.Float:switch(t.precision){case Qe.HALF:return Ke.Float16;case Qe.SINGLE:return Ke.Float32;case Qe.DOUBLE:return Ke.Float64}return Ke.Float;case Ke.Binary:return Ke.Binary;case Ke.Utf8:return Ke.Utf8;case Ke.Bool:return Ke.Bool;case Ke.Decimal:return Ke.Decimal;case Ke.Time:switch(t.unit){case Ze.SECOND:return Ke.TimeSecond;case Ze.MILLISECOND:return Ke.TimeMillisecond;case Ze.MICROSECOND:return Ke.TimeMicrosecond;case Ze.NANOSECOND:return Ke.TimeNanosecond}return Ke.Time;case Ke.Timestamp:switch(t.unit){case Ze.SECOND:return Ke.TimestampSecond;case Ze.MILLISECOND:return Ke.TimestampMillisecond;case Ze.MICROSECOND:return Ke.TimestampMicrosecond;case Ze.NANOSECOND:return Ke.TimestampNanosecond}return Ke.Timestamp;case Ke.Date:switch(t.unit){case Je.DAY:return Ke.DateDay;case Je.MILLISECOND:return Ke.DateMillisecond}return Ke.Date;case Ke.Interval:switch(t.unit){case tn.DAY_TIME:return Ke.IntervalDayTime;case tn.YEAR_MONTH:return Ke.IntervalYearMonth}return Ke.Interval;case Ke.Map:return Ke.Map;case Ke.List:return Ke.List;case Ke.Struct:return Ke.Struct;case Ke.Union:switch(t.mode){case Xe.Dense:return Ke.DenseUnion;case Xe.Sparse:return Ke.SparseUnion}return Ke.Union;case Ke.FixedSizeBinary:return Ke.FixedSizeBinary;case Ke.FixedSizeList:return Ke.FixedSizeList;case Ke.Dictionary:return Ke.Dictionary}throw new Error("Unrecognized type '".concat(Ke[t.typeId],"'"))}vn.prototype.visitInt8=null,vn.prototype.visitInt16=null,vn.prototype.visitInt32=null,vn.prototype.visitInt64=null,vn.prototype.visitUint8=null,vn.prototype.visitUint16=null,vn.prototype.visitUint32=null,vn.prototype.visitUint64=null,vn.prototype.visitFloat16=null,vn.prototype.visitFloat32=null,vn.prototype.visitFloat64=null,vn.prototype.visitDateDay=null,vn.prototype.visitDateMillisecond=null,vn.prototype.visitTimestampSecond=null,vn.prototype.visitTimestampMillisecond=null,vn.prototype.visitTimestampMicrosecond=null,vn.prototype.visitTimestampNanosecond=null,vn.prototype.visitTimeSecond=null,vn.prototype.visitTimeMillisecond=null,vn.prototype.visitTimeMicrosecond=null,vn.prototype.visitTimeNanosecond=null,vn.prototype.visitDenseUnion=null,vn.prototype.visitSparseUnion=null,vn.prototype.visitIntervalDayTime=null,vn.prototype.visitIntervalYearMonth=null;var mn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"compareSchemas",value:function(t,e){return t===e||e instanceof t.constructor&&An.compareFields(t.fields,e.fields)}},{key:"compareFields",value:function(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((function(t,n){return An.compareField(t,e[n])}))}},{key:"compareField",value:function(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&An.visit(t.type,e.type)}}]),n}(vn);function wn(t,e){return e instanceof t.constructor}function kn(t,e){return t===e||wn(t,e)}function _n(t,e){return t===e||wn(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function xn(t,e){return t===e||wn(t,e)&&t.precision===e.precision}function Ln(t,e){return t===e||wn(t,e)&&t.unit===e.unit}function In(t,e){return t===e||wn(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function Sn(t,e){return t===e||wn(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function En(t,e){return t===e||wn(t,e)&&t.mode===e.mode&&t.typeIds.every((function(t,n){return t===e.typeIds[n]}))&&An.compareFields(t.children,e.children)}function On(t,e){return t===e||wn(t,e)&&t.unit===e.unit}mn.prototype.visitNull=kn,mn.prototype.visitBool=kn,mn.prototype.visitInt=_n,mn.prototype.visitInt8=_n,mn.prototype.visitInt16=_n,mn.prototype.visitInt32=_n,mn.prototype.visitInt64=_n,mn.prototype.visitUint8=_n,mn.prototype.visitUint16=_n,mn.prototype.visitUint32=_n,mn.prototype.visitUint64=_n,mn.prototype.visitFloat=xn,mn.prototype.visitFloat16=xn,mn.prototype.visitFloat32=xn,mn.prototype.visitFloat64=xn,mn.prototype.visitUtf8=kn,mn.prototype.visitBinary=kn,mn.prototype.visitFixedSizeBinary=function(t,e){return t===e||wn(t,e)&&t.byteWidth===e.byteWidth},mn.prototype.visitDate=Ln,mn.prototype.visitDateDay=Ln,mn.prototype.visitDateMillisecond=Ln,mn.prototype.visitTimestamp=In,mn.prototype.visitTimestampSecond=In,mn.prototype.visitTimestampMillisecond=In,mn.prototype.visitTimestampMicrosecond=In,mn.prototype.visitTimestampNanosecond=In,mn.prototype.visitTime=Sn,mn.prototype.visitTimeSecond=Sn,mn.prototype.visitTimeMillisecond=Sn,mn.prototype.visitTimeMicrosecond=Sn,mn.prototype.visitTimeNanosecond=Sn,mn.prototype.visitDecimal=kn,mn.prototype.visitList=function(t,e){return t===e||wn(t,e)&&t.children.length===e.children.length&&An.compareFields(t.children,e.children)},mn.prototype.visitStruct=function(t,e){return t===e||wn(t,e)&&t.children.length===e.children.length&&An.compareFields(t.children,e.children)},mn.prototype.visitUnion=En,mn.prototype.visitDenseUnion=En,mn.prototype.visitSparseUnion=En,mn.prototype.visitDictionary=function(t,e){return t===e||wn(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&An.visit(t.indices,e.indices)&&An.visit(t.dictionary,e.dictionary)},mn.prototype.visitInterval=On,mn.prototype.visitIntervalDayTime=On,mn.prototype.visitIntervalYearMonth=On,mn.prototype.visitFixedSizeList=function(t,e){return t===e||wn(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&An.compareFields(t.children,e.children)},mn.prototype.visitMap=function(t,e){return t===e||wn(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&An.compareFields(t.children,e.children)};var Tn,An=new mn,Bn=function(){function t(){F(this,t)}return N(t,[{key:"typeId",get:function(){return Ke.NONE}},{key:"compareTo",value:function(t){return An.visit(this,t)}}],[{key:"isNull",value:function(t){return t&&t.typeId===Ke.Null}},{key:"isInt",value:function(t){return t&&t.typeId===Ke.Int}},{key:"isFloat",value:function(t){return t&&t.typeId===Ke.Float}},{key:"isBinary",value:function(t){return t&&t.typeId===Ke.Binary}},{key:"isUtf8",value:function(t){return t&&t.typeId===Ke.Utf8}},{key:"isBool",value:function(t){return t&&t.typeId===Ke.Bool}},{key:"isDecimal",value:function(t){return t&&t.typeId===Ke.Decimal}},{key:"isDate",value:function(t){return t&&t.typeId===Ke.Date}},{key:"isTime",value:function(t){return t&&t.typeId===Ke.Time}},{key:"isTimestamp",value:function(t){return t&&t.typeId===Ke.Timestamp}},{key:"isInterval",value:function(t){return t&&t.typeId===Ke.Interval}},{key:"isList",value:function(t){return t&&t.typeId===Ke.List}},{key:"isStruct",value:function(t){return t&&t.typeId===Ke.Struct}},{key:"isUnion",value:function(t){return t&&t.typeId===Ke.Union}},{key:"isFixedSizeBinary",value:function(t){return t&&t.typeId===Ke.FixedSizeBinary}},{key:"isFixedSizeList",value:function(t){return t&&t.typeId===Ke.FixedSizeList}},{key:"isMap",value:function(t){return t&&t.typeId===Ke.Map}},{key:"isDictionary",value:function(t){return t&&t.typeId===Ke.Dictionary}}]),t}();Bn[Symbol.toStringTag]=((Tn=Bn.prototype).children=null,Tn.ArrayType=Array,Tn[Symbol.toStringTag]="DataType");var Fn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"toString",value:function(){return"Null"}},{key:"typeId",get:function(){return Ke.Null}}]),n}(Bn);Fn[Symbol.toStringTag]=function(t){return t[Symbol.toStringTag]="Null"}(Fn.prototype);var Dn=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).isSigned=t,i.bitWidth=r,i}return N(n,[{key:"typeId",get:function(){return Ke.Int}},{key:"ArrayType",get:function(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:case 64:return this.isSigned?Int32Array:Uint32Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),n}(Bn);Dn[Symbol.toStringTag]=function(t){return t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"}(Dn.prototype);var Nn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!0,8)}return N(n)}(Dn),jn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!0,16)}return N(n)}(Dn),Mn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!0,32)}return N(n)}(Dn),Un=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!0,64)}return N(n)}(Dn),Pn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!1,8)}return N(n)}(Dn),Cn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!1,16)}return N(n)}(Dn),Vn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!1,32)}return N(n)}(Dn),Rn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,!1,64)}return N(n)}(Dn);Object.defineProperty(Nn.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(jn.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Mn.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Un.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Pn.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(Cn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Vn.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Rn.prototype,"ArrayType",{value:Uint32Array});var zn=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).precision=t,r}return N(n,[{key:"typeId",get:function(){return Ke.Float}},{key:"ArrayType",get:function(){switch(this.precision){case Qe.HALF:return Uint16Array;case Qe.SINGLE:return Float32Array;case Qe.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}},{key:"toString",value:function(){return"Float".concat(this.precision<<5||16)}}]),n}(Bn);zn[Symbol.toStringTag]=function(t){return t.precision=null,t[Symbol.toStringTag]="Float"}(zn.prototype);var Gn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,Qe.HALF)}return N(n)}(zn),Yn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,Qe.SINGLE)}return N(n)}(zn),Wn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,Qe.DOUBLE)}return N(n)}(zn);Object.defineProperty(Gn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Yn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(Wn.prototype,"ArrayType",{value:Float64Array});var Hn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this)}return N(n,[{key:"typeId",get:function(){return Ke.Binary}},{key:"toString",value:function(){return"Binary"}}]),n}(Bn);Hn[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"}(Hn.prototype);var $n=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this)}return N(n,[{key:"typeId",get:function(){return Ke.Utf8}},{key:"toString",value:function(){return"Utf8"}}]),n}(Bn);$n[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"}($n.prototype);var Kn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this)}return N(n,[{key:"typeId",get:function(){return Ke.Bool}},{key:"toString",value:function(){return"Bool"}}]),n}(Bn);Kn[Symbol.toStringTag]=function(t){return t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"}(Kn.prototype);var qn=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).scale=t,i.precision=r,i}return N(n,[{key:"typeId",get:function(){return Ke.Decimal}},{key:"toString",value:function(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}}]),n}(Bn);qn[Symbol.toStringTag]=function(t){return t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"}(qn.prototype);var Jn=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).unit=t,r}return N(n,[{key:"typeId",get:function(){return Ke.Date}},{key:"toString",value:function(){return"Date".concat(32*(this.unit+1),"<").concat(Je[this.unit],">")}}]),n}(Bn);Jn[Symbol.toStringTag]=function(t){return t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Date"}(Jn.prototype);var Zn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,Je.DAY)}return N(n)}(Jn),Qn=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.call(this,Je.MILLISECOND)}return N(n)}(Jn),Xn=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).unit=t,i.bitWidth=r,i}return N(n,[{key:"typeId",get:function(){return Ke.Time}},{key:"toString",value:function(){return"Time".concat(this.bitWidth,"<").concat(Ze[this.unit],">")}}]),n}(Bn);Xn[Symbol.toStringTag]=function(t){return t.unit=null,t.bitWidth=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Time"}(Xn.prototype);var tr=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).unit=t,i.timezone=r,i}return N(n,[{key:"typeId",get:function(){return Ke.Timestamp}},{key:"toString",value:function(){return"Timestamp<".concat(Ze[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}}]),n}(Bn);tr[Symbol.toStringTag]=function(t){return t.unit=null,t.timezone=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Timestamp"}(tr.prototype);var er=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).unit=t,r}return N(n,[{key:"typeId",get:function(){return Ke.Interval}},{key:"toString",value:function(){return"Interval<".concat(tn[this.unit],">")}}]),n}(Bn);er[Symbol.toStringTag]=function(t){return t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"}(er.prototype);var nr=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).children=[t],r}return N(n,[{key:"typeId",get:function(){return Ke.List}},{key:"toString",value:function(){return"List<".concat(this.valueType,">")}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:"ArrayType",get:function(){return this.valueType.ArrayType}}]),n}(Bn);nr[Symbol.toStringTag]=function(t){return t.children=null,t[Symbol.toStringTag]="List"}(nr.prototype);var rr=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).children=t,r}return N(n,[{key:"typeId",get:function(){return Ke.Struct}},{key:"toString",value:function(){return"Struct<{".concat(this.children.map((function(t){return"".concat(t.name,":").concat(t.type)})).join(", "),"}>")}}]),n}(Bn);rr[Symbol.toStringTag]=function(t){return t.children=null,t[Symbol.toStringTag]="Struct"}(rr.prototype);var ir=function(t){et(n,t);var e=ut(n);function n(t,r,i){var o;return F(this,n),(o=e.call(this)).mode=t,o.children=i,o.typeIds=r=Int32Array.from(r),o.typeIdToChildIndex=r.reduce((function(t,e,n){return(t[e]=n)&&t||t}),Object.create(null)),o}return N(n,[{key:"typeId",get:function(){return Ke.Union}},{key:"toString",value:function(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map((function(t){return"".concat(t.type)})).join(" | "),">")}}]),n}(Bn);ir[Symbol.toStringTag]=function(t){return t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"}(ir.prototype);var or=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).byteWidth=t,r}return N(n,[{key:"typeId",get:function(){return Ke.FixedSizeBinary}},{key:"toString",value:function(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}}]),n}(Bn);or[Symbol.toStringTag]=function(t){return t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"}(or.prototype);var ar=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).listSize=t,i.children=[r],i}return N(n,[{key:"typeId",get:function(){return Ke.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:"ArrayType",get:function(){return this.valueType.ArrayType}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),n}(Bn);ar[Symbol.toStringTag]=function(t){return t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"}(ar.prototype);var ur=function(t){et(n,t);var e=ut(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return F(this,n),(r=e.call(this)).children=[t],r.keysSorted=i,r}return N(n,[{key:"typeId",get:function(){return Ke.Map}},{key:"keyType",get:function(){return this.children[0].type.children[0].type}},{key:"valueType",get:function(){return this.children[0].type.children[1].type}},{key:"toString",value:function(){return"Map<{".concat(this.children[0].type.children.map((function(t){return"".concat(t.name,":").concat(t.type)})).join(", "),"}>")}}]),n}(Bn);ur[Symbol.toStringTag]=function(t){return t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"}(ur.prototype);var sr,cr=(sr=-1,function(){return++sr}),fr=function(t){et(n,t);var e=ut(n);function n(t,r,i,o){var a;return F(this,n),(a=e.call(this)).indices=r,a.dictionary=t,a.isOrdered=o||!1,a.id=null==i?cr():"number"===typeof i?i:i.low,a}return N(n,[{key:"typeId",get:function(){return Ke.Dictionary}},{key:"children",get:function(){return this.dictionary.children}},{key:"valueType",get:function(){return this.dictionary}},{key:"ArrayType",get:function(){return this.dictionary.ArrayType}},{key:"toString",value:function(){return"Dictionary<".concat(this.indices,", ").concat(this.dictionary,">")}}]),n}(Bn);function lr(t){var e=t;switch(t.typeId){case Ke.Decimal:return 4;case Ke.Timestamp:return 2;case Ke.Date:case Ke.Interval:return 1+e.unit;case Ke.Int:case Ke.Time:return+(e.bitWidth>32)+1;case Ke.FixedSizeList:return e.listSize;case Ke.FixedSizeBinary:return e.byteWidth;default:return 1}}fr[Symbol.toStringTag]=function(t){return t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"}(fr.prototype);var hr=function(){function t(e,n,r,i,o,a,u){var s;F(this,t),this.type=e,this.dictionary=u,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1)),this.childData=(a||[]).map((function(e){return e instanceof t?e:e.data})),o instanceof t?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=lr(e),o&&((s=o[0])&&(this.valueOffsets=s),(s=o[1])&&(this.values=s),(s=o[2])&&(this.nullBitmap=s),(s=o[3])&&(this.typeIds=s)))}return N(t,[{key:"typeId",get:function(){return this.type.typeId}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"buffers",get:function(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}},{key:"byteLength",get:function(){var t=0,e=this.valueOffsets,n=this.values,r=this.nullBitmap,i=this.typeIds;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),this.childData.reduce((function(t,e){return t+e.byteLength}),t)}},{key:"nullCount",get:function(){var t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-hn(t,this.offset,this.offset+this.length)),e}},{key:"clone",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.offset,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._nullCount,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.childData;return new t(e,n,r,i,o,a,this.dictionary)}},{key:"slice",value:function(t,e){var n=this.stride,r=this.typeId,i=this.childData,o=+(0===this._nullCount)-1,a=16===r?n:1,u=this._sliceBuffers(t,e,n,r);return this.clone(this.type,this.offset+t,e,o,u,!i.length||this.valueOffsets?i:this._sliceChildren(i,a*t,a*e))}},{key:"_changeLengthAndBackfillNullBitmap",value:function(t){if(this.typeId===Ke.Null)return this.clone(this.type,0,t,0);var e=this.length,n=this.nullCount,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<0&&r.set(cn(this.offset,e,this.nullBitmap),0);var i=this.buffers;return i[qe.VALIDITY]=r,this.clone(this.type,0,t,n+(t-e),i)}},{key:"_sliceBuffers",value:function(t,e,n,r){var i,o=this.buffers;return(i=o[qe.TYPE])&&(o[qe.TYPE]=i.subarray(t,t+e)),(i=o[qe.OFFSET])&&(o[qe.OFFSET]=i.subarray(t,t+e+1))||(i=o[qe.DATA])&&(o[qe.DATA]=6===r?i:i.subarray(n*t,n*(t+e))),o}},{key:"_sliceChildren",value:function(t,e,n){return t.map((function(t){return t.slice(e,n)}))}}],[{key:"new",value:function(e,n,r,i,o,a,u){switch(o instanceof t?o=o.buffers:o||(o=[]),e.typeId){case Ke.Null:return t.Null(e,n,r);case Ke.Int:return t.Int(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Dictionary:return t.Dictionary(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[],u);case Ke.Float:return t.Float(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Bool:return t.Bool(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Decimal:return t.Decimal(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Date:return t.Date(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Time:return t.Time(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Timestamp:return t.Timestamp(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Interval:return t.Interval(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.FixedSizeBinary:return t.FixedSizeBinary(e,n,r,i||0,o[qe.VALIDITY],o[qe.DATA]||[]);case Ke.Binary:return t.Binary(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],o[qe.DATA]||[]);case Ke.Utf8:return t.Utf8(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],o[qe.DATA]||[]);case Ke.List:return t.List(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],(a||[])[0]);case Ke.FixedSizeList:return t.FixedSizeList(e,n,r,i||0,o[qe.VALIDITY],(a||[])[0]);case Ke.Struct:return t.Struct(e,n,r,i||0,o[qe.VALIDITY],a||[]);case Ke.Map:return t.Map(e,n,r,i||0,o[qe.VALIDITY],o[qe.OFFSET]||[],(a||[])[0]);case Ke.Union:return t.Union(e,n,r,i||0,o[qe.VALIDITY],o[qe.TYPE]||[],o[qe.OFFSET]||a,a)}throw new Error("Unrecognized typeId ".concat(e.typeId))}},{key:"Null",value:function(e,n,r){return new t(e,n,r,0)}},{key:"Int",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Dictionary",value:function(e,n,r,i,o,a,u){return new t(e,n,r,i,[void 0,Gt(e.indices.ArrayType,a),Kt(o)],[],u)}},{key:"Float",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Bool",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Decimal",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Date",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Time",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Timestamp",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Interval",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"FixedSizeBinary",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,Gt(e.ArrayType,a),Kt(o)])}},{key:"Binary",value:function(e,n,r,i,o,a,u){return new t(e,n,r,i,[Ht(a),Kt(u),Kt(o)])}},{key:"Utf8",value:function(e,n,r,i,o,a,u){return new t(e,n,r,i,[Ht(a),Kt(u),Kt(o)])}},{key:"List",value:function(e,n,r,i,o,a,u){return new t(e,n,r,i,[Ht(a),void 0,Kt(o)],[u])}},{key:"FixedSizeList",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,void 0,Kt(o)],[a])}},{key:"Struct",value:function(e,n,r,i,o,a){return new t(e,n,r,i,[void 0,void 0,Kt(o)],a)}},{key:"Map",value:function(e,n,r,i,o,a,u){return new t(e,n,r,i,[Ht(a),void 0,Kt(o)],[u])}},{key:"Union",value:function(e,n,r,i,o,a,u,s){var c=[void 0,void 0,Kt(o),Gt(e.ArrayType,a)];return e.mode===Xe.Sparse?new t(e,n,r,i,c,u):(c[qe.OFFSET]=Ht(u),new t(e,n,r,i,c,s))}}]),t}();hr.prototype.childData=Object.freeze([]);function yr(t){if(null===t)return"null";if(void 0===t)return"undefined";switch(typeof t){case"number":case"bigint":return"".concat(t);case"string":return'"'.concat(t,'"')}return"function"===typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?"[".concat(t,"]"):JSON.stringify(t)}function pr(t){if(!t||t.length<=0)return function(t){return!0};var e="",n=t.filter((function(t){return t===t}));return n.length>0&&(e="\n switch (x) {".concat(n.map((function(t){return"\n case ".concat(function(t){if("bigint"!==typeof t)return yr(t);if(dt)return"".concat(yr(t),"n");return'"'.concat(yr(t),'"')}(t),":")})).join(""),"\n return false;\n }")),t.length!==n.length&&(e="if (x !== x) return false;\n".concat(e)),new Function("x","".concat(e,"\nreturn true;"))}var dr=function(t,e){return(t*e+63&-64||64)/e},vr=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.length>=e?t.subarray(0,e):Rt(new t.constructor(e),t,0)},br=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;F(this,t),this.buffer=e,this.stride=n,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e.constructor,this._resize(this.length=e.length/n|0)}return N(t,[{key:"byteLength",get:function(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}},{key:"reservedLength",get:function(){return this.buffer.length/this.stride}},{key:"reservedByteLength",get:function(){return this.buffer.byteLength}},{key:"set",value:function(t,e){return this}},{key:"append",value:function(t){return this.set(this.length,t)}},{key:"reserve",value:function(t){if(t>0){this.length+=t;var e=this.stride,n=this.length*e,r=this.buffer.length;n>=r&&this._resize(dr(0===r?1*n:2*n,this.BYTES_PER_ELEMENT))}return this}},{key:"flush",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;t=dr(t*this.stride,this.BYTES_PER_ELEMENT);var e=vr(this.buffer,t);return this.clear(),e}},{key:"clear",value:function(){return this.length=0,this._resize(0),this}},{key:"_resize",value:function(t){return this.buffer=Rt(new this.ArrayType(t),this.buffer)}}]),t}();br.prototype.offset=0;var gr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"last",value:function(){return this.get(this.length-1)}},{key:"get",value:function(t){return this.buffer[t]}},{key:"set",value:function(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}]),n}(br),mr=function(t){et(n,t);var e=ut(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(0);return F(this,n),(t=e.call(this,r,1/8)).numValid=0,t}return N(n,[{key:"numInvalid",get:function(){return this.length-this.numValid}},{key:"get",value:function(t){return this.buffer[t>>3]>>t%8&1}},{key:"set",value:function(t,e){var n=this.reserve(t-this.length+1).buffer,r=t>>3,i=t%8,o=n[r]>>i&1;return e?0===o&&(n[r]|=1<0&&void 0!==arguments[0]?arguments[0]:new Int32Array(1);return F(this,n),e.call(this,t,1)}return N(n,[{key:"append",value:function(t){return this.set(this.length-1,t)}},{key:"set",value:function(t,e){var n=this.length-1,r=this.reserve(t-n+1).buffer;return n0&&void 0!==arguments[0]?arguments[0]:this.length-1;return t>this.length&&this.set(t-1,0),Ve(nt(n.prototype),"flush",this).call(this,t+1)}}]),n}(gr),kr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"ArrayType64",get:function(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?bt:mt)}},{key:"set",value:function(t,e){switch(this.reserve(t-this.length+1),typeof e){case"bigint":this.buffer64[t]=e;break;case"number":this.buffer[t*this.stride]=e;break;default:this.buffer.set(e,t*this.stride)}return this}},{key:"_resize",value:function(t){var e=Ve(nt(n.prototype),"_resize",this).call(this,t),r=e.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return dt&&(this.buffer64=new this.ArrayType64(e.buffer,e.byteOffset,r)),e}}]),n}(br);function _r(){_r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function xr(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Lr(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Lr(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Lr=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Lr(t)}var Ir=function(){function t(e){var n=e.type,r=e.nullValues;F(this,t),this.length=0,this.finished=!1,this.type=n,this.children=[],this.nullValues=r,this.stride=lr(n),this._nulls=new mr,r&&r.length>0&&(this._isValid=pr(r))}return N(t,[{key:"toVector",value:function(){return $e.new(this.flush())}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"nullCount",get:function(){return this._nulls.numInvalid}},{key:"numChildren",get:function(){return this.children.length}},{key:"byteLength",get:function(){var t=0;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),this._typeIds&&(t+=this._typeIds.byteLength),this.children.reduce((function(t,e){return t+e.byteLength}),t)}},{key:"reservedLength",get:function(){return this._nulls.reservedLength}},{key:"reservedByteLength",get:function(){var t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((function(t,e){return t+e.reservedByteLength}),t)}},{key:"valueOffsets",get:function(){return this._offsets?this._offsets.buffer:null}},{key:"values",get:function(){return this._values?this._values.buffer:null}},{key:"nullBitmap",get:function(){return this._nulls?this._nulls.buffer:null}},{key:"typeIds",get:function(){return this._typeIds?this._typeIds.buffer:null}},{key:"append",value:function(t){return this.set(this.length,t)}},{key:"isValid",value:function(t){return this._isValid(t)}},{key:"set",value:function(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}},{key:"setValue",value:function(t,e){this._setValue(this,t,e)}},{key:"setValid",value:function(t,e){return this.length=this._nulls.set(t,+e).length,e}},{key:"addChild",value:function(t){arguments.length>1&&void 0!==arguments[1]||"".concat(this.numChildren);throw new Error('Cannot append children to non-nested type "'.concat(this.type,'"'))}},{key:"getChildAt",value:function(t){return this.children[t]||null}},{key:"flush",value:function(){var t=[],e=this._values,n=this._offsets,r=this._typeIds,i=this.length,o=this.nullCount;r?(t[qe.TYPE]=r.flush(i),n&&(t[qe.OFFSET]=n.flush(i))):n?(e&&(t[qe.DATA]=e.flush(n.last())),t[qe.OFFSET]=n.flush(i)):e&&(t[qe.DATA]=e.flush(i)),o>0&&(t[qe.VALIDITY]=this._nulls.flush(i));var a=hr.new(this.type,0,i,o,t,this.children.map((function(t){return t.flush()})));return this.clear(),a}},{key:"finish",value:function(){return this.finished=!0,this.children.forEach((function(t){return t.finish()})),this}},{key:"clear",value:function(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach((function(t){return t.clear()})),this}}],[{key:"new",value:function(t){}},{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t){throw new Error('"throughDOM" not available in this environment')}},{key:"throughIterable",value:function(t){return function(t){var e=t.queueingStrategy,n=void 0===e?"count":e,r=t.highWaterMark,i=void 0===r?"bytes"!==n?1e3:Math.pow(2,14):r,o="bytes"!==n?"length":"byteLength";return _r().mark((function e(n){var r,a,u,s,c;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0,a=Ir.new(t),u=T(n),e.prev=3,u.s();case 5:if((s=u.n()).done){e.next=14;break}if(c=s.value,!(a.append(c)[o]>=i)){e.next=12;break}if(e.t0=++r,!e.t0){e.next=12;break}return e.next=12,a.toVector();case 12:e.next=5;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(3),u.e(e.t1);case 19:return e.prev=19,u.f(),e.finish(19);case 22:if(!(a.finish().length>0||0===r)){e.next=25;break}return e.next=25,a.toVector();case 25:case"end":return e.stop()}}),e,null,[[3,16,19,22]])}))}(t)}},{key:"throughAsyncIterable",value:function(t){return function(t){var e=t.queueingStrategy,n=void 0===e?"count":e,r=t.highWaterMark,i=void 0===r?"bytes"!==n?1e3:Math.pow(2,14):r,o="bytes"!==n?"length":"byteLength";return function(){var e=C(_r().mark((function e(n){var r,a,u,s,c,f,l,h;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0,a=Ir.new(t),u=!1,s=!1,e.prev=4,f=xr(n);case 6:return e.next=8,U(f.next());case 8:if(!(u=!(l=e.sent).done)){e.next=18;break}if(h=l.value,!(a.append(h)[o]>=i)){e.next=15;break}if(e.t0=++r,!e.t0){e.next=15;break}return e.next=15,a.toVector();case 15:u=!1,e.next=6;break;case 18:e.next=24;break;case 20:e.prev=20,e.t1=e.catch(4),s=!0,c=e.t1;case 24:if(e.prev=24,e.prev=25,!u||null==f.return){e.next=29;break}return e.next=29,U(f.return());case 29:if(e.prev=29,!s){e.next=32;break}throw c;case 32:return e.finish(29);case 33:return e.finish(24);case 34:if(!(a.finish().length>0||0===r)){e.next=37;break}return e.next=37,a.toVector();case 37:case"end":return e.stop()}}),e,null,[[4,20,24,34],[25,,29,33]])})));return function(t){return e.apply(this,arguments)}}()}(t)}}]),t}();Ir.prototype.length=1,Ir.prototype.stride=1,Ir.prototype.children=null,Ir.prototype.finished=!1,Ir.prototype.nullValues=null,Ir.prototype._isValid=function(){return!0};var Sr=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._values=new gr(new r.ArrayType(0),r.stride),r}return N(n,[{key:"setValue",value:function(t,e){var r=this._values;return r.reserve(t-r.length+1),Ve(nt(n.prototype),"setValue",this).call(this,t,e)}}]),n}(Ir),Er=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._pendingLength=0,r._offsets=new wr,r}return N(n,[{key:"setValue",value:function(t,e){var n=this._pending||(this._pending=new Map),r=n.get(t);r&&(this._pendingLength-=r.length),this._pendingLength+=e.length,n.set(t,e)}},{key:"setValid",value:function(t,e){return!!Ve(nt(n.prototype),"setValid",this).call(this,t,e)||((this._pending||(this._pending=new Map)).set(t,void 0),!1)}},{key:"clear",value:function(){return this._pendingLength=0,this._pending=void 0,Ve(nt(n.prototype),"clear",this).call(this)}},{key:"flush",value:function(){return this._flush(),Ve(nt(n.prototype),"flush",this).call(this)}},{key:"finish",value:function(){return this._flush(),Ve(nt(n.prototype),"finish",this).call(this)}},{key:"_flush",value:function(){var t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}]),n}(Ir);var Or=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._values=new mr,r}return N(n,[{key:"setValue",value:function(t,e){this._values.set(t,+e)}}]),n}(Ir),Tr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"setValue",value:function(t,e){}},{key:"setValid",value:function(t,e){return this.length=Math.max(t+1,this.length),e}}]),n}(Ir),Ar=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),Br=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Ar),Fr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Ar),Dr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),Nr=function(t){et(n,t);var e=ut(n);function n(t){var r,i=t.type,o=t.nullValues,a=t.dictionaryHashFunction;return F(this,n),(r=e.call(this,{type:new fr(i.dictionary,i.indices,i.id,i.isOrdered)}))._nulls=null,r._dictionaryOffset=0,r._keysToIndices=Object.create(null),r.indices=Ir.new({type:r.type.indices,nullValues:o}),r.dictionary=Ir.new({type:r.type.dictionary,nullValues:null}),"function"===typeof a&&(r.valueToKey=a),r}return N(n,[{key:"values",get:function(){return this.indices.values}},{key:"nullCount",get:function(){return this.indices.nullCount}},{key:"nullBitmap",get:function(){return this.indices.nullBitmap}},{key:"byteLength",get:function(){return this.indices.byteLength+this.dictionary.byteLength}},{key:"reservedLength",get:function(){return this.indices.reservedLength+this.dictionary.reservedLength}},{key:"reservedByteLength",get:function(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}},{key:"isValid",value:function(t){return this.indices.isValid(t)}},{key:"setValid",value:function(t,e){var n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}},{key:"setValue",value:function(t,e){var n=this._keysToIndices,r=this.valueToKey(e),i=n[r];return void 0===i&&(n[r]=i=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,i)}},{key:"flush",value:function(){var t=this.type,e=this._dictionary,n=this.dictionary.toVector(),r=this.indices.flush().clone(t);return r.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=r.dictionary,this.clear(),r}},{key:"finish",value:function(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),Ve(nt(n.prototype),"finish",this).call(this)}},{key:"clear",value:function(){return this.indices.clear(),this.dictionary.clear(),Ve(nt(n.prototype),"clear",this).call(this)}},{key:"valueToKey",value:function(t){return"string"===typeof t?t:"".concat(t)}}]),n}(Ir),jr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),Mr=new Float64Array(1),Ur=new Uint32Array(Mr.buffer);function Pr(t){var e=(31744&t)>>10,n=(1023&t)/1024,r=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,e-15)*(1+n)}function Cr(t){if(t!==t)return 32256;Mr[0]=t;var e=(2147483648&Ur[1])>>16&65535,n=2146435072&Ur[1],r=0;return n>=1089470464?Ur[0]>0?n=31744:(n=(2080374784&n)>>16,r=(1048575&Ur[1])>>10):n<=1056964608?(r=1048576+((r=1048576+(1048575&Ur[1]))<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=512+(1048575&Ur[1])>>10),e|n|65535&r}var Vr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),Rr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"setValue",value:function(t,e){this._values.set(t,Cr(e))}}]),n}(Vr),zr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(Vr),Gr=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(Vr);function Yr(t,e,n){return(Yr=rt()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&tt(i,n.prototype),i}).apply(null,arguments)}var Wr,Hr,$r=Symbol.for("isArrowBigNum");function Kr(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r>>=0),s+=(n>>>0)+e*Math.pow(c,32);return s}function Xr(t){var e="",n=new Uint32Array(2),r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,a=r.length-1;do{for(n[0]=r[o=0];o0&&void 0!==arguments[0]?arguments[0]:"default";switch(t){case"number":return Qr(this);case"string":return Wr(this);case"default":return Hr(this)}return Wr(this)},Object.setPrototypeOf(qr.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Jr.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Zr.prototype,Object.create(Uint32Array.prototype)),Object.assign(qr.prototype,Kr.prototype,{constructor:qr,signed:!0,TypedArray:Int32Array,BigIntArray:bt}),Object.assign(Jr.prototype,Kr.prototype,{constructor:Jr,signed:!1,TypedArray:Uint32Array,BigIntArray:mt}),Object.assign(Zr.prototype,Kr.prototype,{constructor:Zr,signed:!0,TypedArray:Uint32Array,BigIntArray:mt}),dt?(Hr=function(t){return 8===t.byteLength?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:Xr(t)},Wr=function(t){return 8===t.byteLength?"".concat(new t.BigIntArray(t.buffer,t.byteOffset,1)[0]):Xr(t)}):Hr=Wr=Xr;var ti,ei=function(){function t(e,n){return F(this,t),t.new(e,n)}return N(t,null,[{key:"new",value:function(t,e){switch(e){case!0:return new qr(t);case!1:return new Jr(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case bt:return new qr(t)}return 16===t.byteLength?new Zr(t):new Jr(t)}},{key:"signed",value:function(t){return new qr(t)}},{key:"unsigned",value:function(t){return new Jr(t)}},{key:"decimal",value:function(t){return new Zr(t)}}]),t}(),ni=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"setValue",value:function(t,e){this._values.set(t,e)}}]),n}(Sr),ri=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),ii=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),oi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),ai=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),t.nullValues&&(t.nullValues=t.nullValues.map(li)),(r=e.call(this,t))._values=new kr(new Int32Array(0),2),r}return N(n,[{key:"values64",get:function(){return this._values.buffer64}},{key:"isValid",value:function(t){return Ve(nt(n.prototype),"isValid",this).call(this,li(t))}}]),n}(ni),ui=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),si=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),ci=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(ni),fi=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),t.nullValues&&(t.nullValues=t.nullValues.map(li)),(r=e.call(this,t))._values=new kr(new Uint32Array(0),2),r}return N(n,[{key:"values64",get:function(){return this._values.buffer64}},{key:"isValid",value:function(t){return Ve(nt(n.prototype),"isValid",this).call(this,li(t))}}]),n}(ni),li=(ti={BigIntArray:bt},function(t){return ArrayBuffer.isView(t)&&(ti.buffer=t.buffer,ti.byteOffset=t.byteOffset,ti.byteLength=t.byteLength,t=Hr(ti),ti.buffer=null),t}),hi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),yi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(hi),pi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(hi),di=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(hi),vi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(hi),bi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),gi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(bi),mi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(bi),wi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(bi),ki=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(bi),_i=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(Sr),xi=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(_i),Li=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(_i),Ii=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._values=new br(new Uint8Array(0)),r}return N(n,[{key:"byteLength",get:function(){var t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}},{key:"setValue",value:function(t,e){return Ve(nt(n.prototype),"setValue",this).call(this,t,Kt(e))}},{key:"_flushPending",value:function(t,e){var n,r,i=this._offsets,o=this._values.reserve(e).buffer,a=0,u=0,s=0,c=T(t);try{for(c.s();!(r=c.n()).done;){var f=j(r.value,2);a=f[0],void 0===(n=f[1])?i.set(a,0):(u=n.length,o.set(n,s),i.set(a,u),s+=u)}}catch(l){c.e(l)}finally{c.f()}}}]),n}(Er),Si=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._values=new br(new Uint8Array(0)),r}return N(n,[{key:"byteLength",get:function(){var t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}},{key:"setValue",value:function(t,e){return Ve(nt(n.prototype),"setValue",this).call(this,t,X(e))}},{key:"_flushPending",value:function(t,e){}}]),n}(Er);Si.prototype._flushPending=Ii.prototype._flushPending;var Ei=function(){function t(){F(this,t)}return N(t,[{key:"length",get:function(){return this._values.length}},{key:"get",value:function(t){return this._values[t]}},{key:"clear",value:function(){return this._values=null,this}},{key:"bind",value:function(t){return t instanceof $e?t:(this._values=t,this)}}]),t}();function Oi(){Oi=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var Ti=Symbol.for("parent"),Ai=Symbol.for("rowIndex"),Bi=Symbol.for("keyToIdx"),Fi=Symbol.for("idxToVal"),Di=Symbol.for("nodejs.util.inspect.custom"),Ni=function(t){function e(t,n){F(this,e),this[Ti]=t,this.size=n}return N(e,[{key:"entries",value:function(){return this[Symbol.iterator]()}},{key:"has",value:function(t){return void 0!==this.get(t)}},{key:"get",value:function(t){var e=void 0;if(null!==t&&void 0!==t){var n=this[Bi]||(this[Bi]=new Map),r=n.get(t);if(void 0!==r){var i=this[Fi]||(this[Fi]=new Array(this.size));void 0!==(e=i[r])||(i[r]=e=this.getValue(r))}else if((r=this.getIndex(t))>-1){n.set(t,r);var o=this[Fi]||(this[Fi]=new Array(this.size));void 0!==(e=o[r])||(o[r]=e=this.getValue(r))}}return e}},{key:"set",value:function(t,e){if(null!==t&&void 0!==t){var n=this[Bi]||(this[Bi]=new Map),r=n.get(t);if(void 0===r&&n.set(t,r=this.getIndex(t)),r>-1)(this[Fi]||(this[Fi]=new Array(this.size)))[r]=this.setValue(r,e)}return this}},{key:"clear",value:function(){throw new Error("Clearing ".concat(this[Symbol.toStringTag]," not supported."))}},{key:"delete",value:function(t){throw new Error("Deleting ".concat(this[Symbol.toStringTag]," values not supported."))}},{key:Symbol.iterator,value:Oi().mark((function t(){var e,n,r,i,o,a,u,s,c;return Oi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.keys(),n=this.values(),r=this[Bi]||(this[Bi]=new Map),i=this[Fi]||(this[Fi]=new Array(this.size)),u=0;case 5:if((s=e.next()).done||(c=n.next()).done){t.next=15;break}return o=s.value,a=c.value,i[u]=a,r.has(o)||r.set(o,u),t.next=12,[o,a];case 12:++u,t.next=5;break;case 15:case"end":return t.stop()}}),t,this)}))},{key:"forEach",value:function(t,e){for(var n,r,i,o,a=this.keys(),u=this.values(),s=void 0===e?t:function(n,r,i){return t.call(e,n,r,i)},c=this[Bi]||(this[Bi]=new Map),f=this[Fi]||(this[Fi]=new Array(this.size)),l=0;!(i=a.next()).done&&!(o=u.next()).done;++l)n=i.value,r=o.value,f[l]=r,c.has(n)||c.set(n,l),s(r,n,this)}},{key:"toArray",value:function(){return dn(this.values())}},{key:"toJSON",value:function(){var t={};return this.forEach((function(e,n){return t[n]=e})),t}},{key:"inspect",value:function(){return this.toString()}},{key:Di,value:function(){return this.toString()}},{key:"toString",value:function(){var t=[];return this.forEach((function(e,n){n=yr(n),e=yr(e),t.push("".concat(n,": ").concat(e))})),"{ ".concat(t.join(", ")," }")}}]),e}();Ni[Symbol.toStringTag]=function(t){var e;return Object.defineProperties(t,(Ue(e={size:{writable:!0,enumerable:!1,configurable:!1,value:0}},Ti,{writable:!0,enumerable:!1,configurable:!1,value:null}),Ue(e,Ai,{writable:!0,enumerable:!1,configurable:!1,value:-1}),e)),t[Symbol.toStringTag]="Row"}(Ni.prototype);var ji=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),at(r=e.call(this,t,t.length),Ci(ot(r)))}return N(n,[{key:"keys",value:function(){return this[Ti].getChildAt(0)[Symbol.iterator]()}},{key:"values",value:function(){return this[Ti].getChildAt(1)[Symbol.iterator]()}},{key:"getKey",value:function(t){return this[Ti].getChildAt(0).get(t)}},{key:"getIndex",value:function(t){return this[Ti].getChildAt(0).indexOf(t)}},{key:"getValue",value:function(t){return this[Ti].getChildAt(1).get(t)}},{key:"setValue",value:function(t,e){this[Ti].getChildAt(1).set(t,e)}}]),n}(Ni),Mi=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),at(r=e.call(this,t,t.type.children.length),Pi(ot(r)))}return N(n,[{key:"keys",value:Oi().mark((function t(){var e,n,r;return Oi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=T(this[Ti].type.children),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=9;break}return r=n.value,t.next=7,r.name;case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[1,11,14,17]])}))},{key:"values",value:Oi().mark((function t(){var e,n,r;return Oi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=T(this[Ti].type.children),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=9;break}return r=n.value,t.next=7,this[r.name];case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[1,11,14,17]])}))},{key:"getKey",value:function(t){return this[Ti].type.children[t].name}},{key:"getIndex",value:function(t){return this[Ti].type.children.findIndex((function(e){return e.name===t}))}},{key:"getValue",value:function(t){return this[Ti].getChildAt(t).get(this[Ai])}},{key:"setValue",value:function(t,e){return this[Ti].getChildAt(t).set(this[Ai],e)}}]),n}(Ni);Object.setPrototypeOf(Ni.prototype,Map.prototype);var Ui,Pi=function(){var t={enumerable:!0,configurable:!1,get:null,set:null};return function(e){var n,r=-1,i=e[Bi]||(e[Bi]=new Map),o=function(t){return function(){return this.get(t)}},a=function(t){return function(e){return this.set(t,e)}},u=T(e.keys());try{for(u.s();!(n=u.n()).done;){var s=n.value;i.set(s,++r),t.get=o(s),t.set=a(s),e.hasOwnProperty(s)||(t.enumerable=!0,Object.defineProperty(e,s,t)),e.hasOwnProperty(r)||(t.enumerable=!1,Object.defineProperty(e,r,t))}}catch(c){u.e(c)}finally{u.f()}return t.get=t.set=null,e}}(),Ci=function(){if("undefined"===typeof Proxy)return Pi;var t=Ni.prototype.has,e=Ni.prototype.get,n=Ni.prototype.set,r=Ni.prototype.getKey,i={isExtensible:function(){return!1},deleteProperty:function(){return!1},preventExtensions:function(){return!0},ownKeys:function(t){return dn(t.keys()).map((function(t){return"".concat(t)}))},has:function(t,e){switch(e){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Ti:case Ai:case Fi:case Bi:case Di:return!0}return"number"!==typeof e||t.has(e)||(e=t.getKey(e)),t.has(e)},get:function(n,i,o){switch(i){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Ti:case Ai:case Fi:case Bi:case Di:return Reflect.get(n,i,o)}return"number"!==typeof i||t.call(o,i)||(i=r.call(o,i)),e.call(o,i)},set:function(e,i,o,a){switch(i){case Ti:case Ai:case Fi:case Bi:return Reflect.set(e,i,o,a);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return"number"!==typeof i||t.call(a,i)||(i=r.call(a,i)),!!t.call(a,i)&&!!n.call(a,i,o)}};return function(t){return new Proxy(t,i)}}();function Vi(t,e,n){var r=t.length,i=e>-1?e:r+e%r;return n?n(t,i):i}function Ri(t,e,n,r){var i=t.length,o=void 0===i?0:i,a="number"!==typeof e?0:e,u="number"!==typeof n?o:n;return a<0&&(a=(a%o+o)%o),u<0&&(u=(u%o+o)%o),uo&&(u=o),r?r(t,a,u):[a,u]}var zi=dt?pt(0):0,Gi=function(t){return t!==t};function Yi(t){var e=typeof t;if("object"!==e||null===t)return Gi(t)?Gi:"bigint"!==e?function(e){return e===t}:function(e){return zi+e===t};if(t instanceof Date){var n=t.valueOf();return function(t){return t instanceof Date&&t.valueOf()===n}}return ArrayBuffer.isView(t)?function(e){return!!e&&Le(t,e)}:t instanceof Map?function(t){var e=-1,n=[];return t.forEach((function(t){return n[++e]=Yi(t)})),Wi(n)}(t):Array.isArray(t)?function(t){for(var e=[],n=-1,r=t.length;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var Ki=function(t,e){et(r,t);var n=ut(r);function r(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:qi(i);return F(this,r),(e=n.call(this))._nullCount=-1,e._type=t,e._chunks=i,e._chunkOffsets=o,e._length=o[o.length-1],e._numChildren=(e._type.children||[]).length,e}return N(r,[{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._length}},{key:"chunks",get:function(){return this._chunks}},{key:"typeId",get:function(){return this._type.typeId}},{key:"VectorName",get:function(){return"Chunked<".concat(this._type,">")}},{key:"data",get:function(){return this._chunks[0]?this._chunks[0].data:null}},{key:"ArrayType",get:function(){return this._type.ArrayType}},{key:"numChildren",get:function(){return this._numChildren}},{key:"stride",get:function(){return this._chunks[0]?this._chunks[0].stride:1}},{key:"byteLength",get:function(){return this._chunks.reduce((function(t,e){return t+e.byteLength}),0)}},{key:"nullCount",get:function(){var t=this._nullCount;return t<0&&(this._nullCount=t=this._chunks.reduce((function(t,e){return t+e.nullCount}),0)),t}},{key:"indices",get:function(){if(Bn.isDictionary(this._type)){if(!this._indices){var t=this._chunks;this._indices=1===t.length?t[0].indices:r.concat.apply(r,dn(t.map((function(t){return t.indices}))))}return this._indices}return null}},{key:"dictionary",get:function(){return Bn.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}},{key:e,value:$i().mark((function t(){var e,n,r;return $i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=T(this._chunks),t.prev=1,e.s();case 3:if((n=e.n()).done){t.next=8;break}return r=n.value,t.delegateYield(r,"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[1,10,13,16]])}))},{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new r(this._type,t)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n=this._numChildren)return null;var e,n,i,o=this._children||(this._children=[]);return(e=o[t])?e:(n=(this._type.children||[])[t])&&(i=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}))).length>0?o[t]=new r(n.type,i):null}},{key:"search",value:function(t,e){var n=t,r=this._chunkOffsets,i=r.length-1;if(n<0)return null;if(n>=r[i])return null;if(i<=1)return e?e(this,0,n):[0,n];var o=0,a=0,u=0;do{if(o+1===i)return e?e(this,o,n-a):[o,n-a];n>=r[u=o+(i-o)/2|0]?o=u:i=u}while(n=(a=r[o]));return null}},{key:"isValid",value:function(t){return!!this.search(t,this.isValidInternal)}},{key:"get",value:function(t){return this.search(t,this.getInternal)}},{key:"set",value:function(t,e){this.search(t,(function(t,n,r){return t.chunks[n].set(r,e)}))}},{key:"indexOf",value:function(t,e){var n=this;return e&&"number"===typeof e?this.search(e,(function(e,r,i){return n.indexOfInternal(e,r,i,t)})):this.indexOfInternal(this,0,Math.max(0,e||0),t)}},{key:"toArray",value:function(){var t=this.chunks,e=t.length,n=this._type.ArrayType;if(e<=0)return new n(0);if(e<=1)return t[0].toArray();for(var r=0,i=new Array(e),o=-1;++o=n)break;if(!(e>=f+c))if(f>=e&&f+c<=n)r.push(s);else{var l=Math.max(0,e-f),h=Math.min(n-f,c);r.push(s.slice(l,h))}}return t.clone(r)}}],[{key:"flatten",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return F(this,n),i=Ki.flatten.apply(Ki,dn(i)),(r=e.call(this,t.type,i,o))._field=t,1!==i.length||ot(r)instanceof Xi?r:at(r,new Xi(t,i[0],r._chunkOffsets))}return N(n,[{key:"field",get:function(){return this._field}},{key:"name",get:function(){return this._field.name}},{key:"nullable",get:function(){return this._field.nullable}},{key:"metadata",get:function(){return this._field.metadata}},{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new n(this._field,t)}},{key:"getChildAt",value:function(t){if(t<0||t>=this.numChildren)return null;var e,r,i,o=this._children||(this._children=[]);return(e=o[t])?e:(r=(this.type.children||[])[t])&&(i=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}))).length>0?o[t]=new n(r,i):null}}],[{key:"new",value:function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o0}))&&(t=t.clone({nullable:!0}));return new n(t,a)}}]),n}(Ki),Xi=function(t){et(n,t);var e=ut(n);function n(t,r,i){var o;return F(this,n),(o=e.call(this,t,[r],i))._chunk=r,o}return N(n,[{key:"search",value:function(t,e){return e?e(this,0,t):[0,t]}},{key:"isValid",value:function(t){return this._chunk.isValid(t)}},{key:"get",value:function(t){return this._chunk.get(t)}},{key:"set",value:function(t,e){this._chunk.set(t,e)}},{key:"indexOf",value:function(t,e){return this._chunk.indexOf(t,e)}}]),n}(Qi),to=Array.isArray,eo=function(t,e){return ao(t,e,[],0)},no=function(t){var e=j(so(t,[[],[]]),2),n=e[0];return e[1].map((function(t,e){return t instanceof Qi?Qi.new(t.field.clone(n[e]),t):t instanceof $e?Qi.new(n[e],t):Qi.new(n[e],[])}))},ro=function(t){return so(t,[[],[]])},io=function(t,e){return function t(e,n,r,i){var o,a=i,u=-1,s=n.length;for(;++u0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;F(this,e),this.fields=t||[],this.metadata=n||new Map,r||(r=ho(t)),this.dictionaries=r}return N(e,[{key:Symbol.toStringTag,get:function(){return"Schema"}},{key:"toString",value:function(){return"Schema<{ ".concat(this.fields.map((function(t,e){return"".concat(e,": ").concat(t)})).join(", ")," }>")}},{key:"compareTo",value:function(t){return An.compareSchemas(this,t)}},{key:"select",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;F(this,e),this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}return N(e,[{key:"typeId",get:function(){return this.type.typeId}},{key:Symbol.toStringTag,get:function(){return"Field"}},{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.type)}},{key:"compareTo",value:function(t){return An.compareField(this,t)}},{key:"clone",value:function(){for(var t,n,r,i,o,a,u,s,c,f,l=arguments.length,h=new Array(l),y=0;y1&&void 0!==arguments[1]?arguments[1]:new Map,n=-1,r=t.length;++n0&&ho(o.children,e)}return e}co.prototype.fields=null,co.prototype.metadata=null,co.prototype.dictionaries=null,fo.prototype.type=null,fo.prototype.name=null,fo.prototype.nullable=null,fo.prototype.metadata=null;var yo=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._run=new Ei,r._offsets=new wr,r}return N(n,[{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new nr(new fo(e,t.type,!0)),this.numChildren-1}},{key:"clear",value:function(){return this._run.clear(),Ve(nt(n.prototype),"clear",this).call(this)}},{key:"_flushPending",value:function(t){var e,n,r=this._run,i=this._offsets,o=this._setValue,a=0,u=T(t);try{for(u.s();!(n=u.n()).done;){var s=j(n.value,2);a=s[0],void 0===(e=s[1])?i.set(a,0):(i.set(a,e.length),o(this,a,r.bind(e)))}}catch(c){u.e(c)}finally{u.f()}}}]),n}(Er),po=function(t){et(n,t);var e=ut(n);function n(){var t;return F(this,n),(t=e.apply(this,arguments))._run=new Ei,t}return N(n,[{key:"setValue",value:function(t,e){Ve(nt(n.prototype),"setValue",this).call(this,t,this._run.bind(e))}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");var n=this.children.push(t);return this.type=new ar(this.type.listSize,new fo(e,t.type,!0)),n}},{key:"clear",value:function(){return this._run.clear(),Ve(nt(n.prototype),"clear",this).call(this)}}]),n}(Ir),vo=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"set",value:function(t,e){return Ve(nt(n.prototype),"set",this).call(this,t,e)}},{key:"setValue",value:function(t,e){e=e instanceof Map?e:new Map(Object.entries(e));var n=this._pending||(this._pending=new Map),r=n.get(t);r&&(this._pendingLength-=r.size),this._pendingLength+=e.size,n.set(t,e)}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.numChildren);if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ur(new fo(e,t.type,!0),this.type.keysSorted),this.numChildren-1}},{key:"_flushPending",value:function(t){var e=this,n=this._offsets,r=this._setValue;t.forEach((function(t,i){void 0===t?n.set(i,0):(n.set(i,t.size),r(e,i,t))}))}}]),n}(Er),bo=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.numChildren),n=this.children.push(t);return this.type=new rr([].concat(dn(this.type.children),[new fo(e,t.type,!0)])),n}}]),n}(Ir),go=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._typeIds=new gr(new Int8Array(0),1),"function"===typeof t.valueToChildTypeId&&(r._valueToChildTypeId=t.valueToChildTypeId),r}return N(n,[{key:"typeIdToChildIndex",get:function(){return this.type.typeIdToChildIndex}},{key:"append",value:function(t,e){return this.set(this.length,t,e)}},{key:"set",value:function(t,e,n){return void 0===n&&(n=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,n),this}},{key:"setValue",value:function(t,e,r){this._typeIds.set(t,r),Ve(nt(n.prototype),"setValue",this).call(this,t,e)}},{key:"addChild",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"".concat(this.children.length),n=this.children.push(t),r=this.type,i=r.children,o=r.mode,a=r.typeIds,u=[].concat(dn(i),[new fo(e,t.type)]);return this.type=new ir(o,[].concat(dn(a),[n]),u),n}},{key:"_valueToChildTypeId",value:function(t,e,n){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.")}}]),n}(Ir),mo=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(go),wo=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._offsets=new gr(new Int32Array(0)),r}return N(n,[{key:"setValue",value:function(t,e,r){var i=this.type.typeIdToChildIndex[r];return this._offsets.set(t,this.getChildAt(i).length),Ve(nt(n.prototype),"setValue",this).call(this,t,e,r)}}]),n}(go),ko=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(vn),_o=function(t,e,n){t[e]=n%4294967296|0,t[e+1]=n/4294967296|0},xo=function(t,e,n,r){var i=e[n],o=e[n+1];null!=i&&null!=o&&t.set(r.subarray(0,o-i),i)},Lo=function(t,e,n){!function(t,e,n){t[e]=n/864e5|0}(t.values,e,n.valueOf())},Io=function(t,e,n){var r=t.values;_o(r,2*e,n.valueOf())},So=function(t,e,n){var r=t.stride;t.values[r*e]=n},Eo=function(t,e,n){var r=t.stride;t.values[r*e]=Cr(n)},Oo=function(t,e,n){switch(typeof n){case"bigint":t.values64[e]=n;break;case"number":t.values[e*t.stride]=n;break;default:var r=n,i=t.stride,o=Gt(t.ArrayType,r);t.values.set(o.subarray(0,i),i*e)}},To=function(t,e,n){var r=t.values;return _o(r,2*e,n/1e3)},Ao=function(t,e,n){var r=t.values;return _o(r,2*e,n)},Bo=function(t,e,n){return function(t,e,n){t[e]=1e3*n%4294967296|0,t[e+1]=1e3*n/4294967296|0}(t.values,2*e,n)},Fo=function(t,e,n){return function(t,e,n){t[e]=1e6*n%4294967296|0,t[e+1]=1e6*n/4294967296|0}(t.values,2*e,n)},Do=function(t,e,n){t.values[t.stride*e]=n},No=function(t,e,n){t.values[t.stride*e]=n},jo=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Mo=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Uo=function(t,e,n){var r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);i&&i.set(t.valueOffsets[e],n)},Po=function(t,e,n){var r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);i&&i.set(e,n)},Co=function(t,e,n){t.values.set(n.subarray(0,2),2*e)},Vo=function(t,e,n){t.values[e]=12*n[0]+n[1]%12};ko.prototype.visitBool=function(t,e,n){var r=t.offset,i=t.values,o=r+e;n?i[o>>3]|=1<>3]&=~(1<=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}Ir.new=function t(e){var n=e.type,r=new(Go.getVisitFn(n)())(e);if(n.children&&n.children.length>0){var i=e.children||[],o={nullValues:e.nullValues},a=Array.isArray(i)?function(t,e){return i[e]||o}:function(t){var e=t.name;return i[e]||o};n.children.forEach((function(e,n){var i=e.type,o=a(e,n);r.children.push(t(Ce(Ce({},o),{},{type:i})))}))}return r},Object.keys(Ke).map((function(t){return Ke[t]})).filter((function(t){return"number"===typeof t&&t!==Ke.NONE})).forEach((function(t){Go.visit(t).prototype._setValue=zo.getVisitFn(t)})),Si.prototype._setValue=zo.visitBinary,function(t){!function(e){!function(e){!function(e){var n=function(){function e(){F(this,e),this.bb=null,this.bb_pos=0}return N(e,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"version",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Re.apache.arrow.flatbuf.MetadataVersion.V1}},{key:"schema",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new Re.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"dictionaries",value:function(e,n){var r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+r)+24*e,this.bb):null}},{key:"dictionariesLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"recordBatches",value:function(e,n){var r=this.bb.__offset(this.bb_pos,10);return r?(n||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+r)+24*e,this.bb):null}},{key:"recordBatchesLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}}],[{key:"getRootAsFooter",value:function(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}},{key:"startFooter",value:function(t){t.startObject(4)}},{key:"addVersion",value:function(t,e){t.addFieldInt16(0,e,Re.apache.arrow.flatbuf.MetadataVersion.V1)}},{key:"addSchema",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"addDictionaries",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"startDictionariesVector",value:function(t,e){t.startVector(24,e,8)}},{key:"addRecordBatches",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"startRecordBatchesVector",value:function(t,e){t.startVector(24,e,8)}},{key:"endFooter",value:function(t){return t.endObject()}},{key:"finishFooterBuffer",value:function(t,e){t.finish(e)}},{key:"createFooter",value:function(t,n,r,i,o){return e.startFooter(t),e.addVersion(t,n),e.addSchema(t,r),e.addDictionaries(t,i),e.addRecordBatches(t,o),e.endFooter(t)}}]),e}();e.Footer=n}(e.flatbuf||(e.flatbuf={}))}(e.arrow||(e.arrow={}))}(t.apache||(t.apache={}))}(Ro||(Ro={})),function(t){!function(t){!function(t){!function(t){var e=function(){function t(){F(this,t),this.bb=null,this.bb_pos=0}return N(t,[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"offset",value:function(){return this.bb.readInt64(this.bb_pos)}},{key:"metaDataLength",value:function(){return this.bb.readInt32(this.bb_pos+8)}},{key:"bodyLength",value:function(){return this.bb.readInt64(this.bb_pos+16)}}],[{key:"createBlock",value:function(t,e,n,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}}]),t}();t.Block=e}(t.flatbuf||(t.flatbuf={}))}(t.arrow||(t.arrow={}))}(t.apache||(t.apache={}))}(Ro||(Ro={}));var Wo=R.Long,Ho=R.Builder,$o=R.ByteBuffer,Ko=Ro.apache.arrow.flatbuf.Block,qo=Ro.apache.arrow.flatbuf.Footer,Jo=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nn.V4,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;F(this,t),this.schema=e,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}return N(t,[{key:"numRecordBatches",get:function(){return this._recordBatches.length}},{key:"numDictionaries",get:function(){return this._dictionaryBatches.length}},{key:"recordBatches",value:Yo().mark((function t(){var e,n,r;return Yo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=-1,r=this.numRecordBatches;case 1:if(!(++n=0&&t=0&&t=0&&t=0&&t=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function ta(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new ea(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function ea(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(ea=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new ea(t)}var na=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"write",value:function(t){if((t=Kt(t)).byteLength>0)return Ve(nt(n.prototype),"write",this).call(this,t)}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t?Q(this.toUint8Array(!0)):this.toUint8Array(!1).then(Q)}},{key:"toUint8Array",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?zt(this._values)[0]:B(Xo().mark((function e(){var n,r,i,o,a,u,s,c;return Xo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],r=0,i=!1,o=!1,e.prev=3,u=ta(t);case 5:return e.next=7,u.next();case 7:if(!(i=!(s=e.sent).done)){e.next=14;break}c=s.value,n.push(c),r+=c.byteLength;case 11:i=!1,e.next=5;break;case 14:e.next=20;break;case 16:e.prev=16,e.t0=e.catch(3),o=!0,a=e.t0;case 20:if(e.prev=20,e.prev=21,!i||null==u.return){e.next=25;break}return e.next=25,u.return();case 25:if(e.prev=25,!o){e.next=28;break}throw a;case 28:return e.finish(25);case 29:return e.finish(20);case 30:return e.abrupt("return",zt(n,r)[0]);case 31:case"end":return e.stop()}}),e,null,[[3,16,20,30],[21,,25,29]])})))()}}]),n}(ht),ra=function(t){function e(t){F(this,e),t&&(this.source=new oa(Ee.fromIterable(t)))}return N(e,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(t){return this.source.next(t)}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"peek",value:function(t){return this.source.peek(t)}},{key:"read",value:function(t){return this.source.read(t)}}]),e}(),ia=function(t){function e(t){F(this,e),t instanceof e?this.source=t.source:t instanceof na?this.source=new aa(Ee.fromAsyncIterable(t)):Nt(t)?this.source=new aa(Ee.fromNodeStream(t)):Ft(t)?this.source=new aa(Ee.fromDOMStream(t)):At(t)?this.source=new aa(Ee.fromDOMStream(t.body)):It(t)?this.source=new aa(Ee.fromIterable(t)):(Lt(t)||St(t))&&(this.source=new aa(Ee.fromAsyncIterable(t)))}return N(e,[{key:Symbol.asyncIterator,value:function(){return this}},{key:"next",value:function(t){return this.source.next(t)}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"closed",get:function(){return this.source.closed}},{key:"cancel",value:function(t){return this.source.cancel(t)}},{key:"peek",value:function(t){return this.source.peek(t)}},{key:"read",value:function(t){return this.source.read(t)}}]),e}(),oa=function(){function t(e){F(this,t),this.source=e}return N(t,[{key:"cancel",value:function(t){this.return(t)}},{key:"peek",value:function(t){return this.next(t,"peek").value}},{key:"read",value:function(t){return this.next(t,"read").value}},{key:"next",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"read";return this.source.next({cmd:e,size:t})}},{key:"throw",value:function(t){return Object.create(this.source.throw&&this.source.throw(t)||ct)}},{key:"return",value:function(t){return Object.create(this.source.return&&this.source.return(t)||ct)}}]),t}(),aa=function(){function t(e){var n=this;F(this,t),this.source=e,this._closedPromise=new Promise((function(t){return n._closedPromiseResolve=t}))}return N(t,[{key:"cancel",value:function(){var t=B(Xo().mark((function t(e){return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.return(e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"closed",get:function(){return this._closedPromise}},{key:"read",value:function(){var t=B(Xo().mark((function t(e){return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"read");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"peek",value:function(){var t=B(Xo().mark((function t(e){return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.next(e,"peek");case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=B(Xo().mark((function t(e){var n,r=arguments;return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:"read",t.next=3,this.source.next({cmd:n,size:e});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"throw",value:function(){var t=B(Xo().mark((function t(e){var n;return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t1=this.source.throw,!t.t1){t.next=5;break}return t.next=4,this.source.throw(e);case 4:t.t1=t.sent;case 5:if(t.t0=t.t1,t.t0){t.next=8;break}t.t0=ct;case 8:return n=t.t0,this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,t.abrupt("return",Object.create(n));case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=B(Xo().mark((function t(e){var n;return Xo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t1=this.source.return,!t.t1){t.next=5;break}return t.next=4,this.source.return(e);case 4:t.t1=t.sent;case 5:if(t.t0=t.t1,t.t0){t.next=8;break}t.t0=ct;case 8:return n=t.t0,this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,t.abrupt("return",Object.create(n));case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()}]),t}();function ua(){ua=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var sa=function(t){et(n,t);var e=ut(n);function n(t,r){var i;return F(this,n),(i=e.call(this)).position=0,i.buffer=Kt(t),i.size="undefined"===typeof r?i.buffer.byteLength:r,i}return N(n,[{key:"readInt32",value:function(t){var e=this.readAt(t,4),n=e.buffer,r=e.byteOffset;return new DataView(n,r).getInt32(0,!0)}},{key:"seek",value:function(t){return this.position=Math.min(t,this.size),t>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),n=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]),r=e[3]*n[3];this.buffer[0]=65535&r;var i=r>>>16;return i+=r=e[2]*n[3],i+=r=e[3]*n[2]>>>0,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}},{key:"_plus",value:function(t){var e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}},{key:"lessThan",value:function(t){return this.buffer[1]1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString("string"===typeof t?t:t.toString(),e)}},{key:"fromNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString(t.toString(),e)}},{key:"fromString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2),r=t.length,i=new n(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString("string"===typeof t?t:t.toString(),e)}},{key:"fromNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2);return n.fromString(t.toString(),e)}},{key:"fromString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(2),r=t.startsWith("-"),i=t.length,o=new n(e),a=r?1:0;a>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}},{key:"hex",value:function(){return"".concat(fa(this.buffer[3])," ").concat(fa(this.buffer[2])," ").concat(fa(this.buffer[1])," ").concat(fa(this.buffer[0]))}}],[{key:"multiply",value:function(e,n){return new t(new Uint32Array(e.buffer)).times(n)}},{key:"add",value:function(e,n){return new t(new Uint32Array(e.buffer)).plus(n)}},{key:"from",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4);return t.fromString("string"===typeof e?e:e.toString(),n)}},{key:"fromNumber",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4);return t.fromString(e.toString(),n)}},{key:"fromString",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint32Array(4),r=e.startsWith("-"),i=e.length,o=new t(n),a=r?1:0;a1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length;return hr.Null(t,0,n)}},{key:"visitBool",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Bool(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitInt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Int(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitFloat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Float(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitUtf8",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Utf8(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}},{key:"visitBinary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Binary(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}},{key:"visitFixedSizeBinary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.FixedSizeBinary(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitDate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Date(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitTimestamp",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Timestamp(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitTime",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Time(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitDecimal",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Decimal(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitList",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.List(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}},{key:"visitStruct",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Struct(t,0,n,r,this.readNullBitmap(t,r),this.visitMany(t.children))}},{key:"visitUnion",value:function(t){return t.mode===Xe.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}},{key:"visitDenseUnion",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Union(t,0,n,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.readOffsets(t),this.visitMany(t.children))}},{key:"visitSparseUnion",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Union(t,0,n,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.visitMany(t.children))}},{key:"visitDictionary",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Dictionary(t,0,n,r,this.readNullBitmap(t,r),this.readData(t.indices),this.readDictionary(t))}},{key:"visitInterval",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Interval(t,0,n,r,this.readNullBitmap(t,r),this.readData(t))}},{key:"visitFixedSizeList",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.FixedSizeList(t,0,n,r,this.readNullBitmap(t,r),this.visit(t.children[0]))}},{key:"visitMap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextFieldNode(),n=e.length,r=e.nullCount;return hr.Map(t,0,n,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}},{key:"nextFieldNode",value:function(){return this.nodes[++this.nodesIndex]}},{key:"nextBufferRange",value:function(){return this.buffers[++this.buffersIndex]}},{key:"readNullBitmap",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.nextBufferRange();return e>0&&this.readData(t,n)||new Uint8Array(0)}},{key:"readOffsets",value:function(t,e){return this.readData(t,e)}},{key:"readTypeIds",value:function(t,e){return this.readData(t,e)}},{key:"readData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.length,r=e.offset;return this.bytes.subarray(r,r+n)}},{key:"readDictionary",value:function(t){return this.dictionaries.get(t.id)}}]),n}(vn),ba=function(t){et(n,t);var e=ut(n);function n(t,r,i,o){var a;return F(this,n),(a=e.call(this,new Uint8Array(0),r,i,o)).sources=t,a}return N(n,[{key:"readNullBitmap",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.nextBufferRange(),r=n.offset;return e<=0?new Uint8Array(0):fn(this.sources[r])}},{key:"readOffsets",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset;return Gt(Uint8Array,Gt(Int32Array,this.sources[n]))}},{key:"readTypeIds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset;return Gt(Uint8Array,Gt(t.ArrayType,this.sources[n]))}},{key:"readData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nextBufferRange(),n=e.offset,r=this.sources;return Bn.isTimestamp(t)||(Bn.isInt(t)||Bn.isTime(t))&&64===t.bitWidth||Bn.isDate(t)&&t.unit===Je.MILLISECOND?Gt(Uint8Array,pa.convertArray(r[n])):Bn.isDecimal(t)?Gt(Uint8Array,da.convertArray(r[n])):Bn.isBinary(t)||Bn.isFixedSizeBinary(t)?ga(r[n]):Bn.isBool(t)?fn(r[n]):Bn.isUtf8(t)?X(r[n].join("")):Gt(Uint8Array,Gt(t.ArrayType,r[n].map((function(t){return+t}))))}}]),n}(va);function ga(t){for(var e=t.join(""),n=new Uint8Array(e.length/2),r=0;r>1]=parseInt(e.substr(r,2),16);return n}var ma=R.Long,wa=Re.apache.arrow.flatbuf.Null,ka=Re.apache.arrow.flatbuf.Int,_a=Re.apache.arrow.flatbuf.FloatingPoint,xa=Re.apache.arrow.flatbuf.Binary,La=Re.apache.arrow.flatbuf.Bool,Ia=Re.apache.arrow.flatbuf.Utf8,Sa=Re.apache.arrow.flatbuf.Decimal,Ea=Re.apache.arrow.flatbuf.Date,Oa=Re.apache.arrow.flatbuf.Time,Ta=Re.apache.arrow.flatbuf.Timestamp,Aa=Re.apache.arrow.flatbuf.Interval,Ba=Re.apache.arrow.flatbuf.List,Fa=Re.apache.arrow.flatbuf.Struct_,Da=Re.apache.arrow.flatbuf.Union,Na=Re.apache.arrow.flatbuf.DictionaryEncoding,ja=Re.apache.arrow.flatbuf.FixedSizeBinary,Ma=Re.apache.arrow.flatbuf.FixedSizeList,Ua=Re.apache.arrow.flatbuf.Map,Pa=new(function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"visit",value:function(t,e){return null==t||null==e?void 0:Ve(nt(n.prototype),"visit",this).call(this,t,e)}},{key:"visitNull",value:function(t,e){return wa.startNull(e),wa.endNull(e)}},{key:"visitInt",value:function(t,e){return ka.startInt(e),ka.addBitWidth(e,t.bitWidth),ka.addIsSigned(e,t.isSigned),ka.endInt(e)}},{key:"visitFloat",value:function(t,e){return _a.startFloatingPoint(e),_a.addPrecision(e,t.precision),_a.endFloatingPoint(e)}},{key:"visitBinary",value:function(t,e){return xa.startBinary(e),xa.endBinary(e)}},{key:"visitBool",value:function(t,e){return La.startBool(e),La.endBool(e)}},{key:"visitUtf8",value:function(t,e){return Ia.startUtf8(e),Ia.endUtf8(e)}},{key:"visitDecimal",value:function(t,e){return Sa.startDecimal(e),Sa.addScale(e,t.scale),Sa.addPrecision(e,t.precision),Sa.endDecimal(e)}},{key:"visitDate",value:function(t,e){return Ea.startDate(e),Ea.addUnit(e,t.unit),Ea.endDate(e)}},{key:"visitTime",value:function(t,e){return Oa.startTime(e),Oa.addUnit(e,t.unit),Oa.addBitWidth(e,t.bitWidth),Oa.endTime(e)}},{key:"visitTimestamp",value:function(t,e){var n=t.timezone&&e.createString(t.timezone)||void 0;return Ta.startTimestamp(e),Ta.addUnit(e,t.unit),void 0!==n&&Ta.addTimezone(e,n),Ta.endTimestamp(e)}},{key:"visitInterval",value:function(t,e){return Aa.startInterval(e),Aa.addUnit(e,t.unit),Aa.endInterval(e)}},{key:"visitList",value:function(t,e){return Ba.startList(e),Ba.endList(e)}},{key:"visitStruct",value:function(t,e){return Fa.startStruct_(e),Fa.endStruct_(e)}},{key:"visitUnion",value:function(t,e){Da.startTypeIdsVector(e,t.typeIds.length);var n=Da.createTypeIdsVector(e,t.typeIds);return Da.startUnion(e),Da.addMode(e,t.mode),Da.addTypeIds(e,n),Da.endUnion(e)}},{key:"visitDictionary",value:function(t,e){var n=this.visit(t.indices,e);return Na.startDictionaryEncoding(e),Na.addId(e,new ma(t.id,0)),Na.addIsOrdered(e,t.isOrdered),void 0!==n&&Na.addIndexType(e,n),Na.endDictionaryEncoding(e)}},{key:"visitFixedSizeBinary",value:function(t,e){return ja.startFixedSizeBinary(e),ja.addByteWidth(e,t.byteWidth),ja.endFixedSizeBinary(e)}},{key:"visitFixedSizeList",value:function(t,e){return Ma.startFixedSizeList(e),Ma.addListSize(e,t.listSize),Ma.endFixedSizeList(e)}},{key:"visitMap",value:function(t,e){return Ua.startMap(e),Ua.addKeysSorted(e,t.keysSorted),Ua.endMap(e)}}]),n}(vn));function Ca(t){return new ou(t.count,function t(e){return(e||[]).reduce((function(e,n){return[].concat(dn(e),[new su(n.count,(r=n.VALIDITY,(r||[]).reduce((function(t,e){return t+ +(0===e)}),0)))],dn(t(n.children)));var r}),[])}(t.columns),function t(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=-1,i=(e||[]).length;++r1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof co)return new t(0,nn.V4,en.Schema,e);if(e instanceof ou)return new t(n,nn.V4,en.RecordBatch,e);if(e instanceof au)return new t(n,nn.V4,en.DictionaryBatch,e);throw new Error("Unrecognized Message header: ".concat(e))}}]),t}(),ou=function(){function t(e,n,r){F(this,t),this._nodes=n,this._buffers=r,this._length="number"===typeof e?e:e.low}return N(t,[{key:"nodes",get:function(){return this._nodes}},{key:"length",get:function(){return this._length}},{key:"buffers",get:function(){return this._buffers}}]),t}(),au=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];F(this,t),this._data=e,this._isDelta=r,this._id="number"===typeof n?n:n.low}return N(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"isDelta",get:function(){return this._isDelta}},{key:"length",get:function(){return this.data.length}},{key:"nodes",get:function(){return this.data.nodes}},{key:"buffers",get:function(){return this.data.buffers}}]),t}(),uu=N((function t(e,n){F(this,t),this.offset="number"===typeof e?e:e.low,this.length="number"===typeof n?n:n.low})),su=N((function t(e,n){F(this,t),this.length="number"===typeof e?e:e.low,this.nullCount="number"===typeof n?n:n.low}));function cu(t){for(var e,n=[],r=-1,i=-1,o=t.nodesLength();++r0?qa.createCustomMetadataVector(t,dn(e.metadata).map((function(e){var n=j(e,2),r=n[0],i=n[1],o=t.createString("".concat(r)),a=t.createString("".concat(i));return Xa.startKeyValue(t),Xa.addKey(t,o),Xa.addValue(t,a),Xa.endKeyValue(t)}))):-1;e.name&&(n=t.createString(e.name));qa.startField(t),qa.addType(t,r),qa.addTypeType(t,a),qa.addChildren(t,s),qa.addNullable(t,!!e.nullable),-1!==n&&qa.addName(t,n);-1!==i&&qa.addDictionary(t,i);-1!==c&&qa.addCustomMetadata(t,c);return qa.endField(t)},fo.decode=function(t,e){var n,r,i,o,a,u;e&&(u=t.dictionary())?e.has(n=u.id().low)?(o=(o=u.indexType())?pu(o):new Mn,a=new fr(e.get(n),o,n,u.isOrdered()),r=new fo(t.name(),a,t.nullable(),yu(t))):(o=(o=u.indexType())?pu(o):new Mn,e.set(n,i=du(t,hu(t,e))),a=new fr(i,o,n,u.isOrdered()),r=new fo(t.name(),a,t.nullable(),yu(t))):(i=du(t,hu(t,e)),r=new fo(t.name(),i,t.nullable(),yu(t)));return r||null},fo.fromJSON=function(t,e){var n,r,i,o,a,u;return e&&(o=t.dictionary)?e.has(n=o.id)?(r=(r=o.indexType)?Ga(r):new Mn,u=new fr(e.get(n),r,n,o.isOrdered),i=new fo(t.name,u,t.nullable,za(t.customMetadata))):(r=(r=o.indexType)?Ga(r):new Mn,e.set(n,a=Ya(t,Ra(t,e))),u=new fr(a,r,n,o.isOrdered),i=new fo(t.name,u,t.nullable,za(t.customMetadata))):(a=Ya(t,Ra(t,e)),i=new fo(t.name,a,t.nullable,za(t.customMetadata))),i||null},co.encode=function(t,e){var n=e.fields.map((function(e){return fo.encode(t,e)}));Ja.startFieldsVector(t,n.length);var r=Ja.createFieldsVector(t,n),i=e.metadata&&e.metadata.size>0?Ja.createCustomMetadataVector(t,dn(e.metadata).map((function(e){var n=j(e,2),r=n[0],i=n[1],o=t.createString("".concat(r)),a=t.createString("".concat(i));return Xa.startKeyValue(t),Xa.addKey(t,o),Xa.addValue(t,a),Xa.endKeyValue(t)}))):-1;Ja.startSchema(t),Ja.addFields(t,r),Ja.addEndianness(t,vu?eu.Little:eu.Big),-1!==i&&Ja.addCustomMetadata(t,i);return Ja.endSchema(t)},co.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map,n=lu(t,e);return new co(n,yu(t),e)},co.fromJSON=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return new co(Va(t,e),za(t.customMetadata),e)},ou.encode=function(t,e){var n=e.nodes||[],r=e.buffers||[];nu.startNodesVector(t,n.length),n.slice().reverse().forEach((function(e){return su.encode(t,e)}));var i=t.endVector();nu.startBuffersVector(t,r.length),r.slice().reverse().forEach((function(e){return uu.encode(t,e)}));var o=t.endVector();return nu.startRecordBatch(t),nu.addLength(t,new Wa(e.length,0)),nu.addNodes(t,i),nu.addBuffers(t,o),nu.endRecordBatch(t)},ou.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nn.V4;return new ou(t.length(),cu(t),fu(t,e))},ou.fromJSON=Ca,au.encode=function(t,e){var n=ou.encode(t,e.data);return ru.startDictionaryBatch(t),ru.addId(t,new Wa(e.id,0)),ru.addIsDelta(t,e.isDelta),ru.addData(t,n),ru.endDictionaryBatch(t)},au.decode=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nn.V4;return new au(ou.decode(t.data(),e),t.id(),t.isDelta())},au.fromJSON=function(t){return new au(Ca(t.data),t.id,t.isDelta)},su.encode=function(t,e){return tu.createFieldNode(t,new Wa(e.length,0),new Wa(e.nullCount,0))},su.decode=function(t){return new su(t.length(),t.nullCount())},uu.encode=function(t,e){return Za.createBuffer(t,new Wa(e.offset,0),new Wa(e.length,0))},uu.decode=function(t){return new uu(t.offset(),t.length())};var vu=function(){var t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]}();function bu(){bu=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}for(var gu=R.ByteBuffer,mu=function(t){return"Expected ".concat(en[t]," Message in stream, but was null or length 0.")},wu=function(t){return"Header pointer of flatbuffer-encoded ".concat(en[t]," Message is null or length 0.")},ku=function(t,e){return"Expected to read ".concat(t," metadata bytes, but only read ").concat(e,".")},_u=function(t,e){return"Expected to read ".concat(t," bytes for message body, but only read ").concat(e,".")},xu=function(t){function e(t){F(this,e),this.source=t instanceof ra?t:new ra(t)}return N(e,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(){var t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?ct:t}},{key:"throw",value:function(t){return this.source.throw(t)}},{key:"return",value:function(t){return this.source.return(t)}},{key:"readMessage",value:function(t){var e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(mu(t));return e.value}},{key:"readMessageBody",value:function(t){if(t<=0)return new Uint8Array(0);var e=Kt(this.source.read(t));if(e.byteLength0&&void 0!==arguments[0]&&arguments[0],e=en.Schema,n=this.readMessage(e),r=n&&n.header();if(t&&!r)throw new Error(wu(e));return r}},{key:"readMetadataLength",value:function(){var t=this.source.read(Su),e=t&&new gu(t),n=e&&e.readInt32(0)||0;return{done:0===n,value:n}}},{key:"readMetadata",value:function(t){var e=this.source.read(t);if(!e)return ct;if(e.byteLength0&&void 0!==o[0]&&o[0],n=en.Schema,t.next=4,this.readMessage(n);case 4:if(r=t.sent,i=r&&r.header(),!e||i){t.next=8;break}throw new Error(wu(n));case 8:return t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"readMetadataLength",value:function(){var t=B(bu().mark((function t(){var e,n,r;return bu().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.source.read(Su);case 2:return e=t.sent,n=e&&new gu(e),r=n&&n.readInt32(0)||0,t.abrupt("return",{done:0===r,value:r});case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"readMetadata",value:function(){var t=B(bu().mark((function t(e){var n;return bu().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.source.read(e);case 2:if(n=t.sent){t.next=5;break}return t.abrupt("return",ct);case 5:if(!(n.byteLength1&&void 0!==arguments[1]?arguments[1]:0,n=-1,r=Eu.length;++n2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");Bn.isNull(t.type)||Nu.call(this,i<=0?new Uint8Array(0):cn(e.offset,r,e.nullBitmap)),this.nodes.push(new su(r,i))}return Ve(nt(n.prototype),"visit",this).call(this,t)}},{key:"visitNull",value:function(t){return this}},{key:"visitDictionary",value:function(t){return this.visit(t.indices)}},{key:"nodes",get:function(){return this._nodes}},{key:"buffers",get:function(){return this._buffers}},{key:"byteLength",get:function(){return this._byteLength}},{key:"bufferRegions",get:function(){return this._bufferRegions}}],[{key:"assemble",value:function(){for(var t=new n,e=arguments.length,r=new Array(e),i=0;i=t.length?Nu.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?Nu.call(this,cn(t.offset,t.length,e)):Nu.call(this,fn(t))},Du.prototype.visitInt=ju,Du.prototype.visitFloat=ju,Du.prototype.visitUtf8=Mu,Du.prototype.visitBinary=Mu,Du.prototype.visitFixedSizeBinary=ju,Du.prototype.visitDate=ju,Du.prototype.visitTimestamp=ju,Du.prototype.visitTime=ju,Du.prototype.visitDecimal=ju,Du.prototype.visitList=Uu,Du.prototype.visitStruct=Pu,Du.prototype.visitUnion=function(t){var e=t.type,n=t.length,r=t.typeIds,i=t.valueOffsets;if(Nu.call(this,r),e.mode===Xe.Sparse)return Pu.call(this,t);if(e.mode===Xe.Dense){if(t.offset<=0)return Nu.call(this,i),Pu.call(this,t);for(var o,a,u=r.reduce((function(t,e){return Math.max(t,e)}),r[0]),s=new Int32Array(u+1),c=new Int32Array(u+1).fill(-1),f=new Int32Array(n),l=xe(-i[0],n,i),h=-1;++h=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Vu(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Ru(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ru(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Ru=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Ru(t)}var zu=function(t,e){et(r,t);var n=ut(r);function r(t){var e;return F(this,r),(e=n.call(this))._position=0,e._started=!1,e._sink=new na,e._schema=null,e._dictionaryBlocks=[],e._recordBatchBlocks=[],e._dictionaryDeltaOffsets=new Map,xt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),e._autoDestroy="boolean"!==typeof t.autoDestroy||t.autoDestroy,e._writeLegacyIpcFormat="boolean"===typeof t.writeLegacyIpcFormat&&t.writeLegacyIpcFormat,e}return N(r,[{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sink.toString(t)}},{key:"toUint8Array",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sink.toUint8Array(t)}},{key:"writeAll",value:function(t){var e=this;return Lt(t)?t.then((function(t){return e.writeAll(t)})):St(t)?Hu(this,t):Wu(this,t)}},{key:"closed",get:function(){return this._sink.closed}},{key:e,value:function(){return this._sink[Symbol.asyncIterator]()}},{key:"toDOMStream",value:function(t){return this._sink.toDOMStream(t)}},{key:"toNodeStream",value:function(t){return this._sink.toNodeStream(t)}},{key:"close",value:function(){return this.reset()._sink.close()}},{key:"abort",value:function(t){return this.reset()._sink.abort(t)}},{key:"finish",value:function(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}},{key:"reset",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._sink,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t===this._sink||t instanceof na?this._sink=t:(this._sink=new na,t&&Bt(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Dt(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,e&&e.compareTo(this._schema)||(null===e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}},{key:"write",value:function(t){var e=null;if(!this._sink)throw new Error("RecordBatchWriter is closed");if(null===t||void 0===t)return this.finish()&&void 0;if(t instanceof Wc&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Hc&&!(e=t.schema))return this.finish()&&void 0;if(e&&!e.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Hc?t instanceof $c||this._writeRecordBatch(t):t instanceof Wc?this.writeAll(t.chunks):It(t)&&this.writeAll(t)}},{key:"_writeMessage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=e-1,r=iu.encode(t),i=r.byteLength,o=this._writeLegacyIpcFormat?4:8,a=i+o+n&~n,u=a-i-o;return t.headerType===en.RecordBatch?this._recordBatchBlocks.push(new Qo(a,t.bodyLength,this._position)):t.headerType===en.DictionaryBatch&&this._dictionaryBlocks.push(new Qo(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),i>0&&this._write(r),this._writePadding(u)}},{key:"_write",value:function(t){if(this._started){var e=Kt(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}},{key:"_writeSchema",value:function(t){return this._writeMessage(iu.from(t))}},{key:"_writeFooter",value:function(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}},{key:"_writeMagic",value:function(){return this._write(Eu)}},{key:"_writePadding",value:function(t){return t>0?this._write(new Uint8Array(t)):this}},{key:"_writeRecordBatch",value:function(t){var e=Du.assemble(t),n=e.byteLength,r=e.nodes,i=e.bufferRegions,o=e.buffers,a=new ou(t.length,r,i),u=iu.from(a,n);return this._writeDictionaries(t)._writeMessage(u)._writeBodyBuffers(o)}},{key:"_writeDictionaryBatch",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));var r=Du.assemble(t),i=r.byteLength,o=r.nodes,a=r.bufferRegions,u=r.buffers,s=new ou(t.length,o,a),c=new au(s,e,n),f=iu.from(c,i);return this._writeMessage(f)._writeBodyBuffers(u)}},{key:"_writeBodyBuffers",value:function(t){for(var e,n,r,i=-1,o=t.length;++i0&&(this._write(e),(r=(n+7&-8)-n)>0&&this._writePadding(r));return this}},{key:"_writeDictionaries",value:function(t){var e,n=T(t.dictionaries);try{for(n.s();!(e=n.n()).done;){var r=j(e.value,2),i=r[0],o=r[1],a=this._dictionaryDeltaOffsets.get(i)||0;if(0===a||(o=o.slice(a)).length>0){var u,s=T("chunks"in o?o.chunks:[o]);try{for(s.s();!(u=s.n()).done;){var c=u.value;this._writeDictionaryBatch(c,i,a>0),a+=c.length}}catch(f){s.e(f)}finally{s.f()}}}}catch(f){n.e(f)}finally{n.f()}return this}}],[{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t,e){throw new Error('"throughDOM" not available in this environment')}}]),r}(lt,Symbol.asyncIterator),Gu=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,null,[{key:"writeAll",value:function(t,e){var r=new n(e);return Lt(t)?t.then((function(t){return r.writeAll(t)})):St(t)?Hu(r,t):Wu(r,t)}}]),n}(zu),Yu=function(t){et(n,t);var e=ut(n);function n(){var t;return F(this,n),(t=e.call(this))._autoDestroy=!0,t}return N(n,[{key:"_writeSchema",value:function(t){return this._writeMagic()._writePadding(2)}},{key:"_writeFooter",value:function(t){var e=Jo.encode(new Jo(t,nn.V4,this._recordBatchBlocks,this._dictionaryBlocks));return Ve(nt(n.prototype),"_writeFooter",this).call(this,t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}],[{key:"writeAll",value:function(t){var e=new n;return Lt(t)?t.then((function(t){return e.writeAll(t)})):St(t)?Hu(e,t):Wu(e,t)}}]),n}(zu);function Wu(t,e){var n=e;e instanceof Wc&&(n=e.chunks,t.reset(void 0,e.schema));var r,i=T(n);try{for(i.s();!(r=i.n()).done;){var o=r.value;t.write(o)}}catch(a){i.e(a)}finally{i.f()}return t.finish()}function Hu(t,e){return $u.apply(this,arguments)}function $u(){return($u=B(Cu().mark((function t(e,n){var r,i,o,a,u,s;return Cu().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=!1,i=!1,t.prev=2,a=Vu(n);case 4:return t.next=6,a.next();case 6:if(!(r=!(u=t.sent).done)){t.next=12;break}s=u.value,e.write(s);case 9:r=!1,t.next=4;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(2),i=!0,o=t.t0;case 18:if(t.prev=18,t.prev=19,!r||null==a.return){t.next=23;break}return t.next=23,a.return();case 23:if(t.prev=23,!i){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(18);case 28:return t.abrupt("return",e.finish());case 29:case"end":return t.stop()}}),t,null,[[2,14,18,28],[19,,23,27]])})))).apply(this,arguments)}var Ku=new Uint8Array(0),qu=function(t){return[Ku,Ku,new Uint8Array(t),Ku]};function Ju(t,e){for(var n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.reduce((function(t,e){return Math.max(t,e.length)}),0),o=-1,a=e.length,u=dn(t.fields),s=[],c=(i+63&-64)>>3;++o0;){for(u=Number.POSITIVE_INFINITY,s=-1;++s0&&(i[a++]=[u,f.slice()]))}return[t=new co(r,t.metadata),i.map((function(e){return Yr(Hc,[t].concat(dn(e)))}))]}(t,e.map((function(t){return t instanceof Ki?t.chunks.map((function(t){return t.data})):[t.data]})))}function Xu(t,e,n,r,i){for(var o,a,u=0,s=-1,c=r.length,f=(e+63&-64)>>3;++s=e?u===e?n[s]=o:(n[s]=o.slice(0,e),o=o.slice(e,u-e),i.numBatches=Math.max(i.numBatches,r[s].unshift(o))):((a=t[s]).nullable||(t[s]=a.clone({nullable:!0})),n[s]=o?o._changeLengthAndBackfillNullBitmap(e):hr.new(a.type,0,e,e,qu(f)));return n}function ts(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var es=function(t,e){et(r,t);var n=ut(r);function r(t,e){var i;return F(this,r),(i=n.call(this))._children=e,i.numChildren=t.childData.length,i._bindDataAccessors(i.data=t),i}return N(r,[{key:"type",get:function(){return this.data.type}},{key:"typeId",get:function(){return this.data.typeId}},{key:"length",get:function(){return this.data.length}},{key:"offset",get:function(){return this.data.offset}},{key:"stride",get:function(){return this.data.stride}},{key:"nullCount",get:function(){return this.data.nullCount}},{key:"byteLength",get:function(){return this.data.byteLength}},{key:"VectorName",get:function(){return"".concat(Ke[this.typeId],"Vector")}},{key:"ArrayType",get:function(){return this.type.ArrayType}},{key:"values",get:function(){return this.data.values}},{key:"typeIds",get:function(){return this.data.typeIds}},{key:"nullBitmap",get:function(){return this.data.nullBitmap}},{key:"valueOffsets",get:function(){return this.data.valueOffsets}},{key:e,get:function(){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}},{key:"clone",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._children;return $e.new(t,e)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0){var e=this.offset+t;return 0!==(this.nullBitmap[e>>3]&1<=this.numChildren?null:(this._children||(this._children=[]))[t]||(this._children[t]=$e.new(this.data.childData[t]))}},{key:"toJSON",value:function(){return dn(this)}},{key:"_sliceInternal",value:function(t,e,n){return t.clone(t.data.slice(e,n-e),null)}},{key:"_bindDataAccessors",value:function(t){}}]),r}($e,Symbol.toStringTag);es.prototype[Symbol.isConcatSpreadable]=!0;var ns=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"asUtf8",value:function(){return $e.new(this.data.clone(new $n))}}]),n}(es),rs=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,null,[{key:"from",value:function(t){return Rc((function(){return new Kn}),t)}}]),n}(es),is=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,null,[{key:"from",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n>>0)},nc=function(t){return new Date(t)},rc=function(t,e,n){var r=e[n],i=e[n+1];return null!=r&&null!=i?t.subarray(r,i):null},ic=function(t,e){return function(t,e){return nc(function(t,e){return 864e5*t[e]}(t,e))}(t.values,e)},oc=function(t,e){return function(t,e){return nc(ec(t,e))}(t.values,2*e)},ac=function(t,e){var n=t.stride;return t.values[n*e]},uc=function(t,e){var n=t.stride;return Pr(t.values[n*e])},sc=function(t,e){var n=t.stride,r=t.values,i=t.type;return ei.new(r.subarray(n*e,n*(e+1)),i.isSigned)},cc=function(t,e){var n=t.values;return 1e3*ec(n,2*e)},fc=function(t,e){var n=t.values;return ec(n,2*e)},lc=function(t,e){return function(t,e){return t[e+1]/1e3*4294967296+(t[e]>>>0)/1e3}(t.values,2*e)},hc=function(t,e){return function(t,e){return t[e+1]/1e6*4294967296+(t[e]>>>0)/1e6}(t.values,2*e)},yc=function(t,e){return t.values[t.stride*e]},pc=function(t,e){return t.values[t.stride*e]},dc=function(t,e){var n=t.values;return ei.signed(n.subarray(2*e,2*(e+1)))},vc=function(t,e){var n=t.values;return ei.signed(n.subarray(2*e,2*(e+1)))},bc=function(t,e){var n=t.typeIdToChildIndex[t.typeIds[e]],r=t.getChildAt(n);return r?r.get(t.valueOffsets[e]):null},gc=function(t,e){var n=t.typeIdToChildIndex[t.typeIds[e]],r=t.getChildAt(n);return r?r.get(e):null},mc=function(t,e){return t.values.subarray(2*e,2*(e+1))},wc=function(t,e){var n=t.values[e],r=new Int32Array(2);return r[0]=n/12|0,r[1]=n%12|0,r};tc.prototype.visitNull=function(t,e){return null},tc.prototype.visitBool=function(t,e){var n=t.offset+e;return 0!==(t.values[n>>3]&1<0?0:-1},_c.prototype.visitBool=xc,_c.prototype.visitInt=xc,_c.prototype.visitInt8=xc,_c.prototype.visitInt16=xc,_c.prototype.visitInt32=xc,_c.prototype.visitInt64=xc,_c.prototype.visitUint8=xc,_c.prototype.visitUint16=xc,_c.prototype.visitUint32=xc,_c.prototype.visitUint64=xc,_c.prototype.visitFloat=xc,_c.prototype.visitFloat16=xc,_c.prototype.visitFloat32=xc,_c.prototype.visitFloat64=xc,_c.prototype.visitUtf8=xc,_c.prototype.visitBinary=xc,_c.prototype.visitFixedSizeBinary=xc,_c.prototype.visitDate=xc,_c.prototype.visitDateDay=xc,_c.prototype.visitDateMillisecond=xc,_c.prototype.visitTimestamp=xc,_c.prototype.visitTimestampSecond=xc,_c.prototype.visitTimestampMillisecond=xc,_c.prototype.visitTimestampMicrosecond=xc,_c.prototype.visitTimestampNanosecond=xc,_c.prototype.visitTime=xc,_c.prototype.visitTimeSecond=xc,_c.prototype.visitTimeMillisecond=xc,_c.prototype.visitTimeMicrosecond=xc,_c.prototype.visitTimeNanosecond=xc,_c.prototype.visitDecimal=xc,_c.prototype.visitList=xc,_c.prototype.visitStruct=xc,_c.prototype.visitUnion=xc,_c.prototype.visitDenseUnion=Lc,_c.prototype.visitSparseUnion=Lc,_c.prototype.visitDictionary=xc,_c.prototype.visitInterval=xc,_c.prototype.visitIntervalDayTime=xc,_c.prototype.visitIntervalYearMonth=xc,_c.prototype.visitFixedSizeList=xc,_c.prototype.visitMap=xc;var Ic=new _c;function Sc(){Sc=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var Ec=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n)}(vn);function Oc(t){if(t.nullCount>0)return function(t){var e=kc.getVisitFn(t);return ln(t.nullBitmap,t.offset,t.length,t,(function(t,n,r,i){return 0!==(r&1<0)?t.values.subarray(0,r)[Symbol.iterator]():Sc().mark((function e(n){var i;return Sc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=-1;case 1:if(!(++i=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Cc(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Vc(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Vc(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Vc=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Vc(t)}function Rc(t,e){if(It(e))return $e.from({nullValues:[null,void 0],type:t(),values:e});if(St(e))return $e.from({nullValues:[null,void 0],type:t(),values:e});var n=Ce({},e),r=n.values,i=void 0===r?[]:r,o=n.type,a=void 0===o?t():o,u=n.nullValues,s=void 0===u?[null,void 0]:u;return It(i),$e.from(Ce(Ce({nullValues:s},e),{},{type:a}))}function zc(){zc=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Gc(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Yc(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Yc(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Yc=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Yc(t)}$e.new=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r0&&(this.get=(e=this.get,function(t){return this.isValid(t)?e.call(this,t):null}),this.set=function(t){return function(e,n){sn(this.nullBitmap,this.offset+e,!(null===n||void 0===n))&&t.call(this,e,n)}}(this.set));var e},Object.keys(Ke).map((function(t){return Ke[t]})).filter((function(t){return"number"===typeof t})).filter((function(t){return t!==Ke.NONE})).forEach((function(t){var e,n=Mc.visit(t);n.prototype.get=(e=kc.getVisitFn(t),function(t){return e(this,t)}),n.prototype.set=Xs(zo.getVisitFn(t)),n.prototype.indexOf=Xs(Ic.getVisitFn(t)),n.prototype.toArray=Qs(Fc.getVisitFn(t)),n.prototype.getByteWidth=function(t){return function(){return t(this.type)}}(jc.getVisitFn(t)),n.prototype[Symbol.iterator]=Qs(Tc.getVisitFn(t))}));var Wc=function(t){et(n,t);var e=ut(n);function n(){var t;F(this,n);for(var r=null,i=arguments.length,o=new Array(i),a=0;a0&&void 0!==arguments[0]?arguments[0]:this._chunks;return new n(this._schema,t)}},{key:"getColumn",value:function(t){return this.getColumnAt(this.getColumnIndex(t))}},{key:"getColumnAt",value:function(t){return this.getChildAt(t)}},{key:"getColumnIndex",value:function(t){return this._schema.fields.findIndex((function(e){return e.name===t}))}},{key:"getChildAt",value:function(t){if(t<0||t>=this.numChildren)return null;var e,n,r=this._schema.fields,i=this._children||(this._children=[]);if(n=i[t])return n;if(e=r[t]){var o=this._chunks.map((function(e){return e.getChildAt(t)})).filter((function(t){return null!=t}));if(o.length>0)return i[t]=new Qi(e,o)}return null}},{key:"serialize",value:function(){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=t?Gu:Yu;return e.writeAll(this).toUint8Array(!0)}},{key:"count",value:function(){return this._length}},{key:"select",value:function(){for(var t=this._schema.fields.reduce((function(t,e,n){return t.set(e.name,n)}),new Map),e=arguments.length,n=new Array(e),r=0;r-1}))))}},{key:"selectAt",value:function(){for(var t,e=arguments.length,r=new Array(e),i=0;i3&&void 0!==arguments[3]?arguments[3]:u[r];return void 0===o?e.getColumnAt(r):t.getColumnAt(o)}))),dn(a.map((function(e){return t.getColumnAt(e)})))).filter(Boolean);return Yr(n,dn(Qu(s,c)))}}],[{key:"empty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new co([]);return new n(t,[])}},{key:"from",value:function(t){if(!t)return n.empty();if("object"===typeof t){var e=It(t.values)?function(t){if(t.type instanceof rr)return Wc.fromStruct(Us.from(t));return null}(t):St(t.values)?function(t){if(t.type instanceof rr)return Us.from(t).then((function(t){return Wc.fromStruct(t)}));return null}(t):null;if(null!==e)return e}var r=Xc.from(t);return Lt(r)?B(zc().mark((function t(){return zc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=n,t.next=3,r;case 3:return t.t1=t.sent,t.next=6,t.t0.from.call(t.t0,t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))():r.isSync()&&(r=r.open())?r.schema?new n(r.schema,dn(r)):n.empty():function(){var t=B(zc().mark((function t(e){var r,i,o,a,u,s,c,f,l;return zc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:if(r=t.sent,i=r.schema,o=[],!i){t.next=35;break}a=!1,u=!1,t.prev=8,c=Gc(r);case 10:return t.next=12,c.next();case 12:if(!(a=!(f=t.sent).done)){t.next=18;break}l=f.value,o.push(l);case 15:a=!1,t.next=10;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(8),u=!0,s=t.t0;case 24:if(t.prev=24,t.prev=25,!a||null==c.return){t.next=29;break}return t.next=29,c.return();case 29:if(t.prev=29,!u){t.next=32;break}throw s;case 32:return t.finish(29);case 33:return t.finish(24);case 34:return t.abrupt("return",new n(i,o));case 35:return t.abrupt("return",n.empty());case 36:case"end":return t.stop()}}),t,null,[[8,20,24,34],[25,,29,33]])})));return function(e){return t.apply(this,arguments)}}()(r.open())}},{key:"fromAsync",value:function(){var t=B(zc().mark((function t(e){return zc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.from(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},{key:"fromStruct",value:function(t){return n.new(t.data.childData,t.type.children)}},{key:"new",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:this._children;return new n(this._schema,t,e)}},{key:"concat",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r-1}))))}},{key:"selectAt",value:function(){for(var t,e=this,r=arguments.length,i=new Array(r),o=0;o0&&this.dictionaries.set(e.id,n),this}}],[{key:"collect",value:function(t){return(new n).visit(t.data,new rr(t.schema.fields)).dictionaries}}]),n}(vn),qc=Jc().mark(hf);function Jc(){Jc=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Zc(t){var e,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new Qc(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Qc(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then((function(t){return{value:t,done:e}}))}return(Qc=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return void 0===n?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return void 0===n?Promise.reject(t):e(n.apply(this.s,arguments))}},new Qc(t)}var Xc=function(t,e,n){et(i,t);var r=ut(i);function i(t){var e;return F(this,i),(e=r.call(this))._impl=t,e}return N(i,[{key:"closed",get:function(){return this._impl.closed}},{key:"schema",get:function(){return this._impl.schema}},{key:"autoDestroy",get:function(){return this._impl.autoDestroy}},{key:"dictionaries",get:function(){return this._impl.dictionaries}},{key:"numDictionaries",get:function(){return this._impl.numDictionaries}},{key:"numRecordBatches",get:function(){return this._impl.numRecordBatches}},{key:"footer",get:function(){return this._impl.isFile()?this._impl.footer:null}},{key:"isSync",value:function(){return this._impl.isSync()}},{key:"isAsync",value:function(){return this._impl.isAsync()}},{key:"isFile",value:function(){return this._impl.isFile()}},{key:"isStream",value:function(){return this._impl.isStream()}},{key:"next",value:function(){return this._impl.next()}},{key:"throw",value:function(t){return this._impl.throw(t)}},{key:"return",value:function(t){return this._impl.return(t)}},{key:"cancel",value:function(){return this._impl.cancel()}},{key:"reset",value:function(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}},{key:"open",value:function(t){var e=this,n=this._impl.open(t);return Lt(n)?n.then((function(){return e})):this}},{key:"readRecordBatch",value:function(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}},{key:e,value:function(){return this._impl[Symbol.iterator]()}},{key:n,value:function(){return this._impl[Symbol.asyncIterator]()}},{key:"toDOMStream",value:function(){var t=this;return Ee.toDOMStream(this.isSync()?Ue({},Symbol.iterator,(function(){return t})):Ue({},Symbol.asyncIterator,(function(){return t})))}},{key:"toNodeStream",value:function(){var t=this;return Ee.toNodeStream(this.isSync()?Ue({},Symbol.iterator,(function(){return t})):Ue({},Symbol.asyncIterator,(function(){return t})),{objectMode:!0})}}],[{key:"throughNode",value:function(t){throw new Error('"throughNode" not available in this environment')}},{key:"throughDOM",value:function(t,e){throw new Error('"throughDOM" not available in this environment')}},{key:"from",value:function(t){return t instanceof i?t:Et(t)?function(t){return new tf(new ff(t))}(t):Tt(t)?function(t){return vf.apply(this,arguments)}(t):Lt(t)?B(Jc().mark((function e(){return Jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=i,e.next=3,t;case 3:return e.t1=e.sent,e.next=6,e.t0.from.call(e.t0,e.t1);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))():At(t)||Ft(t)||Nt(t)||St(t)?function(t){return df.apply(this,arguments)}(new ia(t)):function(t){var e=t.peek(Au+7&-8);return e&&e.byteLength>=4?Tu(e)?new nf(new sf(t.read())):new tf(new af(t)):new tf(new af(Jc().mark((function t(){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))()))}(new ra(t))}},{key:"readAll",value:function(t){return t instanceof i?t.isSync()?hf(t):yf(t):Et(t)||ArrayBuffer.isView(t)||It(t)||Ot(t)?hf(t):yf(t)}}]),i}(lt,Symbol.iterator,Symbol.asyncIterator),tf=function(t,e,n){et(i,t);var r=ut(i);function i(t){var e;return F(this,i),(e=r.call(this,t))._impl=t,e}return N(i,[{key:e,value:function(){return this._impl[Symbol.iterator]()}},{key:n,value:function(){var t=this;return C(Jc().mark((function e(){return Jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.delegateYield(V(Zc(t[Symbol.iterator]()),U),"t0",1);case 1:case"end":return e.stop()}}),e)})))()}}]),i}(Xc,Symbol.iterator,Symbol.asyncIterator),ef=function(t,e,n){et(i,t);var r=ut(i);function i(t){var e;return F(this,i),(e=r.call(this,t))._impl=t,e}return N(i,[{key:e,value:function(){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}},{key:n,value:function(){return this._impl[Symbol.asyncIterator]()}}]),i}(Xc,Symbol.iterator,Symbol.asyncIterator),nf=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._impl=t,r}return N(n)}(tf),rf=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this,t))._impl=t,r}return N(n)}(ef),of=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;F(this,t),this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}return N(t,[{key:"numDictionaries",get:function(){return this._dictionaryIndex}},{key:"numRecordBatches",get:function(){return this._recordBatchIndex}},{key:"isSync",value:function(){return!1}},{key:"isAsync",value:function(){return!1}},{key:"isFile",value:function(){return!1}},{key:"isStream",value:function(){return!1}},{key:"reset",value:function(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}},{key:"_loadRecordBatch",value:function(t,e){return new Hc(this.schema,t.length,this._loadVectors(t,e,this.schema.fields))}},{key:"_loadDictionaryBatch",value:function(t,e){var n=t.id,r=t.isDelta,i=t.data,o=this.dictionaries,a=this.schema,u=o.get(n);if(r||!u){var s=a.dictionaries.get(n);return u&&r?u.concat($e.new(this._loadVectors(i,e,[s])[0])):$e.new(this._loadVectors(i,e,[s])[0])}return u}},{key:"_loadVectors",value:function(t,e,n){return new va(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}]),t}(),af=function(t,e){et(r,t);var n=ut(r);function r(t,e){var i;return F(this,r),(i=n.call(this,e))._reader=Et(t)?new Iu(i._handle=t):new xu(i._handle=t),i}return N(r,[{key:"isSync",value:function(){return!0}},{key:"isStream",value:function(){return!0}},{key:e,value:function(){return this}},{key:"cancel",value:function(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}},{key:"open",value:function(t){return this.closed||(this.autoDestroy=lf(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}},{key:"throw",value:function(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):ct}},{key:"return",value:function(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ct}},{key:"next",value:function(){if(this.closed)return ct;for(var t,e=this._reader;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;var n=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;var i=t.header(),o=e.readMessageBody(t.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new $c(this.schema)}):this.return()}},{key:"_readNextMessageAndValidate",value:function(t){return this._reader.readMessage(t)}}]),r}(of,Symbol.iterator),uf=function(t,e){et(r,t);var n=ut(r);function r(t,e){var i;return F(this,r),(i=n.call(this,e))._reader=new Lu(i._handle=t),i}return N(r,[{key:"isAsync",value:function(){return!0}},{key:"isStream",value:function(){return!0}},{key:e,value:function(){return this}},{key:"cancel",value:function(){var t=B(Jc().mark((function t(){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!(this.closed=!0)){t.next=5;break}return t.next=3,this.reset()._reader.return();case 3:this._reader=null,this.dictionaries=null;case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"open",value:function(){var t=B(Jc().mark((function t(e){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed){t.next=10;break}if(this.autoDestroy=lf(this,e),t.t0=this.schema,t.t0){t.next=7;break}return t.next=6,this._reader.readSchema();case 6:t.t0=this.schema=t.sent;case 7:if(t.t0){t.next=10;break}return t.next=10,this.cancel();case 10:return t.abrupt("return",this);case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"throw",value:function(){var t=B(Jc().mark((function t(e){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!this.autoDestroy||!(this.closed=!0)){t.next=4;break}return t.next=3,this.reset()._reader.throw(e);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",ct);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"return",value:function(){var t=B(Jc().mark((function t(e){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.closed||!this.autoDestroy||!(this.closed=!0)){t.next=4;break}return t.next=3,this.reset()._reader.return(e);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",ct);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"next",value:function(){var t=B(Jc().mark((function t(){var e,n,r,i,o,a,u,s;return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.closed){t.next=2;break}return t.abrupt("return",ct);case 2:n=this._reader;case 3:return t.next=5,this._readNextMessageAndValidate();case 5:if(!(e=t.sent)){t.next=31;break}if(!e.isSchema()){t.next=11;break}return t.next=9,this.reset(e.header());case 9:t.next=29;break;case 11:if(!e.isRecordBatch()){t.next=21;break}return this._recordBatchIndex++,r=e.header(),t.next=16,n.readMessageBody(e.bodyLength);case 16:return i=t.sent,o=this._loadRecordBatch(r,i),t.abrupt("return",{done:!1,value:o});case 21:if(!e.isDictionaryBatch()){t.next=29;break}return this._dictionaryIndex++,a=e.header(),t.next=26,n.readMessageBody(e.bodyLength);case 26:u=t.sent,s=this._loadDictionaryBatch(a,u),this.dictionaries.set(a.id,s);case 29:t.next=3;break;case 31:if(!this.schema||0!==this._recordBatchIndex){t.next=34;break}return this._recordBatchIndex++,t.abrupt("return",{done:!1,value:new $c(this.schema)});case 34:return t.next=36,this.return();case 36:return t.abrupt("return",t.sent);case 37:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_readNextMessageAndValidate",value:function(){var t=B(Jc().mark((function t(e){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._reader.readMessage(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()}]),r}(of,Symbol.asyncIterator),sf=function(t){et(n,t);var e=ut(n);function n(t,r){return F(this,n),e.call(this,t instanceof sa?t:new sa(t),r)}return N(n,[{key:"footer",get:function(){return this._footer}},{key:"numDictionaries",get:function(){return this._footer?this._footer.numDictionaries:0}},{key:"numRecordBatches",get:function(){return this._footer?this._footer.numRecordBatches:0}},{key:"isSync",value:function(){return!0}},{key:"isFile",value:function(){return!0}},{key:"open",value:function(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;var e,r=T(this._footer.dictionaryBatches());try{for(r.s();!(e=r.n()).done;){e.value&&this._readDictionaryBatch(this._dictionaryIndex++)}}catch(i){r.e(i)}finally{r.f()}}return Ve(nt(n.prototype),"open",this).call(this,t)}},{key:"readRecordBatch",value:function(t){if(this.closed)return null;this._footer||this.open();var e=this._footer&&this._footer.getRecordBatch(t);if(e&&this._handle.seek(e.offset)){var n=this._reader.readMessage(en.RecordBatch);if(n&&n.isRecordBatch()){var r=n.header(),i=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(r,i)}}return null}},{key:"_readDictionaryBatch",value:function(t){var e=this._footer&&this._footer.getDictionaryBatch(t);if(e&&this._handle.seek(e.offset)){var n=this._reader.readMessage(en.DictionaryBatch);if(n&&n.isDictionaryBatch()){var r=n.header(),i=this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}}}},{key:"_readFooter",value:function(){var t=this._handle,e=t.size-Bu,n=t.readInt32(e),r=t.readAt(e-n,n);return Jo.decode(r)}},{key:"_readNextMessageAndValidate",value:function(t){if(this._footer||this.open(),this._footer&&this._recordBatchIndex1?r-1:0),o=1;o=4)){t.next=18;break}if(Tu(n)){t.next=8;break}t.t1=new ef(new uf(e)),t.next=15;break;case 8:return t.t2=nf,t.t3=sf,t.next=12,e.read();case 12:t.t4=t.sent,t.t5=new t.t3(t.t4),t.t1=new t.t2(t.t5);case 15:t.t0=t.t1,t.next=19;break;case 18:t.t0=new ef(new uf(C(Jc().mark((function t(){return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})))()));case 19:return t.abrupt("return",t.t0);case 20:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function vf(){return(vf=B(Jc().mark((function t(e){var n,r,i;return Jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.stat();case 2:if(n=t.sent,r=n.size,i=new ca(e,r),!(r>=Fu)){t.next=12;break}return t.t0=Tu,t.next=9,i.readAt(0,Au+7&-8);case 9:if(t.t1=t.sent,!(0,t.t0)(t.t1)){t.next=12;break}return t.abrupt("return",new rf(new cf(i)));case 12:return t.abrupt("return",new ef(new uf(i)));case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function bf(){bf=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var gf=["readableStrategy","writableStrategy","queueingStrategy"];var mf=function(){function t(e){var n,r,i=this;F(this,t),this._numChunks=0,this._finished=!1,this._bufferedSize=0;var o=e.readableStrategy,a=e.writableStrategy,u=e.queueingStrategy,s=void 0===u?"count":u,c=ts(e,gf);this._controller=null,this._builder=Ir.new(c),this._getSize="bytes"!==s?wf:kf;var f=Ce({},o).highWaterMark,l=void 0===f?"bytes"===s?Math.pow(2,14):1e3:f,h=Ce({},a).highWaterMark,y=void 0===h?"bytes"===s?Math.pow(2,14):1e3:h;this.readable=new ReadableStream((Ue(n={},"cancel",(function(){i._builder.clear()})),Ue(n,"pull",(function(t){i._maybeFlush(i._builder,i._controller=t)})),Ue(n,"start",(function(t){i._maybeFlush(i._builder,i._controller=t)})),n),{highWaterMark:l,size:"bytes"!==s?wf:kf}),this.writable=new WritableStream((Ue(r={},"abort",(function(){i._builder.clear()})),Ue(r,"write",(function(){i._maybeFlush(i._builder,i._controller)})),Ue(r,"close",(function(){i._maybeFlush(i._builder.finish(),i._controller)})),r),{highWaterMark:y,size:function(t){return i._writeValueAndReturnChunkSize(t)}})}return N(t,[{key:"_writeValueAndReturnChunkSize",value:function(t){var e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}},{key:"_maybeFlush",value:function(t,e){null!==e&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||0===this._numChunks)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}},{key:"_enqueue",value:function(t,e){this._bufferedSize=0,this._controller=null,null===e?t.close():t.enqueue(e)}}]),t}(),wf=function(t){return t.length},kf=function(t){return t.byteLength};function _f(){_f=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function xf(){xf=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}var Lf=function(){function t(){F(this,t)}return N(t,[{key:"eq",value:function(e){return e instanceof t||(e=new If(e)),new Ff(this,e)}},{key:"le",value:function(e){return e instanceof t||(e=new If(e)),new Df(this,e)}},{key:"ge",value:function(e){return e instanceof t||(e=new If(e)),new Nf(this,e)}},{key:"lt",value:function(t){return new jf(this.ge(t))}},{key:"gt",value:function(t){return new jf(this.le(t))}},{key:"ne",value:function(t){return new jf(this.eq(t))}}]),t}(),If=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).v=t,r}return N(n)}(Lf),Sf=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).name=t,r}return N(n,[{key:"bind",value:function(t){if(!this.colidx){this.colidx=-1;for(var e=t.schema.fields,n=-1;++n=n.v;return function(){return r}}},{key:"_bindColCol",value:function(t,e,n){var r=e.bind(t),i=n.bind(t);return function(t,e){return r(t,e)>=i(t,e)}}},{key:"_bindColLit",value:function(t,e,n){var r=e.bind(t);return function(t,e){return r(t,e)>=n.v}}},{key:"_bindLitCol",value:function(t,e,n){var r=n.bind(t);return function(t,n){return e.v>=r(t,n)}}}]),n}(Of),jf=function(t){et(n,t);var e=ut(n);function n(t){var r;return F(this,n),(r=e.call(this)).child=t,r}return N(n,[{key:"bind",value:function(t){var e=this.child.bind(t);return function(t,n){return!e(t,n)}}}]),n}(Ef);function Mf(){Mf=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(S){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=w(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=s;var f={};function l(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(L([])));v&&v!==e&&n.call(v,i)&&(p=v);var b=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}Wc.prototype.countBy=function(t){return new Uf(this.chunks).countBy(t)},Wc.prototype.scan=function(t,e){return new Uf(this.chunks).scan(t,e)},Wc.prototype.scanReverse=function(t,e){return new Uf(this.chunks).scanReverse(t,e)},Wc.prototype.filter=function(t){return new Uf(this.chunks).filter(t)};var Uf=function(t){et(n,t);var e=ut(n);function n(){return F(this,n),e.apply(this,arguments)}return N(n,[{key:"filter",value:function(t){return new Cf(this.chunks,t)}},{key:"scan",value:function(t,e){for(var n=this.chunks,r=n.length,i=-1;++i=0;){var i=n[r];e&&e(i);for(var o=i.length;--o>=0;)t(o,i)}}},{key:"countBy",value:function(t){var e=this.chunks,n=e.length,r="string"===typeof t?new Sf(t):t;r.bind(e[n-1]);var i=r.vector;if(!Bn.isDictionary(i.type))throw new Error("countBy currently only supports dictionary-encoded columns");for(var o=Math.ceil(Math.log(i.length)/Math.log(256)),a=new(4==o?Uint32Array:o>=2?Uint16Array:Uint8Array)(i.dictionary.length),u=-1;++u=0;)for(var i=n[r],o=this._predicate.bind(i),a=!1,u=i.length;--u>=0;)o(u,i)&&(e&&!a&&(e(i),a=!0),t(u,i))}},{key:"count",value:function(){for(var t=0,e=this._chunks,n=e.length,r=-1;++r=2?Uint16Array:Uint8Array)(i.dictionary.length),u=-1;++u=i.headerRows&&e=i.headerColumns;if(n){var a=["blank"];return e>0&&a.push("level"+t),{type:"blank",classNames:a.join(" "),content:""}}if(o)return{type:"columns",classNames:(a=["col_heading","level"+t,"col"+(s=e-i.headerColumns)]).join(" "),content:i.getContent(i.columnsTable,s,t)};if(r){a=["row_heading","level"+e,"row"+(u=t-i.headerRows)];return{type:"index",id:"T_"+i.uuid+"level"+e+"_row"+u,classNames:a.join(" "),content:i.getContent(i.indexTable,u,e)}}a=["data","row"+(u=t-i.headerRows),"col"+(s=e-i.headerColumns)];var u,s,c=i.styler?i.getContent(i.styler.displayValuesTable,u,s):i.getContent(i.dataTable,u,s);return{type:"data",id:"T_"+i.uuid+"row"+u+"_col"+s,classNames:a.join(" "),content:c}},this.getContent=function(t,e,n){var r=t.getColumnAt(n);if(null===r)return"";switch(i.getColumnTypeId(t,n)){case Ke.Timestamp:return i.nanosToDate(r.get(e));default:return r.get(e)}},this.dataTable=Wc.from(t),this.indexTable=Wc.from(e),this.columnsTable=Wc.from(n),this.styler=r?{caption:r.caption,displayValuesTable:Wc.from(r.displayValues),styles:r.styles,uuid:r.uuid}:void 0}return Object.defineProperty(t.prototype,"rows",{get:function(){return this.indexTable.length+this.columnsTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataRows",{get:function(){return this.dataTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"table",{get:function(){return this.dataTable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this.indexTable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){return{data:this.dataTable.serialize(),index:this.indexTable.serialize(),columns:this.columnsTable.serialize()}},t.prototype.getColumnTypeId=function(t,e){return t.schema.fields[e].type.typeId},t.prototype.nanosToDate=function(t){return new Date(t/1e6)},t}(),zf=function(){return(zf=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?t.argsDataframeToObject(e.dfs):{};n=zf(zf({},n),r);var i=Boolean(e.disabled),o=e.theme;o&&Yf(o);var a={disabled:i,args:n,theme:o},u=new CustomEvent(t.RENDER_EVENT,{detail:a});t.events.dispatchEvent(u)},t.argsDataframeToObject=function(e){var n=e.map((function(e){var n=e.key,r=e.value;return[n,t.toArrowTable(r)]}));return Object.fromEntries(n)},t.toArrowTable=function(t){var e=t.data,n=e.data,r=e.index,i=e.columns,o=e.styler;return new Rf(n,r,i,o)},t.sendBackMsg=function(t,e){window.parent.postMessage(zf({isStreamlitMessage:!0,type:t},e),"*")},t}(),Yf=function(t){var e=document.createElement("style");document.head.appendChild(e),e.innerHTML="\n :root {\n --primary-color: "+t.primaryColor+";\n --background-color: "+t.backgroundColor+";\n --secondary-background-color: "+t.secondaryBackgroundColor+";\n --text-color: "+t.textColor+";\n --font: "+t.font+";\n }\n\n body {\n background-color: var(--background-color);\n color: var(--text-color);\n }\n "};var Wf=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}Wf(e,t),e.prototype.componentDidMount=function(){Gf.setFrameHeight()},e.prototype.componentDidUpdate=function(){Gf.setFrameHeight()}}(f.a.PureComponent)},function(t,e,n){"use strict";var r=n(5),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function s(t){return r.isMemo(t)?a:u[t.$$typeof]||i}u[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[r.Memo]=a;var c=Object.defineProperty,f=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,y=Object.getPrototypeOf,p=Object.prototype;t.exports=function t(e,n,r){if("string"!==typeof n){if(p){var i=y(n);i&&i!==p&&t(e,i,r)}var a=f(n);l&&(a=a.concat(l(n)));for(var u=s(e),d=s(n),v=0;vA.length&&A.push(t)}function D(t,e,n){return null==t?0:function t(e,n,r,i){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var s=!1;if(null===e)s=!0;else switch(u){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case o:case a:s=!0}}if(s)return r(i,e,""===n?"."+N(e,0):n),1;if(s=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nexport default function _createForOfIteratorHelper(o) {\n if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) {\n if (Array.isArray(o) || (o = unsupportedIterableToArray(o))) {\n var i = 0;\n\n var F = function F() {};\n\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var it,\n normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = o[Symbol.iterator]();\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","export default function _AwaitValue(value) {\n this.wrapped = value;\n}","import AwaitValue from \"./AwaitValue\";\nexport default function _awaitAsyncGenerator(value) {\n return new AwaitValue(value);\n}","import AwaitValue from \"./AwaitValue\";\nexport default function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg);\n var value = result.value;\n var wrappedAwait = value instanceof AwaitValue;\n Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {\n if (wrappedAwait) {\n resume(key === \"return\" ? \"return\" : \"next\", arg);\n return;\n }\n\n settle(result.done ? \"return\" : \"normal\", arg);\n }, function (err) {\n resume(\"throw\", err);\n });\n } catch (err) {\n settle(\"throw\", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case \"return\":\n front.resolve({\n value: value,\n done: true\n });\n break;\n\n case \"throw\":\n front.reject(value);\n break;\n\n default:\n front.resolve({\n value: value,\n done: false\n });\n break;\n }\n\n front = front.next;\n\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n if (typeof gen[\"return\"] !== \"function\") {\n this[\"return\"] = undefined;\n }\n}\n\nif (typeof Symbol === \"function\" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () {\n return this;\n };\n}\n\nAsyncGenerator.prototype.next = function (arg) {\n return this._invoke(\"next\", arg);\n};\n\nAsyncGenerator.prototype[\"throw\"] = function (arg) {\n return this._invoke(\"throw\", arg);\n};\n\nAsyncGenerator.prototype[\"return\"] = function (arg) {\n return this._invoke(\"return\", arg);\n};","import AsyncGenerator from \"./AsyncGenerator\";\nexport default function _wrapAsyncGenerator(fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n}","export default function _asyncGeneratorDelegate(inner, awaitWrap) {\n var iter = {},\n waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) {\n resolve(inner[key](value));\n });\n return {\n done: false,\n value: awaitWrap(value)\n };\n }\n\n ;\n\n if (typeof Symbol === \"function\" && Symbol.iterator) {\n iter[Symbol.iterator] = function () {\n return this;\n };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n\n return pump(\"next\", value);\n };\n\n if (typeof inner[\"throw\"] === \"function\") {\n iter[\"throw\"] = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n\n return pump(\"throw\", value);\n };\n }\n\n if (typeof inner[\"return\"] === \"function\") {\n iter[\"return\"] = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n\n return pump(\"return\", value);\n };\n }\n\n return iter;\n}","/// @file\n/// @addtogroup flatbuffers_javascript_api\n/// @{\n/// @cond FLATBUFFERS_INTERNAL\n\n/**\n * @fileoverview\n *\n * Need to suppress 'global this' error so the Node.js export line doesn't cause\n * closure compile to error out.\n * @suppress {globalThis}\n */\n\n/**\n * @const\n * @namespace\n */\nvar flatbuffers = {};\n\n/**\n * @typedef {number}\n */\nflatbuffers.Offset;\n\n/**\n * @typedef {{\n * bb: flatbuffers.ByteBuffer,\n * bb_pos: number\n * }}\n */\nflatbuffers.Table;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.SIZEOF_SHORT = 2;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.SIZEOF_INT = 4;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.FILE_IDENTIFIER_LENGTH = 4;\n\n/**\n * @enum {number}\n */\nflatbuffers.Encoding = {\n UTF8_BYTES: 1,\n UTF16_STRING: 2\n};\n\n/**\n * @type {Int32Array}\n * @const\n */\nflatbuffers.int32 = new Int32Array(2);\n\n/**\n * @type {Float32Array}\n * @const\n */\nflatbuffers.float32 = new Float32Array(flatbuffers.int32.buffer);\n\n/**\n * @type {Float64Array}\n * @const\n */\nflatbuffers.float64 = new Float64Array(flatbuffers.int32.buffer);\n\n/**\n * @type {boolean}\n * @const\n */\nflatbuffers.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * @constructor\n * @param {number} low\n * @param {number} high\n */\nflatbuffers.Long = function(low, high) {\n /**\n * @type {number}\n * @const\n */\n this.low = low | 0;\n\n /**\n * @type {number}\n * @const\n */\n this.high = high | 0;\n};\n\n/**\n * @param {number} low\n * @param {number} high\n * @returns {flatbuffers.Long}\n */\nflatbuffers.Long.create = function(low, high) {\n // Special-case zero to avoid GC overhead for default values\n return low == 0 && high == 0 ? flatbuffers.Long.ZERO : new flatbuffers.Long(low, high);\n};\n\n/**\n * @returns {number}\n */\nflatbuffers.Long.prototype.toFloat64 = function() {\n return (this.low >>> 0) + this.high * 0x100000000;\n};\n\n/**\n * @param {flatbuffers.Long} other\n * @returns {boolean}\n */\nflatbuffers.Long.prototype.equals = function(other) {\n return this.low == other.low && this.high == other.high;\n};\n\n/**\n * @type {flatbuffers.Long}\n * @const\n */\nflatbuffers.Long.ZERO = new flatbuffers.Long(0, 0);\n\n/// @endcond\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a FlatBufferBuilder.\n *\n * @constructor\n * @param {number=} opt_initial_size\n */\nflatbuffers.Builder = function(opt_initial_size) {\n if (!opt_initial_size) {\n var initial_size = 1024;\n } else {\n var initial_size = opt_initial_size;\n }\n\n /**\n * @type {flatbuffers.ByteBuffer}\n * @private\n */\n this.bb = flatbuffers.ByteBuffer.allocate(initial_size);\n\n /**\n * Remaining space in the ByteBuffer.\n *\n * @type {number}\n * @private\n */\n this.space = initial_size;\n\n /**\n * Minimum alignment encountered so far.\n *\n * @type {number}\n * @private\n */\n this.minalign = 1;\n\n /**\n * The vtable for the current table.\n *\n * @type {Array.}\n * @private\n */\n this.vtable = null;\n\n /**\n * The amount of fields we're actually using.\n *\n * @type {number}\n * @private\n */\n this.vtable_in_use = 0;\n\n /**\n * Whether we are currently serializing a table.\n *\n * @type {boolean}\n * @private\n */\n this.isNested = false;\n\n /**\n * Starting offset of the current struct/table.\n *\n * @type {number}\n * @private\n */\n this.object_start = 0;\n\n /**\n * List of offsets of all vtables.\n *\n * @type {Array.}\n * @private\n */\n this.vtables = [];\n\n /**\n * For the current vector being built.\n *\n * @type {number}\n * @private\n */\n this.vector_num_elems = 0;\n\n /**\n * False omits default values from the serialized data\n *\n * @type {boolean}\n * @private\n */\n this.force_defaults = false;\n};\n\nflatbuffers.Builder.prototype.clear = function() {\n this.bb.clear();\n this.space = this.bb.capacity();\n this.minalign = 1;\n this.vtable = null;\n this.vtable_in_use = 0;\n this.isNested = false;\n this.object_start = 0;\n this.vtables = [];\n this.vector_num_elems = 0;\n this.force_defaults = false;\n};\n\n/**\n * In order to save space, fields that are set to their default value\n * don't get serialized into the buffer. Forcing defaults provides a\n * way to manually disable this optimization.\n *\n * @param {boolean} forceDefaults true always serializes default values\n */\nflatbuffers.Builder.prototype.forceDefaults = function(forceDefaults) {\n this.force_defaults = forceDefaults;\n};\n\n/**\n * Get the ByteBuffer representing the FlatBuffer. Only call this after you've\n * called finish(). The actual data starts at the ByteBuffer's current position,\n * not necessarily at 0.\n *\n * @returns {flatbuffers.ByteBuffer}\n */\nflatbuffers.Builder.prototype.dataBuffer = function() {\n return this.bb;\n};\n\n/**\n * Get the bytes representing the FlatBuffer. Only call this after you've\n * called finish().\n *\n * @returns {Uint8Array}\n */\nflatbuffers.Builder.prototype.asUint8Array = function() {\n return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Prepare to write an element of `size` after `additional_bytes` have been\n * written, e.g. if you write a string, you need to align such the int length\n * field is aligned to 4 bytes, and the string data follows it directly. If all\n * you need to do is alignment, `additional_bytes` will be 0.\n *\n * @param {number} size This is the of the new element to write\n * @param {number} additional_bytes The padding size\n */\nflatbuffers.Builder.prototype.prep = function(size, additional_bytes) {\n // Track the biggest thing we've ever aligned to.\n if (size > this.minalign) {\n this.minalign = size;\n }\n\n // Find the amount of alignment needed such that `size` is properly\n // aligned after `additional_bytes`\n var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);\n\n // Reallocate the buffer if needed.\n while (this.space < align_size + size + additional_bytes) {\n var old_buf_size = this.bb.capacity();\n this.bb = flatbuffers.Builder.growByteBuffer(this.bb);\n this.space += this.bb.capacity() - old_buf_size;\n }\n\n this.pad(align_size);\n};\n\n/**\n * @param {number} byte_size\n */\nflatbuffers.Builder.prototype.pad = function(byte_size) {\n for (var i = 0; i < byte_size; i++) {\n this.bb.writeInt8(--this.space, 0);\n }\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt8 = function(value) {\n this.bb.writeInt8(this.space -= 1, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt16 = function(value) {\n this.bb.writeInt16(this.space -= 2, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt32 = function(value) {\n this.bb.writeInt32(this.space -= 4, value);\n};\n\n/**\n * @param {flatbuffers.Long} value\n */\nflatbuffers.Builder.prototype.writeInt64 = function(value) {\n this.bb.writeInt64(this.space -= 8, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeFloat32 = function(value) {\n this.bb.writeFloat32(this.space -= 4, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeFloat64 = function(value) {\n this.bb.writeFloat64(this.space -= 8, value);\n};\n/// @endcond\n\n/**\n * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int8` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt8 = function(value) {\n this.prep(1, 0);\n this.writeInt8(value);\n};\n\n/**\n * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int16` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt16 = function(value) {\n this.prep(2, 0);\n this.writeInt16(value);\n};\n\n/**\n * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int32` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt32 = function(value) {\n this.prep(4, 0);\n this.writeInt32(value);\n};\n\n/**\n * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {flatbuffers.Long} value The `int64` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt64 = function(value) {\n this.prep(8, 0);\n this.writeInt64(value);\n};\n\n/**\n * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `float32` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addFloat32 = function(value) {\n this.prep(4, 0);\n this.writeFloat32(value);\n};\n\n/**\n * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `float64` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addFloat64 = function(value) {\n this.prep(8, 0);\n this.writeFloat64(value);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt8 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt8(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt16 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt16(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt32 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt32(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {flatbuffers.Long} value\n * @param {flatbuffers.Long} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt64 = function(voffset, value, defaultValue) {\n if (this.force_defaults || !value.equals(defaultValue)) {\n this.addInt64(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldFloat32 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat32(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldFloat64 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat64(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {flatbuffers.Offset} value\n * @param {flatbuffers.Offset} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldOffset = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addOffset(value);\n this.slot(voffset);\n }\n};\n\n/**\n * Structs are stored inline, so nothing additional is being added. `d` is always 0.\n *\n * @param {number} voffset\n * @param {flatbuffers.Offset} value\n * @param {flatbuffers.Offset} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldStruct = function(voffset, value, defaultValue) {\n if (value != defaultValue) {\n this.nested(value);\n this.slot(voffset);\n }\n};\n\n/**\n * Structures are always stored inline, they need to be created right\n * where they're used. You'll get this assertion failure if you\n * created it elsewhere.\n *\n * @param {flatbuffers.Offset} obj The offset of the created object\n */\nflatbuffers.Builder.prototype.nested = function(obj) {\n if (obj != this.offset()) {\n throw new Error('FlatBuffers: struct must be serialized inline.');\n }\n};\n\n/**\n * Should not be creating any other object, string or vector\n * while an object is being constructed\n */\nflatbuffers.Builder.prototype.notNested = function() {\n if (this.isNested) {\n throw new Error('FlatBuffers: object serialization must not be nested.');\n }\n};\n\n/**\n * Set the current vtable at `voffset` to the current location in the buffer.\n *\n * @param {number} voffset\n */\nflatbuffers.Builder.prototype.slot = function(voffset) {\n this.vtable[voffset] = this.offset();\n};\n\n/**\n * @returns {flatbuffers.Offset} Offset relative to the end of the buffer.\n */\nflatbuffers.Builder.prototype.offset = function() {\n return this.bb.capacity() - this.space;\n};\n\n/**\n * Doubles the size of the backing ByteBuffer and copies the old data towards\n * the end of the new buffer (since we build the buffer backwards).\n *\n * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data\n * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied\n * to it. The data is located at the end of the buffer.\n *\n * uint8Array.set() formally takes {Array|ArrayBufferView}, so to pass\n * it a uint8Array we need to suppress the type check:\n * @suppress {checkTypes}\n */\nflatbuffers.Builder.growByteBuffer = function(bb) {\n var old_buf_size = bb.capacity();\n\n // Ensure we don't grow beyond what fits in an int.\n if (old_buf_size & 0xC0000000) {\n throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');\n }\n\n var new_buf_size = old_buf_size << 1;\n var nbb = flatbuffers.ByteBuffer.allocate(new_buf_size);\n nbb.setPosition(new_buf_size - old_buf_size);\n nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);\n return nbb;\n};\n/// @endcond\n\n/**\n * Adds on offset, relative to where it will be written.\n *\n * @param {flatbuffers.Offset} offset The offset to add.\n */\nflatbuffers.Builder.prototype.addOffset = function(offset) {\n this.prep(flatbuffers.SIZEOF_INT, 0); // Ensure alignment is already done.\n this.writeInt32(this.offset() - offset + flatbuffers.SIZEOF_INT);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Start encoding a new object in the buffer. Users will not usually need to\n * call this directly. The FlatBuffers compiler will generate helper methods\n * that call this method internally.\n *\n * @param {number} numfields\n */\nflatbuffers.Builder.prototype.startObject = function(numfields) {\n this.notNested();\n if (this.vtable == null) {\n this.vtable = [];\n }\n this.vtable_in_use = numfields;\n for (var i = 0; i < numfields; i++) {\n this.vtable[i] = 0; // This will push additional elements as needed\n }\n this.isNested = true;\n this.object_start = this.offset();\n};\n\n/**\n * Finish off writing the object that is under construction.\n *\n * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer`\n */\nflatbuffers.Builder.prototype.endObject = function() {\n if (this.vtable == null || !this.isNested) {\n throw new Error('FlatBuffers: endObject called without startObject');\n }\n\n this.addInt32(0);\n var vtableloc = this.offset();\n\n // Trim trailing zeroes.\n var i = this.vtable_in_use - 1;\n for (; i >= 0 && this.vtable[i] == 0; i--) {}\n var trimmed_size = i + 1;\n\n // Write out the current vtable.\n for (; i >= 0; i--) {\n // Offset relative to the start of the table.\n this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);\n }\n\n var standard_fields = 2; // The fields below:\n this.addInt16(vtableloc - this.object_start);\n var len = (trimmed_size + standard_fields) * flatbuffers.SIZEOF_SHORT;\n this.addInt16(len);\n\n // Search for an existing vtable that matches the current one.\n var existing_vtable = 0;\n var vt1 = this.space;\nouter_loop:\n for (i = 0; i < this.vtables.length; i++) {\n var vt2 = this.bb.capacity() - this.vtables[i];\n if (len == this.bb.readInt16(vt2)) {\n for (var j = flatbuffers.SIZEOF_SHORT; j < len; j += flatbuffers.SIZEOF_SHORT) {\n if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {\n continue outer_loop;\n }\n }\n existing_vtable = this.vtables[i];\n break;\n }\n }\n\n if (existing_vtable) {\n // Found a match:\n // Remove the current vtable.\n this.space = this.bb.capacity() - vtableloc;\n\n // Point table to existing vtable.\n this.bb.writeInt32(this.space, existing_vtable - vtableloc);\n } else {\n // No match:\n // Add the location of the current vtable to the list of vtables.\n this.vtables.push(this.offset());\n\n // Point table to current vtable.\n this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);\n }\n\n this.isNested = false;\n return vtableloc;\n};\n/// @endcond\n\n/**\n * Finalize a buffer, poiting to the given `root_table`.\n *\n * @param {flatbuffers.Offset} root_table\n * @param {string=} opt_file_identifier\n */\nflatbuffers.Builder.prototype.finish = function(root_table, opt_file_identifier) {\n if (opt_file_identifier) {\n var file_identifier = opt_file_identifier;\n this.prep(this.minalign, flatbuffers.SIZEOF_INT +\n flatbuffers.FILE_IDENTIFIER_LENGTH);\n if (file_identifier.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: file identifier must be length ' +\n flatbuffers.FILE_IDENTIFIER_LENGTH);\n }\n for (var i = flatbuffers.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {\n this.writeInt8(file_identifier.charCodeAt(i));\n }\n }\n this.prep(this.minalign, flatbuffers.SIZEOF_INT);\n this.addOffset(root_table);\n this.bb.setPosition(this.space);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * This checks a required field has been set in a given table that has\n * just been constructed.\n *\n * @param {flatbuffers.Offset} table\n * @param {number} field\n */\nflatbuffers.Builder.prototype.requiredField = function(table, field) {\n var table_start = this.bb.capacity() - table;\n var vtable_start = table_start - this.bb.readInt32(table_start);\n var ok = this.bb.readInt16(vtable_start + field) != 0;\n\n // If this fails, the caller will show what field needs to be set.\n if (!ok) {\n throw new Error('FlatBuffers: field ' + field + ' must be set');\n }\n};\n\n/**\n * Start a new array/vector of objects. Users usually will not call\n * this directly. The FlatBuffers compiler will create a start/end\n * method for vector types in generated code.\n *\n * @param {number} elem_size The size of each element in the array\n * @param {number} num_elems The number of elements in the array\n * @param {number} alignment The alignment of the array\n */\nflatbuffers.Builder.prototype.startVector = function(elem_size, num_elems, alignment) {\n this.notNested();\n this.vector_num_elems = num_elems;\n this.prep(flatbuffers.SIZEOF_INT, elem_size * num_elems);\n this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.\n};\n\n/**\n * Finish off the creation of an array and all its elements. The array must be\n * created with `startVector`.\n *\n * @returns {flatbuffers.Offset} The offset at which the newly created array\n * starts.\n */\nflatbuffers.Builder.prototype.endVector = function() {\n this.writeInt32(this.vector_num_elems);\n return this.offset();\n};\n/// @endcond\n\n/**\n * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed\n * instead of a string, it is assumed to contain valid UTF-8 encoded data.\n *\n * @param {string|Uint8Array} s The string to encode\n * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts\n */\nflatbuffers.Builder.prototype.createString = function(s) {\n if (s instanceof Uint8Array) {\n var utf8 = s;\n } else {\n var utf8 = [];\n var i = 0;\n\n while (i < s.length) {\n var codePoint;\n\n // Decode UTF-16\n var a = s.charCodeAt(i++);\n if (a < 0xD800 || a >= 0xDC00) {\n codePoint = a;\n } else {\n var b = s.charCodeAt(i++);\n codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);\n }\n\n // Encode UTF-8\n if (codePoint < 0x80) {\n utf8.push(codePoint);\n } else {\n if (codePoint < 0x800) {\n utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);\n } else {\n if (codePoint < 0x10000) {\n utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);\n } else {\n utf8.push(\n ((codePoint >> 18) & 0x07) | 0xF0,\n ((codePoint >> 12) & 0x3F) | 0x80);\n }\n utf8.push(((codePoint >> 6) & 0x3F) | 0x80);\n }\n utf8.push((codePoint & 0x3F) | 0x80);\n }\n }\n }\n\n this.addInt8(0);\n this.startVector(1, utf8.length, 1);\n this.bb.setPosition(this.space -= utf8.length);\n for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {\n bytes[offset++] = utf8[i];\n }\n return this.endVector();\n};\n\n/**\n * A helper function to avoid generated code depending on this file directly.\n *\n * @param {number} low\n * @param {number} high\n * @returns {flatbuffers.Long}\n */\nflatbuffers.Builder.prototype.createLong = function(low, high) {\n return flatbuffers.Long.create(low, high);\n};\n////////////////////////////////////////////////////////////////////////////////\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Create a new ByteBuffer with a given array of bytes (`Uint8Array`).\n *\n * @constructor\n * @param {Uint8Array} bytes\n */\nflatbuffers.ByteBuffer = function(bytes) {\n /**\n * @type {Uint8Array}\n * @private\n */\n this.bytes_ = bytes;\n\n /**\n * @type {number}\n * @private\n */\n this.position_ = 0;\n};\n\n/**\n * Create and allocate a new ByteBuffer with a given size.\n *\n * @param {number} byte_size\n * @returns {flatbuffers.ByteBuffer}\n */\nflatbuffers.ByteBuffer.allocate = function(byte_size) {\n return new flatbuffers.ByteBuffer(new Uint8Array(byte_size));\n};\n\nflatbuffers.ByteBuffer.prototype.clear = function() {\n this.position_ = 0;\n};\n\n/**\n * Get the underlying `Uint8Array`.\n *\n * @returns {Uint8Array}\n */\nflatbuffers.ByteBuffer.prototype.bytes = function() {\n return this.bytes_;\n};\n\n/**\n * Get the buffer's position.\n *\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.position = function() {\n return this.position_;\n};\n\n/**\n * Set the buffer's position.\n *\n * @param {number} position\n */\nflatbuffers.ByteBuffer.prototype.setPosition = function(position) {\n this.position_ = position;\n};\n\n/**\n * Get the buffer's capacity.\n *\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.capacity = function() {\n return this.bytes_.length;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt8 = function(offset) {\n return this.readUint8(offset) << 24 >> 24;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint8 = function(offset) {\n return this.bytes_[offset];\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt16 = function(offset) {\n return this.readUint16(offset) << 16 >> 16;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint16 = function(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt32 = function(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint32 = function(offset) {\n return this.readInt32(offset) >>> 0;\n};\n\n/**\n * @param {number} offset\n * @returns {flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.readInt64 = function(offset) {\n return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4));\n};\n\n/**\n * @param {number} offset\n * @returns {flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.readUint64 = function(offset) {\n return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4));\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readFloat32 = function(offset) {\n flatbuffers.int32[0] = this.readInt32(offset);\n return flatbuffers.float32[0];\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readFloat64 = function(offset) {\n flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1] = this.readInt32(offset);\n flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);\n return flatbuffers.float64[0];\n};\n\n/**\n * @param {number} offset\n * @param {number|boolean} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt8 = function(offset, value) {\n this.bytes_[offset] = /** @type {number} */(value);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint8 = function(offset, value) {\n this.bytes_[offset] = value;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt16 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint16 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt32 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint32 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n};\n\n/**\n * @param {number} offset\n * @param {flatbuffers.Long} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt64 = function(offset, value) {\n this.writeInt32(offset, value.low);\n this.writeInt32(offset + 4, value.high);\n};\n\n/**\n * @param {number} offset\n * @param {flatbuffers.Long} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint64 = function(offset, value) {\n this.writeUint32(offset, value.low);\n this.writeUint32(offset + 4, value.high);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeFloat32 = function(offset, value) {\n flatbuffers.float32[0] = value;\n this.writeInt32(offset, flatbuffers.int32[0]);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeFloat64 = function(offset, value) {\n flatbuffers.float64[0] = value;\n this.writeInt32(offset, flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1]);\n this.writeInt32(offset + 4, flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0]);\n};\n\n/**\n * Return the file identifier. Behavior is undefined for FlatBuffers whose\n * schema does not include a file_identifier (likely points at padding or the\n * start of a the root vtable).\n * @returns {string}\n */\nflatbuffers.ByteBuffer.prototype.getBufferIdentifier = function() {\n if (this.bytes_.length < this.position_ + flatbuffers.SIZEOF_INT +\n flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error(\n 'FlatBuffers: ByteBuffer is too short to contain an identifier.');\n }\n var result = \"\";\n for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {\n result += String.fromCharCode(\n this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i));\n }\n return result;\n};\n\n/**\n * Look up a field in the vtable, return an offset into the object, or 0 if the\n * field is not present.\n *\n * @param {number} bb_pos\n * @param {number} vtable_offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__offset = function(bb_pos, vtable_offset) {\n var vtable = bb_pos - this.readInt32(bb_pos);\n return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;\n};\n\n/**\n * Initialize any Table-derived type to point to the union at the given offset.\n *\n * @param {flatbuffers.Table} t\n * @param {number} offset\n * @returns {flatbuffers.Table}\n */\nflatbuffers.ByteBuffer.prototype.__union = function(t, offset) {\n t.bb_pos = offset + this.readInt32(offset);\n t.bb = this;\n return t;\n};\n\n/**\n * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.\n * This allocates a new string and converts to wide chars upon each access.\n *\n * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as\n * the \"optionalEncoding\" argument. This is useful for avoiding conversion to\n * and from UTF-16 when the data will just be packaged back up in another\n * FlatBuffer later on.\n *\n * @param {number} offset\n * @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING\n * @returns {string|Uint8Array}\n */\nflatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) {\n offset += this.readInt32(offset);\n\n var length = this.readInt32(offset);\n var result = '';\n var i = 0;\n\n offset += flatbuffers.SIZEOF_INT;\n\n if (opt_encoding === flatbuffers.Encoding.UTF8_BYTES) {\n return this.bytes_.subarray(offset, offset + length);\n }\n\n while (i < length) {\n var codePoint;\n\n // Decode UTF-8\n var a = this.readUint8(offset + i++);\n if (a < 0xC0) {\n codePoint = a;\n } else {\n var b = this.readUint8(offset + i++);\n if (a < 0xE0) {\n codePoint =\n ((a & 0x1F) << 6) |\n (b & 0x3F);\n } else {\n var c = this.readUint8(offset + i++);\n if (a < 0xF0) {\n codePoint =\n ((a & 0x0F) << 12) |\n ((b & 0x3F) << 6) |\n (c & 0x3F);\n } else {\n var d = this.readUint8(offset + i++);\n codePoint =\n ((a & 0x07) << 18) |\n ((b & 0x3F) << 12) |\n ((c & 0x3F) << 6) |\n (d & 0x3F);\n }\n }\n }\n\n // Encode UTF-16\n if (codePoint < 0x10000) {\n result += String.fromCharCode(codePoint);\n } else {\n codePoint -= 0x10000;\n result += String.fromCharCode(\n (codePoint >> 10) + 0xD800,\n (codePoint & ((1 << 10) - 1)) + 0xDC00);\n }\n }\n\n return result;\n};\n\n/**\n * Retrieve the relative offset stored at \"offset\"\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__indirect = function(offset) {\n return offset + this.readInt32(offset);\n};\n\n/**\n * Get the start of data of a vector whose offset is stored at \"offset\" in this object.\n *\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__vector = function(offset) {\n return offset + this.readInt32(offset) + flatbuffers.SIZEOF_INT; // data starts after the length\n};\n\n/**\n * Get the length of a vector whose offset is stored at \"offset\" in this object.\n *\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__vector_len = function(offset) {\n return this.readInt32(offset + this.readInt32(offset));\n};\n\n/**\n * @param {string} ident\n * @returns {boolean}\n */\nflatbuffers.ByteBuffer.prototype.__has_identifier = function(ident) {\n if (ident.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: file identifier must be length ' +\n flatbuffers.FILE_IDENTIFIER_LENGTH);\n }\n for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {\n if (ident.charCodeAt(i) != this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i)) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * A helper function to avoid generated code depending on this file directly.\n *\n * @param {number} low\n * @param {number} high\n * @returns {flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.createLong = function(low, high) {\n return flatbuffers.Long.create(low, high);\n};\n\n// Exports for Node.js and RequireJS\nexport { flatbuffers };\n\n/// @endcond\n/// @}\n","'use strict';\n\n// This is free and unencumbered software released into the public domain.\n// See LICENSE.md for more information.\n\n//\n// Utilities\n//\n\n/**\n * @param {number} a The number to test.\n * @param {number} min The minimum value in the range, inclusive.\n * @param {number} max The maximum value in the range, inclusive.\n * @return {boolean} True if a >= min and a <= max.\n */\nfunction inRange(a, min, max) {\n return min <= a && a <= max;\n}\n\n/**\n * @param {*} o\n * @return {Object}\n */\nfunction ToDictionary(o) {\n if (o === undefined) return {};\n if (o === Object(o)) return o;\n throw TypeError('Could not convert argument to dictionary');\n}\n\n/**\n * @param {string} string Input string of UTF-16 code units.\n * @return {!Array.} Code points.\n */\nfunction stringToCodePoints(string) {\n // https://heycam.github.io/webidl/#dfn-obtain-unicode\n\n // 1. Let S be the DOMString value.\n var s = String(string);\n\n // 2. Let n be the length of S.\n var n = s.length;\n\n // 3. Initialize i to 0.\n var i = 0;\n\n // 4. Initialize U to be an empty sequence of Unicode characters.\n var u = [];\n\n // 5. While i < n:\n while (i < n) {\n\n // 1. Let c be the code unit in S at index i.\n var c = s.charCodeAt(i);\n\n // 2. Depending on the value of c:\n\n // c < 0xD800 or c > 0xDFFF\n if (c < 0xD800 || c > 0xDFFF) {\n // Append to U the Unicode character with code point c.\n u.push(c);\n }\n\n // 0xDC00 ≤ c ≤ 0xDFFF\n else if (0xDC00 <= c && c <= 0xDFFF) {\n // Append to U a U+FFFD REPLACEMENT CHARACTER.\n u.push(0xFFFD);\n }\n\n // 0xD800 ≤ c ≤ 0xDBFF\n else if (0xD800 <= c && c <= 0xDBFF) {\n // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT\n // CHARACTER.\n if (i === n - 1) {\n u.push(0xFFFD);\n }\n // 2. Otherwise, i < n−1:\n else {\n // 1. Let d be the code unit in S at index i+1.\n var d = string.charCodeAt(i + 1);\n\n // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:\n if (0xDC00 <= d && d <= 0xDFFF) {\n // 1. Let a be c & 0x3FF.\n var a = c & 0x3FF;\n\n // 2. Let b be d & 0x3FF.\n var b = d & 0x3FF;\n\n // 3. Append to U the Unicode character with code point\n // 2^16+2^10*a+b.\n u.push(0x10000 + (a << 10) + b);\n\n // 4. Set i to i+1.\n i += 1;\n }\n\n // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a\n // U+FFFD REPLACEMENT CHARACTER.\n else {\n u.push(0xFFFD);\n }\n }\n }\n\n // 3. Set i to i+1.\n i += 1;\n }\n\n // 6. Return U.\n return u;\n}\n\n/**\n * @param {!Array.} code_points Array of code points.\n * @return {string} string String of UTF-16 code units.\n */\nfunction codePointsToString(code_points) {\n var s = '';\n for (var i = 0; i < code_points.length; ++i) {\n var cp = code_points[i];\n if (cp <= 0xFFFF) {\n s += String.fromCharCode(cp);\n } else {\n cp -= 0x10000;\n s += String.fromCharCode((cp >> 10) + 0xD800,\n (cp & 0x3FF) + 0xDC00);\n }\n }\n return s;\n}\n\n\n//\n// Implementation of Encoding specification\n// https://encoding.spec.whatwg.org/\n//\n\n//\n// 3. Terminology\n//\n\n/**\n * End-of-stream is a special token that signifies no more tokens\n * are in the stream.\n * @const\n */ var end_of_stream = -1;\n\n/**\n * A stream represents an ordered sequence of tokens.\n *\n * @constructor\n * @param {!(Array.|Uint8Array)} tokens Array of tokens that provide the\n * stream.\n */\nfunction Stream(tokens) {\n /** @type {!Array.} */\n this.tokens = [].slice.call(tokens);\n}\n\nStream.prototype = {\n /**\n * @return {boolean} True if end-of-stream has been hit.\n */\n endOfStream: function() {\n return !this.tokens.length;\n },\n\n /**\n * When a token is read from a stream, the first token in the\n * stream must be returned and subsequently removed, and\n * end-of-stream must be returned otherwise.\n *\n * @return {number} Get the next token from the stream, or\n * end_of_stream.\n */\n read: function() {\n if (!this.tokens.length)\n return end_of_stream;\n return this.tokens.shift();\n },\n\n /**\n * When one or more tokens are prepended to a stream, those tokens\n * must be inserted, in given order, before the first token in the\n * stream.\n *\n * @param {(number|!Array.)} token The token(s) to prepend to the stream.\n */\n prepend: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.unshift(tokens.pop());\n } else {\n this.tokens.unshift(token);\n }\n },\n\n /**\n * When one or more tokens are pushed to a stream, those tokens\n * must be inserted, in given order, after the last token in the\n * stream.\n *\n * @param {(number|!Array.)} token The tokens(s) to prepend to the stream.\n */\n push: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.push(tokens.shift());\n } else {\n this.tokens.push(token);\n }\n }\n};\n\n//\n// 4. Encodings\n//\n\n// 4.1 Encoders and decoders\n\n/** @const */\nvar finished = -1;\n\n/**\n * @param {boolean} fatal If true, decoding errors raise an exception.\n * @param {number=} opt_code_point Override the standard fallback code point.\n * @return {number} The code point to insert on a decoding error.\n */\nfunction decoderError(fatal, opt_code_point) {\n if (fatal)\n throw TypeError('Decoder error');\n return opt_code_point || 0xFFFD;\n}\n\n/** @interface */\nfunction Decoder() {}\nDecoder.prototype = {\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point, or |finished|.\n */\n handler: function(stream, bite) {}\n};\n\n/** @interface */\nfunction Encoder() {}\nEncoder.prototype = {\n /**\n * @param {Stream} stream The stream of code points being encoded.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit, or |finished|.\n */\n handler: function(stream, code_point) {}\n};\n\n//\n// 7. API\n//\n\n/** @const */ var DEFAULT_ENCODING = 'utf-8';\n\n// 7.1 Interface TextDecoder\n\n/**\n * @constructor\n * @param {string=} encoding The label of the encoding;\n * defaults to 'utf-8'.\n * @param {Object=} options\n */\nfunction TextDecoder(encoding, options) {\n if (!(this instanceof TextDecoder)) {\n return new TextDecoder(encoding, options);\n }\n encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;\n if (encoding !== DEFAULT_ENCODING) {\n throw new Error('Encoding not supported. Only utf-8 is supported');\n }\n options = ToDictionary(options);\n\n /** @private @type {boolean} */\n this._streaming = false;\n /** @private @type {boolean} */\n this._BOMseen = false;\n /** @private @type {?Decoder} */\n this._decoder = null;\n /** @private @type {boolean} */\n this._fatal = Boolean(options['fatal']);\n /** @private @type {boolean} */\n this._ignoreBOM = Boolean(options['ignoreBOM']);\n\n Object.defineProperty(this, 'encoding', {value: 'utf-8'});\n Object.defineProperty(this, 'fatal', {value: this._fatal});\n Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});\n}\n\nTextDecoder.prototype = {\n /**\n * @param {ArrayBufferView=} input The buffer of bytes to decode.\n * @param {Object=} options\n * @return {string} The decoded string.\n */\n decode: function decode(input, options) {\n var bytes;\n if (typeof input === 'object' && input instanceof ArrayBuffer) {\n bytes = new Uint8Array(input);\n } else if (typeof input === 'object' && 'buffer' in input &&\n input.buffer instanceof ArrayBuffer) {\n bytes = new Uint8Array(input.buffer,\n input.byteOffset,\n input.byteLength);\n } else {\n bytes = new Uint8Array(0);\n }\n\n options = ToDictionary(options);\n\n if (!this._streaming) {\n this._decoder = new UTF8Decoder({fatal: this._fatal});\n this._BOMseen = false;\n }\n this._streaming = Boolean(options['stream']);\n\n var input_stream = new Stream(bytes);\n\n var code_points = [];\n\n /** @type {?(number|!Array.)} */\n var result;\n\n while (!input_stream.endOfStream()) {\n result = this._decoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (result === null)\n continue;\n if (Array.isArray(result))\n code_points.push.apply(code_points, /**@type {!Array.}*/(result));\n else\n code_points.push(result);\n }\n if (!this._streaming) {\n do {\n result = this._decoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (result === null)\n continue;\n if (Array.isArray(result))\n code_points.push.apply(code_points, /**@type {!Array.}*/(result));\n else\n code_points.push(result);\n } while (!input_stream.endOfStream());\n this._decoder = null;\n }\n\n if (code_points.length) {\n // If encoding is one of utf-8, utf-16be, and utf-16le, and\n // ignore BOM flag and BOM seen flag are unset, run these\n // subsubsteps:\n if (['utf-8'].indexOf(this.encoding) !== -1 &&\n !this._ignoreBOM && !this._BOMseen) {\n // If token is U+FEFF, set BOM seen flag.\n if (code_points[0] === 0xFEFF) {\n this._BOMseen = true;\n code_points.shift();\n } else {\n // Otherwise, if token is not end-of-stream, set BOM seen\n // flag and append token to output.\n this._BOMseen = true;\n }\n }\n }\n\n return codePointsToString(code_points);\n }\n};\n\n// 7.2 Interface TextEncoder\n\n/**\n * @constructor\n * @param {string=} encoding The label of the encoding;\n * defaults to 'utf-8'.\n * @param {Object=} options\n */\nfunction TextEncoder(encoding, options) {\n if (!(this instanceof TextEncoder))\n return new TextEncoder(encoding, options);\n encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;\n if (encoding !== DEFAULT_ENCODING) {\n throw new Error('Encoding not supported. Only utf-8 is supported');\n }\n options = ToDictionary(options);\n\n /** @private @type {boolean} */\n this._streaming = false;\n /** @private @type {?Encoder} */\n this._encoder = null;\n /** @private @type {{fatal: boolean}} */\n this._options = {fatal: Boolean(options['fatal'])};\n\n Object.defineProperty(this, 'encoding', {value: 'utf-8'});\n}\n\nTextEncoder.prototype = {\n /**\n * @param {string=} opt_string The string to encode.\n * @param {Object=} options\n * @return {Uint8Array} Encoded bytes, as a Uint8Array.\n */\n encode: function encode(opt_string, options) {\n opt_string = opt_string ? String(opt_string) : '';\n options = ToDictionary(options);\n\n // NOTE: This option is nonstandard. None of the encodings\n // permitted for encoding (i.e. UTF-8, UTF-16) are stateful,\n // so streaming is not necessary.\n if (!this._streaming)\n this._encoder = new UTF8Encoder(this._options);\n this._streaming = Boolean(options['stream']);\n\n var bytes = [];\n var input_stream = new Stream(stringToCodePoints(opt_string));\n /** @type {?(number|!Array.)} */\n var result;\n while (!input_stream.endOfStream()) {\n result = this._encoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (Array.isArray(result))\n bytes.push.apply(bytes, /**@type {!Array.}*/(result));\n else\n bytes.push(result);\n }\n if (!this._streaming) {\n while (true) {\n result = this._encoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (Array.isArray(result))\n bytes.push.apply(bytes, /**@type {!Array.}*/(result));\n else\n bytes.push(result);\n }\n this._encoder = null;\n }\n return new Uint8Array(bytes);\n }\n};\n\n//\n// 8. The encoding\n//\n\n// 8.1 utf-8\n\n/**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\nfunction UTF8Decoder(options) {\n var fatal = options.fatal;\n\n // utf-8's decoder's has an associated utf-8 code point, utf-8\n // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8\n // lower boundary (initially 0x80), and a utf-8 upper boundary\n // (initially 0xBF).\n var /** @type {number} */ utf8_code_point = 0,\n /** @type {number} */ utf8_bytes_seen = 0,\n /** @type {number} */ utf8_bytes_needed = 0,\n /** @type {number} */ utf8_lower_boundary = 0x80,\n /** @type {number} */ utf8_upper_boundary = 0xBF;\n\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,\n // set utf-8 bytes needed to 0 and return error.\n if (bite === end_of_stream && utf8_bytes_needed !== 0) {\n utf8_bytes_needed = 0;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream, return finished.\n if (bite === end_of_stream)\n return finished;\n\n // 3. If utf-8 bytes needed is 0, based on byte:\n if (utf8_bytes_needed === 0) {\n\n // 0x00 to 0x7F\n if (inRange(bite, 0x00, 0x7F)) {\n // Return a code point whose value is byte.\n return bite;\n }\n\n // 0xC2 to 0xDF\n if (inRange(bite, 0xC2, 0xDF)) {\n // Set utf-8 bytes needed to 1 and utf-8 code point to byte\n // − 0xC0.\n utf8_bytes_needed = 1;\n utf8_code_point = bite - 0xC0;\n }\n\n // 0xE0 to 0xEF\n else if (inRange(bite, 0xE0, 0xEF)) {\n // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.\n if (bite === 0xE0)\n utf8_lower_boundary = 0xA0;\n // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.\n if (bite === 0xED)\n utf8_upper_boundary = 0x9F;\n // 3. Set utf-8 bytes needed to 2 and utf-8 code point to\n // byte − 0xE0.\n utf8_bytes_needed = 2;\n utf8_code_point = bite - 0xE0;\n }\n\n // 0xF0 to 0xF4\n else if (inRange(bite, 0xF0, 0xF4)) {\n // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.\n if (bite === 0xF0)\n utf8_lower_boundary = 0x90;\n // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.\n if (bite === 0xF4)\n utf8_upper_boundary = 0x8F;\n // 3. Set utf-8 bytes needed to 3 and utf-8 code point to\n // byte − 0xF0.\n utf8_bytes_needed = 3;\n utf8_code_point = bite - 0xF0;\n }\n\n // Otherwise\n else {\n // Return error.\n return decoderError(fatal);\n }\n\n // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code\n // point to utf-8 code point << (6 × utf-8 bytes needed) and\n // return continue.\n utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed);\n return null;\n }\n\n // 4. If byte is not in the range utf-8 lower boundary to utf-8\n // upper boundary, run these substeps:\n if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {\n\n // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8\n // bytes seen to 0, set utf-8 lower boundary to 0x80, and set\n // utf-8 upper boundary to 0xBF.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 2. Prepend byte to stream.\n stream.prepend(bite);\n\n // 3. Return error.\n return decoderError(fatal);\n }\n\n // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary\n // to 0xBF.\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 6. Increase utf-8 bytes seen by one and set utf-8 code point\n // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes\n // needed − utf-8 bytes seen)).\n utf8_bytes_seen += 1;\n utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen));\n\n // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed,\n // continue.\n if (utf8_bytes_seen !== utf8_bytes_needed)\n return null;\n\n // 8. Let code point be utf-8 code point.\n var code_point = utf8_code_point;\n\n // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes\n // seen to 0.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n\n // 10. Return a code point whose value is code point.\n return code_point;\n };\n}\n\n/**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\nfunction UTF8Encoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is in the range U+0000 to U+007F, return a\n // byte whose value is code point.\n if (inRange(code_point, 0x0000, 0x007f))\n return code_point;\n\n // 3. Set count and offset based on the range code point is in:\n var count, offset;\n // U+0080 to U+07FF: 1 and 0xC0\n if (inRange(code_point, 0x0080, 0x07FF)) {\n count = 1;\n offset = 0xC0;\n }\n // U+0800 to U+FFFF: 2 and 0xE0\n else if (inRange(code_point, 0x0800, 0xFFFF)) {\n count = 2;\n offset = 0xE0;\n }\n // U+10000 to U+10FFFF: 3 and 0xF0\n else if (inRange(code_point, 0x10000, 0x10FFFF)) {\n count = 3;\n offset = 0xF0;\n }\n\n // 4.Let bytes be a byte sequence whose first byte is (code\n // point >> (6 × count)) + offset.\n var bytes = [(code_point >> (6 * count)) + offset];\n\n // 5. Run these substeps while count is greater than 0:\n while (count > 0) {\n\n // 1. Set temp to code point >> (6 × (count − 1)).\n var temp = code_point >> (6 * (count - 1));\n\n // 2. Append to bytes 0x80 | (temp & 0x3F).\n bytes.push(0x80 | (temp & 0x3F));\n\n // 3. Decrease count by one.\n count -= 1;\n }\n\n // 6. Return bytes bytes, in order.\n return bytes;\n };\n}\n\nexport {TextEncoder, TextDecoder};\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { toUint8Array } from './buffer';\nimport {\n TextDecoder as TextDecoderPolyfill,\n TextEncoder as TextEncoderPolyfill,\n} from 'text-encoding-utf-8';\n\n/** @ignore @suppress {missingRequire} */\nconst _Buffer = typeof Buffer === 'function' ? Buffer : null;\n/** @ignore */\nconst useNativeEncoders = typeof TextDecoder === 'function' && typeof TextEncoder === 'function';\n\n/** @ignore */\nexport const decodeUtf8 = ((TextDecoder) => {\n if (useNativeEncoders || !_Buffer) {\n const decoder = new TextDecoder('utf-8');\n return (buffer?: ArrayBuffer | ArrayBufferView) => decoder.decode(buffer);\n }\n return (input: ArrayBufferLike | ArrayBufferView) => {\n const { buffer, byteOffset, length } = toUint8Array(input);\n return _Buffer.from(buffer, byteOffset, length).toString();\n };\n})(typeof TextDecoder !== 'undefined' ? TextDecoder : TextDecoderPolyfill);\n\n/** @ignore */\nexport const encodeUtf8 = ((TextEncoder) => {\n if (useNativeEncoders || !_Buffer) {\n const encoder = new TextEncoder();\n return (value?: string) => encoder.encode(value);\n }\n return (input = '') => toUint8Array(_Buffer.from(input, 'utf8'));\n})(typeof TextEncoder !== 'undefined' ? TextEncoder : TextEncoderPolyfill);\n","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n return function () {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (isNativeReflectConstruct()) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport streamAdapters from './adapters';\n\n/** @ignore */\nexport const ITERATOR_DONE: any = Object.freeze({ done: true, value: void (0) });\n\n/** @ignore */\nexport type FileHandle = import('fs').promises.FileHandle;\n/** @ignore */\nexport type ArrowJSONLike = { schema: any; batches?: any[]; dictionaries?: any[]; };\n/** @ignore */\nexport type ReadableDOMStreamOptions = { type: 'bytes' | undefined, autoAllocateChunkSize?: number, highWaterMark?: number };\n\n/** @ignore */\nexport class ArrowJSON {\n // @ts-ignore\n constructor(private _json: ArrowJSONLike) {}\n public get schema(): any { return this._json['schema']; }\n public get batches(): any[] { return (this._json['batches'] || []) as any[]; }\n public get dictionaries(): any[] { return (this._json['dictionaries'] || []) as any[]; }\n}\n\n/** @ignore */\nexport interface Readable {\n\n readonly closed: Promise;\n cancel(reason?: any): Promise;\n\n read(size?: number | null): Promise;\n peek(size?: number | null): Promise;\n throw(value?: any): Promise>;\n return(value?: any): Promise>;\n next(size?: number | null): Promise>;\n}\n\n/** @ignore */\nexport interface Writable {\n readonly closed: Promise;\n close(): void;\n write(chunk: T): void;\n abort(reason?: any): void;\n}\n\n/** @ignore */\nexport interface ReadableWritable extends Readable, Writable {\n [Symbol.asyncIterator](): AsyncIterableIterator;\n toDOMStream(options?: ReadableDOMStreamOptions): ReadableStream;\n toNodeStream(options?: import('stream').ReadableOptions): import('stream').Readable;\n}\n\n/** @ignore */\nexport abstract class ReadableInterop {\n\n public abstract toDOMStream(options?: ReadableDOMStreamOptions): ReadableStream;\n public abstract toNodeStream(options?: import('stream').ReadableOptions): import('stream').Readable;\n\n public tee(): [ReadableStream, ReadableStream] {\n return this._getDOMStream().tee();\n }\n public pipe(writable: R, options?: { end?: boolean; }) {\n return this._getNodeStream().pipe(writable, options);\n }\n public pipeTo(writable: WritableStream, options?: PipeOptions) { return this._getDOMStream().pipeTo(writable, options); }\n public pipeThrough>(duplex: { writable: WritableStream, readable: R }, options?: PipeOptions) {\n return this._getDOMStream().pipeThrough(duplex, options);\n }\n\n protected _DOMStream?: ReadableStream;\n private _getDOMStream() {\n return this._DOMStream || (this._DOMStream = this.toDOMStream());\n }\n\n protected _nodeStream?: import('stream').Readable;\n private _getNodeStream() {\n return this._nodeStream || (this._nodeStream = this.toNodeStream());\n }\n}\n\n/** @ignore */\ntype Resolution = { resolve: (value?: T | PromiseLike) => void; reject: (reason?: any) => void; };\n\n/** @ignore */\nexport class AsyncQueue extends ReadableInterop\n implements AsyncIterableIterator, ReadableWritable {\n\n protected _values: TWritable[] = [];\n protected _error?: { error: any; };\n protected _closedPromise: Promise;\n protected _closedPromiseResolve?: (value?: any) => void;\n protected resolvers: Resolution>[] = [];\n\n constructor() {\n super();\n this._closedPromise = new Promise((r) => this._closedPromiseResolve = r);\n }\n\n public get closed(): Promise { return this._closedPromise; }\n public async cancel(reason?: any) { await this.return(reason); }\n public write(value: TWritable) {\n if (this._ensureOpen()) {\n this.resolvers.length <= 0\n ? (this._values.push(value))\n : (this.resolvers.shift()!.resolve({ done: false, value } as any));\n }\n }\n public abort(value?: any) {\n if (this._closedPromiseResolve) {\n this.resolvers.length <= 0\n ? (this._error = { error: value })\n : (this.resolvers.shift()!.reject({ done: true, value }));\n }\n }\n public close() {\n if (this._closedPromiseResolve) {\n const { resolvers } = this;\n while (resolvers.length > 0) {\n resolvers.shift()!.resolve(ITERATOR_DONE);\n }\n this._closedPromiseResolve();\n this._closedPromiseResolve = undefined;\n }\n }\n\n public [Symbol.asyncIterator]() { return this; }\n public toDOMStream(options?: ReadableDOMStreamOptions) {\n return streamAdapters.toDOMStream(\n (this._closedPromiseResolve || this._error)\n ? (this as AsyncIterable)\n : (this._values as any) as Iterable,\n options);\n }\n public toNodeStream(options?: import('stream').ReadableOptions) {\n return streamAdapters.toNodeStream(\n (this._closedPromiseResolve || this._error)\n ? (this as AsyncIterable)\n : (this._values as any) as Iterable,\n options);\n }\n public async throw(_?: any) { await this.abort(_); return ITERATOR_DONE; }\n public async return(_?: any) { await this.close(); return ITERATOR_DONE; }\n\n public async read(size?: number | null): Promise { return (await this.next(size, 'read')).value; }\n public async peek(size?: number | null): Promise { return (await this.next(size, 'peek')).value; }\n public next(..._args: any[]): Promise> {\n if (this._values.length > 0) {\n return Promise.resolve({ done: false, value: this._values.shift()! } as any);\n } else if (this._error) {\n return Promise.reject({ done: true, value: this._error.error });\n } else if (!this._closedPromiseResolve) {\n return Promise.resolve(ITERATOR_DONE);\n } else {\n return new Promise>((resolve, reject) => {\n this.resolvers.push({ resolve, reject });\n });\n }\n }\n\n protected _ensureOpen() {\n if (this._closedPromiseResolve) {\n return true;\n }\n throw new Error(`${this} is closed`);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { ReadableInterop, ArrowJSONLike } from '../io/interfaces';\n\n/** @ignore */\ntype FSReadStream = import('fs').ReadStream;\n/** @ignore */\ntype FileHandle = import('fs').promises.FileHandle;\n\n/** @ignore */\nexport interface Subscription {\n unsubscribe: () => void;\n}\n\n/** @ignore */\nexport interface Observer {\n closed?: boolean;\n next: (value: T) => void;\n error: (err: any) => void;\n complete: () => void;\n}\n\n/** @ignore */\nexport interface Observable {\n subscribe: (observer: Observer) => Subscription;\n}\n\n/** @ignore */\nconst [BigIntCtor, BigIntAvailable] = (() => {\n const BigIntUnavailableError = () => { throw new Error('BigInt is not available in this environment'); };\n function BigIntUnavailable() { throw BigIntUnavailableError(); }\n BigIntUnavailable.asIntN = () => { throw BigIntUnavailableError(); };\n BigIntUnavailable.asUintN = () => { throw BigIntUnavailableError(); };\n return typeof BigInt !== 'undefined' ? [BigInt, true] : [ BigIntUnavailable, false];\n})() as [BigIntConstructor, boolean];\n\n/** @ignore */\nconst [BigInt64ArrayCtor, BigInt64ArrayAvailable] = (() => {\n const BigInt64ArrayUnavailableError = () => { throw new Error('BigInt64Array is not available in this environment'); };\n class BigInt64ArrayUnavailable {\n static get BYTES_PER_ELEMENT() { return 8; }\n static of() { throw BigInt64ArrayUnavailableError(); }\n static from() { throw BigInt64ArrayUnavailableError(); }\n constructor() { throw BigInt64ArrayUnavailableError(); }\n }\n return typeof BigInt64Array !== 'undefined' ? [BigInt64Array, true] : [ BigInt64ArrayUnavailable, false];\n})() as [BigInt64ArrayConstructor, boolean];\n\n/** @ignore */\nconst [BigUint64ArrayCtor, BigUint64ArrayAvailable] = (() => {\n const BigUint64ArrayUnavailableError = () => { throw new Error('BigUint64Array is not available in this environment'); };\n class BigUint64ArrayUnavailable {\n static get BYTES_PER_ELEMENT() { return 8; }\n static of() { throw BigUint64ArrayUnavailableError(); }\n static from() { throw BigUint64ArrayUnavailableError(); }\n constructor() { throw BigUint64ArrayUnavailableError(); }\n }\n return typeof BigUint64Array !== 'undefined' ? [BigUint64Array, true] : [ BigUint64ArrayUnavailable, false];\n})() as [BigUint64ArrayConstructor, boolean];\n\nexport { BigIntCtor as BigInt, BigIntAvailable };\nexport { BigInt64ArrayCtor as BigInt64Array, BigInt64ArrayAvailable };\nexport { BigUint64ArrayCtor as BigUint64Array, BigUint64ArrayAvailable };\n\n/** @ignore */ const isNumber = (x: any) => typeof x === 'number';\n/** @ignore */ const isBoolean = (x: any) => typeof x === 'boolean';\n/** @ignore */ const isFunction = (x: any) => typeof x === 'function';\n/** @ignore */\nexport const isObject = (x: any): x is Object => x != null && Object(x) === x;\n\n/** @ignore */\nexport const isPromise = (x: any): x is PromiseLike => {\n return isObject(x) && isFunction(x.then);\n};\n\n/** @ignore */\nexport const isObservable = (x: any): x is Observable => {\n return isObject(x) && isFunction(x.subscribe);\n};\n\n/** @ignore */\nexport const isIterable = (x: any): x is Iterable => {\n return isObject(x) && isFunction(x[Symbol.iterator]);\n};\n\n/** @ignore */\nexport const isAsyncIterable = (x: any): x is AsyncIterable => {\n return isObject(x) && isFunction(x[Symbol.asyncIterator]);\n};\n\n/** @ignore */\nexport const isArrowJSON = (x: any): x is ArrowJSONLike => {\n return isObject(x) && isObject(x['schema']);\n};\n\n/** @ignore */\nexport const isArrayLike = (x: any): x is ArrayLike => {\n return isObject(x) && isNumber(x['length']);\n};\n\n/** @ignore */\nexport const isIteratorResult = (x: any): x is IteratorResult => {\n return isObject(x) && ('done' in x) && ('value' in x);\n};\n\n/** @ignore */\nexport const isUnderlyingSink = (x: any): x is UnderlyingSink => {\n return isObject(x) &&\n isFunction(x['abort']) &&\n isFunction(x['close']) &&\n isFunction(x['start']) &&\n isFunction(x['write']);\n};\n\n/** @ignore */\nexport const isFileHandle = (x: any): x is FileHandle => {\n return isObject(x) && isFunction(x['stat']) && isNumber(x['fd']);\n};\n\n/** @ignore */\nexport const isFSReadStream = (x: any): x is FSReadStream => {\n return isReadableNodeStream(x) && isNumber(( x)['bytesRead']);\n};\n\n/** @ignore */\nexport const isFetchResponse = (x: any): x is Response => {\n return isObject(x) && isReadableDOMStream(x['body']);\n};\n\n/** @ignore */\nexport const isWritableDOMStream = (x: any): x is WritableStream => {\n return isObject(x) &&\n isFunction(x['abort']) &&\n isFunction(x['getWriter']) &&\n !(x instanceof ReadableInterop);\n};\n\n/** @ignore */\nexport const isReadableDOMStream = (x: any): x is ReadableStream => {\n return isObject(x) &&\n isFunction(x['cancel']) &&\n isFunction(x['getReader']) &&\n !(x instanceof ReadableInterop);\n};\n\n/** @ignore */\nexport const isWritableNodeStream = (x: any): x is NodeJS.WritableStream => {\n return isObject(x) &&\n isFunction(x['end']) &&\n isFunction(x['write']) &&\n isBoolean(x['writable']) &&\n !(x instanceof ReadableInterop);\n};\n\n/** @ignore */\nexport const isReadableNodeStream = (x: any): x is NodeJS.ReadableStream => {\n return isObject(x) &&\n isFunction(x['read']) &&\n isFunction(x['pipe']) &&\n isBoolean(x['readable']) &&\n !(x instanceof ReadableInterop);\n};\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { flatbuffers } from 'flatbuffers';\nimport { encodeUtf8 } from '../util/utf8';\nimport ByteBuffer = flatbuffers.ByteBuffer;\nimport { TypedArray, TypedArrayConstructor } from '../interfaces';\nimport { BigIntArray, BigIntArrayConstructor } from '../interfaces';\nimport { isPromise, isIterable, isAsyncIterable, isIteratorResult, BigInt64Array, BigUint64Array } from './compat';\n\n/** @ignore */\nconst SharedArrayBuf = (typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : ArrayBuffer);\n\n/** @ignore */\nfunction collapseContiguousByteRanges(chunks: Uint8Array[]) {\n let result = chunks[0] ? [chunks[0]] : [];\n let xOffset: number, yOffset: number, xLen: number, yLen: number;\n for (let x, y, i = 0, j = 0, n = chunks.length; ++i < n;) {\n x = result[j];\n y = chunks[i];\n // continue if x and y don't share the same underlying ArrayBuffer, or if x isn't before y\n if (!x || !y || x.buffer !== y.buffer || y.byteOffset < x.byteOffset) {\n y && (result[++j] = y);\n continue;\n }\n ({ byteOffset: xOffset, byteLength: xLen } = x);\n ({ byteOffset: yOffset, byteLength: yLen } = y);\n // continue if the byte ranges of x and y aren't contiguous\n if ((xOffset + xLen) < yOffset || (yOffset + yLen) < xOffset) {\n y && (result[++j] = y);\n continue;\n }\n result[j] = new Uint8Array(x.buffer, xOffset, yOffset - xOffset + yLen);\n }\n return result;\n}\n\n/** @ignore */\nexport function memcpy(target: TTarget, source: TSource, targetByteOffset = 0, sourceByteLength = source.byteLength) {\n const targetByteLength = target.byteLength;\n const dst = new Uint8Array(target.buffer, target.byteOffset, targetByteLength);\n const src = new Uint8Array(source.buffer, source.byteOffset, Math.min(sourceByteLength, targetByteLength));\n dst.set(src, targetByteOffset);\n return target;\n}\n\n/** @ignore */\nexport function joinUint8Arrays(chunks: Uint8Array[], size?: number | null): [Uint8Array, Uint8Array[], number] {\n // collapse chunks that share the same underlying ArrayBuffer and whose byte ranges overlap,\n // to avoid unnecessarily copying the bytes to do this buffer join. This is a common case during\n // streaming, where we may be reading partial byte ranges out of the same underlying ArrayBuffer\n let result = collapseContiguousByteRanges(chunks);\n let byteLength = result.reduce((x, b) => x + b.byteLength, 0);\n let source: Uint8Array, sliced: Uint8Array, buffer: Uint8Array | void;\n let offset = 0, index = -1, length = Math.min(size || Infinity, byteLength);\n for (let n = result.length; ++index < n;) {\n source = result[index];\n sliced = source.subarray(0, Math.min(source.length, length - offset));\n if (length <= (offset + sliced.length)) {\n if (sliced.length < source.length) {\n result[index] = source.subarray(sliced.length);\n } else if (sliced.length === source.length) { index++; }\n buffer ? memcpy(buffer, sliced, offset) : (buffer = sliced);\n break;\n }\n memcpy(buffer || (buffer = new Uint8Array(length)), sliced, offset);\n offset += sliced.length;\n }\n return [buffer || new Uint8Array(0), result.slice(index), byteLength - (buffer ? buffer.byteLength : 0)];\n}\n\n/** @ignore */\nexport type ArrayBufferViewInput = ArrayBufferView | ArrayBufferLike | ArrayBufferView | Iterable | ArrayLike | ByteBuffer | string | null | undefined |\n IteratorResult | ArrayLike | ByteBuffer | string | null | undefined> |\n ReadableStreamReadResult | ArrayLike | ByteBuffer | string | null | undefined> ;\n\n/** @ignore */\nexport function toArrayBufferView(ArrayBufferViewCtor: TypedArrayConstructor, input: ArrayBufferViewInput): T;\nexport function toArrayBufferView(ArrayBufferViewCtor: BigIntArrayConstructor, input: ArrayBufferViewInput): T;\nexport function toArrayBufferView(ArrayBufferViewCtor: any, input: ArrayBufferViewInput) {\n\n let value: any = isIteratorResult(input) ? input.value : input;\n\n if (value instanceof ArrayBufferViewCtor) {\n if (ArrayBufferViewCtor === Uint8Array) {\n // Node's `Buffer` class passes the `instanceof Uint8Array` check, but we need\n // a real Uint8Array, since Buffer#slice isn't the same as Uint8Array#slice :/\n return new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength);\n }\n return value;\n }\n if (!value) { return new ArrayBufferViewCtor(0); }\n if (typeof value === 'string') { value = encodeUtf8(value); }\n if (value instanceof ArrayBuffer) { return new ArrayBufferViewCtor(value); }\n if (value instanceof SharedArrayBuf) { return new ArrayBufferViewCtor(value); }\n if (value instanceof ByteBuffer) { return toArrayBufferView(ArrayBufferViewCtor, value.bytes()); }\n return !ArrayBuffer.isView(value) ? ArrayBufferViewCtor.from(value) : value.byteLength <= 0 ? new ArrayBufferViewCtor(0)\n : new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength / ArrayBufferViewCtor.BYTES_PER_ELEMENT);\n}\n\n/** @ignore */ export const toInt8Array = (input: ArrayBufferViewInput) => toArrayBufferView(Int8Array, input);\n/** @ignore */ export const toInt16Array = (input: ArrayBufferViewInput) => toArrayBufferView(Int16Array, input);\n/** @ignore */ export const toInt32Array = (input: ArrayBufferViewInput) => toArrayBufferView(Int32Array, input);\n/** @ignore */ export const toBigInt64Array = (input: ArrayBufferViewInput) => toArrayBufferView(BigInt64Array, input);\n/** @ignore */ export const toUint8Array = (input: ArrayBufferViewInput) => toArrayBufferView(Uint8Array, input);\n/** @ignore */ export const toUint16Array = (input: ArrayBufferViewInput) => toArrayBufferView(Uint16Array, input);\n/** @ignore */ export const toUint32Array = (input: ArrayBufferViewInput) => toArrayBufferView(Uint32Array, input);\n/** @ignore */ export const toBigUint64Array = (input: ArrayBufferViewInput) => toArrayBufferView(BigUint64Array, input);\n/** @ignore */ export const toFloat32Array = (input: ArrayBufferViewInput) => toArrayBufferView(Float32Array, input);\n/** @ignore */ export const toFloat64Array = (input: ArrayBufferViewInput) => toArrayBufferView(Float64Array, input);\n/** @ignore */ export const toUint8ClampedArray = (input: ArrayBufferViewInput) => toArrayBufferView(Uint8ClampedArray, input);\n\n/** @ignore */\ntype ArrayBufferViewIteratorInput = Iterable | ArrayBufferViewInput;\n\n/** @ignore */\nconst pump = | AsyncIterator>(iterator: T) => { iterator.next(); return iterator; };\n\n/** @ignore */\nexport function* toArrayBufferViewIterator(ArrayCtor: TypedArrayConstructor, source: ArrayBufferViewIteratorInput) {\n\n const wrap = function*(x: T) { yield x; };\n const buffers: Iterable =\n (typeof source === 'string') ? wrap(source)\n : (ArrayBuffer.isView(source)) ? wrap(source)\n : (source instanceof ArrayBuffer) ? wrap(source)\n : (source instanceof SharedArrayBuf) ? wrap(source)\n : !isIterable(source) ? wrap(source) : source;\n\n yield* pump((function* (it) {\n let r: IteratorResult = null;\n do {\n r = it.next(yield toArrayBufferView(ArrayCtor, r));\n } while (!r.done);\n })(buffers[Symbol.iterator]()));\n}\n\n/** @ignore */ export const toInt8ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Int8Array, input);\n/** @ignore */ export const toInt16ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Int16Array, input);\n/** @ignore */ export const toInt32ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Int32Array, input);\n/** @ignore */ export const toUint8ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Uint8Array, input);\n/** @ignore */ export const toUint16ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Uint16Array, input);\n/** @ignore */ export const toUint32ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Uint32Array, input);\n/** @ignore */ export const toFloat32ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Float32Array, input);\n/** @ignore */ export const toFloat64ArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Float64Array, input);\n/** @ignore */ export const toUint8ClampedArrayIterator = (input: ArrayBufferViewIteratorInput) => toArrayBufferViewIterator(Uint8ClampedArray, input);\n\n/** @ignore */\ntype ArrayBufferViewAsyncIteratorInput = AsyncIterable | Iterable | PromiseLike | ArrayBufferViewInput;\n\n/** @ignore */\nexport async function* toArrayBufferViewAsyncIterator(ArrayCtor: TypedArrayConstructor, source: ArrayBufferViewAsyncIteratorInput): AsyncIterableIterator {\n\n // if a Promise, unwrap the Promise and iterate the resolved value\n if (isPromise(source)) {\n return yield* toArrayBufferViewAsyncIterator(ArrayCtor, await source);\n }\n\n const wrap = async function*(x: T) { yield await x; };\n const emit = async function* >(source: T) {\n yield* pump((function*(it: Iterator) {\n let r: IteratorResult = null;\n do {\n r = it.next(yield r && r.value);\n } while (!r.done);\n })(source[Symbol.iterator]()));\n };\n\n const buffers: AsyncIterable =\n (typeof source === 'string') ? wrap(source) // if string, wrap in an AsyncIterableIterator\n : (ArrayBuffer.isView(source)) ? wrap(source) // if TypedArray, wrap in an AsyncIterableIterator\n : (source instanceof ArrayBuffer) ? wrap(source) // if ArrayBuffer, wrap in an AsyncIterableIterator\n : (source instanceof SharedArrayBuf) ? wrap(source) // if SharedArrayBuffer, wrap in an AsyncIterableIterator\n : isIterable(source) ? emit(source) // If Iterable, wrap in an AsyncIterableIterator and compose the `next` values\n : !isAsyncIterable(source) ? wrap(source) // If not an AsyncIterable, treat as a sentinel and wrap in an AsyncIterableIterator\n : source; // otherwise if AsyncIterable, use it\n\n yield* pump((async function* (it) {\n let r: IteratorResult = null;\n do {\n r = await it.next(yield toArrayBufferView(ArrayCtor, r));\n } while (!r.done);\n })(buffers[Symbol.asyncIterator]()));\n}\n\n/** @ignore */ export const toInt8ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Int8Array, input);\n/** @ignore */ export const toInt16ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Int16Array, input);\n/** @ignore */ export const toInt32ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Int32Array, input);\n/** @ignore */ export const toUint8ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Uint8Array, input);\n/** @ignore */ export const toUint16ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Uint16Array, input);\n/** @ignore */ export const toUint32ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Uint32Array, input);\n/** @ignore */ export const toFloat32ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Float32Array, input);\n/** @ignore */ export const toFloat64ArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Float64Array, input);\n/** @ignore */ export const toUint8ClampedArrayAsyncIterator = (input: ArrayBufferViewAsyncIteratorInput) => toArrayBufferViewAsyncIterator(Uint8ClampedArray, input);\n\n/** @ignore */\nexport function rebaseValueOffsets(offset: number, length: number, valueOffsets: Int32Array) {\n // If we have a non-zero offset, create a new offsets array with the values\n // shifted by the start offset, such that the new start offset is 0\n if (offset !== 0) {\n valueOffsets = valueOffsets.slice(0, length + 1);\n for (let i = -1; ++i <= length;) {\n valueOffsets[i] += offset;\n }\n }\n return valueOffsets;\n}\n\n/** @ignore */\nexport function compareArrayLike>(a: T, b: T) {\n let i = 0, n = a.length;\n if (n !== b.length) { return false; }\n if (n > 0) {\n do { if (a[i] !== b[i]) { return false; } } while (++i < n);\n }\n return true;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport {\n toUint8Array,\n joinUint8Arrays,\n ArrayBufferViewInput,\n toUint8ArrayIterator,\n toUint8ArrayAsyncIterator\n} from '../util/buffer';\n\nimport { ReadableDOMStreamOptions } from './interfaces';\n\n/** @ignore */\nexport default {\n fromIterable(source: Iterable | T): IterableIterator {\n return pump(fromIterable(source));\n },\n fromAsyncIterable(source: AsyncIterable | PromiseLike): AsyncIterableIterator {\n return pump(fromAsyncIterable(source));\n },\n fromDOMStream(source: ReadableStream): AsyncIterableIterator {\n return pump(fromDOMStream(source));\n },\n fromNodeStream(stream: NodeJS.ReadableStream): AsyncIterableIterator {\n return pump(fromNodeStream(stream));\n },\n // @ts-ignore\n toDOMStream(source: Iterable | AsyncIterable, options?: ReadableDOMStreamOptions): ReadableStream {\n throw new Error(`\"toDOMStream\" not available in this environment`);\n },\n // @ts-ignore\n toNodeStream(source: Iterable | AsyncIterable, options?: import('stream').ReadableOptions): import('stream').Readable {\n throw new Error(`\"toNodeStream\" not available in this environment`);\n },\n};\n\n/** @ignore */\nconst pump = | AsyncIterator>(iterator: T) => { iterator.next(); return iterator; };\n\n/** @ignore */\nfunction* fromIterable(source: Iterable | T): IterableIterator {\n\n let done: boolean, threw = false;\n let buffers: Uint8Array[] = [], buffer: Uint8Array;\n let cmd: 'peek' | 'read', size: number, bufferLength = 0;\n\n function byteRange() {\n if (cmd === 'peek') {\n return joinUint8Arrays(buffers, size)[0];\n }\n [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);\n return buffer;\n }\n\n // Yield so the caller can inject the read command before creating the source Iterator\n ({ cmd, size } = yield null);\n\n // initialize the iterator\n let it = toUint8ArrayIterator(source)[Symbol.iterator]();\n\n try {\n do {\n // read the next value\n ({ done, value: buffer } = isNaN(size - bufferLength) ?\n it.next(undefined) : it.next(size - bufferLength));\n // if chunk is not null or empty, push it onto the queue\n if (!done && buffer.byteLength > 0) {\n buffers.push(buffer);\n bufferLength += buffer.byteLength;\n }\n // If we have enough bytes in our buffer, yield chunks until we don't\n if (done || size <= bufferLength) {\n do {\n ({ cmd, size } = yield byteRange());\n } while (size < bufferLength);\n }\n } while (!done);\n } catch (e) {\n (threw = true) && (typeof it.throw === 'function') && (it.throw(e));\n } finally {\n (threw === false) && (typeof it.return === 'function') && (it.return());\n }\n}\n\n/** @ignore */\nasync function* fromAsyncIterable(source: AsyncIterable | PromiseLike): AsyncIterableIterator {\n\n let done: boolean, threw = false;\n let buffers: Uint8Array[] = [], buffer: Uint8Array;\n let cmd: 'peek' | 'read', size: number, bufferLength = 0;\n\n function byteRange() {\n if (cmd === 'peek') {\n return joinUint8Arrays(buffers, size)[0];\n }\n [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);\n return buffer;\n }\n\n // Yield so the caller can inject the read command before creating the source AsyncIterator\n ({ cmd, size } = yield null);\n\n // initialize the iterator\n let it = toUint8ArrayAsyncIterator(source)[Symbol.asyncIterator]();\n\n try {\n do {\n // read the next value\n ({ done, value: buffer } = isNaN(size - bufferLength)\n ? await it.next(undefined)\n : await it.next(size - bufferLength));\n // if chunk is not null or empty, push it onto the queue\n if (!done && buffer.byteLength > 0) {\n buffers.push(buffer);\n bufferLength += buffer.byteLength;\n }\n // If we have enough bytes in our buffer, yield chunks until we don't\n if (done || size <= bufferLength) {\n do {\n ({ cmd, size } = yield byteRange());\n } while (size < bufferLength);\n }\n } while (!done);\n } catch (e) {\n (threw = true) && (typeof it.throw === 'function') && (await it.throw(e));\n } finally {\n (threw === false) && (typeof it.return === 'function') && (await it.return());\n }\n}\n\n// All this manual Uint8Array chunk management can be avoided if/when engines\n// add support for ArrayBuffer.transfer() or ArrayBuffer.prototype.realloc():\n// https://github.com/domenic/proposal-arraybuffer-transfer\n/** @ignore */\nasync function* fromDOMStream(source: ReadableStream): AsyncIterableIterator {\n\n let done = false, threw = false;\n let buffers: Uint8Array[] = [], buffer: Uint8Array;\n let cmd: 'peek' | 'read', size: number, bufferLength = 0;\n\n function byteRange() {\n if (cmd === 'peek') {\n return joinUint8Arrays(buffers, size)[0];\n }\n [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);\n return buffer;\n }\n\n // Yield so the caller can inject the read command before we establish the ReadableStream lock\n ({ cmd, size } = yield null);\n\n // initialize the reader and lock the stream\n let it = new AdaptiveByteReader(source);\n\n try {\n do {\n // read the next value\n ({ done, value: buffer } = isNaN(size - bufferLength)\n ? await it['read'](undefined)\n : await it['read'](size - bufferLength));\n // if chunk is not null or empty, push it onto the queue\n if (!done && buffer.byteLength > 0) {\n buffers.push(toUint8Array(buffer));\n bufferLength += buffer.byteLength;\n }\n // If we have enough bytes in our buffer, yield chunks until we don't\n if (done || size <= bufferLength) {\n do {\n ({ cmd, size } = yield byteRange());\n } while (size < bufferLength);\n }\n } while (!done);\n } catch (e) {\n (threw = true) && (await it['cancel'](e));\n } finally {\n (threw === false) ? (await it['cancel']())\n : source['locked'] && it.releaseLock();\n }\n}\n\n/** @ignore */\nclass AdaptiveByteReader {\n\n private supportsBYOB: boolean;\n private byobReader: ReadableStreamBYOBReader | null = null;\n private defaultReader: ReadableStreamDefaultReader | null = null;\n private reader: ReadableStreamBYOBReader | ReadableStreamDefaultReader | null;\n\n constructor(private source: ReadableStream) {\n try {\n this.supportsBYOB = !!(this.reader = this.getBYOBReader());\n } catch (e) {\n this.supportsBYOB = !!!(this.reader = this.getDefaultReader());\n }\n }\n\n get closed(): Promise {\n return this.reader ? this.reader['closed'].catch(() => {}) : Promise.resolve();\n }\n\n releaseLock(): void {\n if (this.reader) {\n this.reader.releaseLock();\n }\n this.reader = this.byobReader = this.defaultReader = null;\n }\n\n async cancel(reason?: any): Promise {\n const { reader, source } = this;\n reader && (await reader['cancel'](reason).catch(() => {}));\n source && (source['locked'] && this.releaseLock());\n }\n\n async read(size?: number): Promise> {\n if (size === 0) {\n return { done: this.reader == null, value: new Uint8Array(0) };\n }\n const result = !this.supportsBYOB || typeof size !== 'number'\n ? await this.getDefaultReader().read()\n : await this.readFromBYOBReader(size);\n !result.done && (result.value = toUint8Array(result as ReadableStreamReadResult));\n return result as ReadableStreamReadResult;\n }\n\n private getDefaultReader() {\n if (this.byobReader) { this.releaseLock(); }\n if (!this.defaultReader) {\n this.defaultReader = this.source['getReader']();\n // We have to catch and swallow errors here to avoid uncaught promise rejection exceptions\n // that seem to be raised when we call `releaseLock()` on this reader. I'm still mystified\n // about why these errors are raised, but I'm sure there's some important spec reason that\n // I haven't considered. I hate to employ such an anti-pattern here, but it seems like the\n // only solution in this case :/\n this.defaultReader['closed'].catch(() => {});\n }\n return (this.reader = this.defaultReader);\n }\n\n private getBYOBReader() {\n if (this.defaultReader) { this.releaseLock(); }\n if (!this.byobReader) {\n this.byobReader = this.source['getReader']({ mode: 'byob' });\n // We have to catch and swallow errors here to avoid uncaught promise rejection exceptions\n // that seem to be raised when we call `releaseLock()` on this reader. I'm still mystified\n // about why these errors are raised, but I'm sure there's some important spec reason that\n // I haven't considered. I hate to employ such an anti-pattern here, but it seems like the\n // only solution in this case :/\n this.byobReader['closed'].catch(() => {});\n }\n return (this.reader = this.byobReader);\n }\n\n // This strategy plucked from the example in the streams spec:\n // https://streams.spec.whatwg.org/#example-manual-read-bytes\n private async readFromBYOBReader(size: number) {\n return await readInto(this.getBYOBReader(), new ArrayBuffer(size), 0, size);\n }\n}\n\n/** @ignore */\nasync function readInto(reader: ReadableStreamBYOBReader, buffer: ArrayBufferLike, offset: number, size: number): Promise> {\n if (offset >= size) {\n return { done: false, value: new Uint8Array(buffer, 0, size) };\n }\n const { done, value } = await reader.read(new Uint8Array(buffer, offset, size - offset));\n if (((offset += value.byteLength) < size) && !done) {\n return await readInto(reader, value.buffer, offset, size);\n }\n return { done, value: new Uint8Array(value.buffer, 0, offset) };\n}\n\n/** @ignore */\ntype EventName = 'end' | 'error' | 'readable';\n/** @ignore */\ntype Event = [EventName, (_: any) => void, Promise<[EventName, Error | null]>];\n/** @ignore */\nconst onEvent = (stream: NodeJS.ReadableStream, event: T) => {\n let handler = (_: any) => resolve([event, _]);\n let resolve: (value?: [T, any] | PromiseLike<[T, any]>) => void;\n return [event, handler, new Promise<[T, any]>(\n (r) => (resolve = r) && stream['once'](event, handler)\n )] as Event;\n};\n\n/** @ignore */\nasync function* fromNodeStream(stream: NodeJS.ReadableStream): AsyncIterableIterator {\n\n let events: Event[] = [];\n let event: EventName = 'error';\n let done = false, err: Error | null = null;\n let cmd: 'peek' | 'read', size: number, bufferLength = 0;\n let buffers: Uint8Array[] = [], buffer: Uint8Array | Buffer | string;\n\n function byteRange() {\n if (cmd === 'peek') {\n return joinUint8Arrays(buffers, size)[0];\n }\n [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);\n return buffer;\n }\n\n // Yield so the caller can inject the read command before we\n // add the listener for the source stream's 'readable' event.\n ({ cmd, size } = yield null);\n\n // ignore stdin if it's a TTY\n if ((stream as any)['isTTY']) { return yield new Uint8Array(0); }\n\n try {\n // initialize the stream event handlers\n events[0] = onEvent(stream, 'end');\n events[1] = onEvent(stream, 'error');\n\n do {\n events[2] = onEvent(stream, 'readable');\n\n // wait on the first message event from the stream\n [event, err] = await Promise.race(events.map((x) => x[2]));\n\n // if the stream emitted an Error, rethrow it\n if (event === 'error') { break; }\n if (!(done = event === 'end')) {\n // If the size is NaN, request to read everything in the stream's internal buffer\n if (!isFinite(size - bufferLength)) {\n buffer = toUint8Array(stream['read'](undefined));\n } else {\n buffer = toUint8Array(stream['read'](size - bufferLength));\n // If the byteLength is 0, then the requested amount is more than the stream has\n // in its internal buffer. In this case the stream needs a \"kick\" to tell it to\n // continue emitting readable events, so request to read everything the stream\n // has in its internal buffer right now.\n if (buffer.byteLength < (size - bufferLength)) {\n buffer = toUint8Array(stream['read'](undefined));\n }\n }\n // if chunk is not null or empty, push it onto the queue\n if (buffer.byteLength > 0) {\n buffers.push(buffer);\n bufferLength += buffer.byteLength;\n }\n }\n // If we have enough bytes in our buffer, yield chunks until we don't\n if (done || size <= bufferLength) {\n do {\n ({ cmd, size } = yield byteRange());\n } while (size < bufferLength);\n }\n } while (!done);\n } finally {\n await cleanup(events, event === 'error' ? err : null);\n }\n\n function cleanup(events: Event[], err?: T) {\n buffer = buffers = null;\n return new Promise(async (resolve, reject) => {\n for (const [evt, fn] of events) {\n stream['off'](evt, fn);\n }\n try {\n // Some stream implementations don't call the destroy callback,\n // because it's really a node-internal API. Just calling `destroy`\n // here should be enough to conform to the ReadableStream contract\n const destroy = (stream as any)['destroy'];\n destroy && destroy.call(stream, err);\n err = undefined;\n } catch (e) { err = e || err; } finally {\n err != null ? reject(err) : resolve();\n }\n });\n }\n}\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","import superPropBase from \"./superPropBase\";\nexport default function _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nexport default function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { DataType } from './type';\nimport { Chunked } from './vector/chunked';\n\n/** @ignore */\nexport interface Clonable {\n clone(...args: any[]): R;\n}\n\n/** @ignore */\nexport interface Sliceable {\n slice(begin?: number, end?: number): R;\n}\n\n/** @ignore */\nexport interface Applicative {\n concat(...others: Vector[]): R;\n readonly [Symbol.isConcatSpreadable]: boolean;\n}\n\nexport interface AbstractVector\n extends Clonable>,\n Sliceable>,\n Applicative> {\n\n readonly TType: T['TType'];\n readonly TArray: T['TArray'];\n readonly TValue: T['TValue'];\n}\n\nexport abstract class AbstractVector implements Iterable {\n\n public abstract readonly data: Data;\n public abstract readonly type: T;\n public abstract readonly typeId: T['TType'];\n public abstract readonly length: number;\n public abstract readonly stride: number;\n public abstract readonly nullCount: number;\n public abstract readonly byteLength: number;\n public abstract readonly numChildren: number;\n\n public abstract readonly ArrayType: T['ArrayType'];\n\n public abstract isValid(index: number): boolean;\n public abstract get(index: number): T['TValue'] | null;\n public abstract set(index: number, value: T['TValue'] | null): void;\n public abstract indexOf(value: T['TValue'] | null, fromIndex?: number): number;\n public abstract [Symbol.iterator](): IterableIterator;\n\n public abstract toArray(): T['TArray'];\n public abstract getChildAt(index: number): Vector | null;\n}\n\nexport { AbstractVector as Vector };\n","/* tslint:disable:class-name */\n\n// automatically generated by the FlatBuffers compiler, do not modify\n\nimport { flatbuffers } from 'flatbuffers';\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum MetadataVersion {\n /**\n * 0.1.0\n */\n V1 = 0,\n\n /**\n * 0.2.0\n */\n V2 = 1,\n\n /**\n * 0.3.0 -> 0.7.1\n */\n V3 = 2,\n\n /**\n * >= 0.8.0\n */\n V4 = 3\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum UnionMode {\n Sparse = 0,\n Dense = 1\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum Precision {\n HALF = 0,\n SINGLE = 1,\n DOUBLE = 2\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum DateUnit {\n DAY = 0,\n MILLISECOND = 1\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum TimeUnit {\n SECOND = 0,\n MILLISECOND = 1,\n MICROSECOND = 2,\n NANOSECOND = 3\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum IntervalUnit {\n YEAR_MONTH = 0,\n DAY_TIME = 1\n }\n}\n\n/**\n * ----------------------------------------------------------------------\n * Top-level Type value, enabling extensible type-specific metadata. We can\n * add new logical types to Type without breaking backwards compatibility\n *\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum Type {\n NONE = 0,\n Null = 1,\n Int = 2,\n FloatingPoint = 3,\n Binary = 4,\n Utf8 = 5,\n Bool = 6,\n Decimal = 7,\n Date = 8,\n Time = 9,\n Timestamp = 10,\n Interval = 11,\n List = 12,\n Struct_ = 13,\n Union = 14,\n FixedSizeBinary = 15,\n FixedSizeList = 16,\n Map = 17,\n Duration = 18,\n LargeBinary = 19,\n LargeUtf8 = 20,\n LargeList = 21\n }\n}\n\n/**\n * ----------------------------------------------------------------------\n * Endianness of the platform producing the data\n *\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum Endianness {\n Little = 0,\n Big = 1\n }\n}\n\n/**\n * These are stored in the flatbuffer in the Type union below\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Null {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Null\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Null {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Null= obj\n * @returns Null\n */\n static getRootAsNull(bb: flatbuffers.ByteBuffer, obj?: Null): Null {\n return (obj || new Null).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startNull(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endNull(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createNull(builder: flatbuffers.Builder): flatbuffers.Offset {\n Null.startNull(builder);\n return Null.endNull(builder);\n }\n }\n}\n/**\n * A Struct_ in the flatbuffer metadata is the same as an Arrow Struct\n * (according to the physical memory layout). We used Struct_ here as\n * Struct is a reserved word in Flatbuffers\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Struct_ {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Struct_\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Struct_ {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Struct_= obj\n * @returns Struct_\n */\n static getRootAsStruct_(bb: flatbuffers.ByteBuffer, obj?: Struct_): Struct_ {\n return (obj || new Struct_).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startStruct_(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endStruct_(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createStruct_(builder: flatbuffers.Builder): flatbuffers.Offset {\n Struct_.startStruct_(builder);\n return Struct_.endStruct_(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class List {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns List\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): List {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param List= obj\n * @returns List\n */\n static getRootAsList(bb: flatbuffers.ByteBuffer, obj?: List): List {\n return (obj || new List).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startList(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endList(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createList(builder: flatbuffers.Builder): flatbuffers.Offset {\n List.startList(builder);\n return List.endList(builder);\n }\n }\n}\n/**\n * Same as List, but with 64-bit offsets, allowing to represent\n * extremely large data values.\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class LargeList {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns LargeList\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): LargeList {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param LargeList= obj\n * @returns LargeList\n */\n static getRootAsLargeList(bb: flatbuffers.ByteBuffer, obj?: LargeList): LargeList {\n return (obj || new LargeList).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startLargeList(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endLargeList(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createLargeList(builder: flatbuffers.Builder): flatbuffers.Offset {\n LargeList.startLargeList(builder);\n return LargeList.endLargeList(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class FixedSizeList {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns FixedSizeList\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): FixedSizeList {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param FixedSizeList= obj\n * @returns FixedSizeList\n */\n static getRootAsFixedSizeList(bb: flatbuffers.ByteBuffer, obj?: FixedSizeList): FixedSizeList {\n return (obj || new FixedSizeList).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * Number of list items per value\n *\n * @returns number\n */\n listSize(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startFixedSizeList(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number listSize\n */\n static addListSize(builder: flatbuffers.Builder, listSize: number) {\n builder.addFieldInt32(0, listSize, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endFixedSizeList(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createFixedSizeList(builder: flatbuffers.Builder, listSize: number): flatbuffers.Offset {\n FixedSizeList.startFixedSizeList(builder);\n FixedSizeList.addListSize(builder, listSize);\n return FixedSizeList.endFixedSizeList(builder);\n }\n }\n}\n/**\n * A Map is a logical nested type that is represented as\n *\n * List>\n *\n * In this layout, the keys and values are each respectively contiguous. We do\n * not constrain the key and value types, so the application is responsible\n * for ensuring that the keys are hashable and unique. Whether the keys are sorted\n * may be set in the metadata for this field\n *\n * In a Field with Map type, the Field has a child Struct field, which then\n * has two children: key type and the second the value type. The names of the\n * child fields may be respectively \"entry\", \"key\", and \"value\", but this is\n * not enforced\n *\n * Map\n * - child[0] entry: Struct\n * - child[0] key: K\n * - child[1] value: V\n *\n * Neither the \"entry\" field nor the \"key\" field may be nullable.\n *\n * The metadata is structured so that Arrow systems without special handling\n * for Map can make Map an alias for List. The \"layout\" attribute for the Map\n * field must have the same contents as a List.\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Map {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Map\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Map {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Map= obj\n * @returns Map\n */\n static getRootAsMap(bb: flatbuffers.ByteBuffer, obj?: Map): Map {\n return (obj || new Map).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * Set to true if the keys within each value are sorted\n *\n * @returns boolean\n */\n keysSorted(): boolean {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startMap(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param boolean keysSorted\n */\n static addKeysSorted(builder: flatbuffers.Builder, keysSorted: boolean) {\n builder.addFieldInt8(0, +keysSorted, +false);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endMap(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createMap(builder: flatbuffers.Builder, keysSorted: boolean): flatbuffers.Offset {\n Map.startMap(builder);\n Map.addKeysSorted(builder, keysSorted);\n return Map.endMap(builder);\n }\n }\n}\n/**\n * A union is a complex type with children in Field\n * By default ids in the type vector refer to the offsets in the children\n * optionally typeIds provides an indirection between the child offset and the type id\n * for each child typeIds[offset] is the id used in the type vector\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Union {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Union\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Union {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Union= obj\n * @returns Union\n */\n static getRootAsUnion(bb: flatbuffers.ByteBuffer, obj?: Union): Union {\n return (obj || new Union).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.UnionMode\n */\n mode(): org.apache.arrow.flatbuf.UnionMode {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.UnionMode.Sparse;\n }\n\n /**\n * @param number index\n * @returns number\n */\n typeIds(index: number): number | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;\n }\n\n /**\n * @returns number\n */\n typeIdsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns Int32Array\n */\n typeIdsArray(): Int32Array | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startUnion(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.UnionMode mode\n */\n static addMode(builder: flatbuffers.Builder, mode: org.apache.arrow.flatbuf.UnionMode) {\n builder.addFieldInt16(0, mode, org.apache.arrow.flatbuf.UnionMode.Sparse);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset typeIdsOffset\n */\n static addTypeIds(builder: flatbuffers.Builder, typeIdsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, typeIdsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createTypeIdsVector(builder: flatbuffers.Builder, data: number[] | Int32Array): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt32(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startTypeIdsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endUnion(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createUnion(builder: flatbuffers.Builder, mode: org.apache.arrow.flatbuf.UnionMode, typeIdsOffset: flatbuffers.Offset): flatbuffers.Offset {\n Union.startUnion(builder);\n Union.addMode(builder, mode);\n Union.addTypeIds(builder, typeIdsOffset);\n return Union.endUnion(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Int {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Int\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Int {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Int= obj\n * @returns Int\n */\n static getRootAsInt(bb: flatbuffers.ByteBuffer, obj?: Int): Int {\n return (obj || new Int).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns number\n */\n bitWidth(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns boolean\n */\n isSigned(): boolean {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startInt(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number bitWidth\n */\n static addBitWidth(builder: flatbuffers.Builder, bitWidth: number) {\n builder.addFieldInt32(0, bitWidth, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param boolean isSigned\n */\n static addIsSigned(builder: flatbuffers.Builder, isSigned: boolean) {\n builder.addFieldInt8(1, +isSigned, +false);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endInt(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createInt(builder: flatbuffers.Builder, bitWidth: number, isSigned: boolean): flatbuffers.Offset {\n Int.startInt(builder);\n Int.addBitWidth(builder, bitWidth);\n Int.addIsSigned(builder, isSigned);\n return Int.endInt(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class FloatingPoint {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns FloatingPoint\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): FloatingPoint {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param FloatingPoint= obj\n * @returns FloatingPoint\n */\n static getRootAsFloatingPoint(bb: flatbuffers.ByteBuffer, obj?: FloatingPoint): FloatingPoint {\n return (obj || new FloatingPoint).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.Precision\n */\n precision(): org.apache.arrow.flatbuf.Precision {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Precision.HALF;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startFloatingPoint(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.Precision precision\n */\n static addPrecision(builder: flatbuffers.Builder, precision: org.apache.arrow.flatbuf.Precision) {\n builder.addFieldInt16(0, precision, org.apache.arrow.flatbuf.Precision.HALF);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endFloatingPoint(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createFloatingPoint(builder: flatbuffers.Builder, precision: org.apache.arrow.flatbuf.Precision): flatbuffers.Offset {\n FloatingPoint.startFloatingPoint(builder);\n FloatingPoint.addPrecision(builder, precision);\n return FloatingPoint.endFloatingPoint(builder);\n }\n }\n}\n/**\n * Unicode with UTF-8 encoding\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Utf8 {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Utf8\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Utf8 {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Utf8= obj\n * @returns Utf8\n */\n static getRootAsUtf8(bb: flatbuffers.ByteBuffer, obj?: Utf8): Utf8 {\n return (obj || new Utf8).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startUtf8(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endUtf8(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createUtf8(builder: flatbuffers.Builder): flatbuffers.Offset {\n Utf8.startUtf8(builder);\n return Utf8.endUtf8(builder);\n }\n }\n}\n/**\n * Opaque binary data\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Binary {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Binary\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Binary {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Binary= obj\n * @returns Binary\n */\n static getRootAsBinary(bb: flatbuffers.ByteBuffer, obj?: Binary): Binary {\n return (obj || new Binary).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startBinary(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endBinary(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createBinary(builder: flatbuffers.Builder): flatbuffers.Offset {\n Binary.startBinary(builder);\n return Binary.endBinary(builder);\n }\n }\n}\n/**\n * Same as Utf8, but with 64-bit offsets, allowing to represent\n * extremely large data values.\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class LargeUtf8 {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns LargeUtf8\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): LargeUtf8 {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param LargeUtf8= obj\n * @returns LargeUtf8\n */\n static getRootAsLargeUtf8(bb: flatbuffers.ByteBuffer, obj?: LargeUtf8): LargeUtf8 {\n return (obj || new LargeUtf8).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startLargeUtf8(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endLargeUtf8(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createLargeUtf8(builder: flatbuffers.Builder): flatbuffers.Offset {\n LargeUtf8.startLargeUtf8(builder);\n return LargeUtf8.endLargeUtf8(builder);\n }\n }\n}\n/**\n * Same as Binary, but with 64-bit offsets, allowing to represent\n * extremely large data values.\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class LargeBinary {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns LargeBinary\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): LargeBinary {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param LargeBinary= obj\n * @returns LargeBinary\n */\n static getRootAsLargeBinary(bb: flatbuffers.ByteBuffer, obj?: LargeBinary): LargeBinary {\n return (obj || new LargeBinary).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startLargeBinary(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endLargeBinary(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createLargeBinary(builder: flatbuffers.Builder): flatbuffers.Offset {\n LargeBinary.startLargeBinary(builder);\n return LargeBinary.endLargeBinary(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class FixedSizeBinary {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns FixedSizeBinary\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): FixedSizeBinary {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param FixedSizeBinary= obj\n * @returns FixedSizeBinary\n */\n static getRootAsFixedSizeBinary(bb: flatbuffers.ByteBuffer, obj?: FixedSizeBinary): FixedSizeBinary {\n return (obj || new FixedSizeBinary).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * Number of bytes per value\n *\n * @returns number\n */\n byteWidth(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startFixedSizeBinary(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number byteWidth\n */\n static addByteWidth(builder: flatbuffers.Builder, byteWidth: number) {\n builder.addFieldInt32(0, byteWidth, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endFixedSizeBinary(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createFixedSizeBinary(builder: flatbuffers.Builder, byteWidth: number): flatbuffers.Offset {\n FixedSizeBinary.startFixedSizeBinary(builder);\n FixedSizeBinary.addByteWidth(builder, byteWidth);\n return FixedSizeBinary.endFixedSizeBinary(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Bool {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Bool\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Bool {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Bool= obj\n * @returns Bool\n */\n static getRootAsBool(bb: flatbuffers.ByteBuffer, obj?: Bool): Bool {\n return (obj || new Bool).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startBool(builder: flatbuffers.Builder) {\n builder.startObject(0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endBool(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createBool(builder: flatbuffers.Builder): flatbuffers.Offset {\n Bool.startBool(builder);\n return Bool.endBool(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Decimal {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Decimal\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Decimal {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Decimal= obj\n * @returns Decimal\n */\n static getRootAsDecimal(bb: flatbuffers.ByteBuffer, obj?: Decimal): Decimal {\n return (obj || new Decimal).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * Total number of decimal digits\n *\n * @returns number\n */\n precision(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * Number of digits after the decimal point \".\"\n *\n * @returns number\n */\n scale(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDecimal(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number precision\n */\n static addPrecision(builder: flatbuffers.Builder, precision: number) {\n builder.addFieldInt32(0, precision, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number scale\n */\n static addScale(builder: flatbuffers.Builder, scale: number) {\n builder.addFieldInt32(1, scale, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDecimal(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDecimal(builder: flatbuffers.Builder, precision: number, scale: number): flatbuffers.Offset {\n Decimal.startDecimal(builder);\n Decimal.addPrecision(builder, precision);\n Decimal.addScale(builder, scale);\n return Decimal.endDecimal(builder);\n }\n }\n}\n/**\n * Date is either a 32-bit or 64-bit type representing elapsed time since UNIX\n * epoch (1970-01-01), stored in either of two units:\n *\n * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no\n * leap seconds), where the values are evenly divisible by 86400000\n * * Days (32 bits) since the UNIX epoch\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Date {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Date\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Date {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Date= obj\n * @returns Date\n */\n static getRootAsDate(bb: flatbuffers.ByteBuffer, obj?: Date): Date {\n return (obj || new Date).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.DateUnit\n */\n unit(): org.apache.arrow.flatbuf.DateUnit {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.DateUnit.MILLISECOND;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDate(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.DateUnit unit\n */\n static addUnit(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.DateUnit) {\n builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.DateUnit.MILLISECOND);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDate(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDate(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.DateUnit): flatbuffers.Offset {\n Date.startDate(builder);\n Date.addUnit(builder, unit);\n return Date.endDate(builder);\n }\n }\n}\n/**\n * Time type. The physical storage type depends on the unit\n * - SECOND and MILLISECOND: 32 bits\n * - MICROSECOND and NANOSECOND: 64 bits\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Time {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Time\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Time {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Time= obj\n * @returns Time\n */\n static getRootAsTime(bb: flatbuffers.ByteBuffer, obj?: Time): Time {\n return (obj || new Time).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.TimeUnit\n */\n unit(): org.apache.arrow.flatbuf.TimeUnit {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.MILLISECOND;\n }\n\n /**\n * @returns number\n */\n bitWidth(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 32;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startTime(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.TimeUnit unit\n */\n static addUnit(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit) {\n builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.MILLISECOND);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number bitWidth\n */\n static addBitWidth(builder: flatbuffers.Builder, bitWidth: number) {\n builder.addFieldInt32(1, bitWidth, 32);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endTime(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createTime(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit, bitWidth: number): flatbuffers.Offset {\n Time.startTime(builder);\n Time.addUnit(builder, unit);\n Time.addBitWidth(builder, bitWidth);\n return Time.endTime(builder);\n }\n }\n}\n/**\n * Time elapsed from the Unix epoch, 00:00:00.000 on 1 January 1970, excluding\n * leap seconds, as a 64-bit integer. Note that UNIX time does not include\n * leap seconds.\n *\n * The Timestamp metadata supports both \"time zone naive\" and \"time zone\n * aware\" timestamps. Read about the timezone attribute for more detail\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Timestamp {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Timestamp\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Timestamp {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Timestamp= obj\n * @returns Timestamp\n */\n static getRootAsTimestamp(bb: flatbuffers.ByteBuffer, obj?: Timestamp): Timestamp {\n return (obj || new Timestamp).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.TimeUnit\n */\n unit(): org.apache.arrow.flatbuf.TimeUnit {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.SECOND;\n }\n\n /**\n * The time zone is a string indicating the name of a time zone, one of:\n *\n * * As used in the Olson time zone database (the \"tz database\" or\n * \"tzdata\"), such as \"America/New_York\"\n * * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30\n *\n * Whether a timezone string is present indicates different semantics about\n * the data:\n *\n * * If the time zone is null or equal to an empty string, the data is \"time\n * zone naive\" and shall be displayed *as is* to the user, not localized\n * to the locale of the user. This data can be though of as UTC but\n * without having \"UTC\" as the time zone, it is not considered to be\n * localized to any time zone\n *\n * * If the time zone is set to a valid value, values can be displayed as\n * \"localized\" to that time zone, even though the underlying 64-bit\n * integers are identical to the same data stored in UTC. Converting\n * between time zones is a metadata-only operation and does not change the\n * underlying values\n *\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n timezone(): string | null;\n timezone(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;\n timezone(optionalEncoding?: any): string | Uint8Array | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startTimestamp(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.TimeUnit unit\n */\n static addUnit(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit) {\n builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.SECOND);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset timezoneOffset\n */\n static addTimezone(builder: flatbuffers.Builder, timezoneOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, timezoneOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endTimestamp(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createTimestamp(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit, timezoneOffset: flatbuffers.Offset): flatbuffers.Offset {\n Timestamp.startTimestamp(builder);\n Timestamp.addUnit(builder, unit);\n Timestamp.addTimezone(builder, timezoneOffset);\n return Timestamp.endTimestamp(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Interval {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Interval\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Interval {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Interval= obj\n * @returns Interval\n */\n static getRootAsInterval(bb: flatbuffers.ByteBuffer, obj?: Interval): Interval {\n return (obj || new Interval).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.IntervalUnit\n */\n unit(): org.apache.arrow.flatbuf.IntervalUnit {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startInterval(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.IntervalUnit unit\n */\n static addUnit(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.IntervalUnit) {\n builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endInterval(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createInterval(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.IntervalUnit): flatbuffers.Offset {\n Interval.startInterval(builder);\n Interval.addUnit(builder, unit);\n return Interval.endInterval(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Duration {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Duration\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Duration {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Duration= obj\n * @returns Duration\n */\n static getRootAsDuration(bb: flatbuffers.ByteBuffer, obj?: Duration): Duration {\n return (obj || new Duration).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.TimeUnit\n */\n unit(): org.apache.arrow.flatbuf.TimeUnit {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.MILLISECOND;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDuration(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.TimeUnit unit\n */\n static addUnit(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit) {\n builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.MILLISECOND);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDuration(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDuration(builder: flatbuffers.Builder, unit: org.apache.arrow.flatbuf.TimeUnit): flatbuffers.Offset {\n Duration.startDuration(builder);\n Duration.addUnit(builder, unit);\n return Duration.endDuration(builder);\n }\n }\n}\n/**\n * ----------------------------------------------------------------------\n * user defined key value pairs to add custom metadata to arrow\n * key namespacing is the responsibility of the user\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class KeyValue {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns KeyValue\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): KeyValue {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param KeyValue= obj\n * @returns KeyValue\n */\n static getRootAsKeyValue(bb: flatbuffers.ByteBuffer, obj?: KeyValue): KeyValue {\n return (obj || new KeyValue).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n key(): string | null;\n key(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;\n key(optionalEncoding?: any): string | Uint8Array | null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n value(): string | null;\n value(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;\n value(optionalEncoding?: any): string | Uint8Array | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startKeyValue(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset keyOffset\n */\n static addKey(builder: flatbuffers.Builder, keyOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, keyOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset valueOffset\n */\n static addValue(builder: flatbuffers.Builder, valueOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, valueOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endKeyValue(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createKeyValue(builder: flatbuffers.Builder, keyOffset: flatbuffers.Offset, valueOffset: flatbuffers.Offset): flatbuffers.Offset {\n KeyValue.startKeyValue(builder);\n KeyValue.addKey(builder, keyOffset);\n KeyValue.addValue(builder, valueOffset);\n return KeyValue.endKeyValue(builder);\n }\n }\n}\n/**\n * ----------------------------------------------------------------------\n * Dictionary encoding metadata\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class DictionaryEncoding {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns DictionaryEncoding\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): DictionaryEncoding {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param DictionaryEncoding= obj\n * @returns DictionaryEncoding\n */\n static getRootAsDictionaryEncoding(bb: flatbuffers.ByteBuffer, obj?: DictionaryEncoding): DictionaryEncoding {\n return (obj || new DictionaryEncoding).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * The known dictionary id in the application where this data is used. In\n * the file or streaming formats, the dictionary ids are found in the\n * DictionaryBatch messages\n *\n * @returns flatbuffers.Long\n */\n id(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * The dictionary indices are constrained to be positive integers. If this\n * field is null, the indices must be signed int32\n *\n * @param org.apache.arrow.flatbuf.Int= obj\n * @returns org.apache.arrow.flatbuf.Int|null\n */\n indexType(obj?: org.apache.arrow.flatbuf.Int): org.apache.arrow.flatbuf.Int | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new org.apache.arrow.flatbuf.Int).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;\n }\n\n /**\n * By default, dictionaries are not ordered, or the order does not have\n * semantic meaning. In some statistical, applications, dictionary-encoding\n * is used to represent ordered categorical data, and we provide a way to\n * preserve that metadata here\n *\n * @returns boolean\n */\n isOrdered(): boolean {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDictionaryEncoding(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long id\n */\n static addId(builder: flatbuffers.Builder, id: flatbuffers.Long) {\n builder.addFieldInt64(0, id, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset indexTypeOffset\n */\n static addIndexType(builder: flatbuffers.Builder, indexTypeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, indexTypeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param boolean isOrdered\n */\n static addIsOrdered(builder: flatbuffers.Builder, isOrdered: boolean) {\n builder.addFieldInt8(2, +isOrdered, +false);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDictionaryEncoding(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDictionaryEncoding(builder: flatbuffers.Builder, id: flatbuffers.Long, indexTypeOffset: flatbuffers.Offset, isOrdered: boolean): flatbuffers.Offset {\n DictionaryEncoding.startDictionaryEncoding(builder);\n DictionaryEncoding.addId(builder, id);\n DictionaryEncoding.addIndexType(builder, indexTypeOffset);\n DictionaryEncoding.addIsOrdered(builder, isOrdered);\n return DictionaryEncoding.endDictionaryEncoding(builder);\n }\n }\n}\n/**\n * ----------------------------------------------------------------------\n * A field represents a named column in a record / row batch or child of a\n * nested type.\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Field {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Field\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Field {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Field= obj\n * @returns Field\n */\n static getRootAsField(bb: flatbuffers.ByteBuffer, obj?: Field): Field {\n return (obj || new Field).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * Name is not required, in i.e. a List\n *\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n name(): string | null;\n name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;\n name(optionalEncoding?: any): string | Uint8Array | null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * Whether or not this field can contain nulls. Should be true in general.\n *\n * @returns boolean\n */\n nullable(): boolean {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.Type\n */\n typeType(): org.apache.arrow.flatbuf.Type {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? /** */ (this.bb!.readUint8(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Type.NONE;\n }\n\n /**\n * This is the type of the decoded value if the field is dictionary encoded.\n *\n * @param flatbuffers.Table obj\n * @returns ?flatbuffers.Table\n */\n type(obj: T): T | null {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;\n }\n\n /**\n * Present only if the field is dictionary encoded.\n *\n * @param org.apache.arrow.flatbuf.DictionaryEncoding= obj\n * @returns org.apache.arrow.flatbuf.DictionaryEncoding|null\n */\n dictionary(obj?: org.apache.arrow.flatbuf.DictionaryEncoding): org.apache.arrow.flatbuf.DictionaryEncoding | null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? (obj || new org.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;\n }\n\n /**\n * children apply only to nested data types like Struct, List and Union. For\n * primitive types children will have length 0.\n *\n * @param number index\n * @param org.apache.arrow.flatbuf.Field= obj\n * @returns org.apache.arrow.flatbuf.Field\n */\n children(index: number, obj?: org.apache.arrow.flatbuf.Field): org.apache.arrow.flatbuf.Field | null {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? (obj || new org.apache.arrow.flatbuf.Field).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n childrenLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * User-defined metadata\n *\n * @param number index\n * @param org.apache.arrow.flatbuf.KeyValue= obj\n * @returns org.apache.arrow.flatbuf.KeyValue\n */\n customMetadata(index: number, obj?: org.apache.arrow.flatbuf.KeyValue): org.apache.arrow.flatbuf.KeyValue | null {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? (obj || new org.apache.arrow.flatbuf.KeyValue).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n customMetadataLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startField(builder: flatbuffers.Builder) {\n builder.startObject(7);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nameOffset\n */\n static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param boolean nullable\n */\n static addNullable(builder: flatbuffers.Builder, nullable: boolean) {\n builder.addFieldInt8(1, +nullable, +false);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.Type typeType\n */\n static addTypeType(builder: flatbuffers.Builder, typeType: org.apache.arrow.flatbuf.Type) {\n builder.addFieldInt8(2, typeType, org.apache.arrow.flatbuf.Type.NONE);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset typeOffset\n */\n static addType(builder: flatbuffers.Builder, typeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(3, typeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dictionaryOffset\n */\n static addDictionary(builder: flatbuffers.Builder, dictionaryOffset: flatbuffers.Offset) {\n builder.addFieldOffset(4, dictionaryOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset childrenOffset\n */\n static addChildren(builder: flatbuffers.Builder, childrenOffset: flatbuffers.Offset) {\n builder.addFieldOffset(5, childrenOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createChildrenVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startChildrenVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset customMetadataOffset\n */\n static addCustomMetadata(builder: flatbuffers.Builder, customMetadataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(6, customMetadataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createCustomMetadataVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startCustomMetadataVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endField(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createField(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, nullable: boolean, typeType: org.apache.arrow.flatbuf.Type, typeOffset: flatbuffers.Offset, dictionaryOffset: flatbuffers.Offset, childrenOffset: flatbuffers.Offset, customMetadataOffset: flatbuffers.Offset): flatbuffers.Offset {\n Field.startField(builder);\n Field.addName(builder, nameOffset);\n Field.addNullable(builder, nullable);\n Field.addTypeType(builder, typeType);\n Field.addType(builder, typeOffset);\n Field.addDictionary(builder, dictionaryOffset);\n Field.addChildren(builder, childrenOffset);\n Field.addCustomMetadata(builder, customMetadataOffset);\n return Field.endField(builder);\n }\n }\n}\n/**\n * ----------------------------------------------------------------------\n * A Buffer represents a single contiguous memory segment\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Buffer {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Buffer\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Buffer {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * The relative offset into the shared memory page where the bytes for this\n * buffer starts\n *\n * @returns flatbuffers.Long\n */\n offset(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos);\n }\n\n /**\n * The absolute length (in bytes) of the memory buffer. The memory is found\n * from offset (inclusive) to offset + length (non-inclusive).\n *\n * @returns flatbuffers.Long\n */\n length(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos + 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long offset\n * @param flatbuffers.Long length\n * @returns flatbuffers.Offset\n */\n static createBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Long, length: flatbuffers.Long): flatbuffers.Offset {\n builder.prep(8, 16);\n builder.writeInt64(length);\n builder.writeInt64(offset);\n return builder.offset();\n }\n\n }\n}\n/**\n * ----------------------------------------------------------------------\n * A Schema describes the columns in a row batch\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Schema {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Schema\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Schema {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Schema= obj\n * @returns Schema\n */\n static getRootAsSchema(bb: flatbuffers.ByteBuffer, obj?: Schema): Schema {\n return (obj || new Schema).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * endianness of the buffer\n * it is Little Endian by default\n * if endianness doesn't match the underlying system then the vectors need to be converted\n *\n * @returns org.apache.arrow.flatbuf.Endianness\n */\n endianness(): org.apache.arrow.flatbuf.Endianness {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Endianness.Little;\n }\n\n /**\n * @param number index\n * @param org.apache.arrow.flatbuf.Field= obj\n * @returns org.apache.arrow.flatbuf.Field\n */\n fields(index: number, obj?: org.apache.arrow.flatbuf.Field): org.apache.arrow.flatbuf.Field | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new org.apache.arrow.flatbuf.Field).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n fieldsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param org.apache.arrow.flatbuf.KeyValue= obj\n * @returns org.apache.arrow.flatbuf.KeyValue\n */\n customMetadata(index: number, obj?: org.apache.arrow.flatbuf.KeyValue): org.apache.arrow.flatbuf.KeyValue | null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new org.apache.arrow.flatbuf.KeyValue).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n customMetadataLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startSchema(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.Endianness endianness\n */\n static addEndianness(builder: flatbuffers.Builder, endianness: org.apache.arrow.flatbuf.Endianness) {\n builder.addFieldInt16(0, endianness, org.apache.arrow.flatbuf.Endianness.Little);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset fieldsOffset\n */\n static addFields(builder: flatbuffers.Builder, fieldsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, fieldsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createFieldsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startFieldsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset customMetadataOffset\n */\n static addCustomMetadata(builder: flatbuffers.Builder, customMetadataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, customMetadataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createCustomMetadataVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startCustomMetadataVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endSchema(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset offset\n */\n static finishSchemaBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset) {\n builder.finish(offset);\n }\n\n static createSchema(builder: flatbuffers.Builder, endianness: org.apache.arrow.flatbuf.Endianness, fieldsOffset: flatbuffers.Offset, customMetadataOffset: flatbuffers.Offset): flatbuffers.Offset {\n Schema.startSchema(builder);\n Schema.addEndianness(builder, endianness);\n Schema.addFields(builder, fieldsOffset);\n Schema.addCustomMetadata(builder, customMetadataOffset);\n return Schema.endSchema(builder);\n }\n }\n}\n","// automatically generated by the FlatBuffers compiler, do not modify\n\nimport { flatbuffers } from 'flatbuffers';\nimport * as NS7624605610262437867 from './Schema';\nexport namespace org.apache.arrow.flatbuf {\n export import Schema = NS7624605610262437867.org.apache.arrow.flatbuf.Schema;\n}\n/**\n * ----------------------------------------------------------------------\n * The root Message type\n * This union enables us to easily send different message types without\n * redundant storage, and in the future we can easily add new message types.\n *\n * Arrow implementations do not need to implement all of the message types,\n * which may include experimental metadata types. For maximum compatibility,\n * it is best to send data using RecordBatch\n *\n * @enum {number}\n */\nexport namespace org.apache.arrow.flatbuf {\n export enum MessageHeader {\n NONE = 0,\n Schema = 1,\n DictionaryBatch = 2,\n RecordBatch = 3,\n Tensor = 4,\n SparseTensor = 5\n }\n}\n\n/**\n * ----------------------------------------------------------------------\n * Data structures for describing a table row batch (a collection of\n * equal-length Arrow arrays)\n * Metadata about a field at some level of a nested type tree (but not\n * its children).\n *\n * For example, a List with values [[1, 2, 3], null, [4], [5, 6], null]\n * would have {length: 5, null_count: 2} for its List node, and {length: 6,\n * null_count: 0} for its Int16 node, as separate FieldNode structs\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class FieldNode {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns FieldNode\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): FieldNode {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * The number of value slots in the Arrow array at this level of a nested\n * tree\n *\n * @returns flatbuffers.Long\n */\n length(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos);\n }\n\n /**\n * The number of observed nulls. Fields with null_count == 0 may choose not\n * to write their physical validity bitmap out as a materialized buffer,\n * instead setting the length of the bitmap buffer to 0.\n *\n * @returns flatbuffers.Long\n */\n nullCount(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos + 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long length\n * @param flatbuffers.Long null_count\n * @returns flatbuffers.Offset\n */\n static createFieldNode(builder: flatbuffers.Builder, length: flatbuffers.Long, null_count: flatbuffers.Long): flatbuffers.Offset {\n builder.prep(8, 16);\n builder.writeInt64(null_count);\n builder.writeInt64(length);\n return builder.offset();\n }\n\n }\n}\n/**\n * A data header describing the shared memory layout of a \"record\" or \"row\"\n * batch. Some systems call this a \"row batch\" internally and others a \"record\n * batch\".\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class RecordBatch {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns RecordBatch\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): RecordBatch {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param RecordBatch= obj\n * @returns RecordBatch\n */\n static getRootAsRecordBatch(bb: flatbuffers.ByteBuffer, obj?: RecordBatch): RecordBatch {\n return (obj || new RecordBatch).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * number of records / rows. The arrays in the batch should all have this\n * length\n *\n * @returns flatbuffers.Long\n */\n length(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * Nodes correspond to the pre-ordered flattened logical schema\n *\n * @param number index\n * @param org.apache.arrow.flatbuf.FieldNode= obj\n * @returns org.apache.arrow.flatbuf.FieldNode\n */\n nodes(index: number, obj?: org.apache.arrow.flatbuf.FieldNode): org.apache.arrow.flatbuf.FieldNode | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new org.apache.arrow.flatbuf.FieldNode).__init(this.bb!.__vector(this.bb_pos + offset) + index * 16, this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n nodesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * Buffers correspond to the pre-ordered flattened buffer tree\n *\n * The number of buffers appended to this list depends on the schema. For\n * example, most primitive arrays will have 2 buffers, 1 for the validity\n * bitmap and 1 for the values. For struct arrays, there will only be a\n * single buffer for the validity (nulls) bitmap\n *\n * @param number index\n * @param org.apache.arrow.flatbuf.Buffer= obj\n * @returns org.apache.arrow.flatbuf.Buffer\n */\n buffers(index: number, obj?: NS7624605610262437867.org.apache.arrow.flatbuf.Buffer): NS7624605610262437867.org.apache.arrow.flatbuf.Buffer | null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new NS7624605610262437867.org.apache.arrow.flatbuf.Buffer).__init(this.bb!.__vector(this.bb_pos + offset) + index * 16, this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n buffersLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startRecordBatch(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long length\n */\n static addLength(builder: flatbuffers.Builder, length: flatbuffers.Long) {\n builder.addFieldInt64(0, length, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nodesOffset\n */\n static addNodes(builder: flatbuffers.Builder, nodesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, nodesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startNodesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(16, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset buffersOffset\n */\n static addBuffers(builder: flatbuffers.Builder, buffersOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, buffersOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startBuffersVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(16, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endRecordBatch(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createRecordBatch(builder: flatbuffers.Builder, length: flatbuffers.Long, nodesOffset: flatbuffers.Offset, buffersOffset: flatbuffers.Offset): flatbuffers.Offset {\n RecordBatch.startRecordBatch(builder);\n RecordBatch.addLength(builder, length);\n RecordBatch.addNodes(builder, nodesOffset);\n RecordBatch.addBuffers(builder, buffersOffset);\n return RecordBatch.endRecordBatch(builder);\n }\n }\n}\n/**\n * For sending dictionary encoding information. Any Field can be\n * dictionary-encoded, but in this case none of its children may be\n * dictionary-encoded.\n * There is one vector / column per dictionary, but that vector / column\n * may be spread across multiple dictionary batches by using the isDelta\n * flag\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class DictionaryBatch {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns DictionaryBatch\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): DictionaryBatch {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param DictionaryBatch= obj\n * @returns DictionaryBatch\n */\n static getRootAsDictionaryBatch(bb: flatbuffers.ByteBuffer, obj?: DictionaryBatch): DictionaryBatch {\n return (obj || new DictionaryBatch).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns flatbuffers.Long\n */\n id(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param org.apache.arrow.flatbuf.RecordBatch= obj\n * @returns org.apache.arrow.flatbuf.RecordBatch|null\n */\n data(obj?: org.apache.arrow.flatbuf.RecordBatch): org.apache.arrow.flatbuf.RecordBatch | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new org.apache.arrow.flatbuf.RecordBatch).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;\n }\n\n /**\n * If isDelta is true the values in the dictionary are to be appended to a\n * dictionary with the indicated id\n *\n * @returns boolean\n */\n isDelta(): boolean {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDictionaryBatch(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long id\n */\n static addId(builder: flatbuffers.Builder, id: flatbuffers.Long) {\n builder.addFieldInt64(0, id, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dataOffset\n */\n static addData(builder: flatbuffers.Builder, dataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, dataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param boolean isDelta\n */\n static addIsDelta(builder: flatbuffers.Builder, isDelta: boolean) {\n builder.addFieldInt8(2, +isDelta, +false);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDictionaryBatch(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDictionaryBatch(builder: flatbuffers.Builder, id: flatbuffers.Long, dataOffset: flatbuffers.Offset, isDelta: boolean): flatbuffers.Offset {\n DictionaryBatch.startDictionaryBatch(builder);\n DictionaryBatch.addId(builder, id);\n DictionaryBatch.addData(builder, dataOffset);\n DictionaryBatch.addIsDelta(builder, isDelta);\n return DictionaryBatch.endDictionaryBatch(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Message {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Message\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Message {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Message= obj\n * @returns Message\n */\n static getRootAsMessage(bb: flatbuffers.ByteBuffer, obj?: Message): Message {\n return (obj || new Message).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.MetadataVersion\n */\n version(): NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion.V1;\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.MessageHeader\n */\n headerType(): org.apache.arrow.flatbuf.MessageHeader {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? /** */ (this.bb!.readUint8(this.bb_pos + offset)) : org.apache.arrow.flatbuf.MessageHeader.NONE;\n }\n\n /**\n * @param flatbuffers.Table obj\n * @returns ?flatbuffers.Table\n */\n header(obj: T): T | null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;\n }\n\n /**\n * @returns flatbuffers.Long\n */\n bodyLength(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param number index\n * @param org.apache.arrow.flatbuf.KeyValue= obj\n * @returns org.apache.arrow.flatbuf.KeyValue\n */\n customMetadata(index: number, obj?: NS7624605610262437867.org.apache.arrow.flatbuf.KeyValue): NS7624605610262437867.org.apache.arrow.flatbuf.KeyValue | null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? (obj || new NS7624605610262437867.org.apache.arrow.flatbuf.KeyValue).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n customMetadataLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startMessage(builder: flatbuffers.Builder) {\n builder.startObject(5);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.MetadataVersion version\n */\n static addVersion(builder: flatbuffers.Builder, version: NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion) {\n builder.addFieldInt16(0, version, NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion.V1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.MessageHeader headerType\n */\n static addHeaderType(builder: flatbuffers.Builder, headerType: org.apache.arrow.flatbuf.MessageHeader) {\n builder.addFieldInt8(1, headerType, org.apache.arrow.flatbuf.MessageHeader.NONE);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset headerOffset\n */\n static addHeader(builder: flatbuffers.Builder, headerOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, headerOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long bodyLength\n */\n static addBodyLength(builder: flatbuffers.Builder, bodyLength: flatbuffers.Long) {\n builder.addFieldInt64(3, bodyLength, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset customMetadataOffset\n */\n static addCustomMetadata(builder: flatbuffers.Builder, customMetadataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(4, customMetadataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createCustomMetadataVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startCustomMetadataVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endMessage(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset offset\n */\n static finishMessageBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset) {\n builder.finish(offset);\n }\n\n static createMessage(builder: flatbuffers.Builder, version: NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion, headerType: org.apache.arrow.flatbuf.MessageHeader, headerOffset: flatbuffers.Offset, bodyLength: flatbuffers.Long, customMetadataOffset: flatbuffers.Offset): flatbuffers.Offset {\n Message.startMessage(builder);\n Message.addVersion(builder, version);\n Message.addHeaderType(builder, headerType);\n Message.addHeader(builder, headerOffset);\n Message.addBodyLength(builder, bodyLength);\n Message.addCustomMetadata(builder, customMetadataOffset);\n return Message.endMessage(builder);\n }\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport * as Schema_ from './fb/Schema';\nimport * as Message_ from './fb/Message';\n\nexport import ArrowType = Schema_.org.apache.arrow.flatbuf.Type;\nexport import DateUnit = Schema_.org.apache.arrow.flatbuf.DateUnit;\nexport import TimeUnit = Schema_.org.apache.arrow.flatbuf.TimeUnit;\nexport import Precision = Schema_.org.apache.arrow.flatbuf.Precision;\nexport import UnionMode = Schema_.org.apache.arrow.flatbuf.UnionMode;\nexport import IntervalUnit = Schema_.org.apache.arrow.flatbuf.IntervalUnit;\nexport import MessageHeader = Message_.org.apache.arrow.flatbuf.MessageHeader;\nexport import MetadataVersion = Schema_.org.apache.arrow.flatbuf.MetadataVersion;\n\n/**\n * Main data type enumeration.\n *\n * Data types in this library are all *logical*. They can be expressed as\n * either a primitive physical type (bytes or bits of some fixed size), a\n * nested type consisting of other data types, or another data type (e.g. a\n * timestamp encoded as an int64).\n *\n * **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow\n * IPC payload.\n *\n * The rest of the values are specified here so TypeScript can narrow the type\n * signatures further beyond the base Arrow Types. The Arrow DataTypes include\n * metadata like `bitWidth` that impact the type signatures of the values we\n * accept and return.\n *\n * For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an\n * `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`\n * reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the\n * underlying `Int32Array`.\n *\n * Library consumers benefit by knowing the narrowest type, since we can ensure\n * the types across all public methods are propagated, and never bail to `any`.\n * These values are _never_ used at runtime, and they will _never_ be written\n * to the flatbuffers metadata of serialized Arrow IPC payloads.\n */\nexport enum Type {\n /** The default placeholder type */\n NONE = 0,\n /** A NULL type having no physical storage */\n Null = 1,\n /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */\n Int = 2,\n /** 2, 4, or 8-byte floating point value */\n Float = 3,\n /** Variable-length bytes (no guarantee of UTF8-ness) */\n Binary = 4,\n /** UTF8 variable-length string as List */\n Utf8 = 5,\n /** Boolean as 1 bit, LSB bit-packed ordering */\n Bool = 6,\n /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */\n Decimal = 7,\n /** int32_t days or int64_t milliseconds since the UNIX epoch */\n Date = 8,\n /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */\n Time = 9,\n /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */\n Timestamp = 10,\n /** YEAR_MONTH or DAY_TIME interval in SQL style */\n Interval = 11,\n /** A list of some logical data type */\n List = 12,\n /** Struct of logical types */\n Struct = 13,\n /** Union of logical types */\n Union = 14,\n /** Fixed-size binary. Each value occupies the same number of bytes */\n FixedSizeBinary = 15,\n /** Fixed-size list. Each value occupies the same number of bytes */\n FixedSizeList = 16,\n /** Map of named logical types */\n Map = 17,\n\n /** Dictionary aka Category type */\n Dictionary = -1,\n Int8 = -2,\n Int16 = -3,\n Int32 = -4,\n Int64 = -5,\n Uint8 = -6,\n Uint16 = -7,\n Uint32 = -8,\n Uint64 = -9,\n Float16 = -10,\n Float32 = -11,\n Float64 = -12,\n DateDay = -13,\n DateMillisecond = -14,\n TimestampSecond = -15,\n TimestampMillisecond = -16,\n TimestampMicrosecond = -17,\n TimestampNanosecond = -18,\n TimeSecond = -19,\n TimeMillisecond = -20,\n TimeMicrosecond = -21,\n TimeNanosecond = -22,\n DenseUnion = -23,\n SparseUnion = -24,\n IntervalDayTime = -25,\n IntervalYearMonth = -26,\n}\n\nexport enum BufferType {\n /**\n * used in List type, Dense Union and variable length primitive types (String, Binary)\n */\n OFFSET = 0,\n\n /**\n * actual data, either wixed width primitive types in slots or variable width delimited by an OFFSET vector\n */\n DATA = 1,\n\n /**\n * Bit vector indicating if each value is null\n */\n VALIDITY = 2,\n\n /**\n * Type vector used in Union type\n */\n TYPE = 3\n }\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/** @ignore */\nexport function getBool(_data: any, _index: number, byte: number, bit: number) {\n return (byte & 1 << bit) !== 0;\n}\n\n/** @ignore */\nexport function getBit(_data: any, _index: number, byte: number, bit: number): 0 | 1 {\n return (byte & 1 << bit) >> bit as (0 | 1);\n}\n\n/** @ignore */\nexport function setBool(bytes: Uint8Array, index: number, value: any) {\n return value ?\n !!(bytes[index >> 3] |= (1 << (index % 8))) || true :\n !(bytes[index >> 3] &= ~(1 << (index % 8))) && false ;\n}\n\n/** @ignore */\nexport function truncateBitmap(offset: number, length: number, bitmap: Uint8Array) {\n const alignedSize = (bitmap.byteLength + 7) & ~7;\n if (offset > 0 || bitmap.byteLength < alignedSize) {\n const bytes = new Uint8Array(alignedSize);\n // If the offset is a multiple of 8 bits, it's safe to slice the bitmap\n bytes.set(offset % 8 === 0 ? bitmap.subarray(offset >> 3) :\n // Otherwise iterate each bit from the offset and return a new one\n packBools(iterateBits(bitmap, offset, length, null, getBool)).subarray(0, alignedSize));\n return bytes;\n }\n return bitmap;\n}\n\n/** @ignore */\nexport function packBools(values: Iterable) {\n let xs: number[] = [];\n let i = 0, bit = 0, byte = 0;\n for (const value of values) {\n value && (byte |= 1 << bit);\n if (++bit === 8) {\n xs[i++] = byte;\n byte = bit = 0;\n }\n }\n if (i === 0 || bit > 0) { xs[i++] = byte; }\n let b = new Uint8Array((xs.length + 7) & ~7);\n b.set(xs);\n return b;\n}\n\n/** @ignore */\nexport function* iterateBits(bytes: Uint8Array, begin: number, length: number, context: any,\n get: (context: any, index: number, byte: number, bit: number) => T) {\n let bit = begin % 8;\n let byteIndex = begin >> 3;\n let index = 0, remaining = length;\n for (; remaining > 0; bit = 0) {\n let byte = bytes[byteIndex++];\n do {\n yield get(context, index++, byte, bit);\n } while (--remaining > 0 && ++bit < 8);\n }\n}\n\n/**\n * Compute the population count (the number of bits set to 1) for a range of bits in a Uint8Array.\n * @param vector The Uint8Array of bits for which to compute the population count.\n * @param lhs The range's left-hand side (or start) bit\n * @param rhs The range's right-hand side (or end) bit\n */\n/** @ignore */\nexport function popcnt_bit_range(data: Uint8Array, lhs: number, rhs: number): number {\n if (rhs - lhs <= 0) { return 0; }\n // If the bit range is less than one byte, sum the 1 bits in the bit range\n if (rhs - lhs < 8) {\n let sum = 0;\n for (const bit of iterateBits(data, lhs, rhs - lhs, data, getBit)) {\n sum += bit;\n }\n return sum;\n }\n // Get the next lowest multiple of 8 from the right hand side\n const rhsInside = rhs >> 3 << 3;\n // Get the next highest multiple of 8 from the left hand side\n const lhsInside = lhs + (lhs % 8 === 0 ? 0 : 8 - lhs % 8);\n return (\n // Get the popcnt of bits between the left hand side, and the next highest multiple of 8\n popcnt_bit_range(data, lhs, lhsInside) +\n // Get the popcnt of bits between the right hand side, and the next lowest multiple of 8\n popcnt_bit_range(data, rhsInside, rhs) +\n // Get the popcnt of all bits between the left and right hand sides' multiples of 8\n popcnt_array(data, lhsInside >> 3, (rhsInside - lhsInside) >> 3)\n );\n}\n\n/** @ignore */\nexport function popcnt_array(arr: ArrayBufferView, byteOffset?: number, byteLength?: number) {\n let cnt = 0, pos = byteOffset! | 0;\n const view = new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n const len = byteLength === void 0 ? arr.byteLength : pos + byteLength;\n while (len - pos >= 4) {\n cnt += popcnt_uint32(view.getUint32(pos));\n pos += 4;\n }\n while (len - pos >= 2) {\n cnt += popcnt_uint32(view.getUint16(pos));\n pos += 2;\n }\n while (len - pos >= 1) {\n cnt += popcnt_uint32(view.getUint8(pos));\n pos += 1;\n }\n return cnt;\n}\n\n/** @ignore */\nexport function popcnt_uint32(uint32: number): number {\n let i = uint32 | 0;\n i = i - ((i >>> 1) & 0x55555555);\n i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);\n return (((i + (i >>> 4)) & 0x0F0F0F0F) * 0x01010101) >>> 24;\n}\n","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { Vector } from './vector';\nimport { Type, Precision, DateUnit, TimeUnit, IntervalUnit, UnionMode } from './enum';\nimport { DataType, Float, Int, Date_, Interval, Time, Timestamp, Union, } from './type';\n\nexport abstract class Visitor {\n public visitMany(nodes: any[], ...args: any[][]) {\n return nodes.map((node, i) => this.visit(node, ...args.map((x) => x[i])));\n }\n public visit(...args: any[]) {\n return this.getVisitFn(args[0], false).apply(this, args);\n }\n public getVisitFn(node: any, throwIfNotFound = true) {\n return getVisitFn(this, node, throwIfNotFound);\n }\n public visitNull (_node: any, ..._args: any[]): any { return null; }\n public visitBool (_node: any, ..._args: any[]): any { return null; }\n public visitInt (_node: any, ..._args: any[]): any { return null; }\n public visitFloat (_node: any, ..._args: any[]): any { return null; }\n public visitUtf8 (_node: any, ..._args: any[]): any { return null; }\n public visitBinary (_node: any, ..._args: any[]): any { return null; }\n public visitFixedSizeBinary (_node: any, ..._args: any[]): any { return null; }\n public visitDate (_node: any, ..._args: any[]): any { return null; }\n public visitTimestamp (_node: any, ..._args: any[]): any { return null; }\n public visitTime (_node: any, ..._args: any[]): any { return null; }\n public visitDecimal (_node: any, ..._args: any[]): any { return null; }\n public visitList (_node: any, ..._args: any[]): any { return null; }\n public visitStruct (_node: any, ..._args: any[]): any { return null; }\n public visitUnion (_node: any, ..._args: any[]): any { return null; }\n public visitDictionary (_node: any, ..._args: any[]): any { return null; }\n public visitInterval (_node: any, ..._args: any[]): any { return null; }\n public visitFixedSizeList (_node: any, ..._args: any[]): any { return null; }\n public visitMap (_node: any, ..._args: any[]): any { return null; }\n}\n\n/** @ignore */\nfunction getVisitFn(visitor: Visitor, node: any, throwIfNotFound = true) {\n let fn: any = null;\n let dtype: T['TType'] = Type.NONE;\n // tslint:disable\n if (node instanceof Data ) { dtype = inferDType(node.type as T); }\n else if (node instanceof Vector ) { dtype = inferDType(node.type as T); }\n else if (node instanceof DataType) { dtype = inferDType(node as T); }\n else if (typeof (dtype = node) !== 'number') { dtype = Type[node] as any as T['TType']; }\n\n switch (dtype) {\n case Type.Null: fn = visitor.visitNull; break;\n case Type.Bool: fn = visitor.visitBool; break;\n case Type.Int: fn = visitor.visitInt; break;\n case Type.Int8: fn = visitor.visitInt8 || visitor.visitInt; break;\n case Type.Int16: fn = visitor.visitInt16 || visitor.visitInt; break;\n case Type.Int32: fn = visitor.visitInt32 || visitor.visitInt; break;\n case Type.Int64: fn = visitor.visitInt64 || visitor.visitInt; break;\n case Type.Uint8: fn = visitor.visitUint8 || visitor.visitInt; break;\n case Type.Uint16: fn = visitor.visitUint16 || visitor.visitInt; break;\n case Type.Uint32: fn = visitor.visitUint32 || visitor.visitInt; break;\n case Type.Uint64: fn = visitor.visitUint64 || visitor.visitInt; break;\n case Type.Float: fn = visitor.visitFloat; break;\n case Type.Float16: fn = visitor.visitFloat16 || visitor.visitFloat; break;\n case Type.Float32: fn = visitor.visitFloat32 || visitor.visitFloat; break;\n case Type.Float64: fn = visitor.visitFloat64 || visitor.visitFloat; break;\n case Type.Utf8: fn = visitor.visitUtf8; break;\n case Type.Binary: fn = visitor.visitBinary; break;\n case Type.FixedSizeBinary: fn = visitor.visitFixedSizeBinary; break;\n case Type.Date: fn = visitor.visitDate; break;\n case Type.DateDay: fn = visitor.visitDateDay || visitor.visitDate; break;\n case Type.DateMillisecond: fn = visitor.visitDateMillisecond || visitor.visitDate; break;\n case Type.Timestamp: fn = visitor.visitTimestamp; break;\n case Type.TimestampSecond: fn = visitor.visitTimestampSecond || visitor.visitTimestamp; break;\n case Type.TimestampMillisecond: fn = visitor.visitTimestampMillisecond || visitor.visitTimestamp; break;\n case Type.TimestampMicrosecond: fn = visitor.visitTimestampMicrosecond || visitor.visitTimestamp; break;\n case Type.TimestampNanosecond: fn = visitor.visitTimestampNanosecond || visitor.visitTimestamp; break;\n case Type.Time: fn = visitor.visitTime; break;\n case Type.TimeSecond: fn = visitor.visitTimeSecond || visitor.visitTime; break;\n case Type.TimeMillisecond: fn = visitor.visitTimeMillisecond || visitor.visitTime; break;\n case Type.TimeMicrosecond: fn = visitor.visitTimeMicrosecond || visitor.visitTime; break;\n case Type.TimeNanosecond: fn = visitor.visitTimeNanosecond || visitor.visitTime; break;\n case Type.Decimal: fn = visitor.visitDecimal; break;\n case Type.List: fn = visitor.visitList; break;\n case Type.Struct: fn = visitor.visitStruct; break;\n case Type.Union: fn = visitor.visitUnion; break;\n case Type.DenseUnion: fn = visitor.visitDenseUnion || visitor.visitUnion; break;\n case Type.SparseUnion: fn = visitor.visitSparseUnion || visitor.visitUnion; break;\n case Type.Dictionary: fn = visitor.visitDictionary; break;\n case Type.Interval: fn = visitor.visitInterval; break;\n case Type.IntervalDayTime: fn = visitor.visitIntervalDayTime || visitor.visitInterval; break;\n case Type.IntervalYearMonth: fn = visitor.visitIntervalYearMonth || visitor.visitInterval; break;\n case Type.FixedSizeList: fn = visitor.visitFixedSizeList; break;\n case Type.Map: fn = visitor.visitMap; break;\n }\n if (typeof fn === 'function') return fn;\n if (!throwIfNotFound) return () => null;\n throw new Error(`Unrecognized type '${Type[dtype]}'`);\n}\n\n/** @ignore */\nfunction inferDType(type: T): Type {\n switch (type.typeId) {\n case Type.Null: return Type.Null;\n case Type.Int:\n const { bitWidth, isSigned } = (type as any as Int);\n switch (bitWidth) {\n case 8: return isSigned ? Type.Int8 : Type.Uint8 ;\n case 16: return isSigned ? Type.Int16 : Type.Uint16;\n case 32: return isSigned ? Type.Int32 : Type.Uint32;\n case 64: return isSigned ? Type.Int64 : Type.Uint64;\n }\n return Type.Int;\n case Type.Float:\n switch((type as any as Float).precision) {\n case Precision.HALF: return Type.Float16;\n case Precision.SINGLE: return Type.Float32;\n case Precision.DOUBLE: return Type.Float64;\n }\n return Type.Float;\n case Type.Binary: return Type.Binary;\n case Type.Utf8: return Type.Utf8;\n case Type.Bool: return Type.Bool;\n case Type.Decimal: return Type.Decimal;\n case Type.Time:\n switch ((type as any as Time).unit) {\n case TimeUnit.SECOND: return Type.TimeSecond;\n case TimeUnit.MILLISECOND: return Type.TimeMillisecond;\n case TimeUnit.MICROSECOND: return Type.TimeMicrosecond;\n case TimeUnit.NANOSECOND: return Type.TimeNanosecond;\n }\n return Type.Time;\n case Type.Timestamp:\n switch ((type as any as Timestamp).unit) {\n case TimeUnit.SECOND: return Type.TimestampSecond;\n case TimeUnit.MILLISECOND: return Type.TimestampMillisecond;\n case TimeUnit.MICROSECOND: return Type.TimestampMicrosecond;\n case TimeUnit.NANOSECOND: return Type.TimestampNanosecond;\n }\n return Type.Timestamp;\n case Type.Date:\n switch ((type as any as Date_).unit) {\n case DateUnit.DAY: return Type.DateDay;\n case DateUnit.MILLISECOND: return Type.DateMillisecond;\n }\n return Type.Date;\n case Type.Interval:\n switch ((type as any as Interval).unit) {\n case IntervalUnit.DAY_TIME: return Type.IntervalDayTime;\n case IntervalUnit.YEAR_MONTH: return Type.IntervalYearMonth;\n }\n return Type.Interval;\n case Type.Map: return Type.Map;\n case Type.List: return Type.List;\n case Type.Struct: return Type.Struct;\n case Type.Union:\n switch ((type as any as Union).mode) {\n case UnionMode.Dense: return Type.DenseUnion;\n case UnionMode.Sparse: return Type.SparseUnion;\n }\n return Type.Union;\n case Type.FixedSizeBinary: return Type.FixedSizeBinary;\n case Type.FixedSizeList: return Type.FixedSizeList;\n case Type.Dictionary: return Type.Dictionary;\n }\n throw new Error(`Unrecognized type '${Type[type.typeId]}'`);\n}\n\nexport interface Visitor {\n visitNull (node: any, ...args: any[]): any;\n visitBool (node: any, ...args: any[]): any;\n visitInt (node: any, ...args: any[]): any;\n visitInt8? (node: any, ...args: any[]): any;\n visitInt16? (node: any, ...args: any[]): any;\n visitInt32? (node: any, ...args: any[]): any;\n visitInt64? (node: any, ...args: any[]): any;\n visitUint8? (node: any, ...args: any[]): any;\n visitUint16? (node: any, ...args: any[]): any;\n visitUint32? (node: any, ...args: any[]): any;\n visitUint64? (node: any, ...args: any[]): any;\n visitFloat (node: any, ...args: any[]): any;\n visitFloat16? (node: any, ...args: any[]): any;\n visitFloat32? (node: any, ...args: any[]): any;\n visitFloat64? (node: any, ...args: any[]): any;\n visitUtf8 (node: any, ...args: any[]): any;\n visitBinary (node: any, ...args: any[]): any;\n visitFixedSizeBinary (node: any, ...args: any[]): any;\n visitDate (node: any, ...args: any[]): any;\n visitDateDay? (node: any, ...args: any[]): any;\n visitDateMillisecond? (node: any, ...args: any[]): any;\n visitTimestamp (node: any, ...args: any[]): any;\n visitTimestampSecond? (node: any, ...args: any[]): any;\n visitTimestampMillisecond? (node: any, ...args: any[]): any;\n visitTimestampMicrosecond? (node: any, ...args: any[]): any;\n visitTimestampNanosecond? (node: any, ...args: any[]): any;\n visitTime (node: any, ...args: any[]): any;\n visitTimeSecond? (node: any, ...args: any[]): any;\n visitTimeMillisecond? (node: any, ...args: any[]): any;\n visitTimeMicrosecond? (node: any, ...args: any[]): any;\n visitTimeNanosecond? (node: any, ...args: any[]): any;\n visitDecimal (node: any, ...args: any[]): any;\n visitList (node: any, ...args: any[]): any;\n visitStruct (node: any, ...args: any[]): any;\n visitUnion (node: any, ...args: any[]): any;\n visitDenseUnion? (node: any, ...args: any[]): any;\n visitSparseUnion? (node: any, ...args: any[]): any;\n visitDictionary (node: any, ...args: any[]): any;\n visitInterval (node: any, ...args: any[]): any;\n visitIntervalDayTime? (node: any, ...args: any[]): any;\n visitIntervalYearMonth? (node: any, ...args: any[]): any;\n visitFixedSizeList (node: any, ...args: any[]): any;\n visitMap (node: any, ...args: any[]): any;\n}\n\n// Add these here so they're picked up by the externs creator\n// in the build, and closure-compiler doesn't minify them away\n(Visitor.prototype as any).visitInt8 = null;\n(Visitor.prototype as any).visitInt16 = null;\n(Visitor.prototype as any).visitInt32 = null;\n(Visitor.prototype as any).visitInt64 = null;\n(Visitor.prototype as any).visitUint8 = null;\n(Visitor.prototype as any).visitUint16 = null;\n(Visitor.prototype as any).visitUint32 = null;\n(Visitor.prototype as any).visitUint64 = null;\n(Visitor.prototype as any).visitFloat16 = null;\n(Visitor.prototype as any).visitFloat32 = null;\n(Visitor.prototype as any).visitFloat64 = null;\n(Visitor.prototype as any).visitDateDay = null;\n(Visitor.prototype as any).visitDateMillisecond = null;\n(Visitor.prototype as any).visitTimestampSecond = null;\n(Visitor.prototype as any).visitTimestampMillisecond = null;\n(Visitor.prototype as any).visitTimestampMicrosecond = null;\n(Visitor.prototype as any).visitTimestampNanosecond = null;\n(Visitor.prototype as any).visitTimeSecond = null;\n(Visitor.prototype as any).visitTimeMillisecond = null;\n(Visitor.prototype as any).visitTimeMicrosecond = null;\n(Visitor.prototype as any).visitTimeNanosecond = null;\n(Visitor.prototype as any).visitDenseUnion = null;\n(Visitor.prototype as any).visitSparseUnion = null;\n(Visitor.prototype as any).visitIntervalDayTime = null;\n(Visitor.prototype as any).visitIntervalYearMonth = null;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { Schema, Field } from '../schema';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface TypeComparator extends Visitor {\n visit(type: T, other?: DataType | null): other is T;\n visitMany(nodes: T[], others?: DataType[] | null): boolean[];\n getVisitFn(node: VectorType | Data | T): (other?: DataType | null) => other is T;\n visitNull (type: T, other?: DataType | null): other is T;\n visitBool (type: T, other?: DataType | null): other is T;\n visitInt (type: T, other?: DataType | null): other is T;\n visitInt8 (type: T, other?: DataType | null): other is T;\n visitInt16 (type: T, other?: DataType | null): other is T;\n visitInt32 (type: T, other?: DataType | null): other is T;\n visitInt64 (type: T, other?: DataType | null): other is T;\n visitUint8 (type: T, other?: DataType | null): other is T;\n visitUint16 (type: T, other?: DataType | null): other is T;\n visitUint32 (type: T, other?: DataType | null): other is T;\n visitUint64 (type: T, other?: DataType | null): other is T;\n visitFloat (type: T, other?: DataType | null): other is T;\n visitFloat16 (type: T, other?: DataType | null): other is T;\n visitFloat32 (type: T, other?: DataType | null): other is T;\n visitFloat64 (type: T, other?: DataType | null): other is T;\n visitUtf8 (type: T, other?: DataType | null): other is T;\n visitBinary (type: T, other?: DataType | null): other is T;\n visitFixedSizeBinary (type: T, other?: DataType | null): other is T;\n visitDate (type: T, other?: DataType | null): other is T;\n visitDateDay (type: T, other?: DataType | null): other is T;\n visitDateMillisecond (type: T, other?: DataType | null): other is T;\n visitTimestamp (type: T, other?: DataType | null): other is T;\n visitTimestampSecond (type: T, other?: DataType | null): other is T;\n visitTimestampMillisecond (type: T, other?: DataType | null): other is T;\n visitTimestampMicrosecond (type: T, other?: DataType | null): other is T;\n visitTimestampNanosecond (type: T, other?: DataType | null): other is T;\n visitTime (type: T, other?: DataType | null): other is T;\n visitTimeSecond (type: T, other?: DataType | null): other is T;\n visitTimeMillisecond (type: T, other?: DataType | null): other is T;\n visitTimeMicrosecond (type: T, other?: DataType | null): other is T;\n visitTimeNanosecond (type: T, other?: DataType | null): other is T;\n visitDecimal (type: T, other?: DataType | null): other is T;\n visitList (type: T, other?: DataType | null): other is T;\n visitStruct (type: T, other?: DataType | null): other is T;\n visitUnion (type: T, other?: DataType | null): other is T;\n visitDenseUnion (type: T, other?: DataType | null): other is T;\n visitSparseUnion (type: T, other?: DataType | null): other is T;\n visitDictionary (type: T, other?: DataType | null): other is T;\n visitInterval (type: T, other?: DataType | null): other is T;\n visitIntervalDayTime (type: T, other?: DataType | null): other is T;\n visitIntervalYearMonth (type: T, other?: DataType | null): other is T;\n visitFixedSizeList (type: T, other?: DataType | null): other is T;\n visitMap (type: T, other?: DataType | null): other is T;\n}\n\n/** @ignore */\nexport class TypeComparator extends Visitor {\n compareSchemas(schema: Schema, other?: Schema | null): other is Schema {\n return (schema === other) || (\n other instanceof schema.constructor &&\n instance.compareFields(schema.fields, other.fields)\n );\n }\n compareFields(fields: Field[], others?: Field[] | null): others is Field[] {\n return (fields === others) || (\n Array.isArray(fields) &&\n Array.isArray(others) &&\n fields.length === others.length &&\n fields.every((f, i) => instance.compareField(f, others[i]))\n );\n }\n compareField(field: Field, other?: Field | null): other is Field {\n return (field === other) || (\n other instanceof field.constructor &&\n field.name === other.name &&\n field.nullable === other.nullable &&\n instance.visit(field.type, other.type)\n );\n }\n}\n\nfunction compareConstructor(type: T, other?: DataType | null): other is T {\n return other instanceof type.constructor;\n}\n\nfunction compareAny(type: T, other?: DataType | null): other is T {\n return (type === other) || compareConstructor(type, other);\n}\n\nfunction compareInt(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.bitWidth === other.bitWidth &&\n type.isSigned === other.isSigned\n );\n}\n\nfunction compareFloat(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.precision === other.precision\n );\n}\n\nfunction compareFixedSizeBinary(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.byteWidth === other.byteWidth\n );\n}\n\nfunction compareDate(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.unit === other.unit\n );\n}\n\nfunction compareTimestamp(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.unit === other.unit &&\n type.timezone === other.timezone\n );\n}\n\nfunction compareTime(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.unit === other.unit &&\n type.bitWidth === other.bitWidth\n );\n}\n\nfunction compareList(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.children.length === other.children.length &&\n instance.compareFields(type.children, other.children)\n );\n}\n\nfunction compareStruct(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.children.length === other.children.length &&\n instance.compareFields(type.children, other.children)\n );\n}\n\nfunction compareUnion(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.mode === other.mode &&\n type.typeIds.every((x, i) => x === other.typeIds[i]) &&\n instance.compareFields(type.children, other.children)\n );\n}\n\nfunction compareDictionary(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.id === other.id &&\n type.isOrdered === other.isOrdered &&\n instance.visit( type.indices, other.indices) &&\n instance.visit(type.dictionary, other.dictionary)\n );\n}\n\nfunction compareInterval(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.unit === other.unit\n );\n}\n\nfunction compareFixedSizeList(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.listSize === other.listSize &&\n type.children.length === other.children.length &&\n instance.compareFields(type.children, other.children)\n );\n}\n\nfunction compareMap(type: T, other?: DataType | null): other is T {\n return (type === other) || (\n compareConstructor(type, other) &&\n type.keysSorted === other.keysSorted &&\n type.children.length === other.children.length &&\n instance.compareFields(type.children, other.children)\n );\n}\n\nTypeComparator.prototype.visitNull = compareAny;\nTypeComparator.prototype.visitBool = compareAny;\nTypeComparator.prototype.visitInt = compareInt;\nTypeComparator.prototype.visitInt8 = compareInt;\nTypeComparator.prototype.visitInt16 = compareInt;\nTypeComparator.prototype.visitInt32 = compareInt;\nTypeComparator.prototype.visitInt64 = compareInt;\nTypeComparator.prototype.visitUint8 = compareInt;\nTypeComparator.prototype.visitUint16 = compareInt;\nTypeComparator.prototype.visitUint32 = compareInt;\nTypeComparator.prototype.visitUint64 = compareInt;\nTypeComparator.prototype.visitFloat = compareFloat;\nTypeComparator.prototype.visitFloat16 = compareFloat;\nTypeComparator.prototype.visitFloat32 = compareFloat;\nTypeComparator.prototype.visitFloat64 = compareFloat;\nTypeComparator.prototype.visitUtf8 = compareAny;\nTypeComparator.prototype.visitBinary = compareAny;\nTypeComparator.prototype.visitFixedSizeBinary = compareFixedSizeBinary;\nTypeComparator.prototype.visitDate = compareDate;\nTypeComparator.prototype.visitDateDay = compareDate;\nTypeComparator.prototype.visitDateMillisecond = compareDate;\nTypeComparator.prototype.visitTimestamp = compareTimestamp;\nTypeComparator.prototype.visitTimestampSecond = compareTimestamp;\nTypeComparator.prototype.visitTimestampMillisecond = compareTimestamp;\nTypeComparator.prototype.visitTimestampMicrosecond = compareTimestamp;\nTypeComparator.prototype.visitTimestampNanosecond = compareTimestamp;\nTypeComparator.prototype.visitTime = compareTime;\nTypeComparator.prototype.visitTimeSecond = compareTime;\nTypeComparator.prototype.visitTimeMillisecond = compareTime;\nTypeComparator.prototype.visitTimeMicrosecond = compareTime;\nTypeComparator.prototype.visitTimeNanosecond = compareTime;\nTypeComparator.prototype.visitDecimal = compareAny;\nTypeComparator.prototype.visitList = compareList;\nTypeComparator.prototype.visitStruct = compareStruct;\nTypeComparator.prototype.visitUnion = compareUnion;\nTypeComparator.prototype.visitDenseUnion = compareUnion;\nTypeComparator.prototype.visitSparseUnion = compareUnion;\nTypeComparator.prototype.visitDictionary = compareDictionary;\nTypeComparator.prototype.visitInterval = compareInterval;\nTypeComparator.prototype.visitIntervalDayTime = compareInterval;\nTypeComparator.prototype.visitIntervalYearMonth = compareInterval;\nTypeComparator.prototype.visitFixedSizeList = compareFixedSizeList;\nTypeComparator.prototype.visitMap = compareMap;\n\n/** @ignore */\nexport const instance = new TypeComparator();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/* tslint:disable:class-name */\n\nimport { Field } from './schema';\nimport { flatbuffers } from 'flatbuffers';\nimport { TypedArrayConstructor } from './interfaces';\nimport { VectorType as V, TypeToDataType } from './interfaces';\nimport { instance as comparer } from './visitor/typecomparator';\n\nimport Long = flatbuffers.Long;\nimport {\n Type,\n Precision, UnionMode,\n DateUnit, TimeUnit, IntervalUnit\n} from './enum';\n\n/** @ignore */\nexport type TimeBitWidth = 32 | 64;\n/** @ignore */\nexport type IntBitWidth = 8 | 16 | 32 | 64;\n/** @ignore */\nexport type IsSigned = { 'true': true; 'false': false };\n/** @ignore */\nexport type RowLike =\n ( Iterable<[string, T[keyof T]['TValue'] | null]> )\n & { [P in keyof T]: T[P]['TValue'] | null }\n & { get(key: K): T[K]['TValue'] | null; }\n & { set(key: K, val: T[K]['TValue'] | null): void; }\n ;\n\n/** @ignore */\nexport type MapLike =\n { [P in K['TValue']]: V['TValue'] | null }\n & ( Map )\n ;\n\nexport interface DataType {\n readonly TType: TType;\n readonly TArray: any;\n readonly TValue: any;\n readonly ArrayType: any;\n readonly children: Field[];\n}\n\n/**\n * An abstract base class for classes that encapsulate metadata about each of\n * the logical types that Arrow can represent.\n */\nexport abstract class DataType {\n\n // @ts-ignore\n public [Symbol.toStringTag]: string;\n\n /** @nocollapse */ static isNull (x: any): x is Null { return x && x.typeId === Type.Null; }\n /** @nocollapse */ static isInt (x: any): x is Int_ { return x && x.typeId === Type.Int; }\n /** @nocollapse */ static isFloat (x: any): x is Float { return x && x.typeId === Type.Float; }\n /** @nocollapse */ static isBinary (x: any): x is Binary { return x && x.typeId === Type.Binary; }\n /** @nocollapse */ static isUtf8 (x: any): x is Utf8 { return x && x.typeId === Type.Utf8; }\n /** @nocollapse */ static isBool (x: any): x is Bool { return x && x.typeId === Type.Bool; }\n /** @nocollapse */ static isDecimal (x: any): x is Decimal { return x && x.typeId === Type.Decimal; }\n /** @nocollapse */ static isDate (x: any): x is Date_ { return x && x.typeId === Type.Date; }\n /** @nocollapse */ static isTime (x: any): x is Time_ { return x && x.typeId === Type.Time; }\n /** @nocollapse */ static isTimestamp (x: any): x is Timestamp_ { return x && x.typeId === Type.Timestamp; }\n /** @nocollapse */ static isInterval (x: any): x is Interval_ { return x && x.typeId === Type.Interval; }\n /** @nocollapse */ static isList (x: any): x is List { return x && x.typeId === Type.List; }\n /** @nocollapse */ static isStruct (x: any): x is Struct { return x && x.typeId === Type.Struct; }\n /** @nocollapse */ static isUnion (x: any): x is Union_ { return x && x.typeId === Type.Union; }\n /** @nocollapse */ static isFixedSizeBinary (x: any): x is FixedSizeBinary { return x && x.typeId === Type.FixedSizeBinary; }\n /** @nocollapse */ static isFixedSizeList (x: any): x is FixedSizeList { return x && x.typeId === Type.FixedSizeList; }\n /** @nocollapse */ static isMap (x: any): x is Map_ { return x && x.typeId === Type.Map; }\n /** @nocollapse */ static isDictionary (x: any): x is Dictionary { return x && x.typeId === Type.Dictionary; }\n\n public get typeId(): TType { return Type.NONE; }\n public compareTo(other: DataType): other is TypeToDataType {\n return comparer.visit(this, other);\n }\n\n protected static [Symbol.toStringTag] = ((proto: DataType) => {\n ( proto).children = null;\n ( proto).ArrayType = Array;\n return proto[Symbol.toStringTag] = 'DataType';\n })(DataType.prototype);\n}\n\n/** @ignore */\nexport interface Null extends DataType { TArray: void; TValue: null; }\n/** @ignore */\nexport class Null extends DataType {\n public toString() { return `Null`; }\n public get typeId() { return Type.Null as Type.Null; }\n protected static [Symbol.toStringTag] = ((proto: Null) => {\n return proto[Symbol.toStringTag] = 'Null';\n })(Null.prototype);\n}\n\n/** @ignore */\ntype Ints = Type.Int | Type.Int8 | Type.Int16 | Type.Int32 | Type.Int64 | Type.Uint8 | Type.Uint16 | Type.Uint32 | Type.Uint64;\n/** @ignore */\ntype IType = {\n [Type.Int ]: { bitWidth: IntBitWidth; isSigned: true | false; TArray: IntArray; TValue: number | bigint | Int32Array | Uint32Array; };\n [Type.Int8 ]: { bitWidth: 8; isSigned: true; TArray: Int8Array; TValue: number; };\n [Type.Int16 ]: { bitWidth: 16; isSigned: true; TArray: Int16Array; TValue: number; };\n [Type.Int32 ]: { bitWidth: 32; isSigned: true; TArray: Int32Array; TValue: number; };\n [Type.Int64 ]: { bitWidth: 64; isSigned: true; TArray: Int32Array; TValue: bigint | Int32Array | Uint32Array; };\n [Type.Uint8 ]: { bitWidth: 8; isSigned: false; TArray: Uint8Array; TValue: number; };\n [Type.Uint16]: { bitWidth: 16; isSigned: false; TArray: Uint16Array; TValue: number; };\n [Type.Uint32]: { bitWidth: 32; isSigned: false; TArray: Uint32Array; TValue: number; };\n [Type.Uint64]: { bitWidth: 64; isSigned: false; TArray: Uint32Array; TValue: bigint | Int32Array | Uint32Array; };\n};\n\n/** @ignore */\ninterface Int_ extends DataType { TArray: IType[T]['TArray']; TValue: IType[T]['TValue']; }\n/** @ignore */\nclass Int_ extends DataType {\n constructor(public readonly isSigned: IType[T]['isSigned'],\n public readonly bitWidth: IType[T]['bitWidth']) {\n super();\n }\n public get typeId() { return Type.Int as T; }\n public get ArrayType(): TypedArrayConstructor {\n switch (this.bitWidth) {\n case 8: return this.isSigned ? Int8Array : Uint8Array;\n case 16: return this.isSigned ? Int16Array : Uint16Array;\n case 32: return this.isSigned ? Int32Array : Uint32Array;\n case 64: return this.isSigned ? Int32Array : Uint32Array;\n }\n throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n }\n public toString() { return `${this.isSigned ? `I` : `Ui`}nt${this.bitWidth}`; }\n protected static [Symbol.toStringTag] = ((proto: Int_) => {\n ( proto).isSigned = null;\n ( proto).bitWidth = null;\n return proto[Symbol.toStringTag] = 'Int';\n })(Int_.prototype);\n}\n\nexport { Int_ as Int };\n\n/** @ignore */\nexport class Int8 extends Int_ { constructor() { super(true, 8); } }\n/** @ignore */\nexport class Int16 extends Int_ { constructor() { super(true, 16); } }\n/** @ignore */\nexport class Int32 extends Int_ { constructor() { super(true, 32); } }\n/** @ignore */\nexport class Int64 extends Int_ { constructor() { super(true, 64); } }\n/** @ignore */\nexport class Uint8 extends Int_ { constructor() { super(false, 8); } }\n/** @ignore */\nexport class Uint16 extends Int_ { constructor() { super(false, 16); } }\n/** @ignore */\nexport class Uint32 extends Int_ { constructor() { super(false, 32); } }\n/** @ignore */\nexport class Uint64 extends Int_ { constructor() { super(false, 64); } }\n\nObject.defineProperty(Int8.prototype, 'ArrayType', { value: Int8Array });\nObject.defineProperty(Int16.prototype, 'ArrayType', { value: Int16Array });\nObject.defineProperty(Int32.prototype, 'ArrayType', { value: Int32Array });\nObject.defineProperty(Int64.prototype, 'ArrayType', { value: Int32Array });\nObject.defineProperty(Uint8.prototype, 'ArrayType', { value: Uint8Array });\nObject.defineProperty(Uint16.prototype, 'ArrayType', { value: Uint16Array });\nObject.defineProperty(Uint32.prototype, 'ArrayType', { value: Uint32Array });\nObject.defineProperty(Uint64.prototype, 'ArrayType', { value: Uint32Array });\n\n/** @ignore */\ntype Floats = Type.Float | Type.Float16 | Type.Float32 | Type.Float64;\n/** @ignore */\ntype FType = {\n [Type.Float ]: { precision: Precision; TArray: FloatArray; TValue: number; };\n [Type.Float16]: { precision: Precision.HALF; TArray: Uint16Array; TValue: number; };\n [Type.Float32]: { precision: Precision.SINGLE; TArray: Float32Array; TValue: number; };\n [Type.Float64]: { precision: Precision.DOUBLE; TArray: Float64Array; TValue: number; };\n};\n\n/** @ignore */\nexport interface Float extends DataType { TArray: FType[T]['TArray']; TValue: number; }\n/** @ignore */\nexport class Float extends DataType {\n constructor(public readonly precision: Precision) {\n super();\n }\n public get typeId() { return Type.Float as T; }\n public get ArrayType(): TypedArrayConstructor {\n switch (this.precision) {\n case Precision.HALF: return Uint16Array;\n case Precision.SINGLE: return Float32Array;\n case Precision.DOUBLE: return Float64Array;\n }\n throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n }\n public toString() { return `Float${(this.precision << 5) || 16}`; }\n protected static [Symbol.toStringTag] = ((proto: Float) => {\n ( proto).precision = null;\n return proto[Symbol.toStringTag] = 'Float';\n })(Float.prototype);\n}\n\n/** @ignore */\nexport class Float16 extends Float { constructor() { super(Precision.HALF); } }\n/** @ignore */\nexport class Float32 extends Float { constructor() { super(Precision.SINGLE); } }\n/** @ignore */\nexport class Float64 extends Float { constructor() { super(Precision.DOUBLE); } }\n\nObject.defineProperty(Float16.prototype, 'ArrayType', { value: Uint16Array });\nObject.defineProperty(Float32.prototype, 'ArrayType', { value: Float32Array });\nObject.defineProperty(Float64.prototype, 'ArrayType', { value: Float64Array });\n\n/** @ignore */\nexport interface Binary extends DataType { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class Binary extends DataType {\n constructor() {\n super();\n }\n public get typeId() { return Type.Binary as Type.Binary; }\n public toString() { return `Binary`; }\n protected static [Symbol.toStringTag] = ((proto: Binary) => {\n ( proto).ArrayType = Uint8Array;\n return proto[Symbol.toStringTag] = 'Binary';\n })(Binary.prototype);\n}\n\n/** @ignore */\nexport interface Utf8 extends DataType { TArray: Uint8Array; TValue: string; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class Utf8 extends DataType {\n constructor() {\n super();\n }\n public get typeId() { return Type.Utf8 as Type.Utf8; }\n public toString() { return `Utf8`; }\n protected static [Symbol.toStringTag] = ((proto: Utf8) => {\n ( proto).ArrayType = Uint8Array;\n return proto[Symbol.toStringTag] = 'Utf8';\n })(Utf8.prototype);\n}\n\n/** @ignore */\nexport interface Bool extends DataType { TArray: Uint8Array; TValue: boolean; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class Bool extends DataType {\n constructor() {\n super();\n }\n public get typeId() { return Type.Bool as Type.Bool; }\n public toString() { return `Bool`; }\n protected static [Symbol.toStringTag] = ((proto: Bool) => {\n ( proto).ArrayType = Uint8Array;\n return proto[Symbol.toStringTag] = 'Bool';\n })(Bool.prototype);\n}\n\n/** @ignore */\nexport interface Decimal extends DataType { TArray: Uint32Array; TValue: Uint32Array; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class Decimal extends DataType {\n constructor(public readonly scale: number,\n public readonly precision: number) {\n super();\n }\n public get typeId() { return Type.Decimal as Type.Decimal; }\n public toString() { return `Decimal[${this.precision}e${this.scale > 0 ? `+` : ``}${this.scale}]`; }\n protected static [Symbol.toStringTag] = ((proto: Decimal) => {\n ( proto).scale = null;\n ( proto).precision = null;\n ( proto).ArrayType = Uint32Array;\n return proto[Symbol.toStringTag] = 'Decimal';\n })(Decimal.prototype);\n}\n\n/** @ignore */\nexport type Dates = Type.Date | Type.DateDay | Type.DateMillisecond;\n/** @ignore */\nexport interface Date_ extends DataType { TArray: Int32Array; TValue: Date; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class Date_ extends DataType {\n constructor(public readonly unit: DateUnit) {\n super();\n }\n public get typeId() { return Type.Date as T; }\n public toString() { return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`; }\n protected static [Symbol.toStringTag] = ((proto: Date_) => {\n ( proto).unit = null;\n ( proto).ArrayType = Int32Array;\n return proto[Symbol.toStringTag] = 'Date';\n })(Date_.prototype);\n}\n\n/** @ignore */\nexport class DateDay extends Date_ { constructor() { super(DateUnit.DAY); } }\n/** @ignore */\nexport class DateMillisecond extends Date_ { constructor() { super(DateUnit.MILLISECOND); } }\n\n/** @ignore */\ntype Times = Type.Time | Type.TimeSecond | Type.TimeMillisecond | Type.TimeMicrosecond | Type.TimeNanosecond;\n/** @ignore */\ntype TimesType = {\n [Type.Time ]: { unit: TimeUnit; TValue: number | Int32Array };\n [Type.TimeSecond ]: { unit: TimeUnit.SECOND; TValue: number; };\n [Type.TimeMillisecond]: { unit: TimeUnit.MILLISECOND; TValue: number; };\n [Type.TimeMicrosecond]: { unit: TimeUnit.MICROSECOND; TValue: Int32Array; };\n [Type.TimeNanosecond ]: { unit: TimeUnit.NANOSECOND; TValue: Int32Array; };\n};\n\n/** @ignore */\ninterface Time_ extends DataType { TArray: Int32Array; TValue: TimesType[T]['TValue']; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nclass Time_ extends DataType {\n constructor(public readonly unit: TimesType[T]['unit'],\n public readonly bitWidth: TimeBitWidth) {\n super();\n }\n public get typeId() { return Type.Time as T; }\n public toString() { return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`; }\n protected static [Symbol.toStringTag] = ((proto: Time_) => {\n ( proto).unit = null;\n ( proto).bitWidth = null;\n ( proto).ArrayType = Int32Array;\n return proto[Symbol.toStringTag] = 'Time';\n })(Time_.prototype);\n}\n\nexport { Time_ as Time };\n\n/** @ignore */\nexport class TimeSecond extends Time_ { constructor() { super(TimeUnit.SECOND, 32); } }\n/** @ignore */\nexport class TimeMillisecond extends Time_ { constructor() { super(TimeUnit.MILLISECOND, 32); } }\n/** @ignore */\nexport class TimeMicrosecond extends Time_ { constructor() { super(TimeUnit.MICROSECOND, 64); } }\n/** @ignore */\nexport class TimeNanosecond extends Time_ { constructor() { super(TimeUnit.NANOSECOND, 64); } }\n\n/** @ignore */\ntype Timestamps = Type.Timestamp | Type.TimestampSecond | Type.TimestampMillisecond | Type.TimestampMicrosecond | Type.TimestampNanosecond;\n/** @ignore */\ninterface Timestamp_ extends DataType { TArray: Int32Array; TValue: number; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nclass Timestamp_ extends DataType {\n constructor(public readonly unit: TimeUnit,\n public readonly timezone?: string | null) {\n super();\n }\n public get typeId() { return Type.Timestamp as T; }\n public toString() { return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ``}>`; }\n protected static [Symbol.toStringTag] = ((proto: Timestamp_) => {\n ( proto).unit = null;\n ( proto).timezone = null;\n ( proto).ArrayType = Int32Array;\n return proto[Symbol.toStringTag] = 'Timestamp';\n })(Timestamp_.prototype);\n}\n\nexport { Timestamp_ as Timestamp };\n\n/** @ignore */\nexport class TimestampSecond extends Timestamp_ { constructor(timezone?: string | null) { super(TimeUnit.SECOND, timezone); } }\n/** @ignore */\nexport class TimestampMillisecond extends Timestamp_ { constructor(timezone?: string | null) { super(TimeUnit.MILLISECOND, timezone); } }\n/** @ignore */\nexport class TimestampMicrosecond extends Timestamp_ { constructor(timezone?: string | null) { super(TimeUnit.MICROSECOND, timezone); } }\n/** @ignore */\nexport class TimestampNanosecond extends Timestamp_ { constructor(timezone?: string | null) { super(TimeUnit.NANOSECOND, timezone); } }\n\n/** @ignore */\ntype Intervals = Type.Interval | Type.IntervalDayTime | Type.IntervalYearMonth;\n/** @ignore */\ninterface Interval_ extends DataType { TArray: Int32Array; TValue: Int32Array; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nclass Interval_ extends DataType {\n constructor(public readonly unit: IntervalUnit) {\n super();\n }\n public get typeId() { return Type.Interval as T; }\n public toString() { return `Interval<${IntervalUnit[this.unit]}>`; }\n protected static [Symbol.toStringTag] = ((proto: Interval_) => {\n ( proto).unit = null;\n ( proto).ArrayType = Int32Array;\n return proto[Symbol.toStringTag] = 'Interval';\n })(Interval_.prototype);\n}\n\nexport { Interval_ as Interval };\n\n/** @ignore */\nexport class IntervalDayTime extends Interval_ { constructor() { super(IntervalUnit.DAY_TIME); } }\n/** @ignore */\nexport class IntervalYearMonth extends Interval_ { constructor() { super(IntervalUnit.YEAR_MONTH); } }\n\n/** @ignore */\nexport interface List extends DataType { TArray: IterableArrayLike; TValue: V; }\n/** @ignore */\nexport class List extends DataType {\n constructor(child: Field) {\n super();\n this.children = [child];\n }\n public readonly children: Field[];\n public get typeId() { return Type.List as Type.List; }\n public toString() { return `List<${this.valueType}>`; }\n public get valueType(): T { return this.children[0].type as T; }\n public get valueField(): Field { return this.children[0] as Field; }\n public get ArrayType(): T['ArrayType'] { return this.valueType.ArrayType; }\n protected static [Symbol.toStringTag] = ((proto: List) => {\n ( proto).children = null;\n return proto[Symbol.toStringTag] = 'List';\n })(List.prototype);\n}\n\n/** @ignore */\nexport interface Struct extends DataType { TArray: IterableArrayLike>; TValue: RowLike; dataTypes: T; }\n/** @ignore */\nexport class Struct extends DataType {\n public readonly children: Field[];\n constructor(children: Field[]) {\n super();\n this.children = children;\n }\n public get typeId() { return Type.Struct as Type.Struct; }\n public toString() { return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`; }\n protected static [Symbol.toStringTag] = ((proto: Struct) => {\n ( proto).children = null;\n return proto[Symbol.toStringTag] = 'Struct';\n })(Struct.prototype);\n}\n\n/** @ignore */\ntype Unions = Type.Union | Type.DenseUnion | Type.SparseUnion;\n/** @ignore */\ninterface Union_ extends DataType { TArray: Int8Array; TValue: any; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nclass Union_ extends DataType {\n public readonly mode: UnionMode;\n public readonly typeIds: Int32Array;\n public readonly children: Field[];\n public readonly typeIdToChildIndex: { [key: number]: number };\n constructor(mode: UnionMode,\n typeIds: number[] | Int32Array,\n children: Field[]) {\n super();\n this.mode = mode;\n this.children = children;\n this.typeIds = typeIds = Int32Array.from(typeIds);\n this.typeIdToChildIndex = typeIds.reduce((typeIdToChildIndex, typeId, idx) => {\n return (typeIdToChildIndex[typeId] = idx) && typeIdToChildIndex || typeIdToChildIndex;\n }, Object.create(null) as { [key: number]: number });\n }\n public get typeId() { return Type.Union as T; }\n public toString() { return `${this[Symbol.toStringTag]}<${\n this.children.map((x) => `${x.type}`).join(` | `)\n }>`; }\n protected static [Symbol.toStringTag] = ((proto: Union_) => {\n ( proto).mode = null;\n ( proto).typeIds = null;\n ( proto).children = null;\n ( proto).typeIdToChildIndex = null;\n ( proto).ArrayType = Int8Array;\n return proto[Symbol.toStringTag] = 'Union';\n })(Union_.prototype);\n}\n\nexport { Union_ as Union };\n\n/** @ignore */\nexport class DenseUnion extends Union_ {\n constructor(typeIds: number[] | Int32Array, children: Field[]) {\n super(UnionMode.Dense, typeIds, children);\n }\n}\n\n/** @ignore */\nexport class SparseUnion extends Union_ {\n constructor(typeIds: number[] | Int32Array, children: Field[]) {\n super(UnionMode.Sparse, typeIds, children);\n }\n}\n\n/** @ignore */\nexport interface FixedSizeBinary extends DataType { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor; }\n/** @ignore */\nexport class FixedSizeBinary extends DataType {\n constructor(public readonly byteWidth: number) {\n super();\n }\n public get typeId() { return Type.FixedSizeBinary as Type.FixedSizeBinary; }\n public toString() { return `FixedSizeBinary[${this.byteWidth}]`; }\n protected static [Symbol.toStringTag] = ((proto: FixedSizeBinary) => {\n ( proto).byteWidth = null;\n ( proto).ArrayType = Uint8Array;\n return proto[Symbol.toStringTag] = 'FixedSizeBinary';\n })(FixedSizeBinary.prototype);\n}\n\n/** @ignore */\nexport interface FixedSizeList extends DataType { TArray: IterableArrayLike; TValue: V; }\n/** @ignore */\nexport class FixedSizeList extends DataType {\n public readonly children: Field[];\n constructor(public readonly listSize: number, child: Field) {\n super();\n this.children = [child];\n }\n public get typeId() { return Type.FixedSizeList as Type.FixedSizeList; }\n public get valueType(): T { return this.children[0].type as T; }\n public get valueField(): Field { return this.children[0] as Field; }\n public get ArrayType(): T['ArrayType'] { return this.valueType.ArrayType; }\n public toString() { return `FixedSizeList[${this.listSize}]<${this.valueType}>`; }\n protected static [Symbol.toStringTag] = ((proto: FixedSizeList) => {\n ( proto).children = null;\n ( proto).listSize = null;\n return proto[Symbol.toStringTag] = 'FixedSizeList';\n })(FixedSizeList.prototype);\n}\n\n/** @ignore */\nexport interface Map_ extends DataType {\n TArray: IterableArrayLike>;\n TChild: Struct<{ key: TKey, value: TValue }>;\n TValue: MapLike;\n}\n\n/** @ignore */\nexport class Map_ extends DataType {\n constructor(child: Field>, keysSorted = false) {\n super();\n this.children = [child];\n this.keysSorted = keysSorted;\n }\n public readonly keysSorted: boolean;\n public readonly children: Field>[];\n public get typeId() { return Type.Map as Type.Map; }\n public get keyType(): TKey { return this.children[0].type.children[0].type as TKey; }\n public get valueType(): TValue { return this.children[0].type.children[1].type as TValue; }\n public toString() { return `Map<{${this.children[0].type.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`; }\n protected static [Symbol.toStringTag] = ((proto: Map_) => {\n ( proto).children = null;\n ( proto).keysSorted = null;\n return proto[Symbol.toStringTag] = 'Map_';\n })(Map_.prototype);\n}\n\n/** @ignore */\nconst getId = ((atomicDictionaryId) => () => ++atomicDictionaryId)(-1);\n\n/** @ignore */\nexport type TKeys = Int8 | Int16 | Int32 | Uint8 | Uint16 | Uint32;\n\n/** @ignore */\nexport interface Dictionary extends DataType { TArray: TKey['TArray']; TValue: T['TValue']; }\n/** @ignore */\nexport class Dictionary extends DataType {\n public readonly id: number;\n public readonly indices: TKey;\n public readonly dictionary: T;\n public readonly isOrdered: boolean;\n constructor(dictionary: T, indices: TKey, id?: Long | number | null, isOrdered?: boolean | null) {\n super();\n this.indices = indices;\n this.dictionary = dictionary;\n this.isOrdered = isOrdered || false;\n this.id = id == null ? getId() : typeof id === 'number' ? id : id.low;\n }\n public get typeId() { return Type.Dictionary as Type.Dictionary; }\n public get children() { return this.dictionary.children; }\n public get valueType(): T { return this.dictionary as T; }\n public get ArrayType(): T['ArrayType'] { return this.dictionary.ArrayType; }\n public toString() { return `Dictionary<${this.indices}, ${this.dictionary}>`; }\n protected static [Symbol.toStringTag] = ((proto: Dictionary) => {\n ( proto).id = null;\n ( proto).indices = null;\n ( proto).isOrdered = null;\n ( proto).dictionary = null;\n return proto[Symbol.toStringTag] = 'Dictionary';\n })(Dictionary.prototype);\n}\n\n/** @ignore */\nexport interface IterableArrayLike extends ArrayLike, Iterable {}\n/** @ignore */\nexport type FloatArray = Uint16Array | Float32Array | Float64Array;\n/** @ignore */\nexport type IntArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array;\n\n/** @ignore */\nexport function strideForType(type: DataType) {\n let t: any = type;\n switch (type.typeId) {\n case Type.Decimal: return 4;\n case Type.Timestamp: return 2;\n case Type.Date: return 1 + (t as Date_).unit;\n case Type.Interval: return 1 + (t as Interval_).unit;\n case Type.Int: return 1 + +((t as Int_).bitWidth > 32);\n case Type.Time: return 1 + +((t as Time_).bitWidth > 32);\n case Type.FixedSizeList: return (t as FixedSizeList).listSize;\n case Type.FixedSizeBinary: return (t as FixedSizeBinary).byteWidth;\n default: return 1;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from './vector';\nimport { truncateBitmap } from './util/bit';\nimport { popcnt_bit_range } from './util/bit';\nimport { BufferType, UnionMode, Type } from './enum';\nimport { DataType, SparseUnion, DenseUnion, strideForType } from './type';\nimport { toArrayBufferView, toUint8Array, toInt32Array } from './util/buffer';\nimport {\n Dictionary,\n Null, Int, Float,\n Binary, Bool, Utf8, Decimal,\n Date_, Time, Timestamp, Interval,\n List, Struct, Union, FixedSizeBinary, FixedSizeList, Map_,\n} from './type';\n\n// When slicing, we do not know the null count of the sliced range without\n// doing some computation. To avoid doing this eagerly, we set the null count\n// to -1 (any negative number will do). When Vector.nullCount is called the\n// first time, the null count will be computed. See ARROW-33\n/** @ignore */ export type kUnknownNullCount = -1;\n/** @ignore */ export const kUnknownNullCount = -1;\n\n/** @ignore */ export type NullBuffer = Uint8Array | null | undefined;\n/** @ignore */ export type TypeIdsBuffer = Int8Array | ArrayLike | Iterable | undefined;\n/** @ignore */ export type ValueOffsetsBuffer = Int32Array | ArrayLike | Iterable | undefined;\n/** @ignore */ export type DataBuffer = T['TArray'] | ArrayLike | Iterable | undefined;\n\n/** @ignore */\nexport interface Buffers {\n [BufferType.OFFSET]: Int32Array;\n [BufferType.DATA]: T['TArray'];\n [BufferType.VALIDITY]: Uint8Array;\n [BufferType.TYPE]: T['TArray'];\n}\n\n/** @ignore */\nexport interface Data {\n readonly TType: T['TType'];\n readonly TArray: T['TArray'];\n readonly TValue: T['TValue'];\n}\n\n/** @ignore */\nexport class Data {\n\n public readonly type: T;\n public readonly length: number;\n public readonly offset: number;\n public readonly stride: number;\n public readonly childData: Data[];\n\n /**\n * The dictionary for this Vector, if any. Only used for Dictionary type.\n */\n public dictionary?: Vector;\n\n public readonly values: Buffers[BufferType.DATA];\n // @ts-ignore\n public readonly typeIds: Buffers[BufferType.TYPE];\n // @ts-ignore\n public readonly nullBitmap: Buffers[BufferType.VALIDITY];\n // @ts-ignore\n public readonly valueOffsets: Buffers[BufferType.OFFSET];\n\n public get typeId(): T['TType'] { return this.type.typeId; }\n public get ArrayType(): T['ArrayType'] { return this.type.ArrayType; }\n public get buffers() {\n return [this.valueOffsets, this.values, this.nullBitmap, this.typeIds] as Buffers;\n }\n public get byteLength(): number {\n let byteLength = 0;\n let { valueOffsets, values, nullBitmap, typeIds } = this;\n valueOffsets && (byteLength += valueOffsets.byteLength);\n values && (byteLength += values.byteLength);\n nullBitmap && (byteLength += nullBitmap.byteLength);\n typeIds && (byteLength += typeIds.byteLength);\n return this.childData.reduce((byteLength, child) => byteLength + child.byteLength, byteLength);\n }\n\n protected _nullCount: number | kUnknownNullCount;\n\n public get nullCount() {\n let nullCount = this._nullCount;\n let nullBitmap: Uint8Array | undefined;\n if (nullCount <= kUnknownNullCount && (nullBitmap = this.nullBitmap)) {\n this._nullCount = nullCount = this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);\n }\n return nullCount;\n }\n\n constructor(type: T, offset: number, length: number, nullCount?: number, buffers?: Partial> | Data, childData?: (Data | Vector)[], dictionary?: Vector) {\n this.type = type;\n this.dictionary = dictionary;\n this.offset = Math.floor(Math.max(offset || 0, 0));\n this.length = Math.floor(Math.max(length || 0, 0));\n this._nullCount = Math.floor(Math.max(nullCount || 0, -1));\n this.childData = (childData || []).map((x) => x instanceof Data ? x : x.data) as Data[];\n let buffer: Buffers[keyof Buffers];\n if (buffers instanceof Data) {\n this.stride = buffers.stride;\n this.values = buffers.values;\n this.typeIds = buffers.typeIds;\n this.nullBitmap = buffers.nullBitmap;\n this.valueOffsets = buffers.valueOffsets;\n } else {\n this.stride = strideForType(type);\n if (buffers) {\n (buffer = (buffers as Buffers)[0]) && (this.valueOffsets = buffer);\n (buffer = (buffers as Buffers)[1]) && (this.values = buffer);\n (buffer = (buffers as Buffers)[2]) && (this.nullBitmap = buffer);\n (buffer = (buffers as Buffers)[3]) && (this.typeIds = buffer);\n }\n }\n }\n\n public clone(type: R, offset = this.offset, length = this.length, nullCount = this._nullCount, buffers: Buffers = this, childData: (Data | Vector)[] = this.childData) {\n return new Data(type, offset, length, nullCount, buffers, childData, this.dictionary);\n }\n\n public slice(offset: number, length: number): Data {\n const { stride, typeId, childData } = this;\n // +true === 1, +false === 0, so this means\n // we keep nullCount at 0 if it's already 0,\n // otherwise set to the invalidated flag -1\n const nullCount = +(this._nullCount === 0) - 1;\n const childStride = typeId === 16 /* FixedSizeList */ ? stride : 1;\n const buffers = this._sliceBuffers(offset, length, stride, typeId);\n return this.clone(this.type, this.offset + offset, length, nullCount, buffers,\n // Don't slice children if we have value offsets (the variable-width types)\n (!childData.length || this.valueOffsets) ? childData : this._sliceChildren(childData, childStride * offset, childStride * length));\n }\n\n public _changeLengthAndBackfillNullBitmap(newLength: number): Data {\n if (this.typeId === Type.Null) {\n return this.clone(this.type, 0, newLength, 0);\n }\n const { length, nullCount } = this;\n // start initialized with 0s (nulls), then fill from 0 to length with 1s (not null)\n const bitmap = new Uint8Array(((newLength + 63) & ~63) >> 3).fill(255, 0, length >> 3);\n // set all the bits in the last byte (up to bit `length - length % 8`) to 1 (not null)\n bitmap[length >> 3] = (1 << (length - (length & ~7))) - 1;\n // if we have a nullBitmap, truncate + slice and set it over the pre-filled 1s\n if (nullCount > 0) {\n bitmap.set(truncateBitmap(this.offset, length, this.nullBitmap), 0);\n }\n const buffers = this.buffers;\n buffers[BufferType.VALIDITY] = bitmap;\n return this.clone(this.type, 0, newLength, nullCount + (newLength - length), buffers);\n }\n\n protected _sliceBuffers(offset: number, length: number, stride: number, typeId: T['TType']): Buffers {\n let arr: any, { buffers } = this;\n // If typeIds exist, slice the typeIds buffer\n (arr = buffers[BufferType.TYPE]) && (buffers[BufferType.TYPE] = arr.subarray(offset, offset + length));\n // If offsets exist, only slice the offsets buffer\n (arr = buffers[BufferType.OFFSET]) && (buffers[BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) ||\n // Otherwise if no offsets, slice the data buffer. Don't slice the data vector for Booleans, since the offset goes by bits not bytes\n (arr = buffers[BufferType.DATA]) && (buffers[BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));\n return buffers;\n }\n\n protected _sliceChildren(childData: Data[], offset: number, length: number): Data[] {\n return childData.map((child) => child.slice(offset, length));\n }\n\n //\n // Convenience methods for creating Data instances for each of the Arrow Vector types\n //\n /** @nocollapse */\n public static new(type: T, offset: number, length: number, nullCount?: number, buffers?: Partial> | Data, childData?: (Data | Vector)[], dictionary?: Vector): Data {\n if (buffers instanceof Data) { buffers = buffers.buffers; } else if (!buffers) { buffers = [] as Partial>; }\n switch (type.typeId) {\n case Type.Null: return Data.Null( type as Null, offset, length) as Data;\n case Type.Int: return Data.Int( type as Int, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Dictionary: return Data.Dictionary( type as Dictionary, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || [], dictionary!) as Data;\n case Type.Float: return Data.Float( type as Float, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Bool: return Data.Bool( type as Bool, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Decimal: return Data.Decimal( type as Decimal, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Date: return Data.Date( type as Date_, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Time: return Data.Time( type as Time, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Timestamp: return Data.Timestamp( type as Timestamp, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Interval: return Data.Interval( type as Interval, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.FixedSizeBinary: return Data.FixedSizeBinary( type as FixedSizeBinary, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []) as Data;\n case Type.Binary: return Data.Binary( type as Binary, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], buffers[BufferType.DATA] || []) as Data;\n case Type.Utf8: return Data.Utf8( type as Utf8, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], buffers[BufferType.DATA] || []) as Data;\n case Type.List: return Data.List( type as List, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], (childData || [])[0]) as Data;\n case Type.FixedSizeList: return Data.FixedSizeList( type as FixedSizeList, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], (childData || [])[0]) as Data;\n case Type.Struct: return Data.Struct( type as Struct, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], childData || []) as Data;\n case Type.Map: return Data.Map( type as Map_, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], (childData || [])[0]) as Data;\n case Type.Union: return Data.Union( type as Union, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.TYPE] || [], buffers[BufferType.OFFSET] || childData, childData) as Data;\n }\n throw new Error(`Unrecognized typeId ${type.typeId}`);\n }\n\n /** @nocollapse */\n public static Null(type: T, offset: number, length: number) {\n return new Data(type, offset, length, 0);\n }\n /** @nocollapse */\n public static Int(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Dictionary(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer, dictionary: Vector) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.indices.ArrayType, data), toUint8Array(nullBitmap)], [], dictionary);\n }\n /** @nocollapse */\n public static Float(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Bool(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Decimal(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Date(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Time(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Timestamp(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Interval(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static FixedSizeBinary(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, data: DataBuffer) {\n return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Binary(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, valueOffsets: ValueOffsetsBuffer, data: Uint8Array) {\n return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), toUint8Array(data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static Utf8(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, valueOffsets: ValueOffsetsBuffer, data: Uint8Array) {\n return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), toUint8Array(data), toUint8Array(nullBitmap)]);\n }\n /** @nocollapse */\n public static List(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, valueOffsets: ValueOffsetsBuffer, child: Data | Vector) {\n return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), undefined, toUint8Array(nullBitmap)], [child]);\n }\n /** @nocollapse */\n public static FixedSizeList(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, child: Data | Vector) {\n return new Data(type, offset, length, nullCount, [undefined, undefined, toUint8Array(nullBitmap)], [child]);\n }\n /** @nocollapse */\n public static Struct(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, children: (Data | Vector)[]) {\n return new Data(type, offset, length, nullCount, [undefined, undefined, toUint8Array(nullBitmap)], children);\n }\n /** @nocollapse */\n public static Map(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, valueOffsets: ValueOffsetsBuffer, child: (Data | Vector)) {\n return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), undefined, toUint8Array(nullBitmap)], [child]);\n }\n public static Union(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, typeIds: TypeIdsBuffer, children: (Data | Vector)[], _?: any): Data;\n public static Union(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, typeIds: TypeIdsBuffer, valueOffsets: ValueOffsetsBuffer, children: (Data | Vector)[]): Data;\n public static Union(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, typeIds: TypeIdsBuffer, valueOffsetsOrChildren: ValueOffsetsBuffer | (Data | Vector)[], children?: (Data | Vector)[]): Data;\n /** @nocollapse */\n public static Union(type: T, offset: number, length: number, nullCount: number, nullBitmap: NullBuffer, typeIds: TypeIdsBuffer, valueOffsetsOrChildren: ValueOffsetsBuffer | (Data | Vector)[], children?: (Data | Vector)[]) {\n const buffers = [\n undefined, undefined,\n toUint8Array(nullBitmap),\n toArrayBufferView(type.ArrayType, typeIds)\n ] as Partial>;\n if (type.mode === UnionMode.Sparse) {\n return new Data(type, offset, length, nullCount, buffers, valueOffsetsOrChildren as (Data | Vector)[]);\n }\n buffers[BufferType.OFFSET] = toInt32Array( valueOffsetsOrChildren);\n return new Data(type, offset, length, nullCount, buffers, children);\n }\n}\n\n(Data.prototype as any).childData = Object.freeze([]);\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/** @ignore */ const undf = void (0);\n\n/** @ignore */\nexport function valueToString(x: any) {\n if (x === null) { return 'null'; }\n if (x === undf) { return 'undefined'; }\n switch (typeof x) {\n case 'number': return `${x}`;\n case 'bigint': return `${x}`;\n case 'string': return `\"${x}\"`;\n }\n // If [Symbol.toPrimitive] is implemented (like in BN)\n // use it instead of JSON.stringify(). This ensures we\n // print BigInts, Decimals, and Binary in their native\n // representation\n if (typeof x[Symbol.toPrimitive] === 'function') {\n return x[Symbol.toPrimitive]('string');\n }\n return ArrayBuffer.isView(x) ? `[${x}]` : JSON.stringify(x);\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DataType } from '../type';\nimport { valueToString } from '../util/pretty';\nimport { BigIntAvailable } from '../util/compat';\n\n/**\n * Dynamically compile the null values into an `isValid()` function whose\n * implementation is a switch statement. Microbenchmarks in v8 indicate\n * this approach is 25% faster than using an ES6 Map.\n *\n * @example\n * console.log(createIsValidFunction([null, 'N/A', NaN]));\n * `function (x) {\n * if (x !== x) return false;\n * switch (x) {\n * case null:\n * case \"N/A\":\n * return false;\n * }\n * return true;\n * }`\n *\n * @ignore\n * @param nullValues\n */\nexport function createIsValidFunction(nullValues?: ReadonlyArray) {\n\n if (!nullValues || nullValues.length <= 0) {\n // @ts-ignore\n return function isValid(value: any) { return true; };\n }\n\n let fnBody = '';\n let noNaNs = nullValues.filter((x) => x === x);\n\n if (noNaNs.length > 0) {\n fnBody = `\n switch (x) {${noNaNs.map((x) => `\n case ${valueToCase(x)}:`).join('')}\n return false;\n }`;\n }\n\n // NaN doesn't equal anything including itself, so it doesn't work as a\n // switch case. Instead we must explicitly check for NaN before the switch.\n if (nullValues.length !== noNaNs.length) {\n fnBody = `if (x !== x) return false;\\n${fnBody}`;\n }\n\n return new Function(`x`, `${fnBody}\\nreturn true;`) as (value: T['TValue'] | TNull) => boolean;\n}\n\n/** @ignore */\nfunction valueToCase(x: any) {\n if (typeof x !== 'bigint') {\n return valueToString(x);\n } else if (BigIntAvailable) {\n return `${valueToString(x)}n`;\n }\n return `\"${valueToString(x)}\"`;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { memcpy } from '../util/buffer';\nimport { BigIntAvailable, BigInt64Array, BigUint64Array } from '../util/compat';\nimport {\n TypedArray, TypedArrayConstructor,\n BigIntArray, BigIntArrayConstructor\n} from '../interfaces';\n\n/** @ignore */ type DataValue = T extends TypedArray ? number : T extends BigIntArray ? WideValue : T;\n/** @ignore */ type WideValue = T extends BigIntArray ? bigint | Int32Array | Uint32Array : never;\n/** @ignore */ type ArrayCtor =\n T extends TypedArray ? TypedArrayConstructor :\n T extends BigIntArray ? BigIntArrayConstructor :\n any;\n\n/** @ignore */\nconst roundLengthUpToNearest64Bytes = (len: number, BPE: number) => ((((len * BPE) + 63) & ~63) || 64) / BPE;\n/** @ignore */\nconst sliceOrExtendArray = (arr: T, len = 0) => (\n arr.length >= len ? arr.subarray(0, len) : memcpy(new (arr.constructor as any)(len), arr, 0)\n) as T;\n\n/** @ignore */\nexport interface BufferBuilder> {\n readonly offset: number;\n}\n\n/** @ignore */\nexport class BufferBuilder> {\n\n constructor(buffer: T, stride = 1) {\n this.buffer = buffer;\n this.stride = stride;\n this.BYTES_PER_ELEMENT = buffer.BYTES_PER_ELEMENT;\n this.ArrayType = buffer.constructor as ArrayCtor;\n this._resize(this.length = buffer.length / stride | 0);\n }\n\n public buffer: T;\n public length: number;\n public readonly stride: number;\n public readonly ArrayType: ArrayCtor;\n public readonly BYTES_PER_ELEMENT: number;\n\n public get byteLength() { return this.length * this.stride * this.BYTES_PER_ELEMENT | 0; }\n public get reservedLength() { return this.buffer.length / this.stride; }\n public get reservedByteLength() { return this.buffer.byteLength; }\n\n // @ts-ignore\n public set(index: number, value: TValue) { return this; }\n public append(value: TValue) { return this.set(this.length, value); }\n public reserve(extra: number) {\n if (extra > 0) {\n this.length += extra;\n const stride = this.stride;\n const length = this.length * stride;\n const reserved = this.buffer.length;\n if (length >= reserved) {\n this._resize(reserved === 0\n ? roundLengthUpToNearest64Bytes(length * 1, this.BYTES_PER_ELEMENT)\n : roundLengthUpToNearest64Bytes(length * 2, this.BYTES_PER_ELEMENT)\n );\n }\n }\n return this;\n }\n public flush(length = this.length) {\n length = roundLengthUpToNearest64Bytes(length * this.stride, this.BYTES_PER_ELEMENT);\n const array = sliceOrExtendArray(this.buffer, length);\n this.clear();\n return array;\n }\n public clear() {\n this.length = 0;\n this._resize(0);\n return this;\n }\n protected _resize(newLength: number) {\n return this.buffer = memcpy(new this.ArrayType(newLength), this.buffer);\n }\n}\n\n(BufferBuilder.prototype as any).offset = 0;\n\n/** @ignore */\nexport class DataBufferBuilder extends BufferBuilder {\n public last() { return this.get(this.length - 1); }\n public get(index: number) { return this.buffer[index]; }\n public set(index: number, value: number) {\n this.reserve(index - this.length + 1);\n this.buffer[index * this.stride] = value;\n return this;\n }\n}\n\n/** @ignore */\nexport class BitmapBufferBuilder extends DataBufferBuilder {\n\n constructor(data = new Uint8Array(0)) { super(data, 1 / 8); }\n\n public numValid = 0;\n public get numInvalid() { return this.length - this.numValid; }\n public get(idx: number) { return this.buffer[idx >> 3] >> idx % 8 & 1; }\n public set(idx: number, val: number) {\n const { buffer } = this.reserve(idx - this.length + 1);\n const byte = idx >> 3, bit = idx % 8, cur = buffer[byte] >> bit & 1;\n // If `val` is truthy and the current bit is 0, flip it to 1 and increment `numValid`.\n // If `val` is falsey and the current bit is 1, flip it to 0 and decrement `numValid`.\n val ? cur === 0 && ((buffer[byte] |= (1 << bit)), ++this.numValid)\n : cur === 1 && ((buffer[byte] &= ~(1 << bit)), --this.numValid);\n return this;\n }\n public clear() {\n this.numValid = 0;\n return super.clear();\n }\n}\n\n/** @ignore */\nexport class OffsetsBufferBuilder extends DataBufferBuilder {\n constructor(data = new Int32Array(1)) { super(data, 1); }\n public append(value: number) {\n return this.set(this.length - 1, value);\n }\n public set(index: number, value: number) {\n const offset = this.length - 1;\n const buffer = this.reserve(index - offset + 1).buffer;\n if (offset < index++) {\n buffer.fill(buffer[offset], offset, index);\n }\n buffer[index] = buffer[index - 1] + value;\n return this;\n }\n public flush(length = this.length - 1) {\n if (length > this.length) {\n this.set(length - 1, 0);\n }\n return super.flush(length + 1);\n }\n}\n\n/** @ignore */\nexport class WideBufferBuilder extends BufferBuilder> {\n // @ts-ignore\n public buffer64: R;\n // @ts-ignore\n protected _ArrayType64: BigIntArrayConstructor;\n public get ArrayType64() {\n return this._ArrayType64 || (this._ArrayType64 = > (this.buffer instanceof Int32Array ? BigInt64Array : BigUint64Array));\n }\n public set(index: number, value: DataValue) {\n this.reserve(index - this.length + 1);\n switch (typeof value) {\n case 'bigint': this.buffer64[index] = value; break;\n case 'number': this.buffer[index * this.stride] = value; break;\n default: this.buffer.set(value as TypedArray, index * this.stride);\n }\n return this;\n }\n protected _resize(newLength: number) {\n const data = super._resize(newLength);\n const length = data.byteLength / (this.BYTES_PER_ELEMENT * this.stride);\n if (BigIntAvailable) {\n this.buffer64 = new this.ArrayType64(data.buffer, data.byteOffset, length);\n }\n return data;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from './vector';\nimport { BufferType } from './enum';\nimport { Data, Buffers } from './data';\nimport { createIsValidFunction } from './builder/valid';\nimport { BuilderType as B, VectorType as V} from './interfaces';\nimport { BufferBuilder, BitmapBufferBuilder, DataBufferBuilder, OffsetsBufferBuilder } from './builder/buffer';\nimport {\n DataType, strideForType,\n Float, Int, Decimal, FixedSizeBinary,\n Date_, Time, Timestamp, Interval,\n Utf8, Binary, List, Map_\n} from './type';\n\n/**\n * A set of options required to create a `Builder` instance for a given `DataType`.\n * @see {@link Builder}\n */\nexport interface BuilderOptions {\n type: T;\n nullValues?: TNull[] | ReadonlyArray | null;\n children?: { [key: string]: BuilderOptions; } | BuilderOptions[];\n}\n\n/**\n * A set of options to create an Iterable or AsyncIterable `Builder` transform function.\n * @see {@link Builder.throughIterable}\n * @see {@link Builder.throughAsyncIterable}\n */\n\nexport interface IterableBuilderOptions extends BuilderOptions {\n highWaterMark?: number;\n queueingStrategy?: 'bytes' | 'count';\n dictionaryHashFunction?: (value: any) => string | number;\n valueToChildTypeId?: (builder: Builder, value: any, offset: number) => number;\n}\n\n/**\n * An abstract base class for types that construct Arrow Vectors from arbitrary JavaScript values.\n *\n * A `Builder` is responsible for writing arbitrary JavaScript values\n * to ArrayBuffers and/or child Builders according to the Arrow specification\n * for each DataType, creating or resizing the underlying ArrayBuffers as necessary.\n *\n * The `Builder` for each Arrow `DataType` handles converting and appending\n * values for a given `DataType`. The high-level {@link Builder.new `Builder.new()`} convenience\n * method creates the specific `Builder` subclass for the supplied `DataType`.\n *\n * Once created, `Builder` instances support both appending values to the end\n * of the `Builder`, and random-access writes to specific indices\n * (`Builder.prototype.append(value)` is a convenience method for\n * `builder.set(builder.length, value)`). Appending or setting values beyond the\n * Builder's current length may cause the builder to grow its underlying buffers\n * or child Builders (if applicable) to accommodate the new values.\n *\n * After enough values have been written to a `Builder`, `Builder.prototype.flush()`\n * will commit the values to the underlying ArrayBuffers (or child Builders). The\n * internal Builder state will be reset, and an instance of `Data` is returned.\n * Alternatively, `Builder.prototype.toVector()` will flush the `Builder` and return\n * an instance of `Vector` instead.\n *\n * When there are no more values to write, use `Builder.prototype.finish()` to\n * finalize the `Builder`. This does not reset the internal state, so it is\n * necessary to call `Builder.prototype.flush()` or `toVector()` one last time\n * if there are still values queued to be flushed.\n *\n * Note: calling `Builder.prototype.finish()` is required when using a `DictionaryBuilder`,\n * because this is when it flushes the values that have been enqueued in its internal\n * dictionary's `Builder`, and creates the `dictionaryVector` for the `Dictionary` `DataType`.\n *\n * ```ts\n * import { Builder, Utf8 } from 'apache-arrow';\n *\n * const utf8Builder = Builder.new({\n * type: new Utf8(),\n * nullValues: [null, 'n/a']\n * });\n *\n * utf8Builder\n * .append('hello')\n * .append('n/a')\n * .append('world')\n * .append(null);\n *\n * const utf8Vector = utf8Builder.finish().toVector();\n *\n * console.log(utf8Vector.toJSON());\n * // > [\"hello\", null, \"world\", null]\n * ```\n *\n * @typeparam T The `DataType` of this `Builder`.\n * @typeparam TNull The type(s) of values which will be considered null-value sentinels.\n */\nexport abstract class Builder {\n\n /**\n * Create a `Builder` instance based on the `type` property of the supplied `options` object.\n * @param {BuilderOptions} options An object with a required `DataType` instance\n * and other optional parameters to be passed to the `Builder` subclass for the given `type`.\n *\n * @typeparam T The `DataType` of the `Builder` to create.\n * @typeparam TNull The type(s) of values which will be considered null-value sentinels.\n * @nocollapse\n */\n // @ts-ignore\n public static new(options: BuilderOptions): B {}\n\n /** @nocollapse */\n // @ts-ignore\n public static throughNode(options: import('./io/node/builder').BuilderDuplexOptions): import('stream').Duplex {\n throw new Error(`\"throughNode\" not available in this environment`);\n }\n /** @nocollapse */\n // @ts-ignore\n public static throughDOM(options: import('./io/whatwg/builder').BuilderTransformOptions): import('./io/whatwg/builder').BuilderTransform {\n throw new Error(`\"throughDOM\" not available in this environment`);\n }\n\n /**\n * Transform a synchronous `Iterable` of arbitrary JavaScript values into a\n * sequence of Arrow Vector following the chunking semantics defined in\n * the supplied `options` argument.\n *\n * This function returns a function that accepts an `Iterable` of values to\n * transform. When called, this function returns an Iterator of `Vector`.\n *\n * The resulting `Iterator>` yields Vectors based on the\n * `queueingStrategy` and `highWaterMark` specified in the `options` argument.\n *\n * * If `queueingStrategy` is `\"count\"` (or omitted), The `Iterator>`\n * will flush the underlying `Builder` (and yield a new `Vector`) once the\n * Builder's `length` reaches or exceeds the supplied `highWaterMark`.\n * * If `queueingStrategy` is `\"bytes\"`, the `Iterator>` will flush\n * the underlying `Builder` (and yield a new `Vector`) once its `byteLength`\n * reaches or exceeds the supplied `highWaterMark`.\n *\n * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use.\n * @returns A function which accepts a JavaScript `Iterable` of values to\n * write, and returns an `Iterator` that yields Vectors according\n * to the chunking semantics defined in the `options` argument.\n * @nocollapse\n */\n public static throughIterable(options: IterableBuilderOptions) {\n return throughIterable(options);\n }\n\n /**\n * Transform an `AsyncIterable` of arbitrary JavaScript values into a\n * sequence of Arrow Vector following the chunking semantics defined in\n * the supplied `options` argument.\n *\n * This function returns a function that accepts an `AsyncIterable` of values to\n * transform. When called, this function returns an AsyncIterator of `Vector`.\n *\n * The resulting `AsyncIterator>` yields Vectors based on the\n * `queueingStrategy` and `highWaterMark` specified in the `options` argument.\n *\n * * If `queueingStrategy` is `\"count\"` (or omitted), The `AsyncIterator>`\n * will flush the underlying `Builder` (and yield a new `Vector`) once the\n * Builder's `length` reaches or exceeds the supplied `highWaterMark`.\n * * If `queueingStrategy` is `\"bytes\"`, the `AsyncIterator>` will flush\n * the underlying `Builder` (and yield a new `Vector`) once its `byteLength`\n * reaches or exceeds the supplied `highWaterMark`.\n *\n * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use.\n * @returns A function which accepts a JavaScript `AsyncIterable` of values\n * to write, and returns an `AsyncIterator` that yields Vectors\n * according to the chunking semantics defined in the `options`\n * argument.\n * @nocollapse\n */\n public static throughAsyncIterable(options: IterableBuilderOptions) {\n return throughAsyncIterable(options);\n }\n\n /**\n * Construct a builder with the given Arrow DataType with optional null values,\n * which will be interpreted as \"null\" when set or appended to the `Builder`.\n * @param {{ type: T, nullValues?: any[] }} options A `BuilderOptions` object used to create this `Builder`.\n */\n constructor({ 'type': type, 'nullValues': nulls }: BuilderOptions) {\n this.type = type;\n this.children = [];\n this.nullValues = nulls;\n this.stride = strideForType(type);\n this._nulls = new BitmapBufferBuilder();\n if (nulls && nulls.length > 0) {\n this._isValid = createIsValidFunction(nulls);\n }\n }\n\n /**\n * The Builder's `DataType` instance.\n * @readonly\n */\n public type: T;\n /**\n * The number of values written to the `Builder` that haven't been flushed yet.\n * @readonly\n */\n public length = 0;\n /**\n * A boolean indicating whether `Builder.prototype.finish()` has been called on this `Builder`.\n * @readonly\n */\n public finished = false;\n /**\n * The number of elements in the underlying values TypedArray that\n * represent a single logical element, determined by this Builder's\n * `DataType`. This is 1 for most types, but is larger when the `DataType`\n * is `Int64`, `Uint64`, `Decimal`, `DateMillisecond`, certain variants of\n * `Interval`, `Time`, or `Timestamp`, `FixedSizeBinary`, and `FixedSizeList`.\n * @readonly\n */\n public readonly stride: number;\n public readonly children: Builder[];\n /**\n * The list of null-value sentinels for this `Builder`. When one of these values\n * is written to the `Builder` (either via `Builder.prototype.set()` or `Builder.prototype.append()`),\n * a 1-bit is written to this Builder's underlying null BitmapBufferBuilder.\n * @readonly\n */\n public readonly nullValues?: TNull[] | ReadonlyArray | null;\n\n /**\n * Flush the `Builder` and return a `Vector`.\n * @returns {Vector} A `Vector` of the flushed values.\n */\n public toVector() { return Vector.new(this.flush()); }\n\n public get ArrayType() { return this.type.ArrayType; }\n public get nullCount() { return this._nulls.numInvalid; }\n public get numChildren() { return this.children.length; }\n\n /**\n * @returns The aggregate length (in bytes) of the values that have been written.\n */\n public get byteLength(): number {\n let size = 0;\n this._offsets && (size += this._offsets.byteLength);\n this._values && (size += this._values.byteLength);\n this._nulls && (size += this._nulls.byteLength);\n this._typeIds && (size += this._typeIds.byteLength);\n return this.children.reduce((size, child) => size + child.byteLength, size);\n }\n\n /**\n * @returns The aggregate number of rows that have been reserved to write new values.\n */\n public get reservedLength(): number {\n return this._nulls.reservedLength;\n }\n\n /**\n * @returns The aggregate length (in bytes) that has been reserved to write new values.\n */\n public get reservedByteLength(): number {\n let size = 0;\n this._offsets && (size += this._offsets.reservedByteLength);\n this._values && (size += this._values.reservedByteLength);\n this._nulls && (size += this._nulls.reservedByteLength);\n this._typeIds && (size += this._typeIds.reservedByteLength);\n return this.children.reduce((size, child) => size + child.reservedByteLength, size);\n }\n\n // @ts-ignore\n protected _offsets: DataBufferBuilder;\n public get valueOffsets() { return this._offsets ? this._offsets.buffer : null; }\n\n // @ts-ignore\n protected _values: BufferBuilder;\n public get values() { return this._values ? this._values.buffer : null; }\n\n protected _nulls: BitmapBufferBuilder;\n public get nullBitmap() { return this._nulls ? this._nulls.buffer : null; }\n\n // @ts-ignore\n protected _typeIds: DataBufferBuilder;\n public get typeIds() { return this._typeIds ? this._typeIds.buffer : null; }\n\n // @ts-ignore\n protected _isValid: (value: T['TValue'] | TNull) => boolean;\n // @ts-ignore\n protected _setValue: (inst: Builder, index: number, value: T['TValue']) => void;\n\n /**\n * Appends a value (or null) to this `Builder`.\n * This is equivalent to `builder.set(builder.length, value)`.\n * @param {T['TValue'] | TNull } value The value to append.\n */\n public append(value: T['TValue'] | TNull) { return this.set(this.length, value); }\n\n /**\n * Validates whether a value is valid (true), or null (false)\n * @param {T['TValue'] | TNull } value The value to compare against null the value representations\n */\n // @ts-ignore\n public isValid(value: T['TValue'] | TNull): boolean { return this._isValid(value); }\n\n /**\n * Write a value (or null-value sentinel) at the supplied index.\n * If the value matches one of the null-value representations, a 1-bit is\n * written to the null `BitmapBufferBuilder`. Otherwise, a 0 is written to\n * the null `BitmapBufferBuilder`, and the value is passed to\n * `Builder.prototype.setValue()`.\n * @param {number} index The index of the value to write.\n * @param {T['TValue'] | TNull } value The value to write at the supplied index.\n * @returns {this} The updated `Builder` instance.\n */\n public set(index: number, value: T['TValue'] | TNull) {\n if (this.setValid(index, this.isValid(value))) {\n this.setValue(index, value);\n }\n return this;\n }\n\n /**\n * Write a value to the underlying buffers at the supplied index, bypassing\n * the null-value check. This is a low-level method that\n * @param {number} index\n * @param {T['TValue'] | TNull } value\n */\n // @ts-ignore\n public setValue(index: number, value: T['TValue']) { this._setValue(this, index, value); }\n public setValid(index: number, valid: boolean) {\n this.length = this._nulls.set(index, +valid).length;\n return valid;\n }\n\n // @ts-ignore\n public addChild(child: Builder, name = `${this.numChildren}`) {\n throw new Error(`Cannot append children to non-nested type \"${this.type}\"`);\n }\n\n /**\n * Retrieve the child `Builder` at the supplied `index`, or null if no child\n * exists at that index.\n * @param {number} index The index of the child `Builder` to retrieve.\n * @returns {Builder | null} The child Builder at the supplied index or null.\n */\n public getChildAt(index: number): Builder | null {\n return this.children[index] || null;\n }\n\n /**\n * Commit all the values that have been written to their underlying\n * ArrayBuffers, including any child Builders if applicable, and reset\n * the internal `Builder` state.\n * @returns A `Data` of the buffers and childData representing the values written.\n */\n public flush() {\n\n const buffers: any = [];\n const values = this._values;\n const offsets = this._offsets;\n const typeIds = this._typeIds;\n const { length, nullCount } = this;\n\n if (typeIds) { /* Unions */\n buffers[BufferType.TYPE] = typeIds.flush(length);\n // DenseUnions\n offsets && (buffers[BufferType.OFFSET] = offsets.flush(length));\n } else if (offsets) { /* Variable-width primitives (Binary, Utf8) and Lists */\n // Binary, Utf8\n values && (buffers[BufferType.DATA] = values.flush(offsets.last()));\n buffers[BufferType.OFFSET] = offsets.flush(length);\n } else if (values) { /* Fixed-width primitives (Int, Float, Decimal, Time, Timestamp, and Interval) */\n buffers[BufferType.DATA] = values.flush(length);\n }\n\n nullCount > 0 && (buffers[BufferType.VALIDITY] = this._nulls.flush(length));\n\n const data = Data.new(\n this.type, 0, length, nullCount, buffers as Buffers,\n this.children.map((child) => child.flush())) as Data;\n\n this.clear();\n\n return data;\n }\n\n /**\n * Finalize this `Builder`, and child builders if applicable.\n * @returns {this} The finalized `Builder` instance.\n */\n public finish() {\n this.finished = true;\n this.children.forEach((child) => child.finish());\n return this;\n }\n\n /**\n * Clear this Builder's internal state, including child Builders if applicable, and reset the length to 0.\n * @returns {this} The cleared `Builder` instance.\n */\n public clear() {\n this.length = 0;\n this._offsets && (this._offsets.clear());\n this._values && (this._values.clear());\n this._nulls && (this._nulls.clear());\n this._typeIds && (this._typeIds.clear());\n this.children.forEach((child) => child.clear());\n return this;\n }\n}\n\n(Builder.prototype as any).length = 1;\n(Builder.prototype as any).stride = 1;\n(Builder.prototype as any).children = null;\n(Builder.prototype as any).finished = false;\n(Builder.prototype as any).nullValues = null;\n(Builder.prototype as any)._isValid = () => true;\n\n/** @ignore */\nexport abstract class FixedWidthBuilder extends Builder {\n constructor(opts: BuilderOptions) {\n super(opts);\n this._values = new DataBufferBuilder(new this.ArrayType(0), this.stride);\n }\n public setValue(index: number, value: T['TValue']) {\n const values = this._values;\n values.reserve(index - values.length + 1);\n return super.setValue(index, value);\n }\n}\n\n/** @ignore */\nexport abstract class VariableWidthBuilder extends Builder {\n protected _pendingLength: number = 0;\n protected _offsets: OffsetsBufferBuilder;\n protected _pending: Map | undefined;\n constructor(opts: BuilderOptions) {\n super(opts);\n this._offsets = new OffsetsBufferBuilder();\n }\n public setValue(index: number, value: T['TValue']) {\n const pending = this._pending || (this._pending = new Map());\n const current = pending.get(index);\n current && (this._pendingLength -= current.length);\n this._pendingLength += value.length;\n pending.set(index, value);\n }\n public setValid(index: number, isValid: boolean) {\n if (!super.setValid(index, isValid)) {\n (this._pending || (this._pending = new Map())).set(index, undefined);\n return false;\n }\n return true;\n }\n public clear() {\n this._pendingLength = 0;\n this._pending = undefined;\n return super.clear();\n }\n public flush() {\n this._flush();\n return super.flush();\n }\n public finish() {\n this._flush();\n return super.finish();\n }\n protected _flush() {\n const pending = this._pending;\n const pendingLength = this._pendingLength;\n this._pendingLength = 0;\n this._pending = undefined;\n if (pending && pending.size > 0) {\n this._flushPending(pending, pendingLength);\n }\n return this;\n }\n protected abstract _flushPending(pending: Map, pendingLength: number): void;\n}\n\n/** @ignore */\ntype ThroughIterable = (source: Iterable) => IterableIterator>;\n\n/** @ignore */\nfunction throughIterable(options: IterableBuilderOptions): ThroughIterable {\n const { ['queueingStrategy']: queueingStrategy = 'count' } = options;\n const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;\n const sizeProperty: 'length' | 'byteLength' = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';\n return function*(source: Iterable) {\n let numChunks = 0;\n let builder = Builder.new(options);\n for (const value of source) {\n if (builder.append(value)[sizeProperty] >= highWaterMark) {\n ++numChunks && (yield builder.toVector());\n }\n }\n if (builder.finish().length > 0 || numChunks === 0) {\n yield builder.toVector();\n }\n };\n}\n\n/** @ignore */\ntype ThroughAsyncIterable = (source: Iterable | AsyncIterable) => AsyncIterableIterator>;\n\n/** @ignore */\nfunction throughAsyncIterable(options: IterableBuilderOptions): ThroughAsyncIterable {\n const { ['queueingStrategy']: queueingStrategy = 'count' } = options;\n const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;\n const sizeProperty: 'length' | 'byteLength' = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';\n return async function* (source: Iterable | AsyncIterable) {\n let numChunks = 0;\n let builder = Builder.new(options);\n for await (const value of source) {\n if (builder.append(value)[sizeProperty] >= highWaterMark) {\n ++numChunks && (yield builder.toVector());\n }\n }\n if (builder.finish().length > 0 || numChunks === 0) {\n yield builder.toVector();\n }\n };\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Bool } from '../type';\nimport { BitmapBufferBuilder } from './buffer';\nimport { Builder, BuilderOptions } from '../builder';\n\n/** @ignore */\nexport class BoolBuilder extends Builder {\n constructor(options: BuilderOptions) {\n super(options);\n this._values = new BitmapBufferBuilder();\n }\n public setValue(index: number, value: boolean) {\n this._values.set(index, +value);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Null } from '../type';\nimport { Builder } from '../builder';\n\n/** @ignore */\nexport class NullBuilder extends Builder {\n // @ts-ignore\n public setValue(index: number, value: null) {}\n public setValid(index: number, valid: boolean) {\n this.length = Math.max(index + 1, this.length);\n return valid;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FixedWidthBuilder } from '../builder';\nimport { Date_, DateDay, DateMillisecond } from '../type';\n\n/** @ignore */\nexport class DateBuilder extends FixedWidthBuilder {}\n/** @ignore */\nexport class DateDayBuilder extends DateBuilder {}\n/** @ignore */\nexport class DateMillisecondBuilder extends DateBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Decimal } from '../type';\nimport { FixedWidthBuilder } from '../builder';\n\n/** @ignore */\nexport class DecimalBuilder extends FixedWidthBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { IntBuilder } from './int';\nimport { Dictionary, DataType } from '../type';\nimport { Builder, BuilderOptions } from '../builder';\n\ntype DictionaryHashFunction = (x: any) => string | number;\n\nexport interface DictionaryBuilderOptions extends BuilderOptions {\n dictionaryHashFunction?: DictionaryHashFunction;\n}\n\n/** @ignore */\nexport class DictionaryBuilder extends Builder {\n\n protected _dictionaryOffset: number;\n protected _dictionary?: Vector;\n protected _keysToIndices: { [key: string]: number };\n public readonly indices: IntBuilder;\n public readonly dictionary: Builder;\n\n constructor({ 'type': type, 'nullValues': nulls, 'dictionaryHashFunction': hashFn }: DictionaryBuilderOptions) {\n super({ type: new Dictionary(type.dictionary, type.indices, type.id, type.isOrdered) as T });\n this._nulls = null;\n this._dictionaryOffset = 0;\n this._keysToIndices = Object.create(null);\n this.indices = Builder.new({ 'type': this.type.indices, 'nullValues': nulls }) as IntBuilder;\n this.dictionary = Builder.new({ 'type': this.type.dictionary, 'nullValues': null }) as Builder;\n if (typeof hashFn === 'function') {\n this.valueToKey = hashFn;\n }\n }\n\n public get values() { return this.indices.values; }\n public get nullCount() { return this.indices.nullCount; }\n public get nullBitmap() { return this.indices.nullBitmap; }\n public get byteLength() { return this.indices.byteLength + this.dictionary.byteLength; }\n public get reservedLength() { return this.indices.reservedLength + this.dictionary.reservedLength; }\n public get reservedByteLength() { return this.indices.reservedByteLength + this.dictionary.reservedByteLength; }\n public isValid(value: T['TValue'] | TNull) { return this.indices.isValid(value); }\n public setValid(index: number, valid: boolean) {\n const indices = this.indices;\n valid = indices.setValid(index, valid);\n this.length = indices.length;\n return valid;\n }\n public setValue(index: number, value: T['TValue']) {\n let keysToIndices = this._keysToIndices;\n let key = this.valueToKey(value);\n let idx = keysToIndices[key];\n if (idx === undefined) {\n keysToIndices[key] = idx = this._dictionaryOffset + this.dictionary.append(value).length - 1;\n }\n return this.indices.setValue(index, idx);\n }\n public flush() {\n const type = this.type;\n const prev = this._dictionary;\n const curr = this.dictionary.toVector();\n const data = this.indices.flush().clone(type);\n data.dictionary = prev ? prev.concat(curr) : curr;\n this.finished || (this._dictionaryOffset += curr.length);\n this._dictionary = data.dictionary as Vector;\n this.clear();\n return data;\n }\n public finish() {\n this.indices.finish();\n this.dictionary.finish();\n this._dictionaryOffset = 0;\n this._keysToIndices = Object.create(null);\n return super.finish();\n }\n public clear() {\n this.indices.clear();\n this.dictionary.clear();\n return super.clear();\n }\n public valueToKey(val: any): string | number {\n return typeof val === 'string' ? val : `${val}`;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FixedSizeBinary } from '../type';\nimport { FixedWidthBuilder } from '../builder';\n\n/** @ignore */\nexport class FixedSizeBinaryBuilder extends FixedWidthBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nconst f64 = new Float64Array(1);\nconst u32 = new Uint32Array(f64.buffer);\n\n/**\n * Convert uint16 (logically a float16) to a JS float64. Inspired by numpy's `npy_half_to_double`:\n * https://github.com/numpy/numpy/blob/5a5987291dc95376bb098be8d8e5391e89e77a2c/numpy/core/src/npymath/halffloat.c#L29\n * @param h {number} the uint16 to convert\n * @private\n * @ignore\n */\nexport function uint16ToFloat64(h: number) {\n let expo = (h & 0x7C00) >> 10;\n let sigf = (h & 0x03FF) / 1024;\n let sign = (-1) ** ((h & 0x8000) >> 15);\n switch (expo) {\n case 0x1F: return sign * (sigf ? NaN : 1 / 0);\n case 0x00: return sign * (sigf ? 6.103515625e-5 * sigf : 0);\n }\n return sign * (2 ** (expo - 15)) * (1 + sigf);\n}\n\n/**\n * Convert a float64 to uint16 (assuming the float64 is logically a float16). Inspired by numpy's `npy_double_to_half`:\n * https://github.com/numpy/numpy/blob/5a5987291dc95376bb098be8d8e5391e89e77a2c/numpy/core/src/npymath/halffloat.c#L43\n * @param d {number} The float64 to convert\n * @private\n * @ignore\n */\nexport function float64ToUint16(d: number) {\n\n if (d !== d) { return 0x7E00; } // NaN\n\n f64[0] = d;\n\n // Magic numbers:\n // 0x80000000 = 10000000 00000000 00000000 00000000 -- masks the 32nd bit\n // 0x7ff00000 = 01111111 11110000 00000000 00000000 -- masks the 21st-31st bits\n // 0x000fffff = 00000000 00001111 11111111 11111111 -- masks the 1st-20th bit\n\n let sign = (u32[1] & 0x80000000) >> 16 & 0xFFFF;\n let expo = (u32[1] & 0x7ff00000), sigf = 0x0000;\n\n if (expo >= 0x40f00000) {\n //\n // If exponent overflowed, the float16 is either NaN or Infinity.\n // Rules to propagate the sign bit: mantissa > 0 ? NaN : +/-Infinity\n //\n // Magic numbers:\n // 0x40F00000 = 01000000 11110000 00000000 00000000 -- 6-bit exponent overflow\n // 0x7C000000 = 01111100 00000000 00000000 00000000 -- masks the 27th-31st bits\n //\n // returns:\n // qNaN, aka 32256 decimal, 0x7E00 hex, or 01111110 00000000 binary\n // sNaN, aka 32000 decimal, 0x7D00 hex, or 01111101 00000000 binary\n // +inf, aka 31744 decimal, 0x7C00 hex, or 01111100 00000000 binary\n // -inf, aka 64512 decimal, 0xFC00 hex, or 11111100 00000000 binary\n //\n // If mantissa is greater than 23 bits, set to +Infinity like numpy\n if (u32[0] > 0) {\n expo = 0x7C00;\n } else {\n expo = (expo & 0x7C000000) >> 16;\n sigf = (u32[1] & 0x000fffff) >> 10;\n }\n } else if (expo <= 0x3f000000) {\n //\n // If exponent underflowed, the float is either signed zero or subnormal.\n //\n // Magic numbers:\n // 0x3F000000 = 00111111 00000000 00000000 00000000 -- 6-bit exponent underflow\n //\n sigf = 0x100000 + (u32[1] & 0x000fffff);\n sigf = 0x100000 + (sigf << ((expo >> 20) - 998)) >> 21;\n expo = 0;\n } else {\n //\n // No overflow or underflow, rebase the exponent and round the mantissa\n // Magic numbers:\n // 0x200 = 00000010 00000000 -- masks off the 10th bit\n //\n\n // Ensure the first mantissa bit (the 10th one) is 1 and round\n expo = (expo - 0x3f000000) >> 10;\n sigf = ((u32[1] & 0x000fffff) + 0x200) >> 10;\n }\n\n return sign | expo | sigf & 0xFFFF;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { float64ToUint16 } from '../util/math';\nimport { FixedWidthBuilder } from '../builder';\nimport { Float, Float16, Float32, Float64 } from '../type';\n\n/** @ignore */\nexport class FloatBuilder extends FixedWidthBuilder {}\n\n/** @ignore */\nexport class Float16Builder extends FloatBuilder {\n public setValue(index: number, value: number) {\n // convert JS float64 to a uint16\n this._values.set(index, float64ToUint16(value));\n }\n}\n\n/** @ignore */\nexport class Float32Builder extends FloatBuilder {\n public setValue(index: number, value: number) {\n this._values.set(index, value);\n }\n}\n\n/** @ignore */\nexport class Float64Builder extends FloatBuilder {\n public setValue(index: number, value: number) {\n this._values.set(index, value);\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct\";\nexport default function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n _construct = Reflect.construct;\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { ArrayBufferViewInput, toArrayBufferView } from './buffer';\nimport { TypedArray, TypedArrayConstructor } from '../interfaces';\nimport { BigIntArray, BigIntArrayConstructor } from '../interfaces';\nimport { BigIntAvailable, BigInt64Array, BigUint64Array } from './compat';\n\n/** @ignore */\nexport const isArrowBigNumSymbol = Symbol.for('isArrowBigNum');\n\n/** @ignore */ type BigNumArray = IntArray | UintArray;\n/** @ignore */ type IntArray = Int8Array | Int16Array | Int32Array;\n/** @ignore */ type UintArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray;\n\n/** @ignore */\nfunction BigNum(this: any, x: any, ...xs: any) {\n if (xs.length === 0) {\n return Object.setPrototypeOf(toArrayBufferView(this['TypedArray'], x), this.constructor.prototype);\n }\n return Object.setPrototypeOf(new this['TypedArray'](x, ...xs), this.constructor.prototype);\n}\n\nBigNum.prototype[isArrowBigNumSymbol] = true;\nBigNum.prototype.toJSON = function>(this: T) { return `\"${bignumToString(this)}\"`; };\nBigNum.prototype.valueOf = function>(this: T) { return bignumToNumber(this); };\nBigNum.prototype.toString = function>(this: T) { return bignumToString(this); };\nBigNum.prototype[Symbol.toPrimitive] = function>(this: T, hint: 'string' | 'number' | 'default' = 'default') {\n switch (hint) {\n case 'number': return bignumToNumber(this);\n case 'string': return bignumToString(this);\n case 'default': return bignumToBigInt(this);\n }\n return bignumToString(this);\n};\n\n/** @ignore */\ntype TypedArrayConstructorArgs =\n [number | void] |\n [Iterable | Iterable] |\n [ArrayBufferLike, number | void, number | void] ;\n\n/** @ignore */\nfunction SignedBigNum(this: any, ...args: TypedArrayConstructorArgs) { return BigNum.apply(this, args); }\n/** @ignore */\nfunction UnsignedBigNum(this: any, ...args: TypedArrayConstructorArgs) { return BigNum.apply(this, args); }\n/** @ignore */\nfunction DecimalBigNum(this: any, ...args: TypedArrayConstructorArgs) { return BigNum.apply(this, args); }\n\nObject.setPrototypeOf(SignedBigNum.prototype, Object.create(Int32Array.prototype));\nObject.setPrototypeOf(UnsignedBigNum.prototype, Object.create(Uint32Array.prototype));\nObject.setPrototypeOf(DecimalBigNum.prototype, Object.create(Uint32Array.prototype));\nObject.assign(SignedBigNum.prototype, BigNum.prototype, { 'constructor': SignedBigNum, 'signed': true, 'TypedArray': Int32Array, 'BigIntArray': BigInt64Array });\nObject.assign(UnsignedBigNum.prototype, BigNum.prototype, { 'constructor': UnsignedBigNum, 'signed': false, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64Array });\nObject.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64Array });\n\n/** @ignore */\nfunction bignumToNumber>(bn: T) {\n let { buffer, byteOffset, length, 'signed': signed } = bn;\n let words = new Int32Array(buffer, byteOffset, length);\n let number = 0, i = 0, n = words.length, hi, lo;\n while (i < n) {\n lo = words[i++];\n hi = words[i++];\n signed || (hi = hi >>> 0);\n number += (lo >>> 0) + (hi * (i ** 32));\n }\n return number;\n}\n\n/** @ignore */\nexport let bignumToString: { >(a: T): string; };\n/** @ignore */\nexport let bignumToBigInt: { >(a: T): bigint; };\n\nif (!BigIntAvailable) {\n bignumToString = decimalToString;\n bignumToBigInt = bignumToString;\n} else {\n bignumToBigInt = (>(a: T) => a.byteLength === 8 ? new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0] : decimalToString(a));\n bignumToString = (>(a: T) => a.byteLength === 8 ? `${new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0]}` : decimalToString(a));\n}\n\n/** @ignore */\nfunction decimalToString>(a: T) {\n let digits = '';\n let base64 = new Uint32Array(2);\n let base32 = new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2);\n let checks = new Uint32Array((base32 = new Uint16Array(base32).reverse()).buffer);\n let i = -1, n = base32.length - 1;\n do {\n for (base64[0] = base32[i = 0]; i < n;) {\n base32[i++] = base64[1] = base64[0] / 10;\n base64[0] = ((base64[0] - base64[1] * 10) << 16) + base32[i];\n }\n base32[i] = base64[1] = base64[0] / 10;\n base64[0] = base64[0] - base64[1] * 10;\n digits = `${base64[0]}${digits}`;\n } while (checks[0] || checks[1] || checks[2] || checks[3]);\n return digits ? digits : `0`;\n}\n\n/** @ignore */\nexport class BN {\n /** @nocollapse */\n public static new(num: T, isSigned?: boolean): (T & BN) {\n switch (isSigned) {\n case true: return new ( SignedBigNum)(num) as (T & BN);\n case false: return new ( UnsignedBigNum)(num) as (T & BN);\n }\n switch (num.constructor) {\n case Int8Array:\n case Int16Array:\n case Int32Array:\n case BigInt64Array:\n return new ( SignedBigNum)(num) as (T & BN);\n }\n if (num.byteLength === 16) {\n return new ( DecimalBigNum)(num) as (T & BN);\n }\n return new ( UnsignedBigNum)(num) as (T & BN);\n }\n /** @nocollapse */\n public static signed(num: T): (T & BN) {\n return new ( SignedBigNum)(num) as (T & BN);\n }\n /** @nocollapse */\n public static unsigned(num: T): (T & BN) {\n return new ( UnsignedBigNum)(num) as (T & BN);\n }\n /** @nocollapse */\n public static decimal(num: T): (T & BN) {\n return new ( DecimalBigNum)(num) as (T & BN);\n }\n constructor(num: T, isSigned?: boolean) {\n return BN.new(num, isSigned) as any;\n }\n}\n\n/** @ignore */\nexport interface BN extends TypedArrayLike {\n\n new(buffer: T, signed?: boolean): T;\n\n readonly signed: boolean;\n readonly TypedArray: TypedArrayConstructor;\n readonly BigIntArray: BigIntArrayConstructor;\n\n [Symbol.toStringTag]:\n 'Int8Array' |\n 'Int16Array' |\n 'Int32Array' |\n 'Uint8Array' |\n 'Uint16Array' |\n 'Uint32Array' |\n 'Uint8ClampedArray';\n\n /**\n * Convert the bytes to their (positive) decimal representation for printing\n */\n toString(): string;\n /**\n * Down-convert the bytes to a 53-bit precision integer. Invoked by JS for\n * arithmetic operators, like `+`. Easy (and unsafe) way to convert BN to\n * number via `+bn_inst`\n */\n valueOf(): number;\n /**\n * Return the JSON representation of the bytes. Must be wrapped in double-quotes,\n * so it's compatible with JSON.stringify().\n */\n toJSON(): string;\n [Symbol.toPrimitive](hint?: any): number | string | bigint;\n}\n\n/** @ignore */\ninterface TypedArrayLike {\n\n readonly length: number;\n readonly buffer: ArrayBuffer;\n readonly byteLength: number;\n readonly byteOffset: number;\n readonly BYTES_PER_ELEMENT: number;\n\n includes(searchElement: number, fromIndex?: number | undefined): boolean;\n copyWithin(target: number, start: number, end?: number | undefined): this;\n every(callbackfn: (value: number, index: number, array: T) => boolean, thisArg?: any): boolean;\n fill(value: number, start?: number | undefined, end?: number | undefined): this;\n filter(callbackfn: (value: number, index: number, array: T) => boolean, thisArg?: any): T;\n find(predicate: (value: number, index: number, obj: T) => boolean, thisArg?: any): number | undefined;\n findIndex(predicate: (value: number, index: number, obj: T) => boolean, thisArg?: any): number;\n forEach(callbackfn: (value: number, index: number, array: T) => void, thisArg?: any): void;\n indexOf(searchElement: number, fromIndex?: number | undefined): number;\n join(separator?: string | undefined): string;\n lastIndexOf(searchElement: number, fromIndex?: number | undefined): number;\n map(callbackfn: (value: number, index: number, array: T) => number, thisArg?: any): T;\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: T) => number): number;\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: T) => number, initialValue: number): number;\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: T) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: T) => number): number;\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: T) => number, initialValue: number): number;\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: T) => U, initialValue: U): U;\n reverse(): T;\n set(array: ArrayLike, offset?: number | undefined): void;\n slice(start?: number | undefined, end?: number | undefined): T;\n some(callbackfn: (value: number, index: number, array: T) => boolean, thisArg?: any): boolean;\n sort(compareFn?: ((a: number, b: number) => number) | undefined): this;\n subarray(begin: number, end?: number | undefined): T;\n toLocaleString(): string;\n entries(): IterableIterator<[number, number]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { bignumToBigInt } from '../util/bn';\nimport { WideBufferBuilder } from './buffer';\nimport { BigInt64Array } from '../util/compat';\nimport { FixedWidthBuilder, BuilderOptions } from '../builder';\nimport { Int, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64 } from '../type';\n\n/** @ignore */\nexport class IntBuilder extends FixedWidthBuilder {\n public setValue(index: number, value: T['TValue']) {\n this._values.set(index, value);\n }\n}\n\n/** @ignore */\nexport class Int8Builder extends IntBuilder {}\n/** @ignore */\nexport class Int16Builder extends IntBuilder {}\n/** @ignore */\nexport class Int32Builder extends IntBuilder {}\n/** @ignore */\nexport class Int64Builder extends IntBuilder {\n protected _values: WideBufferBuilder;\n constructor(options: BuilderOptions) {\n if (options['nullValues']) {\n options['nullValues'] = (options['nullValues'] as TNull[]).map(toBigInt);\n }\n super(options);\n this._values = new WideBufferBuilder(new Int32Array(0), 2);\n }\n public get values64() { return this._values.buffer64; }\n public isValid(value: Int32Array | bigint | TNull) { return super.isValid(toBigInt(value)); }\n}\n\n/** @ignore */\nexport class Uint8Builder extends IntBuilder {}\n/** @ignore */\nexport class Uint16Builder extends IntBuilder {}\n/** @ignore */\nexport class Uint32Builder extends IntBuilder {}\n/** @ignore */\nexport class Uint64Builder extends IntBuilder {\n protected _values: WideBufferBuilder;\n constructor(options: BuilderOptions) {\n if (options['nullValues']) {\n options['nullValues'] = (options['nullValues'] as TNull[]).map(toBigInt);\n }\n super(options);\n this._values = new WideBufferBuilder(new Uint32Array(0), 2);\n }\n public get values64() { return this._values.buffer64; }\n public isValid(value: Uint32Array | bigint | TNull) { return super.isValid(toBigInt(value)); }\n}\n\nconst toBigInt = ((memo: any) => (value: any) => {\n if (ArrayBuffer.isView(value)) {\n memo.buffer = value.buffer;\n memo.byteOffset = value.byteOffset;\n memo.byteLength = value.byteLength;\n value = bignumToBigInt(memo);\n memo.buffer = null;\n }\n return value;\n})({ 'BigIntArray': BigInt64Array });\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FixedWidthBuilder } from '../builder';\nimport { Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond } from '../type';\n\n/** @ignore */\nexport class TimeBuilder extends FixedWidthBuilder {}\n/** @ignore */\nexport class TimeSecondBuilder extends TimeBuilder {}\n/** @ignore */\nexport class TimeMillisecondBuilder extends TimeBuilder {}\n/** @ignore */\nexport class TimeMicrosecondBuilder extends TimeBuilder {}\n/** @ignore */\nexport class TimeNanosecondBuilder extends TimeBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FixedWidthBuilder } from '../builder';\nimport { Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond } from '../type';\n\n/** @ignore */\nexport class TimestampBuilder extends FixedWidthBuilder {}\n/** @ignore */\nexport class TimestampSecondBuilder extends TimestampBuilder {}\n/** @ignore */\nexport class TimestampMillisecondBuilder extends TimestampBuilder {}\n/** @ignore */\nexport class TimestampMicrosecondBuilder extends TimestampBuilder {}\n/** @ignore */\nexport class TimestampNanosecondBuilder extends TimestampBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FixedWidthBuilder } from '../builder';\nimport { Interval, IntervalDayTime, IntervalYearMonth } from '../type';\n\n/** @ignore */\nexport class IntervalBuilder extends FixedWidthBuilder {}\n/** @ignore */\nexport class IntervalDayTimeBuilder extends IntervalBuilder {}\n/** @ignore */\nexport class IntervalYearMonthBuilder extends IntervalBuilder {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Binary } from '../type';\nimport { toUint8Array } from '../util/buffer';\nimport { BufferBuilder } from './buffer';\nimport { VariableWidthBuilder, BuilderOptions } from '../builder';\n\n/** @ignore */\nexport class BinaryBuilder extends VariableWidthBuilder {\n constructor(opts: BuilderOptions) {\n super(opts);\n this._values = new BufferBuilder(new Uint8Array(0));\n }\n public get byteLength(): number {\n let size = this._pendingLength + (this.length * 4);\n this._offsets && (size += this._offsets.byteLength);\n this._values && (size += this._values.byteLength);\n this._nulls && (size += this._nulls.byteLength);\n return size;\n }\n public setValue(index: number, value: Uint8Array) {\n return super.setValue(index, toUint8Array(value));\n }\n protected _flushPending(pending: Map, pendingLength: number) {\n const offsets = this._offsets;\n const data = this._values.reserve(pendingLength).buffer;\n let index = 0, length = 0, offset = 0, value: Uint8Array | undefined;\n for ([index, value] of pending) {\n if (value === undefined) {\n offsets.set(index, 0);\n } else {\n length = value.length;\n data.set(value, offset);\n offsets.set(index, length);\n offset += length;\n }\n }\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Utf8 } from '../type';\nimport { encodeUtf8 } from '../util/utf8';\nimport { BinaryBuilder } from './binary';\nimport { BufferBuilder } from './buffer';\nimport { VariableWidthBuilder, BuilderOptions } from '../builder';\n\n/** @ignore */\nexport class Utf8Builder extends VariableWidthBuilder {\n constructor(opts: BuilderOptions) {\n super(opts);\n this._values = new BufferBuilder(new Uint8Array(0));\n }\n public get byteLength(): number {\n let size = this._pendingLength + (this.length * 4);\n this._offsets && (size += this._offsets.byteLength);\n this._values && (size += this._values.byteLength);\n this._nulls && (size += this._nulls.byteLength);\n return size;\n }\n public setValue(index: number, value: string) {\n return super.setValue(index, encodeUtf8(value) as any);\n }\n // @ts-ignore\n protected _flushPending(pending: Map, pendingLength: number): void {}\n}\n\n(Utf8Builder.prototype as any)._flushPending = (BinaryBuilder.prototype as any)._flushPending;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\n\n/** @ignore */\nexport class Run {\n // @ts-ignore\n protected _values: ArrayLike;\n public get length() { return this._values.length; }\n public get(index: number) { return this._values[index]; }\n public clear() { this._values = null; return this; }\n public bind(values: Vector | ArrayLike) {\n if (values instanceof Vector) {\n return values;\n }\n this._values = values;\n return this as any;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { StructVector } from './struct';\nimport { valueToString } from '../util/pretty';\nimport { DataType, Struct, RowLike } from '../type';\n\n/** @ignore */ const kParent = Symbol.for('parent');\n/** @ignore */ const kRowIndex = Symbol.for('rowIndex');\n/** @ignore */ const kKeyToIdx = Symbol.for('keyToIdx');\n/** @ignore */ const kIdxToVal = Symbol.for('idxToVal');\n/** @ignore */ const kCustomInspect = Symbol.for('nodejs.util.inspect.custom');\n\nabstract class Row implements Map {\n\n public readonly size: number;\n public readonly [Symbol.toStringTag]: string;\n\n protected [kRowIndex]: number;\n protected [kParent]: Vector;\n protected [kKeyToIdx]: Map;\n protected [kIdxToVal]: V[];\n\n constructor(parent: Vector, numKeys: number) {\n this[kParent] = parent;\n this.size = numKeys;\n }\n\n public abstract keys(): IterableIterator;\n public abstract values(): IterableIterator;\n public abstract getKey(idx: number): K;\n public abstract getIndex(key: K): number;\n public abstract getValue(idx: number): V;\n public abstract setValue(idx: number, val: V): void;\n\n public entries() { return this[Symbol.iterator](); }\n\n public has(key: K) { return this.get(key) !== undefined; }\n\n public get(key: K) {\n let val = undefined;\n if (key !== null && key !== undefined) {\n const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());\n let idx = ktoi.get(key);\n if (idx !== undefined) {\n const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));\n ((val = itov[idx]) !== undefined) || (itov[idx] = val = this.getValue(idx));\n } else if ((idx = this.getIndex(key)) > -1) {\n ktoi.set(key, idx);\n const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));\n ((val = itov[idx]) !== undefined) || (itov[idx] = val = this.getValue(idx));\n }\n }\n return val;\n }\n\n public set(key: K, val: V) {\n if (key !== null && key !== undefined) {\n const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());\n let idx = ktoi.get(key);\n if (idx === undefined) {\n ktoi.set(key, idx = this.getIndex(key));\n }\n if (idx > -1) {\n const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));\n itov[idx] = this.setValue(idx, val);\n }\n }\n return this;\n }\n\n public clear(): void { throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`); }\n\n public delete(_: K): boolean { throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`); }\n\n public *[Symbol.iterator](): IterableIterator<[K, V]> {\n\n const ki = this.keys();\n const vi = this.values();\n const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());\n const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));\n\n for (let k: K, v: V, i = 0, kr: IteratorResult, vr: IteratorResult;\n !((kr = ki.next()).done || (vr = vi.next()).done);\n ++i\n ) {\n k = kr.value;\n v = vr.value;\n itov[i] = v;\n ktoi.has(k) || ktoi.set(k, i);\n yield [k, v];\n }\n }\n\n public forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void {\n\n const ki = this.keys();\n const vi = this.values();\n const callback = thisArg === undefined ? callbackfn :\n (v: V, k: K, m: Map) => callbackfn.call(thisArg, v, k, m);\n const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());\n const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));\n\n for (let k: K, v: V, i = 0, kr: IteratorResult, vr: IteratorResult;\n !((kr = ki.next()).done || (vr = vi.next()).done);\n ++i\n ) {\n k = kr.value;\n v = vr.value;\n itov[i] = v;\n ktoi.has(k) || ktoi.set(k, i);\n callback(v, k, this);\n }\n }\n\n public toArray() { return [...this.values()]; }\n public toJSON() {\n const obj = {} as any;\n this.forEach((val, key) => obj[key] = val);\n return obj;\n }\n\n public inspect() { return this.toString(); }\n public [kCustomInspect]() { return this.toString(); }\n public toString() {\n const str: string[] = [];\n this.forEach((val, key) => {\n key = valueToString(key);\n val = valueToString(val);\n str.push(`${key}: ${val}`);\n });\n return `{ ${str.join(', ')} }`;\n }\n\n protected static [Symbol.toStringTag] = ((proto: Row) => {\n Object.defineProperties(proto, {\n 'size': { writable: true, enumerable: false, configurable: false, value: 0 },\n [kParent]: { writable: true, enumerable: false, configurable: false, value: null },\n [kRowIndex]: { writable: true, enumerable: false, configurable: false, value: -1 },\n });\n return (proto as any)[Symbol.toStringTag] = 'Row';\n })(Row.prototype);\n}\n\nexport class MapRow extends Row {\n constructor(slice: Vector>) {\n super(slice, slice.length);\n return createRowProxy(this);\n }\n public keys() {\n return this[kParent].getChildAt(0)![Symbol.iterator]();\n }\n public values() {\n return this[kParent].getChildAt(1)![Symbol.iterator]();\n }\n public getKey(idx: number): K['TValue'] {\n return this[kParent].getChildAt(0)!.get(idx);\n }\n public getIndex(key: K['TValue']): number {\n return this[kParent].getChildAt(0)!.indexOf(key);\n }\n public getValue(index: number): V['TValue'] | null {\n return this[kParent].getChildAt(1)!.get(index);\n }\n public setValue(index: number, value: V['TValue'] | null): void {\n this[kParent].getChildAt(1)!.set(index, value);\n }\n}\n\nexport class StructRow extends Row {\n constructor(parent: StructVector) {\n super(parent, parent.type.children.length);\n return defineRowProxyProperties(this);\n }\n public *keys() {\n for (const field of this[kParent].type.children) {\n yield field.name as keyof T;\n }\n }\n public *values() {\n for (const field of this[kParent].type.children) {\n yield (this as RowLike)[field.name];\n }\n }\n public getKey(idx: number): keyof T {\n return this[kParent].type.children[idx].name as keyof T;\n }\n public getIndex(key: keyof T): number {\n return this[kParent].type.children.findIndex((f) => f.name === key);\n }\n public getValue(index: number): T[keyof T]['TValue'] | null {\n return this[kParent].getChildAt(index)!.get(this[kRowIndex]);\n }\n public setValue(index: number, value: T[keyof T]['TValue'] | null): void {\n return this[kParent].getChildAt(index)!.set(this[kRowIndex], value);\n }\n}\n\nObject.setPrototypeOf(Row.prototype, Map.prototype);\n\n/** @ignore */\nconst defineRowProxyProperties = (() => {\n const desc = { enumerable: true, configurable: false, get: null as any, set: null as any };\n return (row: T) => {\n let idx = -1, ktoi = row[kKeyToIdx] || (row[kKeyToIdx] = new Map());\n const getter = (key: any) => function(this: T) { return this.get(key); };\n const setter = (key: any) => function(this: T, val: any) { return this.set(key, val); };\n for (const key of row.keys()) {\n ktoi.set(key, ++idx);\n desc.get = getter(key);\n desc.set = setter(key);\n row.hasOwnProperty(key) || (desc.enumerable = true, Object.defineProperty(row, key, desc));\n row.hasOwnProperty(idx) || (desc.enumerable = false, Object.defineProperty(row, idx, desc));\n }\n desc.get = desc.set = null;\n return row;\n };\n})();\n\n/** @ignore */\nconst createRowProxy = (() => {\n if (typeof Proxy === 'undefined') {\n return defineRowProxyProperties;\n }\n const has = Row.prototype.has;\n const get = Row.prototype.get;\n const set = Row.prototype.set;\n const getKey = Row.prototype.getKey;\n const RowProxyHandler: ProxyHandler = {\n isExtensible() { return false; },\n deleteProperty() { return false; },\n preventExtensions() { return true; },\n ownKeys(row: Row) { return [...row.keys()].map((x) => `${x}`); },\n has(row: Row, key: PropertyKey) {\n switch (key) {\n case 'getKey': case 'getIndex': case 'getValue': case 'setValue': case 'toArray': case 'toJSON': case 'inspect':\n case 'constructor': case 'isPrototypeOf': case 'propertyIsEnumerable': case 'toString': case 'toLocaleString': case 'valueOf':\n case 'size': case 'has': case 'get': case 'set': case 'clear': case 'delete': case 'keys': case 'values': case 'entries': case 'forEach':\n case '__proto__': case '__defineGetter__': case '__defineSetter__': case 'hasOwnProperty': case '__lookupGetter__': case '__lookupSetter__':\n case Symbol.iterator: case Symbol.toStringTag: case kParent: case kRowIndex: case kIdxToVal: case kKeyToIdx: case kCustomInspect:\n return true;\n }\n if (typeof key === 'number' && !row.has(key)) {\n key = row.getKey(key);\n }\n return row.has(key);\n },\n get(row: Row, key: PropertyKey, receiver: any) {\n switch (key) {\n case 'getKey': case 'getIndex': case 'getValue': case 'setValue': case 'toArray': case 'toJSON': case 'inspect':\n case 'constructor': case 'isPrototypeOf': case 'propertyIsEnumerable': case 'toString': case 'toLocaleString': case 'valueOf':\n case 'size': case 'has': case 'get': case 'set': case 'clear': case 'delete': case 'keys': case 'values': case 'entries': case 'forEach':\n case '__proto__': case '__defineGetter__': case '__defineSetter__': case 'hasOwnProperty': case '__lookupGetter__': case '__lookupSetter__':\n case Symbol.iterator: case Symbol.toStringTag: case kParent: case kRowIndex: case kIdxToVal: case kKeyToIdx: case kCustomInspect:\n return Reflect.get(row, key, receiver);\n }\n if (typeof key === 'number' && !has.call(receiver, key)) {\n key = getKey.call(receiver, key);\n }\n return get.call(receiver, key);\n },\n set(row: Row, key: PropertyKey, val: any, receiver: any) {\n switch (key) {\n case kParent: case kRowIndex: case kIdxToVal: case kKeyToIdx:\n return Reflect.set(row, key, val, receiver);\n case 'getKey': case 'getIndex': case 'getValue': case 'setValue': case 'toArray': case 'toJSON': case 'inspect':\n case 'constructor': case 'isPrototypeOf': case 'propertyIsEnumerable': case 'toString': case 'toLocaleString': case 'valueOf':\n case 'size': case 'has': case 'get': case 'set': case 'clear': case 'delete': case 'keys': case 'values': case 'entries': case 'forEach':\n case '__proto__': case '__defineGetter__': case '__defineSetter__': case 'hasOwnProperty': case '__lookupGetter__': case '__lookupSetter__':\n case Symbol.iterator: case Symbol.toStringTag:\n return false;\n }\n if (typeof key === 'number' && !has.call(receiver, key)) {\n key = getKey.call(receiver, key);\n }\n return has.call(receiver, key) ? !!set.call(receiver, key, val) : false;\n },\n };\n return (row: T) => new Proxy(row, RowProxyHandler) as T;\n})();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { MapRow, StructRow } from '../vector/row';\nimport { compareArrayLike } from '../util/buffer';\nimport { BigInt, BigIntAvailable } from './compat';\n\n/** @ignore */\ntype RangeLike = { length: number; stride?: number };\n/** @ignore */\ntype ClampThen = (source: T, index: number) => any;\n/** @ignore */\ntype ClampRangeThen = (source: T, offset: number, length: number) => any;\n\nexport function clampIndex(source: T, index: number): number;\nexport function clampIndex = ClampThen>(source: T, index: number, then: N): ReturnType;\n/** @ignore */\nexport function clampIndex = ClampThen>(source: T, index: number, then?: N) {\n const length = source.length;\n const adjust = index > -1 ? index : (length + (index % length));\n return then ? then(source, adjust) : adjust;\n}\n\n/** @ignore */\nlet tmp: number;\nexport function clampRange(source: T, begin: number | undefined, end: number | undefined): [number, number];\nexport function clampRange = ClampRangeThen>(source: T, begin: number | undefined, end: number | undefined, then: N): ReturnType;\n/** @ignore */\nexport function clampRange = ClampRangeThen>(source: T, begin: number | undefined, end: number | undefined, then?: N) {\n\n // Adjust args similar to Array.prototype.slice. Normalize begin/end to\n // clamp between 0 and length, and wrap around on negative indices, e.g.\n // slice(-1, 5) or slice(5, -1)\n let { length: len = 0 } = source;\n let lhs = typeof begin !== 'number' ? 0 : begin;\n let rhs = typeof end !== 'number' ? len : end;\n // wrap around on negative start/end positions\n (lhs < 0) && (lhs = ((lhs % len) + len) % len);\n (rhs < 0) && (rhs = ((rhs % len) + len) % len);\n // ensure lhs <= rhs\n (rhs < lhs) && (tmp = lhs, lhs = rhs, rhs = tmp);\n // ensure rhs <= length\n (rhs > len) && (rhs = len);\n\n return then ? then(source, lhs, rhs) : [lhs, rhs];\n}\n\nconst big0 = BigIntAvailable ? BigInt(0) : 0;\nconst isNaNFast = (value: any) => value !== value;\n\n/** @ignore */\nexport function createElementComparator(search: any) {\n let typeofSearch = typeof search;\n // Compare primitives\n if (typeofSearch !== 'object' || search === null) {\n // Compare NaN\n if (isNaNFast(search)) {\n return isNaNFast;\n }\n return typeofSearch !== 'bigint'\n ? (value: any) => value === search\n : (value: any) => (big0 + value) === search;\n }\n // Compare Dates\n if (search instanceof Date) {\n const valueOfSearch = search.valueOf();\n return (value: any) => value instanceof Date ? (value.valueOf() === valueOfSearch) : false;\n }\n // Compare TypedArrays\n if (ArrayBuffer.isView(search)) {\n return (value: any) => value ? compareArrayLike(search, value) : false;\n }\n // Compare Maps and Rows\n if (search instanceof Map) { return creatMapComparator(search); }\n // Compare Array-likes\n if (Array.isArray(search)) { return createArrayLikeComparator(search); }\n // Compare Vectors\n if (search instanceof Vector) { return createVectorComparator(search); }\n // Compare non-empty Objects\n return createObjectComparator(search);\n}\n\n/** @ignore */\nfunction createArrayLikeComparator(lhs: ArrayLike) {\n const comparators = [] as ((x: any) => boolean)[];\n for (let i = -1, n = lhs.length; ++i < n;) {\n comparators[i] = createElementComparator(lhs[i]);\n }\n return createSubElementsComparator(comparators);\n}\n\n/** @ignore */\nfunction creatMapComparator(lhs: Map) {\n let i = -1;\n const comparators = [] as ((x: any) => boolean)[];\n lhs.forEach((v) => comparators[++i] = createElementComparator(v));\n return createSubElementsComparator(comparators);\n}\n\n/** @ignore */\nfunction createVectorComparator(lhs: Vector) {\n const comparators = [] as ((x: any) => boolean)[];\n for (let i = -1, n = lhs.length; ++i < n;) {\n comparators[i] = createElementComparator(lhs.get(i));\n }\n return createSubElementsComparator(comparators);\n}\n\n/** @ignore */\nfunction createObjectComparator(lhs: any) {\n const keys = Object.keys(lhs);\n // Only compare non-empty Objects\n if (keys.length === 0) { return () => false; }\n const comparators = [] as ((x: any) => boolean)[];\n for (let i = -1, n = keys.length; ++i < n;) {\n comparators[i] = createElementComparator(lhs[keys[i]]);\n }\n return createSubElementsComparator(comparators, keys);\n}\n\nfunction createSubElementsComparator(comparators: ((x: any) => boolean)[], keys?: Iterable) {\n return (rhs: any) => {\n if (!rhs || typeof rhs !== 'object') {\n return false;\n }\n switch (rhs.constructor) {\n case Array: return compareArray(comparators, rhs);\n case Map:\n case MapRow:\n case StructRow:\n return compareObject(comparators, rhs, rhs.keys());\n case Object:\n case undefined: // support `Object.create(null)` objects\n return compareObject(comparators, rhs, keys || Object.keys(rhs));\n }\n return rhs instanceof Vector ? compareVector(comparators, rhs) : false;\n };\n}\n\nfunction compareArray(comparators: ((x: any) => boolean)[], arr: any[]) {\n const n = comparators.length;\n if (arr.length !== n) { return false; }\n for (let i = -1; ++i < n;) {\n if (!(comparators[i](arr[i]))) { return false; }\n }\n return true;\n}\n\nfunction compareVector(comparators: ((x: any) => boolean)[], vec: Vector) {\n const n = comparators.length;\n if (vec.length !== n) { return false; }\n for (let i = -1; ++i < n;) {\n if (!(comparators[i](vec.get(i)))) { return false; }\n }\n return true;\n}\n\nfunction compareObject(comparators: ((x: any) => boolean)[], obj: Map, keys: Iterable) {\n\n const lKeyItr = keys[Symbol.iterator]();\n const rKeyItr = obj instanceof Map ? obj.keys() : Object.keys(obj)[Symbol.iterator]();\n const rValItr = obj instanceof Map ? obj.values() : Object.values(obj)[Symbol.iterator]();\n\n let i = 0;\n let n = comparators.length;\n let rVal = rValItr.next();\n let lKey = lKeyItr.next();\n let rKey = rKeyItr.next();\n\n for (; i < n && !lKey.done && !rKey.done && !rVal.done;\n ++i, lKey = lKeyItr.next(), rKey = rKeyItr.next(), rVal = rValItr.next()) {\n if (lKey.value !== rKey.value || !comparators[i](rVal.value)) {\n break;\n }\n }\n if (i === n && lKey.done && rKey.done && rVal.done) {\n return true;\n }\n lKeyItr.return && lKeyItr.return();\n rKeyItr.return && rKeyItr.return();\n rValItr.return && rValItr.return();\n return false;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Field } from '../schema';\nimport { clampRange } from '../util/vector';\nimport { DataType, Dictionary } from '../type';\nimport { selectChunkArgs } from '../util/args';\nimport { DictionaryVector } from './dictionary';\nimport { AbstractVector, Vector } from '../vector';\nimport { Clonable, Sliceable, Applicative } from '../vector';\n\n/** @ignore */\ntype ChunkedDict = T extends Dictionary ? Vector : null | never;\n/** @ignore */\ntype ChunkedKeys = T extends Dictionary ? Vector | Chunked : null | never;\n\n/** @ignore */\nexport type SearchContinuation = (column: T, chunkIndex: number, valueIndex: number) => any;\n\n/** @ignore */\nexport class Chunked\n extends AbstractVector\n implements Clonable>,\n Sliceable>,\n Applicative> {\n\n /** @nocollapse */\n public static flatten(...vectors: (Vector | Vector[])[]) {\n return selectChunkArgs>(Vector, vectors);\n }\n\n /** @nocollapse */\n public static concat(...vectors: (Vector | Vector[])[]) {\n const chunks = Chunked.flatten(...vectors);\n return new Chunked(chunks[0].type, chunks);\n }\n\n protected _type: T;\n protected _length: number;\n protected _chunks: Vector[];\n protected _numChildren: number;\n protected _children?: Chunked[];\n protected _nullCount: number = -1;\n protected _chunkOffsets: Uint32Array;\n\n constructor(type: T, chunks: Vector[] = [], offsets = calculateOffsets(chunks)) {\n super();\n this._type = type;\n this._chunks = chunks;\n this._chunkOffsets = offsets;\n this._length = offsets[offsets.length - 1];\n this._numChildren = (this._type.children || []).length;\n }\n\n public get type() { return this._type; }\n public get length() { return this._length; }\n public get chunks() { return this._chunks; }\n public get typeId(): T['TType'] { return this._type.typeId; }\n public get VectorName() { return `Chunked<${this._type}>`; }\n public get data(): Data {\n return this._chunks[0] ? this._chunks[0].data : null;\n }\n\n public get ArrayType() { return this._type.ArrayType; }\n public get numChildren() { return this._numChildren; }\n public get stride() { return this._chunks[0] ? this._chunks[0].stride : 1; }\n public get byteLength(): number {\n return this._chunks.reduce((byteLength, chunk) => byteLength + chunk.byteLength, 0);\n }\n public get nullCount() {\n let nullCount = this._nullCount;\n if (nullCount < 0) {\n this._nullCount = nullCount = this._chunks.reduce((x, { nullCount }) => x + nullCount, 0);\n }\n return nullCount;\n }\n\n protected _indices?: ChunkedKeys;\n public get indices(): ChunkedKeys | null {\n if (DataType.isDictionary(this._type)) {\n if (!this._indices) {\n const chunks = ( this._chunks) as DictionaryVector[];\n this._indices = (chunks.length === 1\n ? chunks[0].indices\n : Chunked.concat(...chunks.map((x) => x.indices))) as ChunkedKeys;\n }\n return this._indices;\n }\n return null;\n }\n public get dictionary(): ChunkedDict | null {\n if (DataType.isDictionary(this._type)) {\n return this._chunks[this._chunks.length - 1].data.dictionary as ChunkedDict;\n }\n return null;\n }\n\n public *[Symbol.iterator](): IterableIterator {\n for (const chunk of this._chunks) {\n yield* chunk;\n }\n }\n\n public clone(chunks = this._chunks): Chunked {\n return new Chunked(this._type, chunks);\n }\n\n public concat(...others: Vector[]): Chunked {\n return this.clone(Chunked.flatten(this, ...others));\n }\n\n public slice(begin?: number, end?: number): Chunked {\n return clampRange(this, begin, end, this._sliceInternal);\n }\n\n public getChildAt(index: number): Chunked | null {\n\n if (index < 0 || index >= this._numChildren) { return null; }\n\n let columns = this._children || (this._children = []);\n let child: Chunked, field: Field, chunks: Vector[];\n\n if (child = columns[index]) { return child; }\n if (field = ((this._type.children || [])[index] as Field)) {\n chunks = this._chunks\n .map((vector) => vector.getChildAt(index))\n .filter((vec): vec is Vector => vec != null);\n if (chunks.length > 0) {\n return (columns[index] = new Chunked(field.type, chunks));\n }\n }\n\n return null;\n }\n\n public search(index: number): [number, number] | null;\n public search>>(index: number, then?: N): ReturnType;\n public search>>(index: number, then?: N) {\n let idx = index;\n // binary search to find the child vector and value indices\n let offsets = this._chunkOffsets, rhs = offsets.length - 1;\n // return early if out of bounds, or if there's just one child\n if (idx < 0 ) { return null; }\n if (idx >= offsets[rhs]) { return null; }\n if (rhs <= 1 ) { return then ? then(this, 0, idx) : [0, idx]; }\n let lhs = 0, pos = 0, mid = 0;\n do {\n if (lhs + 1 === rhs) {\n return then ? then(this, lhs, idx - pos) : [lhs, idx - pos];\n }\n mid = lhs + ((rhs - lhs) / 2) | 0;\n idx >= offsets[mid] ? (lhs = mid) : (rhs = mid);\n } while (idx < offsets[rhs] && idx >= (pos = offsets[lhs]));\n return null;\n }\n\n public isValid(index: number): boolean {\n return !!this.search(index, this.isValidInternal);\n }\n\n public get(index: number): T['TValue'] | null {\n return this.search(index, this.getInternal);\n }\n\n public set(index: number, value: T['TValue'] | null): void {\n this.search(index, ({ chunks }, i, j) => chunks[i].set(j, value));\n }\n\n public indexOf(element: T['TValue'], offset?: number): number {\n if (offset && typeof offset === 'number') {\n return this.search(offset, (self, i, j) => this.indexOfInternal(self, i, j, element))!;\n }\n return this.indexOfInternal(this, 0, Math.max(0, offset || 0), element);\n }\n\n public toArray(): T['TArray'] {\n const { chunks } = this;\n const n = chunks.length;\n let ArrayType: any = this._type.ArrayType;\n if (n <= 0) { return new ArrayType(0); }\n if (n <= 1) { return chunks[0].toArray(); }\n let len = 0, src = new Array(n);\n for (let i = -1; ++i < n;) {\n len += (src[i] = chunks[i].toArray()).length;\n }\n if (ArrayType !== src[0].constructor) {\n ArrayType = src[0].constructor;\n }\n let dst = new ArrayType(len);\n let set: any = ArrayType === Array ? arraySet : typedSet;\n for (let i = -1, idx = 0; ++i < n;) {\n idx = set(src[i], dst, idx);\n }\n return dst;\n }\n\n protected getInternal({ _chunks }: Chunked, i: number, j: number) { return _chunks[i].get(j); }\n protected isValidInternal({ _chunks }: Chunked, i: number, j: number) { return _chunks[i].isValid(j); }\n protected indexOfInternal({ _chunks }: Chunked, chunkIndex: number, fromIndex: number, element: T['TValue']) {\n let i = chunkIndex - 1, n = _chunks.length;\n let start = fromIndex, offset = 0, found = -1;\n while (++i < n) {\n if (~(found = _chunks[i].indexOf(element, start))) {\n return offset + found;\n }\n start = 0;\n offset += _chunks[i].length;\n }\n return -1;\n }\n\n protected _sliceInternal(self: Chunked, begin: number, end: number) {\n const slices: Vector[] = [];\n const { chunks, _chunkOffsets: chunkOffsets } = self;\n for (let i = -1, n = chunks.length; ++i < n;) {\n const chunk = chunks[i];\n const chunkLength = chunk.length;\n const chunkOffset = chunkOffsets[i];\n // If the child is to the right of the slice boundary, we can stop\n if (chunkOffset >= end) { break; }\n // If the child is to the left of of the slice boundary, exclude\n if (begin >= chunkOffset + chunkLength) { continue; }\n // If the child is between both left and right boundaries, include w/o slicing\n if (chunkOffset >= begin && (chunkOffset + chunkLength) <= end) {\n slices.push(chunk);\n continue;\n }\n // If the child overlaps one of the slice boundaries, include that slice\n const from = Math.max(0, begin - chunkOffset);\n const to = Math.min(end - chunkOffset, chunkLength);\n slices.push(chunk.slice(from, to) as Vector);\n }\n return self.clone(slices);\n }\n}\n\n/** @ignore */\nfunction calculateOffsets(vectors: Vector[]) {\n let offsets = new Uint32Array((vectors || []).length + 1);\n let offset = offsets[0] = 0, length = offsets.length;\n for (let index = 0; ++index < length;) {\n offsets[index] = (offset += vectors[index - 1].length);\n }\n return offsets;\n}\n\n/** @ignore */\nconst typedSet = (src: TypedArray, dst: TypedArray, offset: number) => {\n dst.set(src, offset);\n return (offset + src.length);\n};\n\n/** @ignore */\nconst arraySet = (src: any[], dst: any[], offset: number) => {\n let idx = offset;\n for (let i = -1, n = src.length; ++i < n;) {\n dst[idx++] = src[i];\n }\n return idx;\n};\n\n/** @ignore */\ninterface TypedArray extends ArrayBufferView {\n readonly length: number;\n readonly [n: number]: number;\n set(array: ArrayLike, offset?: number): void;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { Field } from './schema';\nimport { DataType } from './type';\nimport { Vector } from './vector';\nimport { Clonable, Sliceable, Applicative } from './vector';\nimport { VectorCtorArgs, VectorType as V } from './interfaces';\nimport { Chunked, SearchContinuation } from './vector/chunked';\n\nexport interface Column {\n typeId: T['TType'];\n concat(...others: Vector[]): Column;\n slice(begin?: number, end?: number): Column;\n clone(chunks?: Vector[], offsets?: Uint32Array): Column;\n}\n\nexport class Column\n extends Chunked\n implements Clonable>,\n Sliceable>,\n Applicative> {\n\n public static new(field: string | Field, ...chunks: (Vector | Vector[])[]): Column;\n public static new(field: string | Field, data: Data, ...args: VectorCtorArgs>): Column;\n /** @nocollapse */\n public static new(field: string | Field, data: Data | Vector | (Data | Vector)[], ...rest: any[]) {\n\n const chunks = Chunked.flatten(\n Array.isArray(data) ? [...data, ...rest] :\n data instanceof Vector ? [data, ...rest] :\n [Vector.new(data, ...rest)]\n );\n\n if (typeof field === 'string') {\n const type = chunks[0].data.type;\n field = new Field(field, type, true);\n } else if (!field.nullable && chunks.some(({ nullCount }) => nullCount > 0)) {\n field = field.clone({ nullable: true });\n }\n return new Column(field, chunks);\n }\n\n constructor(field: Field, vectors: Vector[] = [], offsets?: Uint32Array) {\n vectors = Chunked.flatten(...vectors);\n super(field.type, vectors, offsets);\n this._field = field;\n if (vectors.length === 1 && !(this instanceof SingleChunkColumn)) {\n return new SingleChunkColumn(field, vectors[0], this._chunkOffsets);\n }\n }\n\n protected _field: Field;\n protected _children?: Column[];\n\n public get field() { return this._field; }\n public get name() { return this._field.name; }\n public get nullable() { return this._field.nullable; }\n public get metadata() { return this._field.metadata; }\n\n public clone(chunks = this._chunks) {\n return new Column(this._field, chunks);\n }\n\n public getChildAt(index: number): Column | null {\n\n if (index < 0 || index >= this.numChildren) { return null; }\n\n let columns = this._children || (this._children = []);\n let column: Column, field: Field, chunks: Vector[];\n\n if (column = columns[index]) { return column; }\n if (field = ((this.type.children || [])[index] as Field)) {\n chunks = this._chunks\n .map((vector) => vector.getChildAt(index))\n .filter((vec): vec is Vector => vec != null);\n if (chunks.length > 0) {\n return (columns[index] = new Column(field, chunks));\n }\n }\n\n return null;\n }\n}\n\n/** @ignore */\nclass SingleChunkColumn extends Column {\n protected _chunk: Vector;\n constructor(field: Field, vector: Vector, offsets?: Uint32Array) {\n super(field, [vector], offsets);\n this._chunk = vector;\n }\n public search(index: number): [number, number] | null;\n public search>>(index: number, then?: N): ReturnType;\n public search>>(index: number, then?: N) {\n return then ? then(this, 0, index) : [0, index];\n }\n public isValid(index: number): boolean {\n return this._chunk.isValid(index);\n }\n public get(index: number): T['TValue'] | null {\n return this._chunk.get(index);\n }\n public set(index: number, value: T['TValue'] | null): void {\n this._chunk.set(index, value);\n }\n public indexOf(element: T['TValue'], offset?: number): number {\n return this._chunk.indexOf(element, offset);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Field } from '../schema';\nimport { Column } from '../column';\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\nimport { Chunked } from '../vector/chunked';\n\ntype RecordBatchCtor = typeof import('../recordbatch').RecordBatch;\n\nconst isArray = Array.isArray;\n\n/** @ignore */\nexport const selectArgs = (Ctor: any, vals: any[]) => _selectArgs(Ctor, vals, [], 0) as T[];\n/** @ignore */\nexport const selectColumnArgs = (args: any[]) => {\n const [fields, values] = _selectFieldArgs(args, [[], []]);\n return values.map((x, i) =>\n x instanceof Column ? Column.new(x.field.clone(fields[i]), x) :\n x instanceof Vector ? Column.new(fields[i], x) as Column :\n Column.new(fields[i], [] as Vector[]));\n};\n\n/** @ignore */\nexport const selectFieldArgs = (args: any[]) => _selectFieldArgs(args, [[], []]);\n/** @ignore */\nexport const selectChunkArgs = (Ctor: any, vals: any[]) => _selectChunkArgs(Ctor, vals, [], 0) as T[];\n/** @ignore */\nexport const selectVectorChildrenArgs = (Ctor: RecordBatchCtor, vals: any[]) => _selectVectorChildrenArgs(Ctor, vals, [], 0) as T[];\n/** @ignore */\nexport const selectColumnChildrenArgs = (Ctor: RecordBatchCtor, vals: any[]) => _selectColumnChildrenArgs(Ctor, vals, [], 0) as T[];\n\n/** @ignore */\nfunction _selectArgs(Ctor: any, vals: any[], res: T[], idx: number) {\n let value: any, j = idx;\n let i = -1, n = vals.length;\n while (++i < n) {\n if (isArray(value = vals[i])) {\n j = _selectArgs(Ctor, value, res, j).length;\n } else if (value instanceof Ctor) { res[j++] = value; }\n }\n return res;\n}\n\n/** @ignore */\nfunction _selectChunkArgs(Ctor: any, vals: any[], res: T[], idx: number) {\n let value: any, j = idx;\n let i = -1, n = vals.length;\n while (++i < n) {\n if (isArray(value = vals[i])) {\n j = _selectChunkArgs(Ctor, value, res, j).length;\n } else if (value instanceof Chunked) {\n j = _selectChunkArgs(Ctor, value.chunks, res, j).length;\n } else if (value instanceof Ctor) { res[j++] = value; }\n }\n return res;\n}\n\n/** @ignore */\nfunction _selectVectorChildrenArgs(Ctor: RecordBatchCtor, vals: any[], res: T[], idx: number) {\n let value: any, j = idx;\n let i = -1, n = vals.length;\n while (++i < n) {\n if (isArray(value = vals[i])) {\n j = _selectVectorChildrenArgs(Ctor, value, res, j).length;\n } else if (value instanceof Ctor) {\n j = _selectArgs(Vector, value.schema.fields.map((_, i) => value.getChildAt(i)!), res, j).length;\n } else if (value instanceof Vector) { res[j++] = value as T; }\n }\n return res;\n}\n\n/** @ignore */\nfunction _selectColumnChildrenArgs(Ctor: RecordBatchCtor, vals: any[], res: T[], idx: number) {\n let value: any, j = idx;\n let i = -1, n = vals.length;\n while (++i < n) {\n if (isArray(value = vals[i])) {\n j = _selectColumnChildrenArgs(Ctor, value, res, j).length;\n } else if (value instanceof Ctor) {\n j = _selectArgs(Column, value.schema.fields.map((f, i) => Column.new(f, value.getChildAt(i)!)), res, j).length;\n } else if (value instanceof Column) { res[j++] = value as T; }\n }\n return res;\n}\n\n/** @ignore */\nconst toKeysAndValues = (xs: [any[], any[]], [k, v]: [any, any], i: number) => (xs[0][i] = k, xs[1][i] = v, xs);\n\n/** @ignore */\nfunction _selectFieldArgs(vals: any[], ret: [Field[], Vector[]]): [Field[], (T[keyof T] | Vector)[]] {\n let keys: any[], n: number;\n switch (n = vals.length) {\n case 0: return ret;\n case 1:\n keys = ret[0];\n if (!(vals[0])) { return ret; }\n if (isArray(vals[0])) { return _selectFieldArgs(vals[0], ret); }\n if (!(vals[0] instanceof Data || vals[0] instanceof Vector || vals[0] instanceof DataType)) {\n [keys, vals] = Object.entries(vals[0]).reduce(toKeysAndValues, ret);\n }\n break;\n default:\n !isArray(keys = vals[n - 1])\n ? (vals = isArray(vals[0]) ? vals[0] : vals, keys = [])\n : (vals = isArray(vals[0]) ? vals[0] : vals.slice(0, n - 1));\n }\n\n let fieldIndex = -1;\n let valueIndex = -1;\n let idx = -1, len = vals.length;\n let field: number | string | Field;\n let val: Vector | Data;\n let [fields, values] = ret as [Field[], any[]];\n\n while (++idx < len) {\n val = vals[idx];\n if (val instanceof Column && (values[++valueIndex] = val)) {\n fields[++fieldIndex] = val.field.clone(keys[idx], val.type, true);\n } else {\n ({ [idx]: field = idx } = keys);\n if (val instanceof DataType && (values[++valueIndex] = val)) {\n fields[++fieldIndex] = Field.new(field, val as DataType, true) as Field;\n } else if (val && val.type && (values[++valueIndex] = val)) {\n val instanceof Data && (values[valueIndex] = val = Vector.new(val) as Vector);\n fields[++fieldIndex] = Field.new(field, val.type, true) as Field;\n }\n }\n }\n return ret;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { Vector } from './vector';\nimport { DataType } from './type';\nimport { selectArgs } from './util/args';\nimport { selectFieldArgs } from './util/args';\nimport { instance as comparer } from './visitor/typecomparator';\n\ntype VectorMap = { [key: string]: Vector };\ntype Fields = (keyof T)[] | Field[];\ntype ChildData = T[keyof T][] | Data[] | Vector[];\n\nexport class Schema {\n\n public static from(children: T): Schema;\n public static from(children: T): Schema<{ [P in keyof T]: T[P]['type'] }>;\n public static from(children: ChildData, fields?: Fields): Schema;\n /** @nocollapse */\n public static from(...args: any[]) {\n return Schema.new(args[0], args[1]);\n }\n\n public static new(children: T): Schema;\n public static new(children: T): Schema<{ [P in keyof T]: T[P]['type'] }>;\n public static new(children: ChildData, fields?: Fields): Schema;\n /** @nocollapse */\n public static new(...args: any[]) {\n return new Schema(selectFieldArgs(args)[0]);\n }\n\n public readonly fields: Field[];\n public readonly metadata: Map;\n public readonly dictionaries: Map;\n\n constructor(fields: Field[] = [],\n metadata?: Map | null,\n dictionaries?: Map | null) {\n this.fields = (fields || []) as Field[];\n this.metadata = metadata || new Map();\n if (!dictionaries) {\n dictionaries = generateDictionaryMap(fields);\n }\n this.dictionaries = dictionaries;\n }\n public get [Symbol.toStringTag]() { return 'Schema'; }\n public toString() {\n return `Schema<{ ${this.fields.map((f, i) => `${i}: ${f}`).join(', ')} }>`;\n }\n\n public compareTo(other?: Schema | null): other is Schema {\n return comparer.compareSchemas(this, other);\n }\n\n public select(...columnNames: K[]) {\n const names = columnNames.reduce((xs, x) => (xs[x] = true) && xs, Object.create(null));\n return new Schema<{ [P in K]: T[P] }>(this.fields.filter((f) => names[f.name]), this.metadata);\n }\n public selectAt(...columnIndices: number[]) {\n return new Schema<{ [key: string]: K }>(columnIndices.map((i) => this.fields[i]).filter(Boolean), this.metadata);\n }\n\n public assign(schema: Schema): Schema;\n public assign(...fields: (Field | Field[])[]): Schema;\n public assign(...args: (Schema | Field | Field[])[]) {\n\n const other = args[0] instanceof Schema ? args[0] as Schema\n : new Schema(selectArgs>(Field, args));\n\n const curFields = [...this.fields] as Field[];\n const metadata = mergeMaps(mergeMaps(new Map(), this.metadata), other.metadata);\n const newFields = other.fields.filter((f2) => {\n const i = curFields.findIndex((f) => f.name === f2.name);\n return ~i ? (curFields[i] = f2.clone({\n metadata: mergeMaps(mergeMaps(new Map(), curFields[i].metadata), f2.metadata)\n })) && false : true;\n }) as Field[];\n\n const newDictionaries = generateDictionaryMap(newFields, new Map());\n\n return new Schema(\n [...curFields, ...newFields], metadata,\n new Map([...this.dictionaries, ...newDictionaries])\n );\n }\n}\n\nexport class Field {\n\n public static new(props: { name: string | number, type: T, nullable?: boolean, metadata?: Map | null }): Field;\n public static new(name: string | number | Field, type: T, nullable?: boolean, metadata?: Map | null): Field;\n /** @nocollapse */\n public static new(...args: any[]) {\n let [name, type, nullable, metadata] = args;\n if (args[0] && typeof args[0] === 'object') {\n ({ name } = args[0]);\n (type === undefined) && (type = args[0].type);\n (nullable === undefined) && (nullable = args[0].nullable);\n (metadata === undefined) && (metadata = args[0].metadata);\n }\n return new Field(`${name}`, type, nullable, metadata);\n }\n\n public readonly type: T;\n public readonly name: string;\n public readonly nullable: boolean;\n public readonly metadata: Map;\n\n constructor(name: string, type: T, nullable = false, metadata?: Map | null) {\n this.name = name;\n this.type = type;\n this.nullable = nullable;\n this.metadata = metadata || new Map();\n }\n\n public get typeId() { return this.type.typeId; }\n public get [Symbol.toStringTag]() { return 'Field'; }\n public toString() { return `${this.name}: ${this.type}`; }\n public compareTo(other?: Field | null): other is Field {\n return comparer.compareField(this, other);\n }\n public clone(props: { name?: string | number, type?: R, nullable?: boolean, metadata?: Map | null }): Field;\n public clone(name?: string | number | Field, type?: R, nullable?: boolean, metadata?: Map | null): Field;\n public clone(...args: any[]) {\n let [name, type, nullable, metadata] = args;\n (!args[0] || typeof args[0] !== 'object')\n ? ([name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata] = args)\n : ({name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata} = args[0]);\n return Field.new(name, type, nullable, metadata);\n }\n}\n\n/** @ignore */\nfunction mergeMaps(m1?: Map | null, m2?: Map | null): Map {\n return new Map([...(m1 || new Map()), ...(m2 || new Map())]);\n}\n\n/** @ignore */\nfunction generateDictionaryMap(fields: Field[], dictionaries = new Map()): Map {\n\n for (let i = -1, n = fields.length; ++i < n;) {\n const field = fields[i];\n const type = field.type;\n if (DataType.isDictionary(type)) {\n if (!dictionaries.has(type.id)) {\n dictionaries.set(type.id, type.dictionary);\n } else if (dictionaries.get(type.id) !== type.dictionary) {\n throw new Error(`Cannot create Schema containing two different dictionaries with the same Id`);\n }\n }\n if (type.children && type.children.length > 0) {\n generateDictionaryMap(type.children, dictionaries);\n }\n }\n\n return dictionaries;\n}\n\n// Add these here so they're picked up by the externs creator\n// in the build, and closure-compiler doesn't minify them away\n(Schema.prototype as any).fields = null;\n(Schema.prototype as any).metadata = null;\n(Schema.prototype as any).dictionaries = null;\n\n(Field.prototype as any).type = null;\n(Field.prototype as any).name = null;\n(Field.prototype as any).nullable = null;\n(Field.prototype as any).metadata = null;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Run } from './run';\nimport { Field } from '../schema';\nimport { DataType, List } from '../type';\nimport { OffsetsBufferBuilder } from './buffer';\nimport { Builder, BuilderOptions, VariableWidthBuilder } from '../builder';\n\n/** @ignore */\nexport class ListBuilder extends VariableWidthBuilder, TNull> {\n protected _run = new Run();\n protected _offsets: OffsetsBufferBuilder;\n constructor(opts: BuilderOptions, TNull>) {\n super(opts);\n this._offsets = new OffsetsBufferBuilder();\n }\n public addChild(child: Builder, name = '0') {\n if (this.numChildren > 0) {\n throw new Error('ListBuilder can only have one child.');\n }\n this.children[this.numChildren] = child;\n this.type = new List(new Field(name, child.type, true));\n return this.numChildren - 1;\n }\n public clear() {\n this._run.clear();\n return super.clear();\n }\n protected _flushPending(pending: Map) {\n const run = this._run;\n const offsets = this._offsets;\n const setValue = this._setValue;\n let index = 0, value: Uint8Array | undefined;\n for ([index, value] of pending) {\n if (value === undefined) {\n offsets.set(index, 0);\n } else {\n offsets.set(index, value.length);\n setValue(this, index, run.bind(value));\n }\n }\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Run } from './run';\nimport { Field } from '../schema';\nimport { Builder } from '../builder';\nimport { DataType, FixedSizeList } from '../type';\n\n/** @ignore */\nexport class FixedSizeListBuilder extends Builder, TNull> {\n protected _run = new Run();\n public setValue(index: number, value: T['TValue']) {\n super.setValue(index, this._run.bind(value));\n }\n public addChild(child: Builder, name = '0') {\n if (this.numChildren > 0) {\n throw new Error('FixedSizeListBuilder can only have one child.');\n }\n const childIndex = this.children.push(child);\n this.type = new FixedSizeList(this.type.listSize, new Field(name, child.type, true));\n return childIndex;\n }\n public clear() {\n this._run.clear();\n return super.clear();\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Field } from '../schema';\nimport { DataType, Map_, Struct } from '../type';\nimport { Builder, VariableWidthBuilder } from '../builder';\n\n/** @ignore */ type MapValue = Map_['TValue'];\n/** @ignore */ type MapValues = Map | undefined>;\n/** @ignore */ type MapValueExt = MapValue | { [key: string]: V } | { [key: number]: V } ;\n\n/** @ignore */\nexport class MapBuilder extends VariableWidthBuilder, TNull> {\n\n protected _pending: MapValues | undefined;\n public set(index: number, value: MapValueExt | TNull) {\n return super.set(index, value as MapValue | TNull);\n }\n\n public setValue(index: number, value: MapValueExt) {\n value = value instanceof Map ? value : new Map(Object.entries(value));\n const pending = this._pending || (this._pending = new Map() as MapValues);\n const current = pending.get(index);\n current && (this._pendingLength -= current.size);\n this._pendingLength += value.size;\n pending.set(index, value);\n }\n\n public addChild(child: Builder>, name = `${this.numChildren}`) {\n if (this.numChildren > 0) {\n throw new Error('ListBuilder can only have one child.');\n }\n this.children[this.numChildren] = child;\n this.type = new Map_(new Field(name, child.type, true), this.type.keysSorted);\n return this.numChildren - 1;\n }\n\n protected _flushPending(pending: MapValues) {\n const offsets = this._offsets;\n const setValue = this._setValue;\n pending.forEach((value, index) => {\n if (value === undefined) {\n offsets.set(index, 0);\n } else {\n offsets.set(index, value.size);\n setValue(this, index, value);\n }\n });\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Field } from '../schema';\nimport { Builder } from '../builder';\nimport { DataType, Struct } from '../type';\n\n/** @ignore */\nexport class StructBuilder extends Builder, TNull> {\n public addChild(child: Builder, name = `${this.numChildren}`) {\n const childIndex = this.children.push(child);\n this.type = new Struct([...this.type.children, new Field(name, child.type, true)]);\n return childIndex;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Field } from '../schema';\nimport { DataBufferBuilder } from './buffer';\nimport { Builder, BuilderOptions } from '../builder';\nimport { Union, SparseUnion, DenseUnion } from '../type';\n\nexport interface UnionBuilderOptions extends BuilderOptions {\n valueToChildTypeId?: (builder: UnionBuilder, value: any, offset: number) => number;\n}\n\n/** @ignore */\nexport abstract class UnionBuilder extends Builder {\n\n protected _typeIds: DataBufferBuilder;\n\n constructor(options: UnionBuilderOptions) {\n super(options);\n this._typeIds = new DataBufferBuilder(new Int8Array(0), 1);\n if (typeof options['valueToChildTypeId'] === 'function') {\n this._valueToChildTypeId = options['valueToChildTypeId'];\n }\n }\n\n public get typeIdToChildIndex() { return this.type.typeIdToChildIndex; }\n\n public append(value: T['TValue'] | TNull, childTypeId?: number) {\n return this.set(this.length, value, childTypeId);\n }\n\n public set(index: number, value: T['TValue'] | TNull, childTypeId?: number) {\n if (childTypeId === undefined) {\n childTypeId = this._valueToChildTypeId(this, value, index);\n }\n if (this.setValid(index, this.isValid(value))) {\n this.setValue(index, value, childTypeId);\n }\n return this;\n }\n\n // @ts-ignore\n public setValue(index: number, value: T['TValue'], childTypeId?: number) {\n this._typeIds.set(index, childTypeId!);\n super.setValue(index, value);\n }\n\n // @ts-ignore\n public addChild(child: Builder, name = `${this.children.length}`) {\n const childTypeId = this.children.push(child);\n const { type: { children, mode, typeIds } } = this;\n const fields = [...children, new Field(name, child.type)];\n this.type = new Union(mode, [...typeIds, childTypeId], fields);\n return childTypeId;\n }\n\n /** @ignore */\n // @ts-ignore\n protected _valueToChildTypeId(builder: UnionBuilder, value: any, offset: number): number {\n throw new Error(`Cannot map UnionBuilder value to child typeId. \\\nPass the \\`childTypeId\\` as the second argument to unionBuilder.append(), \\\nor supply a \\`valueToChildTypeId\\` function as part of the UnionBuilder constructor options.`);\n }\n}\n\n/** @ignore */\nexport class SparseUnionBuilder extends UnionBuilder {}\n/** @ignore */\nexport class DenseUnionBuilder extends UnionBuilder {\n\n protected _offsets: DataBufferBuilder;\n\n constructor(options: UnionBuilderOptions) {\n super(options);\n this._offsets = new DataBufferBuilder(new Int32Array(0));\n }\n\n /** @ignore */\n public setValue(index: number, value: T['TValue'], childTypeId?: number) {\n const childIndex = this.type.typeIdToChildIndex[childTypeId!];\n this._offsets.set(index, this.getChildAt(childIndex)!.length);\n return super.setValue(index, value, childTypeId);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Field } from '../schema';\nimport { Vector } from '../vector';\nimport { Visitor } from '../visitor';\nimport { encodeUtf8 } from '../util/utf8';\nimport { VectorType } from '../interfaces';\nimport { float64ToUint16 } from '../util/math';\nimport { toArrayBufferView } from '../util/buffer';\nimport { Type, UnionMode, Precision, DateUnit, TimeUnit, IntervalUnit } from '../enum';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface SetVisitor extends Visitor {\n visit(node: T, index: number, value: T['TValue']): void;\n visitMany(nodes: T[], indices: number[], values: T['TValue'][]): void[];\n getVisitFn(node: T): (vector: VectorType, index: number, value: VectorType['TValue']) => void;\n getVisitFn(node: VectorType | Data | T): (vector: VectorType, index: number, value: VectorType['TValue']) => void;\n visitNull (vector: VectorType, index: number, value: T['TValue']): void;\n visitBool (vector: VectorType, index: number, value: T['TValue']): void;\n visitInt (vector: VectorType, index: number, value: T['TValue']): void;\n visitInt8 (vector: VectorType, index: number, value: T['TValue']): void;\n visitInt16 (vector: VectorType, index: number, value: T['TValue']): void;\n visitInt32 (vector: VectorType, index: number, value: T['TValue']): void;\n visitInt64 (vector: VectorType, index: number, value: T['TValue']): void;\n visitUint8 (vector: VectorType, index: number, value: T['TValue']): void;\n visitUint16 (vector: VectorType, index: number, value: T['TValue']): void;\n visitUint32 (vector: VectorType, index: number, value: T['TValue']): void;\n visitUint64 (vector: VectorType, index: number, value: T['TValue']): void;\n visitFloat (vector: VectorType, index: number, value: T['TValue']): void;\n visitFloat16 (vector: VectorType, index: number, value: T['TValue']): void;\n visitFloat32 (vector: VectorType, index: number, value: T['TValue']): void;\n visitFloat64 (vector: VectorType, index: number, value: T['TValue']): void;\n visitUtf8 (vector: VectorType, index: number, value: T['TValue']): void;\n visitBinary (vector: VectorType, index: number, value: T['TValue']): void;\n visitFixedSizeBinary (vector: VectorType, index: number, value: T['TValue']): void;\n visitDate (vector: VectorType, index: number, value: T['TValue']): void;\n visitDateDay (vector: VectorType, index: number, value: T['TValue']): void;\n visitDateMillisecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimestamp (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimestampSecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimestampMillisecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimestampMicrosecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimestampNanosecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTime (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimeSecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimeMillisecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimeMicrosecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitTimeNanosecond (vector: VectorType, index: number, value: T['TValue']): void;\n visitDecimal (vector: VectorType, index: number, value: T['TValue']): void;\n visitList (vector: VectorType, index: number, value: T['TValue']): void;\n visitStruct (vector: VectorType, index: number, value: T['TValue']): void;\n visitUnion (vector: VectorType, index: number, value: T['TValue']): void;\n visitDenseUnion (vector: VectorType, index: number, value: T['TValue']): void;\n visitSparseUnion (vector: VectorType, index: number, value: T['TValue']): void;\n visitDictionary (vector: VectorType, index: number, value: T['TValue']): void;\n visitInterval (vector: VectorType, index: number, value: T['TValue']): void;\n visitIntervalDayTime (vector: VectorType, index: number, value: T['TValue']): void;\n visitIntervalYearMonth (vector: VectorType, index: number, value: T['TValue']): void;\n visitFixedSizeList (vector: VectorType, index: number, value: T['TValue']): void;\n visitMap (vector: VectorType, index: number, value: T['TValue']): void;\n}\n\n/** @ignore */\nexport class SetVisitor extends Visitor {}\n\n/** @ignore */\nconst setEpochMsToDays = (data: Int32Array, index: number, epochMs: number) => { data[index] = (epochMs / 86400000) | 0; };\n/** @ignore */\nconst setEpochMsToMillisecondsLong = (data: Int32Array, index: number, epochMs: number) => {\n data[index] = (epochMs % 4294967296) | 0;\n data[index + 1] = (epochMs / 4294967296) | 0;\n};\n/** @ignore */\nconst setEpochMsToMicrosecondsLong = (data: Int32Array, index: number, epochMs: number) => {\n data[index] = ((epochMs * 1000) % 4294967296) | 0;\n data[index + 1] = ((epochMs * 1000) / 4294967296) | 0;\n};\n/** @ignore */\nconst setEpochMsToNanosecondsLong = (data: Int32Array, index: number, epochMs: number) => {\n data[index] = ((epochMs * 1000000) % 4294967296) | 0;\n data[index + 1] = ((epochMs * 1000000) / 4294967296) | 0;\n};\n\n/** @ignore */\nconst setVariableWidthBytes = (values: Uint8Array, valueOffsets: Int32Array, index: number, value: Uint8Array) => {\n const { [index]: x, [index + 1]: y } = valueOffsets;\n if (x != null && y != null) {\n values.set(value.subarray(0, y - x), x);\n }\n};\n\n/** @ignore */\nconst setBool = ({ offset, values }: VectorType, index: number, val: boolean) => {\n const idx = offset + index;\n val ? (values[idx >> 3] |= (1 << (idx % 8))) // true\n : (values[idx >> 3] &= ~(1 << (idx % 8))); // false\n\n};\n\n/** @ignore */ type Numeric1X = Int8 | Int16 | Int32 | Uint8 | Uint16 | Uint32 | Float32 | Float64;\n/** @ignore */ type Numeric2X = Int64 | Uint64;\n\n/** @ignore */\nconst setDateDay = ({ values }: VectorType, index: number, value: T['TValue']): void => { setEpochMsToDays(values, index, value.valueOf()); };\n/** @ignore */\nconst setDateMillisecond = ({ values }: VectorType, index: number, value: T['TValue']): void => { setEpochMsToMillisecondsLong(values, index * 2, value.valueOf()); };\n/** @ignore */\nconst setNumeric = ({ stride, values }: VectorType, index: number, value: T['TValue']): void => { values[stride * index] = value; };\n/** @ignore */\nconst setFloat16 = ({ stride, values }: VectorType, index: number, value: T['TValue']): void => { values[stride * index] = float64ToUint16(value); };\n/** @ignore */\nconst setNumericX2 = (vector: VectorType, index: number, value: T['TValue']): void => {\n switch (typeof value) {\n case 'bigint': vector.values64[index] = value; break;\n case 'number': vector.values[index * vector.stride] = value; break;\n default:\n const val = value as T['TArray'];\n const { stride, ArrayType } = vector;\n const long = toArrayBufferView(ArrayType, val);\n vector.values.set(long.subarray(0, stride), stride * index);\n }\n};\n/** @ignore */\nconst setFixedSizeBinary = ({ stride, values }: VectorType, index: number, value: T['TValue']): void => { values.set(value.subarray(0, stride), stride * index); };\n\n/** @ignore */\nconst setBinary = ({ values, valueOffsets }: VectorType, index: number, value: T['TValue']) => setVariableWidthBytes(values, valueOffsets, index, value);\n/** @ignore */\nconst setUtf8 = ({ values, valueOffsets }: VectorType, index: number, value: T['TValue']) => {\n setVariableWidthBytes(values, valueOffsets, index, encodeUtf8(value));\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst setInt = (vector: VectorType, index: number, value: T['TValue']): void => {\n vector.type.bitWidth < 64\n ? setNumeric(vector as VectorType, index, value as Numeric1X['TValue'])\n : setNumericX2(vector as VectorType, index, value as Numeric2X['TValue']);\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst setFloat = (vector: VectorType, index: number, value: T['TValue']): void => {\n vector.type.precision !== Precision.HALF\n ? setNumeric(vector as VectorType, index, value)\n : setFloat16(vector as VectorType, index, value);\n};\n\n/* istanbul ignore next */\nconst setDate = (vector: VectorType, index: number, value: T['TValue']): void => {\n vector.type.unit === DateUnit.DAY\n ? setDateDay(vector as VectorType, index, value)\n : setDateMillisecond(vector as VectorType, index, value);\n};\n\n/** @ignore */\nconst setTimestampSecond = ({ values }: VectorType, index: number, value: T['TValue']): void => setEpochMsToMillisecondsLong(values, index * 2, value / 1000);\n/** @ignore */\nconst setTimestampMillisecond = ({ values }: VectorType, index: number, value: T['TValue']): void => setEpochMsToMillisecondsLong(values, index * 2, value);\n/** @ignore */\nconst setTimestampMicrosecond = ({ values }: VectorType, index: number, value: T['TValue']): void => setEpochMsToMicrosecondsLong(values, index * 2, value);\n/** @ignore */\nconst setTimestampNanosecond = ({ values }: VectorType, index: number, value: T['TValue']): void => setEpochMsToNanosecondsLong(values, index * 2, value);\n/* istanbul ignore next */\n/** @ignore */\nconst setTimestamp = (vector: VectorType, index: number, value: T['TValue']): void => {\n switch (vector.type.unit) {\n case TimeUnit.SECOND: return setTimestampSecond(vector as VectorType, index, value);\n case TimeUnit.MILLISECOND: return setTimestampMillisecond(vector as VectorType, index, value);\n case TimeUnit.MICROSECOND: return setTimestampMicrosecond(vector as VectorType, index, value);\n case TimeUnit.NANOSECOND: return setTimestampNanosecond(vector as VectorType, index, value);\n }\n};\n\n/** @ignore */\nconst setTimeSecond = ({ values, stride }: VectorType, index: number, value: T['TValue']): void => { values[stride * index] = value; };\n/** @ignore */\nconst setTimeMillisecond = ({ values, stride }: VectorType, index: number, value: T['TValue']): void => { values[stride * index] = value; };\n/** @ignore */\nconst setTimeMicrosecond = ({ values }: VectorType, index: number, value: T['TValue']): void => { values.set(value.subarray(0, 2), 2 * index); };\n/** @ignore */\nconst setTimeNanosecond = ({ values }: VectorType, index: number, value: T['TValue']): void => { values.set(value.subarray(0, 2), 2 * index); };\n/* istanbul ignore next */\n/** @ignore */\nconst setTime = (vector: VectorType, index: number, value: T['TValue']): void => {\n switch (vector.type.unit) {\n case TimeUnit.SECOND: return setTimeSecond(vector as VectorType, index, value as TimeSecond['TValue']);\n case TimeUnit.MILLISECOND: return setTimeMillisecond(vector as VectorType, index, value as TimeMillisecond['TValue']);\n case TimeUnit.MICROSECOND: return setTimeMicrosecond(vector as VectorType, index, value as TimeMicrosecond['TValue']);\n case TimeUnit.NANOSECOND: return setTimeNanosecond(vector as VectorType, index, value as TimeNanosecond['TValue']);\n }\n};\n\n/** @ignore */\nconst setDecimal = ({ values }: VectorType, index: number, value: T['TValue']): void => { values.set(value.subarray(0, 4), 4 * index); };\n\n/** @ignore */\nconst setList = (vector: VectorType, index: number, value: T['TValue']): void => {\n const values = vector.getChildAt(0)!, valueOffsets = vector.valueOffsets;\n for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end;) {\n values.set(itr++, value.get(++idx));\n }\n};\n\n/** @ignore */\nconst setMap = (vector: VectorType, index: number, value: T['TValue']) => {\n const values = vector.getChildAt(0)!, valueOffsets = vector.valueOffsets;\n const entries = value instanceof Map ? [...value] : Object.entries(value);\n for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end;) {\n values.set(itr++, entries[++idx]);\n }\n};\n\n/** @ignore */ const _setStructArrayValue = (o: number, v: any[]) => (c: Vector | null, _: Field, i: number) => c && c.set(o, v[i]);\n/** @ignore */ const _setStructVectorValue = (o: number, v: Vector) => (c: Vector | null, _: Field, i: number) => c && c.set(o, v.get(i));\n/** @ignore */ const _setStructMapValue = (o: number, v: Map) => (c: Vector | null, f: Field, _: number) => c && c.set(o, v.get(f.name));\n/** @ignore */ const _setStructObjectValue = (o: number, v: { [key: string]: any }) => (c: Vector | null, f: Field, _: number) => c && c.set(o, v[f.name]);\n/** @ignore */\nconst setStruct = (vector: VectorType, index: number, value: T['TValue']) => {\n\n const setValue = value instanceof Map ? _setStructMapValue(index, value) :\n value instanceof Vector ? _setStructVectorValue(index, value) :\n Array.isArray(value) ? _setStructArrayValue(index, value) :\n _setStructObjectValue(index, value) ;\n\n vector.type.children.forEach((f: Field, i: number) => setValue(vector.getChildAt(i), f, i));\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst setUnion = <\n V extends VectorType | VectorType | VectorType\n>(vector: V, index: number, value: V['TValue']) => {\n vector.type.mode === UnionMode.Dense ?\n setDenseUnion(vector as VectorType, index, value) :\n setSparseUnion(vector as VectorType, index, value);\n};\n\n/** @ignore */\nconst setDenseUnion = (vector: VectorType, index: number, value: T['TValue']): void => {\n const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];\n const child = vector.getChildAt(childIndex);\n child && child.set(vector.valueOffsets[index], value);\n};\n\n/** @ignore */\nconst setSparseUnion = (vector: VectorType, index: number, value: T['TValue']): void => {\n const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];\n const child = vector.getChildAt(childIndex);\n child && child.set(index, value);\n};\n\n/** @ignore */\nconst setDictionary = (vector: VectorType, index: number, value: T['TValue']): void => {\n const key = vector.getKey(index);\n if (key !== null) {\n vector.setValue(key, value);\n }\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst setIntervalValue = (vector: VectorType, index: number, value: T['TValue']): void => {\n (vector.type.unit === IntervalUnit.DAY_TIME)\n ? setIntervalDayTime(vector as VectorType, index, value)\n : setIntervalYearMonth(vector as VectorType, index, value);\n};\n\n/** @ignore */\nconst setIntervalDayTime = ({ values }: VectorType, index: number, value: T['TValue']): void => { values.set(value.subarray(0, 2), 2 * index); };\n/** @ignore */\nconst setIntervalYearMonth = ({ values }: VectorType, index: number, value: T['TValue']): void => { values[index] = (value[0] * 12) + (value[1] % 12); };\n\n/** @ignore */\nconst setFixedSizeList = (vector: VectorType, index: number, value: T['TValue']): void => {\n const child = vector.getChildAt(0)!, { stride } = vector;\n for (let idx = -1, offset = index * stride; ++idx < stride;) {\n child.set(offset + idx, value.get(idx));\n }\n};\n\nSetVisitor.prototype.visitBool = setBool;\nSetVisitor.prototype.visitInt = setInt;\nSetVisitor.prototype.visitInt8 = setNumeric;\nSetVisitor.prototype.visitInt16 = setNumeric;\nSetVisitor.prototype.visitInt32 = setNumeric;\nSetVisitor.prototype.visitInt64 = setNumericX2;\nSetVisitor.prototype.visitUint8 = setNumeric;\nSetVisitor.prototype.visitUint16 = setNumeric;\nSetVisitor.prototype.visitUint32 = setNumeric;\nSetVisitor.prototype.visitUint64 = setNumericX2;\nSetVisitor.prototype.visitFloat = setFloat;\nSetVisitor.prototype.visitFloat16 = setFloat16;\nSetVisitor.prototype.visitFloat32 = setNumeric;\nSetVisitor.prototype.visitFloat64 = setNumeric;\nSetVisitor.prototype.visitUtf8 = setUtf8;\nSetVisitor.prototype.visitBinary = setBinary;\nSetVisitor.prototype.visitFixedSizeBinary = setFixedSizeBinary;\nSetVisitor.prototype.visitDate = setDate;\nSetVisitor.prototype.visitDateDay = setDateDay;\nSetVisitor.prototype.visitDateMillisecond = setDateMillisecond;\nSetVisitor.prototype.visitTimestamp = setTimestamp;\nSetVisitor.prototype.visitTimestampSecond = setTimestampSecond;\nSetVisitor.prototype.visitTimestampMillisecond = setTimestampMillisecond;\nSetVisitor.prototype.visitTimestampMicrosecond = setTimestampMicrosecond;\nSetVisitor.prototype.visitTimestampNanosecond = setTimestampNanosecond;\nSetVisitor.prototype.visitTime = setTime;\nSetVisitor.prototype.visitTimeSecond = setTimeSecond;\nSetVisitor.prototype.visitTimeMillisecond = setTimeMillisecond;\nSetVisitor.prototype.visitTimeMicrosecond = setTimeMicrosecond;\nSetVisitor.prototype.visitTimeNanosecond = setTimeNanosecond;\nSetVisitor.prototype.visitDecimal = setDecimal;\nSetVisitor.prototype.visitList = setList;\nSetVisitor.prototype.visitStruct = setStruct;\nSetVisitor.prototype.visitUnion = setUnion;\nSetVisitor.prototype.visitDenseUnion = setDenseUnion;\nSetVisitor.prototype.visitSparseUnion = setSparseUnion;\nSetVisitor.prototype.visitDictionary = setDictionary;\nSetVisitor.prototype.visitInterval = setIntervalValue;\nSetVisitor.prototype.visitIntervalDayTime = setIntervalDayTime;\nSetVisitor.prototype.visitIntervalYearMonth = setIntervalYearMonth;\nSetVisitor.prototype.visitFixedSizeList = setFixedSizeList;\nSetVisitor.prototype.visitMap = setMap;\n\n/** @ignore */\nexport const instance = new SetVisitor();\n","// automatically generated by the FlatBuffers compiler, do not modify\n\nimport { flatbuffers } from 'flatbuffers';\nimport * as NS7624605610262437867 from './Schema';\n/**\n * ----------------------------------------------------------------------\n * Arrow File metadata\n *\n *\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Footer {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Footer\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Footer {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Footer= obj\n * @returns Footer\n */\n static getRootAsFooter(bb: flatbuffers.ByteBuffer, obj?: Footer): Footer {\n return (obj || new Footer).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns org.apache.arrow.flatbuf.MetadataVersion\n */\n version(): NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt16(this.bb_pos + offset)) : NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion.V1;\n }\n\n /**\n * @param org.apache.arrow.flatbuf.Schema= obj\n * @returns org.apache.arrow.flatbuf.Schema|null\n */\n schema(obj?: NS7624605610262437867.org.apache.arrow.flatbuf.Schema): NS7624605610262437867.org.apache.arrow.flatbuf.Schema | null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new NS7624605610262437867.org.apache.arrow.flatbuf.Schema).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;\n }\n\n /**\n * @param number index\n * @param org.apache.arrow.flatbuf.Block= obj\n * @returns org.apache.arrow.flatbuf.Block\n */\n dictionaries(index: number, obj?: org.apache.arrow.flatbuf.Block): org.apache.arrow.flatbuf.Block | null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new org.apache.arrow.flatbuf.Block).__init(this.bb!.__vector(this.bb_pos + offset) + index * 24, this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n dictionariesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param org.apache.arrow.flatbuf.Block= obj\n * @returns org.apache.arrow.flatbuf.Block\n */\n recordBatches(index: number, obj?: org.apache.arrow.flatbuf.Block): org.apache.arrow.flatbuf.Block | null {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? (obj || new org.apache.arrow.flatbuf.Block).__init(this.bb!.__vector(this.bb_pos + offset) + index * 24, this.bb!) : null;\n }\n\n /**\n * @returns number\n */\n recordBatchesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startFooter(builder: flatbuffers.Builder) {\n builder.startObject(4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param org.apache.arrow.flatbuf.MetadataVersion version\n */\n static addVersion(builder: flatbuffers.Builder, version: NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion) {\n builder.addFieldInt16(0, version, NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion.V1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset schemaOffset\n */\n static addSchema(builder: flatbuffers.Builder, schemaOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, schemaOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dictionariesOffset\n */\n static addDictionaries(builder: flatbuffers.Builder, dictionariesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, dictionariesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startDictionariesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(24, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset recordBatchesOffset\n */\n static addRecordBatches(builder: flatbuffers.Builder, recordBatchesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(3, recordBatchesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startRecordBatchesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(24, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endFooter(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset offset\n */\n static finishFooterBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset) {\n builder.finish(offset);\n }\n\n static createFooter(builder: flatbuffers.Builder, version: NS7624605610262437867.org.apache.arrow.flatbuf.MetadataVersion, schemaOffset: flatbuffers.Offset, dictionariesOffset: flatbuffers.Offset, recordBatchesOffset: flatbuffers.Offset): flatbuffers.Offset {\n Footer.startFooter(builder);\n Footer.addVersion(builder, version);\n Footer.addSchema(builder, schemaOffset);\n Footer.addDictionaries(builder, dictionariesOffset);\n Footer.addRecordBatches(builder, recordBatchesOffset);\n return Footer.endFooter(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace org.apache.arrow.flatbuf {\n export class Block {\n bb: flatbuffers.ByteBuffer | null = null;\n\n bb_pos: number = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Block\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Block {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * Index to the start of the RecordBlock (note this is past the Message header)\n *\n * @returns flatbuffers.Long\n */\n offset(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos);\n }\n\n /**\n * Length of the metadata\n *\n * @returns number\n */\n metaDataLength(): number {\n return this.bb!.readInt32(this.bb_pos + 8);\n }\n\n /**\n * Length of the data (this is aligned so there can be a gap between this and\n * the metatdata).\n *\n * @returns flatbuffers.Long\n */\n bodyLength(): flatbuffers.Long {\n return this.bb!.readInt64(this.bb_pos + 16);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long offset\n * @param number metaDataLength\n * @param flatbuffers.Long bodyLength\n * @returns flatbuffers.Offset\n */\n static createBlock(builder: flatbuffers.Builder, offset: flatbuffers.Long, metaDataLength: number, bodyLength: flatbuffers.Long): flatbuffers.Offset {\n builder.prep(8, 24);\n builder.writeInt64(bodyLength);\n builder.pad(4);\n builder.writeInt32(metaDataLength);\n builder.writeInt64(offset);\n return builder.offset();\n }\n\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { DataType } from '../type';\nimport { Visitor } from '../visitor';\nimport { VectorType, BuilderCtor } from '../interfaces';\nimport { BinaryBuilder } from '../builder/binary';\nimport { BoolBuilder } from '../builder/bool';\nimport { DateBuilder, DateDayBuilder, DateMillisecondBuilder } from '../builder/date';\nimport { DecimalBuilder } from '../builder/decimal';\nimport { DictionaryBuilder } from '../builder/dictionary';\nimport { FixedSizeBinaryBuilder } from '../builder/fixedsizebinary';\nimport { FixedSizeListBuilder } from '../builder/fixedsizelist';\nimport { FloatBuilder, Float16Builder, Float32Builder, Float64Builder } from '../builder/float';\nimport { IntervalBuilder, IntervalDayTimeBuilder, IntervalYearMonthBuilder } from '../builder/interval';\nimport { IntBuilder, Int8Builder, Int16Builder, Int32Builder, Int64Builder, Uint8Builder, Uint16Builder, Uint32Builder, Uint64Builder } from '../builder/int';\nimport { ListBuilder } from '../builder/list';\nimport { MapBuilder } from '../builder/map';\nimport { NullBuilder } from '../builder/null';\nimport { StructBuilder } from '../builder/struct';\nimport { TimestampBuilder, TimestampSecondBuilder, TimestampMillisecondBuilder, TimestampMicrosecondBuilder, TimestampNanosecondBuilder } from '../builder/timestamp';\nimport { TimeBuilder, TimeSecondBuilder, TimeMillisecondBuilder, TimeMicrosecondBuilder, TimeNanosecondBuilder } from '../builder/time';\nimport { UnionBuilder, DenseUnionBuilder, SparseUnionBuilder } from '../builder/union';\nimport { Utf8Builder } from '../builder/utf8';\n\n/** @ignore */\nexport interface GetBuilderCtor extends Visitor {\n visit(type: T): BuilderCtor;\n visitMany(types: T[]): BuilderCtor[];\n getVisitFn(type: T): () => BuilderCtor;\n getVisitFn(node: VectorType | Data | T): () => BuilderCtor;\n}\n\n/** @ignore */\nexport class GetBuilderCtor extends Visitor {\n public visitNull () { return NullBuilder; }\n public visitBool () { return BoolBuilder; }\n public visitInt () { return IntBuilder; }\n public visitInt8 () { return Int8Builder; }\n public visitInt16 () { return Int16Builder; }\n public visitInt32 () { return Int32Builder; }\n public visitInt64 () { return Int64Builder; }\n public visitUint8 () { return Uint8Builder; }\n public visitUint16 () { return Uint16Builder; }\n public visitUint32 () { return Uint32Builder; }\n public visitUint64 () { return Uint64Builder; }\n public visitFloat () { return FloatBuilder; }\n public visitFloat16 () { return Float16Builder; }\n public visitFloat32 () { return Float32Builder; }\n public visitFloat64 () { return Float64Builder; }\n public visitUtf8 () { return Utf8Builder; }\n public visitBinary () { return BinaryBuilder; }\n public visitFixedSizeBinary () { return FixedSizeBinaryBuilder; }\n public visitDate () { return DateBuilder; }\n public visitDateDay () { return DateDayBuilder; }\n public visitDateMillisecond () { return DateMillisecondBuilder; }\n public visitTimestamp () { return TimestampBuilder; }\n public visitTimestampSecond () { return TimestampSecondBuilder; }\n public visitTimestampMillisecond () { return TimestampMillisecondBuilder; }\n public visitTimestampMicrosecond () { return TimestampMicrosecondBuilder; }\n public visitTimestampNanosecond () { return TimestampNanosecondBuilder; }\n public visitTime () { return TimeBuilder; }\n public visitTimeSecond () { return TimeSecondBuilder; }\n public visitTimeMillisecond () { return TimeMillisecondBuilder; }\n public visitTimeMicrosecond () { return TimeMicrosecondBuilder; }\n public visitTimeNanosecond () { return TimeNanosecondBuilder; }\n public visitDecimal () { return DecimalBuilder; }\n public visitList () { return ListBuilder; }\n public visitStruct () { return StructBuilder; }\n public visitUnion () { return UnionBuilder; }\n public visitDenseUnion () { return DenseUnionBuilder; }\n public visitSparseUnion () { return SparseUnionBuilder; }\n public visitDictionary () { return DictionaryBuilder; }\n public visitInterval () { return IntervalBuilder; }\n public visitIntervalDayTime () { return IntervalDayTimeBuilder; }\n public visitIntervalYearMonth () { return IntervalYearMonthBuilder; }\n public visitFixedSizeList () { return FixedSizeListBuilder; }\n public visitMap () { return MapBuilder; }\n}\n\n/** @ignore */\nexport const instance = new GetBuilderCtor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/** @ignore */\nexport { Builder, BuilderOptions } from '../builder';\nexport { BoolBuilder } from './bool';\nexport { NullBuilder } from './null';\nexport { DateBuilder, DateDayBuilder, DateMillisecondBuilder } from './date';\nexport { DecimalBuilder } from './decimal';\nexport { DictionaryBuilder } from './dictionary';\nexport { FixedSizeBinaryBuilder } from './fixedsizebinary';\nexport { FloatBuilder, Float16Builder, Float32Builder, Float64Builder } from './float';\nexport { IntBuilder, Int8Builder, Int16Builder, Int32Builder, Int64Builder, Uint8Builder, Uint16Builder, Uint32Builder, Uint64Builder } from './int';\nexport { TimeBuilder, TimeSecondBuilder, TimeMillisecondBuilder, TimeMicrosecondBuilder, TimeNanosecondBuilder } from './time';\nexport { TimestampBuilder, TimestampSecondBuilder, TimestampMillisecondBuilder, TimestampMicrosecondBuilder, TimestampNanosecondBuilder } from './timestamp';\nexport { IntervalBuilder, IntervalDayTimeBuilder, IntervalYearMonthBuilder } from './interval';\nexport { Utf8Builder } from './utf8';\nexport { BinaryBuilder } from './binary';\nexport { ListBuilder } from './list';\nexport { FixedSizeListBuilder } from './fixedsizelist';\nexport { MapBuilder } from './map';\nexport { StructBuilder } from './struct';\nexport { UnionBuilder, SparseUnionBuilder, DenseUnionBuilder } from './union';\n\nimport { Type } from '../enum';\nimport { Field } from '../schema';\nimport { DataType } from '../type';\nimport { Utf8Builder } from './utf8';\nimport { BuilderType as B } from '../interfaces';\nimport { Builder, BuilderOptions } from '../builder';\nimport { instance as setVisitor } from '../visitor/set';\nimport { instance as getBuilderConstructor } from '../visitor/builderctor';\n\n/** @nocollapse */\nBuilder.new = newBuilder;\n\nfunction newBuilder(options: BuilderOptions): B {\n\n const type = options.type;\n const builder = new (getBuilderConstructor.getVisitFn(type)())(options) as Builder;\n\n if (type.children && type.children.length > 0) {\n\n const children = options['children'] || [] as BuilderOptions[];\n const defaultOptions = { 'nullValues': options['nullValues'] };\n const getChildOptions = Array.isArray(children)\n ? ((_: Field, i: number) => children[i] || defaultOptions)\n : (({ name }: Field) => children[name] || defaultOptions);\n\n type.children.forEach((field, index) => {\n const { type } = field;\n const opts = getChildOptions(field, index);\n builder.children.push(newBuilder({ ...opts, type }));\n });\n }\n\n return builder as B;\n}\n\n(Object.keys(Type) as any[])\n .map((T: any) => Type[T] as any)\n .filter((T: any): T is Type => typeof T === 'number' && T !== Type.NONE)\n .forEach((typeId) => {\n const BuilderCtor = getBuilderConstructor.visit(typeId);\n BuilderCtor.prototype._setValue = setVisitor.getVisitFn(typeId);\n });\n\n(Utf8Builder.prototype as any)._setValue = setVisitor.visitBinary;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/* tslint:disable:class-name */\n\nimport * as File_ from '../../fb/File';\nimport { flatbuffers } from 'flatbuffers';\n\nimport Long = flatbuffers.Long;\nimport Builder = flatbuffers.Builder;\nimport ByteBuffer = flatbuffers.ByteBuffer;\nimport _Block = File_.org.apache.arrow.flatbuf.Block;\nimport _Footer = File_.org.apache.arrow.flatbuf.Footer;\n\nimport { Schema } from '../../schema';\nimport { MetadataVersion } from '../../enum';\nimport { toUint8Array } from '../../util/buffer';\nimport { ArrayBufferViewInput } from '../../util/buffer';\n\n/** @ignore */\nclass Footer_ {\n\n /** @nocollapse */\n public static decode(buf: ArrayBufferViewInput) {\n buf = new ByteBuffer(toUint8Array(buf));\n const footer = _Footer.getRootAsFooter(buf);\n const schema = Schema.decode(footer.schema()!);\n return new OffHeapFooter(schema, footer) as Footer_;\n }\n\n /** @nocollapse */\n public static encode(footer: Footer_) {\n\n const b: Builder = new Builder();\n const schemaOffset = Schema.encode(b, footer.schema);\n\n _Footer.startRecordBatchesVector(b, footer.numRecordBatches);\n [...footer.recordBatches()].slice().reverse().forEach((rb) => FileBlock.encode(b, rb));\n const recordBatchesOffset = b.endVector();\n\n _Footer.startDictionariesVector(b, footer.numDictionaries);\n [...footer.dictionaryBatches()].slice().reverse().forEach((db) => FileBlock.encode(b, db));\n\n const dictionaryBatchesOffset = b.endVector();\n\n _Footer.startFooter(b);\n _Footer.addSchema(b, schemaOffset);\n _Footer.addVersion(b, MetadataVersion.V4);\n _Footer.addRecordBatches(b, recordBatchesOffset);\n _Footer.addDictionaries(b, dictionaryBatchesOffset);\n _Footer.finishFooterBuffer(b, _Footer.endFooter(b));\n\n return b.asUint8Array();\n }\n\n // @ts-ignore\n protected _recordBatches: FileBlock[];\n // @ts-ignore\n protected _dictionaryBatches: FileBlock[];\n public get numRecordBatches() { return this._recordBatches.length; }\n public get numDictionaries() { return this._dictionaryBatches.length; }\n\n constructor(public schema: Schema,\n public version: MetadataVersion = MetadataVersion.V4,\n recordBatches?: FileBlock[], dictionaryBatches?: FileBlock[]) {\n recordBatches && (this._recordBatches = recordBatches);\n dictionaryBatches && (this._dictionaryBatches = dictionaryBatches);\n }\n\n public *recordBatches(): Iterable {\n for (let block, i = -1, n = this.numRecordBatches; ++i < n;) {\n if (block = this.getRecordBatch(i)) { yield block; }\n }\n }\n\n public *dictionaryBatches(): Iterable {\n for (let block, i = -1, n = this.numDictionaries; ++i < n;) {\n if (block = this.getDictionaryBatch(i)) { yield block; }\n }\n }\n\n public getRecordBatch(index: number) {\n return index >= 0\n && index < this.numRecordBatches\n && this._recordBatches[index] || null;\n }\n\n public getDictionaryBatch(index: number) {\n return index >= 0\n && index < this.numDictionaries\n && this._dictionaryBatches[index] || null;\n }\n}\n\nexport { Footer_ as Footer };\n\n/** @ignore */\nclass OffHeapFooter extends Footer_ {\n\n public get numRecordBatches() { return this._footer.recordBatchesLength(); }\n public get numDictionaries() { return this._footer.dictionariesLength(); }\n\n constructor(schema: Schema, protected _footer: _Footer) {\n super(schema, _footer.version());\n }\n\n public getRecordBatch(index: number) {\n if (index >= 0 && index < this.numRecordBatches) {\n const fileBlock = this._footer.recordBatches(index);\n if (fileBlock) { return FileBlock.decode(fileBlock); }\n }\n return null;\n }\n\n public getDictionaryBatch(index: number) {\n if (index >= 0 && index < this.numDictionaries) {\n const fileBlock = this._footer.dictionaries(index);\n if (fileBlock) { return FileBlock.decode(fileBlock); }\n }\n return null;\n }\n}\n\n/** @ignore */\nexport class FileBlock {\n\n /** @nocollapse */\n public static decode(block: _Block) {\n return new FileBlock(block.metaDataLength(), block.bodyLength(), block.offset());\n }\n\n /** @nocollapse */\n public static encode(b: Builder, fileBlock: FileBlock) {\n const { metaDataLength } = fileBlock;\n const offset = new Long(fileBlock.offset, 0);\n const bodyLength = new Long(fileBlock.bodyLength, 0);\n return _Block.createBlock(b, offset, metaDataLength, bodyLength);\n }\n\n public offset: number;\n public bodyLength: number;\n public metaDataLength: number;\n\n constructor(metaDataLength: number, bodyLength: Long | number, offset: Long | number) {\n this.metaDataLength = metaDataLength;\n this.offset = typeof offset === 'number' ? offset : offset.low;\n this.bodyLength = typeof bodyLength === 'number' ? bodyLength : bodyLength.low;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport streamAdapters from './adapters';\nimport { decodeUtf8 } from '../util/utf8';\nimport { ITERATOR_DONE, Readable, Writable, AsyncQueue } from './interfaces';\nimport { toUint8Array, joinUint8Arrays, ArrayBufferViewInput } from '../util/buffer';\n\nimport {\n isPromise, isFetchResponse,\n isIterable, isAsyncIterable,\n isReadableDOMStream, isReadableNodeStream\n} from '../util/compat';\n\n/** @ignore */\nexport type WritableSink = Writable | WritableStream | NodeJS.WritableStream | null;\n/** @ignore */\nexport type ReadableSource = Readable | PromiseLike | AsyncIterable | ReadableStream | NodeJS.ReadableStream | null;\n\n/** @ignore */\nexport class AsyncByteQueue extends AsyncQueue {\n public write(value: ArrayBufferViewInput | Uint8Array) {\n if ((value = toUint8Array(value)).byteLength > 0) {\n return super.write(value as T);\n }\n }\n public toString(sync: true): string;\n public toString(sync?: false): Promise;\n public toString(sync = false) {\n return sync\n ? decodeUtf8(this.toUint8Array(true))\n : this.toUint8Array(false).then(decodeUtf8);\n }\n public toUint8Array(sync: true): Uint8Array;\n public toUint8Array(sync?: false): Promise;\n public toUint8Array(sync = false) {\n return sync ? joinUint8Arrays(this._values as any[])[0] : (async () => {\n let buffers = [], byteLength = 0;\n for await (const chunk of this) {\n buffers.push(chunk);\n byteLength += chunk.byteLength;\n }\n return joinUint8Arrays(buffers, byteLength)[0];\n })();\n }\n}\n\n/** @ignore */\nexport class ByteStream implements IterableIterator {\n // @ts-ignore\n private source: ByteStreamSource;\n constructor(source?: Iterable | ArrayBufferViewInput) {\n if (source) {\n this.source = new ByteStreamSource(streamAdapters.fromIterable(source));\n }\n }\n [Symbol.iterator]() { return this; }\n public next(value?: any) { return this.source.next(value); }\n public throw(value?: any) { return this.source.throw(value); }\n public return(value?: any) { return this.source.return(value); }\n public peek(size?: number | null) { return this.source.peek(size); }\n public read(size?: number | null) { return this.source.read(size); }\n}\n\n/** @ignore */\nexport class AsyncByteStream implements Readable, AsyncIterableIterator {\n // @ts-ignore\n private source: AsyncByteStreamSource;\n constructor(source?: PromiseLike | Response | ReadableStream | NodeJS.ReadableStream | AsyncIterable | Iterable) {\n if (source instanceof AsyncByteStream) {\n this.source = (source as AsyncByteStream).source;\n } else if (source instanceof AsyncByteQueue) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));\n } else if (isReadableNodeStream(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromNodeStream(source));\n } else if (isReadableDOMStream(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromDOMStream(source));\n } else if (isFetchResponse(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromDOMStream(source.body!));\n } else if (isIterable(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromIterable(source));\n } else if (isPromise(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));\n } else if (isAsyncIterable(source)) {\n this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));\n }\n }\n [Symbol.asyncIterator]() { return this; }\n public next(value?: any) { return this.source.next(value); }\n public throw(value?: any) { return this.source.throw(value); }\n public return(value?: any) { return this.source.return(value); }\n public get closed(): Promise { return this.source.closed; }\n public cancel(reason?: any) { return this.source.cancel(reason); }\n public peek(size?: number | null) { return this.source.peek(size); }\n public read(size?: number | null) { return this.source.read(size); }\n}\n\n/** @ignore */\ninterface ByteStreamSourceIterator extends IterableIterator {\n next(value?: { cmd: 'peek' | 'read', size?: number | null }): IteratorResult;\n}\n\n/** @ignore */\ninterface AsyncByteStreamSourceIterator extends AsyncIterableIterator {\n next(value?: { cmd: 'peek' | 'read', size?: number | null }): Promise>;\n}\n\n/** @ignore */\nclass ByteStreamSource {\n constructor(protected source: ByteStreamSourceIterator) {}\n public cancel(reason?: any) { this.return(reason); }\n public peek(size?: number | null): T | null { return this.next(size, 'peek').value; }\n public read(size?: number | null): T | null { return this.next(size, 'read').value; }\n public next(size?: number | null, cmd: 'peek' | 'read' = 'read') { return this.source.next({ cmd, size }); }\n public throw(value?: any) { return Object.create((this.source.throw && this.source.throw(value)) || ITERATOR_DONE); }\n public return(value?: any) { return Object.create((this.source.return && this.source.return(value)) || ITERATOR_DONE); }\n}\n\n/** @ignore */\nclass AsyncByteStreamSource implements Readable {\n\n private _closedPromise: Promise;\n private _closedPromiseResolve?: (value?: any) => void;\n constructor (protected source: ByteStreamSourceIterator | AsyncByteStreamSourceIterator) {\n this._closedPromise = new Promise((r) => this._closedPromiseResolve = r);\n }\n public async cancel(reason?: any) { await this.return(reason); }\n public get closed(): Promise { return this._closedPromise; }\n public async read(size?: number | null): Promise { return (await this.next(size, 'read')).value; }\n public async peek(size?: number | null): Promise { return (await this.next(size, 'peek')).value; }\n public async next(size?: number | null, cmd: 'peek' | 'read' = 'read') { return (await this.source.next({ cmd, size })); }\n public async throw(value?: any) {\n const result = (this.source.throw && await this.source.throw(value)) || ITERATOR_DONE;\n this._closedPromiseResolve && this._closedPromiseResolve();\n this._closedPromiseResolve = undefined;\n return Object.create(result);\n }\n public async return(value?: any) {\n const result = (this.source.return && await this.source.return(value)) || ITERATOR_DONE;\n this._closedPromiseResolve && this._closedPromiseResolve();\n this._closedPromiseResolve = undefined;\n return Object.create(result);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { FileHandle } from './interfaces';\nimport { ByteStream, AsyncByteStream } from './stream';\nimport { ArrayBufferViewInput, toUint8Array } from '../util/buffer';\n\n/** @ignore */\nexport class RandomAccessFile extends ByteStream {\n public size: number;\n public position: number = 0;\n protected buffer: Uint8Array | null;\n constructor(buffer: ArrayBufferViewInput, byteLength?: number) {\n super();\n this.buffer = toUint8Array(buffer);\n this.size = typeof byteLength === 'undefined' ? this.buffer.byteLength : byteLength;\n }\n public readInt32(position: number) {\n const { buffer, byteOffset } = this.readAt(position, 4);\n return new DataView(buffer, byteOffset).getInt32(0, true);\n }\n public seek(position: number) {\n this.position = Math.min(position, this.size);\n return position < this.size;\n }\n public read(nBytes?: number | null) {\n const { buffer, size, position } = this;\n if (buffer && position < size) {\n if (typeof nBytes !== 'number') { nBytes = Infinity; }\n this.position = Math.min(size,\n position + Math.min(size - position, nBytes));\n return buffer.subarray(position, this.position);\n }\n return null;\n }\n public readAt(position: number, nBytes: number) {\n const buf = this.buffer;\n const end = Math.min(this.size, position + nBytes);\n return buf ? buf.subarray(position, end) : new Uint8Array(nBytes);\n }\n public close() { this.buffer && (this.buffer = null); }\n public throw(value?: any) { this.close(); return { done: true, value }; }\n public return(value?: any) { this.close(); return { done: true, value }; }\n}\n\n/** @ignore */\nexport class AsyncRandomAccessFile extends AsyncByteStream {\n // @ts-ignore\n public size: number;\n public position: number = 0;\n public _pending?: Promise;\n protected _handle: FileHandle | null;\n constructor(file: FileHandle, byteLength?: number) {\n super();\n this._handle = file;\n if (typeof byteLength === 'number') {\n this.size = byteLength;\n } else {\n this._pending = (async () => {\n this.size = (await file.stat()).size;\n delete this._pending;\n })();\n }\n }\n public async readInt32(position: number) {\n const { buffer, byteOffset } = await this.readAt(position, 4);\n return new DataView(buffer, byteOffset).getInt32(0, true);\n }\n public async seek(position: number) {\n this._pending && await this._pending;\n this.position = Math.min(position, this.size);\n return position < this.size;\n }\n public async read(nBytes?: number | null) {\n this._pending && await this._pending;\n const { _handle: file, size, position } = this;\n if (file && position < size) {\n if (typeof nBytes !== 'number') { nBytes = Infinity; }\n let pos = position, offset = 0, bytesRead = 0;\n let end = Math.min(size, pos + Math.min(size - pos, nBytes));\n let buffer = new Uint8Array(Math.max(0, (this.position = end) - pos));\n while ((pos += bytesRead) < end && (offset += bytesRead) < buffer.byteLength) {\n ({ bytesRead } = await file.read(buffer, offset, buffer.byteLength - offset, pos));\n }\n return buffer;\n }\n return null;\n }\n public async readAt(position: number, nBytes: number) {\n this._pending && await this._pending;\n const { _handle: file, size } = this;\n if (file && (position + nBytes) < size) {\n const end = Math.min(size, position + nBytes);\n const buffer = new Uint8Array(end - position);\n return (await file.read(buffer, 0, nBytes, position)).buffer;\n }\n return new Uint8Array(nBytes);\n }\n public async close() { const f = this._handle; this._handle = null; f && await f.close(); }\n public async throw(value?: any) { await this.close(); return { done: true, value }; }\n public async return(value?: any) { await this.close(); return { done: true, value }; }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/** @ignore */\nconst carryBit16 = 1 << 16;\n\n/** @ignore */\nfunction intAsHex(value: number): string {\n if (value < 0) {\n value = 0xFFFFFFFF + value + 1;\n }\n return `0x${value.toString(16)}`;\n}\n\n/** @ignore */\nconst kInt32DecimalDigits = 8;\n/** @ignore */\nconst kPowersOfTen = [1,\n 10,\n 100,\n 1000,\n 10000,\n 100000,\n 1000000,\n 10000000,\n 100000000];\n\n/** @ignore */\nexport class BaseInt64 {\n constructor (protected buffer: Uint32Array) {}\n\n public high(): number { return this.buffer[1]; }\n public low (): number { return this.buffer[0]; }\n\n protected _times(other: BaseInt64) {\n // Break the left and right numbers into 16 bit chunks\n // so that we can multiply them without overflow.\n const L = new Uint32Array([\n this.buffer[1] >>> 16,\n this.buffer[1] & 0xFFFF,\n this.buffer[0] >>> 16,\n this.buffer[0] & 0xFFFF\n ]);\n\n const R = new Uint32Array([\n other.buffer[1] >>> 16,\n other.buffer[1] & 0xFFFF,\n other.buffer[0] >>> 16,\n other.buffer[0] & 0xFFFF\n ]);\n\n let product = L[3] * R[3];\n this.buffer[0] = product & 0xFFFF;\n\n let sum = product >>> 16;\n\n product = L[2] * R[3];\n sum += product;\n\n product = (L[3] * R[2]) >>> 0;\n sum += product;\n\n this.buffer[0] += sum << 16;\n\n this.buffer[1] = (sum >>> 0 < product ? carryBit16 : 0);\n\n this.buffer[1] += sum >>> 16;\n this.buffer[1] += L[1] * R[3] + L[2] * R[2] + L[3] * R[1];\n this.buffer[1] += (L[0] * R[3] + L[1] * R[2] + L[2] * R[1] + L[3] * R[0]) << 16;\n\n return this;\n }\n\n protected _plus(other: BaseInt64) {\n const sum = (this.buffer[0] + other.buffer[0]) >>> 0;\n this.buffer[1] += other.buffer[1];\n if (sum < (this.buffer[0] >>> 0)) {\n ++this.buffer[1];\n }\n this.buffer[0] = sum;\n }\n\n public lessThan(other: BaseInt64): boolean {\n return this.buffer[1] < other.buffer[1] ||\n (this.buffer[1] === other.buffer[1] && this.buffer[0] < other.buffer[0]);\n }\n\n public equals(other: BaseInt64): boolean {\n return this.buffer[1] === other.buffer[1] && this.buffer[0] == other.buffer[0];\n }\n\n public greaterThan(other: BaseInt64): boolean {\n return other.lessThan(this);\n }\n\n public hex(): string {\n return `${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`;\n }\n}\n\n/** @ignore */\nexport class Uint64 extends BaseInt64 {\n public times(other: Uint64): Uint64 {\n this._times(other);\n return this;\n }\n\n public plus(other: Uint64): Uint64 {\n this._plus(other);\n return this;\n }\n\n /** @nocollapse */\n public static from(val: any, out_buffer = new Uint32Array(2)): Uint64 {\n return Uint64.fromString(\n typeof(val) === 'string' ? val : val.toString(),\n out_buffer\n );\n }\n\n /** @nocollapse */\n public static fromNumber(num: number, out_buffer = new Uint32Array(2)): Uint64 {\n // Always parse numbers as strings - pulling out high and low bits\n // directly seems to lose precision sometimes\n // For example:\n // > -4613034156400212000 >>> 0\n // 721782784\n // The correct lower 32-bits are 721782752\n return Uint64.fromString(num.toString(), out_buffer);\n }\n\n /** @nocollapse */\n public static fromString(str: string, out_buffer = new Uint32Array(2)): Uint64 {\n const length = str.length;\n\n let out = new Uint64(out_buffer);\n for (let posn = 0; posn < length;) {\n const group = kInt32DecimalDigits < length - posn ?\n kInt32DecimalDigits : length - posn;\n const chunk = new Uint64(new Uint32Array([parseInt(str.substr(posn, group), 10), 0]));\n const multiple = new Uint64(new Uint32Array([kPowersOfTen[group], 0]));\n\n out.times(multiple);\n out.plus(chunk);\n\n posn += group;\n }\n\n return out;\n }\n\n /** @nocollapse */\n public static convertArray(values: (string|number)[]): Uint32Array {\n const data = new Uint32Array(values.length * 2);\n for (let i = -1, n = values.length; ++i < n;) {\n Uint64.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 2 * i * 4, 2));\n }\n return data;\n }\n\n /** @nocollapse */\n public static multiply(left: Uint64, right: Uint64): Uint64 {\n let rtrn = new Uint64(new Uint32Array(left.buffer));\n return rtrn.times(right);\n }\n\n /** @nocollapse */\n public static add(left: Uint64, right: Uint64): Uint64 {\n let rtrn = new Uint64(new Uint32Array(left.buffer));\n return rtrn.plus(right);\n }\n}\n\n/** @ignore */\nexport class Int64 extends BaseInt64 {\n public negate(): Int64 {\n this.buffer[0] = ~this.buffer[0] + 1;\n this.buffer[1] = ~this.buffer[1];\n\n if (this.buffer[0] == 0) { ++this.buffer[1]; }\n return this;\n }\n\n public times(other: Int64): Int64 {\n this._times(other);\n return this;\n }\n\n public plus(other: Int64): Int64 {\n this._plus(other);\n return this;\n }\n\n public lessThan(other: Int64): boolean {\n // force high bytes to be signed\n const this_high = this.buffer[1] << 0;\n const other_high = other.buffer[1] << 0;\n return this_high < other_high ||\n (this_high === other_high && this.buffer[0] < other.buffer[0]);\n }\n\n /** @nocollapse */\n public static from(val: any, out_buffer = new Uint32Array(2)): Int64 {\n return Int64.fromString(\n typeof(val) === 'string' ? val : val.toString(),\n out_buffer\n );\n }\n\n /** @nocollapse */\n public static fromNumber(num: number, out_buffer = new Uint32Array(2)): Int64 {\n // Always parse numbers as strings - pulling out high and low bits\n // directly seems to lose precision sometimes\n // For example:\n // > -4613034156400212000 >>> 0\n // 721782784\n // The correct lower 32-bits are 721782752\n return Int64.fromString(num.toString(), out_buffer);\n }\n\n /** @nocollapse */\n public static fromString(str: string, out_buffer = new Uint32Array(2)): Int64 {\n // TODO: Assert that out_buffer is 0 and length = 2\n const negate = str.startsWith('-');\n const length = str.length;\n\n let out = new Int64(out_buffer);\n for (let posn = negate ? 1 : 0; posn < length;) {\n const group = kInt32DecimalDigits < length - posn ?\n kInt32DecimalDigits : length - posn;\n const chunk = new Int64(new Uint32Array([parseInt(str.substr(posn, group), 10), 0]));\n const multiple = new Int64(new Uint32Array([kPowersOfTen[group], 0]));\n\n out.times(multiple);\n out.plus(chunk);\n\n posn += group;\n }\n return negate ? out.negate() : out;\n }\n\n /** @nocollapse */\n public static convertArray(values: (string|number)[]): Uint32Array {\n const data = new Uint32Array(values.length * 2);\n for (let i = -1, n = values.length; ++i < n;) {\n Int64.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 2 * i * 4, 2));\n }\n return data;\n }\n\n /** @nocollapse */\n public static multiply(left: Int64, right: Int64): Int64 {\n let rtrn = new Int64(new Uint32Array(left.buffer));\n return rtrn.times(right);\n }\n\n /** @nocollapse */\n public static add(left: Int64, right: Int64): Int64 {\n let rtrn = new Int64(new Uint32Array(left.buffer));\n return rtrn.plus(right);\n }\n}\n\n/** @ignore */\nexport class Int128 {\n constructor (private buffer: Uint32Array) {\n // buffer[3] MSB (high)\n // buffer[2]\n // buffer[1]\n // buffer[0] LSB (low)\n }\n\n public high(): Int64 {\n return new Int64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset + 8, 2));\n }\n\n public low(): Int64 {\n return new Int64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset, 2));\n }\n\n public negate(): Int128 {\n this.buffer[0] = ~this.buffer[0] + 1;\n this.buffer[1] = ~this.buffer[1];\n this.buffer[2] = ~this.buffer[2];\n this.buffer[3] = ~this.buffer[3];\n\n if (this.buffer[0] == 0) { ++this.buffer[1]; }\n if (this.buffer[1] == 0) { ++this.buffer[2]; }\n if (this.buffer[2] == 0) { ++this.buffer[3]; }\n return this;\n }\n\n public times(other: Int128): Int128 {\n // Break the left and right numbers into 32 bit chunks\n // so that we can multiply them without overflow.\n const L0 = new Uint64(new Uint32Array([this.buffer[3], 0]));\n const L1 = new Uint64(new Uint32Array([this.buffer[2], 0]));\n const L2 = new Uint64(new Uint32Array([this.buffer[1], 0]));\n const L3 = new Uint64(new Uint32Array([this.buffer[0], 0]));\n\n const R0 = new Uint64(new Uint32Array([other.buffer[3], 0]));\n const R1 = new Uint64(new Uint32Array([other.buffer[2], 0]));\n const R2 = new Uint64(new Uint32Array([other.buffer[1], 0]));\n const R3 = new Uint64(new Uint32Array([other.buffer[0], 0]));\n\n let product = Uint64.multiply(L3, R3);\n this.buffer[0] = product.low();\n\n let sum = new Uint64(new Uint32Array([product.high(), 0]));\n\n product = Uint64.multiply(L2, R3);\n sum.plus(product);\n\n product = Uint64.multiply(L3, R2);\n sum.plus(product);\n\n this.buffer[1] = sum.low();\n\n this.buffer[3] = (sum.lessThan(product) ? 1 : 0);\n\n this.buffer[2] = sum.high();\n let high = new Uint64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset + 8, 2));\n\n high.plus(Uint64.multiply(L1, R3))\n .plus(Uint64.multiply(L2, R2))\n .plus(Uint64.multiply(L3, R1));\n this.buffer[3] += Uint64.multiply(L0, R3)\n .plus(Uint64.multiply(L1, R2))\n .plus(Uint64.multiply(L2, R1))\n .plus(Uint64.multiply(L3, R0)).low();\n\n return this;\n }\n\n public plus(other: Int128): Int128 {\n let sums = new Uint32Array(4);\n sums[3] = (this.buffer[3] + other.buffer[3]) >>> 0;\n sums[2] = (this.buffer[2] + other.buffer[2]) >>> 0;\n sums[1] = (this.buffer[1] + other.buffer[1]) >>> 0;\n sums[0] = (this.buffer[0] + other.buffer[0]) >>> 0;\n\n if (sums[0] < (this.buffer[0] >>> 0)) {\n ++sums[1];\n }\n if (sums[1] < (this.buffer[1] >>> 0)) {\n ++sums[2];\n }\n if (sums[2] < (this.buffer[2] >>> 0)) {\n ++sums[3];\n }\n\n this.buffer[3] = sums[3];\n this.buffer[2] = sums[2];\n this.buffer[1] = sums[1];\n this.buffer[0] = sums[0];\n\n return this;\n }\n\n public hex(): string {\n return `${intAsHex(this.buffer[3])} ${intAsHex(this.buffer[2])} ${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`;\n }\n\n /** @nocollapse */\n public static multiply(left: Int128, right: Int128): Int128 {\n let rtrn = new Int128(new Uint32Array(left.buffer));\n return rtrn.times(right);\n }\n\n /** @nocollapse */\n public static add(left: Int128, right: Int128): Int128 {\n let rtrn = new Int128(new Uint32Array(left.buffer));\n return rtrn.plus(right);\n }\n\n /** @nocollapse */\n public static from(val: any, out_buffer = new Uint32Array(4)): Int128 {\n return Int128.fromString(\n typeof(val) === 'string' ? val : val.toString(),\n out_buffer\n );\n }\n\n /** @nocollapse */\n public static fromNumber(num: number, out_buffer = new Uint32Array(4)): Int128 {\n // Always parse numbers as strings - pulling out high and low bits\n // directly seems to lose precision sometimes\n // For example:\n // > -4613034156400212000 >>> 0\n // 721782784\n // The correct lower 32-bits are 721782752\n return Int128.fromString(num.toString(), out_buffer);\n }\n\n /** @nocollapse */\n public static fromString(str: string, out_buffer = new Uint32Array(4)): Int128 {\n // TODO: Assert that out_buffer is 0 and length = 4\n const negate = str.startsWith('-');\n const length = str.length;\n\n let out = new Int128(out_buffer);\n for (let posn = negate ? 1 : 0; posn < length;) {\n const group = kInt32DecimalDigits < length - posn ?\n kInt32DecimalDigits : length - posn;\n const chunk = new Int128(new Uint32Array([parseInt(str.substr(posn, group), 10), 0, 0, 0]));\n const multiple = new Int128(new Uint32Array([kPowersOfTen[group], 0, 0, 0]));\n\n out.times(multiple);\n out.plus(chunk);\n\n posn += group;\n }\n\n return negate ? out.negate() : out;\n }\n\n /** @nocollapse */\n public static convertArray(values: (string|number)[]): Uint32Array {\n // TODO: Distinguish between string and number at compile-time\n const data = new Uint32Array(values.length * 4);\n for (let i = -1, n = values.length; ++i < n;) {\n Int128.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 4 * 4 * i, 4));\n }\n return data;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport * as type from '../type';\nimport { Field } from '../schema';\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\nimport { Visitor } from '../visitor';\nimport { packBools } from '../util/bit';\nimport { encodeUtf8 } from '../util/utf8';\nimport { Int64, Int128 } from '../util/int';\nimport { UnionMode, DateUnit } from '../enum';\nimport { toArrayBufferView } from '../util/buffer';\nimport { BufferRegion, FieldNode } from '../ipc/metadata/message';\n\n/** @ignore */\nexport interface VectorLoader extends Visitor {\n visit(node: Field | T): Data;\n visitMany(nodes: (Field | T)[]): Data[];\n}\n\n/** @ignore */\nexport class VectorLoader extends Visitor {\n private bytes: Uint8Array;\n private nodes: FieldNode[];\n private nodesIndex: number = -1;\n private buffers: BufferRegion[];\n private buffersIndex: number = -1;\n private dictionaries: Map>;\n constructor(bytes: Uint8Array, nodes: FieldNode[], buffers: BufferRegion[], dictionaries: Map>) {\n super();\n this.bytes = bytes;\n this.nodes = nodes;\n this.buffers = buffers;\n this.dictionaries = dictionaries;\n }\n\n public visit(node: Field | T): Data {\n return super.visit(node instanceof Field ? node.type : node);\n }\n\n public visitNull (type: T, { length, } = this.nextFieldNode()) { return Data.Null(type, 0, length); }\n public visitBool (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Bool(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitInt (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Int(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitFloat (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Float(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitUtf8 (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Utf8(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.readData(type)); }\n public visitBinary (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Binary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.readData(type)); }\n public visitFixedSizeBinary (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.FixedSizeBinary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitDate (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Date(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitTimestamp (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Timestamp(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitTime (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Time(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitDecimal (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Decimal(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitList (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.List(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.visit(type.children[0])); }\n public visitStruct (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Struct(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.visitMany(type.children)); }\n public visitUnion (type: T ) { return type.mode === UnionMode.Sparse ? this.visitSparseUnion(type as type.SparseUnion) : this.visitDenseUnion(type as type.DenseUnion); }\n public visitDenseUnion (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Union(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readTypeIds(type), this.readOffsets(type), this.visitMany(type.children)); }\n public visitSparseUnion (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Union(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readTypeIds(type), this.visitMany(type.children)); }\n public visitDictionary (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Dictionary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type.indices), this.readDictionary(type)); }\n public visitInterval (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Interval(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }\n public visitFixedSizeList (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.FixedSizeList(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.visit(type.children[0])); }\n public visitMap (type: T, { length, nullCount } = this.nextFieldNode()) { return Data.Map(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.visit(type.children[0])); }\n\n protected nextFieldNode() { return this.nodes[++this.nodesIndex]; }\n protected nextBufferRange() { return this.buffers[++this.buffersIndex]; }\n protected readNullBitmap(type: T, nullCount: number, buffer = this.nextBufferRange()) {\n return nullCount > 0 && this.readData(type, buffer) || new Uint8Array(0);\n }\n protected readOffsets(type: T, buffer?: BufferRegion) { return this.readData(type, buffer); }\n protected readTypeIds(type: T, buffer?: BufferRegion) { return this.readData(type, buffer); }\n protected readData(_type: T, { length, offset } = this.nextBufferRange()) {\n return this.bytes.subarray(offset, offset + length);\n }\n protected readDictionary(type: T): Vector {\n return this.dictionaries.get(type.id)!;\n }\n}\n\n/** @ignore */\nexport class JSONVectorLoader extends VectorLoader {\n private sources: any[][];\n constructor(sources: any[][], nodes: FieldNode[], buffers: BufferRegion[], dictionaries: Map>) {\n super(new Uint8Array(0), nodes, buffers, dictionaries);\n this.sources = sources;\n }\n protected readNullBitmap(_type: T, nullCount: number, { offset } = this.nextBufferRange()) {\n return nullCount <= 0 ? new Uint8Array(0) : packBools(this.sources[offset]);\n }\n protected readOffsets(_type: T, { offset } = this.nextBufferRange()) {\n return toArrayBufferView(Uint8Array, toArrayBufferView(Int32Array, this.sources[offset]));\n }\n protected readTypeIds(type: T, { offset } = this.nextBufferRange()) {\n return toArrayBufferView(Uint8Array, toArrayBufferView(type.ArrayType, this.sources[offset]));\n }\n protected readData(type: T, { offset } = this.nextBufferRange()) {\n const { sources } = this;\n if (DataType.isTimestamp(type)) {\n return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset] as string[]));\n } else if ((DataType.isInt(type) || DataType.isTime(type)) && type.bitWidth === 64) {\n return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset] as string[]));\n } else if (DataType.isDate(type) && type.unit === DateUnit.MILLISECOND) {\n return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset] as string[]));\n } else if (DataType.isDecimal(type)) {\n return toArrayBufferView(Uint8Array, Int128.convertArray(sources[offset] as string[]));\n } else if (DataType.isBinary(type) || DataType.isFixedSizeBinary(type)) {\n return binaryDataFromJSON(sources[offset] as string[]);\n } else if (DataType.isBool(type)) {\n return packBools(sources[offset] as number[]);\n } else if (DataType.isUtf8(type)) {\n return encodeUtf8((sources[offset] as string[]).join(''));\n }\n return toArrayBufferView(Uint8Array, toArrayBufferView(type.ArrayType, sources[offset].map((x) => +x)));\n }\n}\n\n/** @ignore */\nfunction binaryDataFromJSON(values: string[]) {\n // \"DATA\": [\"49BC7D5B6C47D2\",\"3F5FB6D9322026\"]\n // There are definitely more efficient ways to do this... but it gets the\n // job done.\n const joined = values.join('');\n const data = new Uint8Array(joined.length / 2);\n for (let i = 0; i < joined.length; i += 2) {\n data[i >> 1] = parseInt(joined.substr(i, 2), 16);\n }\n return data;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { flatbuffers } from 'flatbuffers';\nimport Long = flatbuffers.Long;\nimport Builder = flatbuffers.Builder;\nimport * as Schema_ from '../fb/Schema';\n\nimport * as type from '../type';\nimport { Visitor } from '../visitor';\n\nimport Null = Schema_.org.apache.arrow.flatbuf.Null;\nimport Int = Schema_.org.apache.arrow.flatbuf.Int;\nimport FloatingPoint = Schema_.org.apache.arrow.flatbuf.FloatingPoint;\nimport Binary = Schema_.org.apache.arrow.flatbuf.Binary;\nimport Bool = Schema_.org.apache.arrow.flatbuf.Bool;\nimport Utf8 = Schema_.org.apache.arrow.flatbuf.Utf8;\nimport Decimal = Schema_.org.apache.arrow.flatbuf.Decimal;\nimport Date = Schema_.org.apache.arrow.flatbuf.Date;\nimport Time = Schema_.org.apache.arrow.flatbuf.Time;\nimport Timestamp = Schema_.org.apache.arrow.flatbuf.Timestamp;\nimport Interval = Schema_.org.apache.arrow.flatbuf.Interval;\nimport List = Schema_.org.apache.arrow.flatbuf.List;\nimport Struct = Schema_.org.apache.arrow.flatbuf.Struct_;\nimport Union = Schema_.org.apache.arrow.flatbuf.Union;\nimport DictionaryEncoding = Schema_.org.apache.arrow.flatbuf.DictionaryEncoding;\nimport FixedSizeBinary = Schema_.org.apache.arrow.flatbuf.FixedSizeBinary;\nimport FixedSizeList = Schema_.org.apache.arrow.flatbuf.FixedSizeList;\nimport Map_ = Schema_.org.apache.arrow.flatbuf.Map;\n\n/** @ignore */\nexport interface TypeAssembler extends Visitor {\n visit(node: T, builder: Builder): number | undefined;\n}\n\n/** @ignore */\nexport class TypeAssembler extends Visitor {\n public visit(node: T, builder: Builder): number | undefined {\n return (node == null || builder == null) ? undefined : super.visit(node, builder);\n }\n public visitNull(_node: T, b: Builder) {\n Null.startNull(b);\n return Null.endNull(b);\n }\n public visitInt(node: T, b: Builder) {\n Int.startInt(b);\n Int.addBitWidth(b, node.bitWidth);\n Int.addIsSigned(b, node.isSigned);\n return Int.endInt(b);\n }\n public visitFloat(node: T, b: Builder) {\n FloatingPoint.startFloatingPoint(b);\n FloatingPoint.addPrecision(b, node.precision);\n return FloatingPoint.endFloatingPoint(b);\n }\n public visitBinary(_node: T, b: Builder) {\n Binary.startBinary(b);\n return Binary.endBinary(b);\n }\n public visitBool(_node: T, b: Builder) {\n Bool.startBool(b);\n return Bool.endBool(b);\n }\n public visitUtf8(_node: T, b: Builder) {\n Utf8.startUtf8(b);\n return Utf8.endUtf8(b);\n }\n public visitDecimal(node: T, b: Builder) {\n Decimal.startDecimal(b);\n Decimal.addScale(b, node.scale);\n Decimal.addPrecision(b, node.precision);\n return Decimal.endDecimal(b);\n }\n public visitDate(node: T, b: Builder) {\n Date.startDate(b);\n Date.addUnit(b, node.unit);\n return Date.endDate(b);\n }\n public visitTime(node: T, b: Builder) {\n Time.startTime(b);\n Time.addUnit(b, node.unit);\n Time.addBitWidth(b, node.bitWidth);\n return Time.endTime(b);\n }\n public visitTimestamp(node: T, b: Builder) {\n const timezone = (node.timezone && b.createString(node.timezone)) || undefined;\n Timestamp.startTimestamp(b);\n Timestamp.addUnit(b, node.unit);\n if (timezone !== undefined) {\n Timestamp.addTimezone(b, timezone);\n }\n return Timestamp.endTimestamp(b);\n }\n public visitInterval(node: T, b: Builder) {\n Interval.startInterval(b);\n Interval.addUnit(b, node.unit);\n return Interval.endInterval(b);\n }\n public visitList(_node: T, b: Builder) {\n List.startList(b);\n return List.endList(b);\n }\n public visitStruct(_node: T, b: Builder) {\n Struct.startStruct_(b);\n return Struct.endStruct_(b);\n }\n public visitUnion(node: T, b: Builder) {\n Union.startTypeIdsVector(b, node.typeIds.length);\n const typeIds = Union.createTypeIdsVector(b, node.typeIds);\n Union.startUnion(b);\n Union.addMode(b, node.mode);\n Union.addTypeIds(b, typeIds);\n return Union.endUnion(b);\n }\n public visitDictionary(node: T, b: Builder) {\n const indexType = this.visit(node.indices, b);\n DictionaryEncoding.startDictionaryEncoding(b);\n DictionaryEncoding.addId(b, new Long(node.id, 0));\n DictionaryEncoding.addIsOrdered(b, node.isOrdered);\n if (indexType !== undefined) {\n DictionaryEncoding.addIndexType(b, indexType);\n }\n return DictionaryEncoding.endDictionaryEncoding(b);\n }\n public visitFixedSizeBinary(node: T, b: Builder) {\n FixedSizeBinary.startFixedSizeBinary(b);\n FixedSizeBinary.addByteWidth(b, node.byteWidth);\n return FixedSizeBinary.endFixedSizeBinary(b);\n }\n public visitFixedSizeList(node: T, b: Builder) {\n FixedSizeList.startFixedSizeList(b);\n FixedSizeList.addListSize(b, node.listSize);\n return FixedSizeList.endFixedSizeList(b);\n }\n public visitMap(node: T, b: Builder) {\n Map_.startMap(b);\n Map_.addKeysSorted(b, node.keysSorted);\n return Map_.endMap(b);\n }\n}\n\n/** @ignore */\nexport const instance = new TypeAssembler();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Schema, Field } from '../../schema';\nimport {\n DataType, Dictionary, TimeBitWidth,\n Utf8, Binary, Decimal, FixedSizeBinary,\n List, FixedSizeList, Map_, Struct, Union,\n Bool, Null, Int, Float, Date_, Time, Interval, Timestamp, IntBitWidth, Int32, TKeys,\n} from '../../type';\n\nimport { DictionaryBatch, RecordBatch, FieldNode, BufferRegion } from './message';\nimport { TimeUnit, Precision, IntervalUnit, UnionMode, DateUnit } from '../../enum';\n\n/** @ignore */\nexport function schemaFromJSON(_schema: any, dictionaries: Map = new Map()) {\n return new Schema(\n schemaFieldsFromJSON(_schema, dictionaries),\n customMetadataFromJSON(_schema['customMetadata']),\n dictionaries\n );\n}\n\n/** @ignore */\nexport function recordBatchFromJSON(b: any) {\n return new RecordBatch(\n b['count'],\n fieldNodesFromJSON(b['columns']),\n buffersFromJSON(b['columns'])\n );\n}\n\n/** @ignore */\nexport function dictionaryBatchFromJSON(b: any) {\n return new DictionaryBatch(\n recordBatchFromJSON(b['data']),\n b['id'], b['isDelta']\n );\n}\n\n/** @ignore */\nfunction schemaFieldsFromJSON(_schema: any, dictionaries?: Map) {\n return (_schema['fields'] || []).filter(Boolean).map((f: any) => Field.fromJSON(f, dictionaries));\n}\n\n/** @ignore */\nfunction fieldChildrenFromJSON(_field: any, dictionaries?: Map): Field[] {\n return (_field['children'] || []).filter(Boolean).map((f: any) => Field.fromJSON(f, dictionaries));\n}\n\n/** @ignore */\nfunction fieldNodesFromJSON(xs: any[]): FieldNode[] {\n return (xs || []).reduce((fieldNodes, column: any) => [\n ...fieldNodes,\n new FieldNode(\n column['count'],\n nullCountFromJSON(column['VALIDITY'])\n ),\n ...fieldNodesFromJSON(column['children'])\n ], [] as FieldNode[]);\n}\n\n/** @ignore */\nfunction buffersFromJSON(xs: any[], buffers: BufferRegion[] = []): BufferRegion[] {\n for (let i = -1, n = (xs || []).length; ++i < n;) {\n const column = xs[i];\n column['VALIDITY'] && buffers.push(new BufferRegion(buffers.length, column['VALIDITY'].length));\n column['TYPE'] && buffers.push(new BufferRegion(buffers.length, column['TYPE'].length));\n column['OFFSET'] && buffers.push(new BufferRegion(buffers.length, column['OFFSET'].length));\n column['DATA'] && buffers.push(new BufferRegion(buffers.length, column['DATA'].length));\n buffers = buffersFromJSON(column['children'], buffers);\n }\n return buffers;\n}\n\n/** @ignore */\nfunction nullCountFromJSON(validity: number[]) {\n return (validity || []).reduce((sum, val) => sum + +(val === 0), 0);\n}\n\n/** @ignore */\nexport function fieldFromJSON(_field: any, dictionaries?: Map) {\n\n let id: number;\n let keys: TKeys | null;\n let field: Field | void;\n let dictMeta: any;\n let type: DataType;\n let dictType: Dictionary;\n\n // If no dictionary encoding\n if (!dictionaries || !(dictMeta = _field['dictionary'])) {\n type = typeFromJSON(_field, fieldChildrenFromJSON(_field, dictionaries));\n field = new Field(_field['name'], type, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));\n }\n // tslint:disable\n // If dictionary encoded and the first time we've seen this dictionary id, decode\n // the data type and child fields, then wrap in a Dictionary type and insert the\n // data type into the dictionary types map.\n else if (!dictionaries.has(id = dictMeta['id'])) {\n // a dictionary index defaults to signed 32 bit int if unspecified\n keys = (keys = dictMeta['indexType']) ? indexTypeFromJSON(keys) as TKeys : new Int32();\n dictionaries.set(id, type = typeFromJSON(_field, fieldChildrenFromJSON(_field, dictionaries)));\n dictType = new Dictionary(type, keys, id, dictMeta['isOrdered']);\n field = new Field(_field['name'], dictType, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));\n }\n // If dictionary encoded, and have already seen this dictionary Id in the schema, then reuse the\n // data type and wrap in a new Dictionary type and field.\n else {\n // a dictionary index defaults to signed 32 bit int if unspecified\n keys = (keys = dictMeta['indexType']) ? indexTypeFromJSON(keys) as TKeys : new Int32();\n dictType = new Dictionary(dictionaries.get(id)!, keys, id, dictMeta['isOrdered']);\n field = new Field(_field['name'], dictType, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));\n }\n return field || null;\n}\n\n/** @ignore */\nfunction customMetadataFromJSON(_metadata?: object) {\n return new Map(Object.entries(_metadata || {}));\n}\n\n/** @ignore */\nfunction indexTypeFromJSON(_type: any) {\n return new Int(_type['isSigned'], _type['bitWidth']);\n}\n\n/** @ignore */\nfunction typeFromJSON(f: any, children?: Field[]): DataType {\n\n const typeId = f['type']['name'];\n\n switch (typeId) {\n case 'NONE': return new Null();\n case 'null': return new Null();\n case 'binary': return new Binary();\n case 'utf8': return new Utf8();\n case 'bool': return new Bool();\n case 'list': return new List((children || [])[0]);\n case 'struct': return new Struct(children || []);\n case 'struct_': return new Struct(children || []);\n }\n\n switch (typeId) {\n case 'int': {\n const t = f['type'];\n return new Int(t['isSigned'], t['bitWidth'] as IntBitWidth);\n }\n case 'floatingpoint': {\n const t = f['type'];\n return new Float(Precision[t['precision']] as any);\n }\n case 'decimal': {\n const t = f['type'];\n return new Decimal(t['scale'], t['precision']);\n }\n case 'date': {\n const t = f['type'];\n return new Date_(DateUnit[t['unit']] as any);\n }\n case 'time': {\n const t = f['type'];\n return new Time(TimeUnit[t['unit']] as any, t['bitWidth'] as TimeBitWidth);\n }\n case 'timestamp': {\n const t = f['type'];\n return new Timestamp(TimeUnit[t['unit']] as any, t['timezone']);\n }\n case 'interval': {\n const t = f['type'];\n return new Interval(IntervalUnit[t['unit']] as any);\n }\n case 'union': {\n const t = f['type'];\n return new Union(UnionMode[t['mode']] as any, (t['typeIds'] || []), children || []);\n }\n case 'fixedsizebinary': {\n const t = f['type'];\n return new FixedSizeBinary(t['byteWidth']);\n }\n case 'fixedsizelist': {\n const t = f['type'];\n return new FixedSizeList(t['listSize'], (children || [])[0]);\n }\n case 'map': {\n const t = f['type'];\n return new Map_((children || [])[0], t['keysSorted']);\n }\n }\n throw new Error(`Unrecognized type: \"${typeId}\"`);\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { flatbuffers } from 'flatbuffers';\nimport * as Schema_ from '../../fb/Schema';\nimport * as Message_ from '../../fb/Message';\n\nimport { Schema, Field } from '../../schema';\nimport { toUint8Array } from '../../util/buffer';\nimport { ArrayBufferViewInput } from '../../util/buffer';\nimport { MessageHeader, MetadataVersion } from '../../enum';\nimport { instance as typeAssembler } from '../../visitor/typeassembler';\nimport { fieldFromJSON, schemaFromJSON, recordBatchFromJSON, dictionaryBatchFromJSON } from './json';\n\nimport Long = flatbuffers.Long;\nimport Builder = flatbuffers.Builder;\nimport ByteBuffer = flatbuffers.ByteBuffer;\nimport _Int = Schema_.org.apache.arrow.flatbuf.Int;\nimport Type = Schema_.org.apache.arrow.flatbuf.Type;\nimport _Field = Schema_.org.apache.arrow.flatbuf.Field;\nimport _Schema = Schema_.org.apache.arrow.flatbuf.Schema;\nimport _Buffer = Schema_.org.apache.arrow.flatbuf.Buffer;\nimport _Message = Message_.org.apache.arrow.flatbuf.Message;\nimport _KeyValue = Schema_.org.apache.arrow.flatbuf.KeyValue;\nimport _FieldNode = Message_.org.apache.arrow.flatbuf.FieldNode;\nimport _Endianness = Schema_.org.apache.arrow.flatbuf.Endianness;\nimport _RecordBatch = Message_.org.apache.arrow.flatbuf.RecordBatch;\nimport _DictionaryBatch = Message_.org.apache.arrow.flatbuf.DictionaryBatch;\nimport _DictionaryEncoding = Schema_.org.apache.arrow.flatbuf.DictionaryEncoding;\n\nimport {\n DataType, Dictionary, TimeBitWidth,\n Utf8, Binary, Decimal, FixedSizeBinary,\n List, FixedSizeList, Map_, Struct, Union,\n Bool, Null, Int, Float, Date_, Time, Interval, Timestamp, IntBitWidth, Int32, TKeys,\n} from '../../type';\n\n/**\n * @ignore\n * @private\n **/\nexport class Message {\n\n /** @nocollapse */\n public static fromJSON(msg: any, headerType: T): Message {\n const message = new Message(0, MetadataVersion.V4, headerType);\n message._createHeader = messageHeaderFromJSON(msg, headerType);\n return message;\n }\n\n /** @nocollapse */\n public static decode(buf: ArrayBufferViewInput) {\n buf = new ByteBuffer(toUint8Array(buf));\n const _message = _Message.getRootAsMessage(buf);\n const bodyLength: Long = _message.bodyLength()!;\n const version: MetadataVersion = _message.version();\n const headerType: MessageHeader = _message.headerType();\n const message = new Message(bodyLength, version, headerType);\n message._createHeader = decodeMessageHeader(_message, headerType);\n return message;\n }\n\n /** @nocollapse */\n public static encode(message: Message) {\n let b = new Builder(), headerOffset = -1;\n if (message.isSchema()) {\n headerOffset = Schema.encode(b, message.header() as Schema);\n } else if (message.isRecordBatch()) {\n headerOffset = RecordBatch.encode(b, message.header() as RecordBatch);\n } else if (message.isDictionaryBatch()) {\n headerOffset = DictionaryBatch.encode(b, message.header() as DictionaryBatch);\n }\n _Message.startMessage(b);\n _Message.addVersion(b, MetadataVersion.V4);\n _Message.addHeader(b, headerOffset);\n _Message.addHeaderType(b, message.headerType);\n _Message.addBodyLength(b, new Long(message.bodyLength, 0));\n _Message.finishMessageBuffer(b, _Message.endMessage(b));\n return b.asUint8Array();\n }\n\n /** @nocollapse */\n public static from(header: Schema | RecordBatch | DictionaryBatch, bodyLength = 0) {\n if (header instanceof Schema) {\n return new Message(0, MetadataVersion.V4, MessageHeader.Schema, header);\n }\n if (header instanceof RecordBatch) {\n return new Message(bodyLength, MetadataVersion.V4, MessageHeader.RecordBatch, header);\n }\n if (header instanceof DictionaryBatch) {\n return new Message(bodyLength, MetadataVersion.V4, MessageHeader.DictionaryBatch, header);\n }\n throw new Error(`Unrecognized Message header: ${header}`);\n }\n\n // @ts-ignore\n public body: Uint8Array;\n protected _headerType: T;\n protected _bodyLength: number;\n protected _version: MetadataVersion;\n public get type() { return this.headerType; }\n public get version() { return this._version; }\n public get headerType() { return this._headerType; }\n public get bodyLength() { return this._bodyLength; }\n // @ts-ignore\n protected _createHeader: MessageHeaderDecoder;\n public header() { return this._createHeader(); }\n public isSchema(): this is Message { return this.headerType === MessageHeader.Schema; }\n public isRecordBatch(): this is Message { return this.headerType === MessageHeader.RecordBatch; }\n public isDictionaryBatch(): this is Message { return this.headerType === MessageHeader.DictionaryBatch; }\n\n constructor(bodyLength: Long | number, version: MetadataVersion, headerType: T, header?: any) {\n this._version = version;\n this._headerType = headerType;\n this.body = new Uint8Array(0);\n header && (this._createHeader = () => header);\n this._bodyLength = typeof bodyLength === 'number' ? bodyLength : bodyLength.low;\n }\n}\n\n/**\n * @ignore\n * @private\n **/\nexport class RecordBatch {\n protected _length: number;\n protected _nodes: FieldNode[];\n protected _buffers: BufferRegion[];\n public get nodes() { return this._nodes; }\n public get length() { return this._length; }\n public get buffers() { return this._buffers; }\n constructor(length: Long | number, nodes: FieldNode[], buffers: BufferRegion[]) {\n this._nodes = nodes;\n this._buffers = buffers;\n this._length = typeof length === 'number' ? length : length.low;\n }\n}\n\n/**\n * @ignore\n * @private\n **/\nexport class DictionaryBatch {\n\n protected _id: number;\n protected _isDelta: boolean;\n protected _data: RecordBatch;\n public get id() { return this._id; }\n public get data() { return this._data; }\n public get isDelta() { return this._isDelta; }\n public get length(): number { return this.data.length; }\n public get nodes(): FieldNode[] { return this.data.nodes; }\n public get buffers(): BufferRegion[] { return this.data.buffers; }\n\n constructor(data: RecordBatch, id: Long | number, isDelta: boolean = false) {\n this._data = data;\n this._isDelta = isDelta;\n this._id = typeof id === 'number' ? id : id.low;\n }\n}\n\n/**\n * @ignore\n * @private\n **/\nexport class BufferRegion {\n public offset: number;\n public length: number;\n constructor(offset: Long | number, length: Long | number) {\n this.offset = typeof offset === 'number' ? offset : offset.low;\n this.length = typeof length === 'number' ? length : length.low;\n }\n}\n\n/**\n * @ignore\n * @private\n **/\nexport class FieldNode {\n public length: number;\n public nullCount: number;\n constructor(length: Long | number, nullCount: Long | number) {\n this.length = typeof length === 'number' ? length : length.low;\n this.nullCount = typeof nullCount === 'number' ? nullCount : nullCount.low;\n }\n}\n\n/** @ignore */\nfunction messageHeaderFromJSON(message: any, type: MessageHeader) {\n return (() => {\n switch (type) {\n case MessageHeader.Schema: return Schema.fromJSON(message);\n case MessageHeader.RecordBatch: return RecordBatch.fromJSON(message);\n case MessageHeader.DictionaryBatch: return DictionaryBatch.fromJSON(message);\n }\n throw new Error(`Unrecognized Message type: { name: ${MessageHeader[type]}, type: ${type} }`);\n }) as MessageHeaderDecoder;\n}\n\n/** @ignore */\nfunction decodeMessageHeader(message: _Message, type: MessageHeader) {\n return (() => {\n switch (type) {\n case MessageHeader.Schema: return Schema.decode(message.header(new _Schema())!);\n case MessageHeader.RecordBatch: return RecordBatch.decode(message.header(new _RecordBatch())!, message.version());\n case MessageHeader.DictionaryBatch: return DictionaryBatch.decode(message.header(new _DictionaryBatch())!, message.version());\n }\n throw new Error(`Unrecognized Message type: { name: ${MessageHeader[type]}, type: ${type} }`);\n }) as MessageHeaderDecoder;\n}\n\nField['encode'] = encodeField;\nField['decode'] = decodeField;\nField['fromJSON'] = fieldFromJSON;\n\nSchema['encode'] = encodeSchema;\nSchema['decode'] = decodeSchema;\nSchema['fromJSON'] = schemaFromJSON;\n\nRecordBatch['encode'] = encodeRecordBatch;\nRecordBatch['decode'] = decodeRecordBatch;\nRecordBatch['fromJSON'] = recordBatchFromJSON;\n\nDictionaryBatch['encode'] = encodeDictionaryBatch;\nDictionaryBatch['decode'] = decodeDictionaryBatch;\nDictionaryBatch['fromJSON'] = dictionaryBatchFromJSON;\n\nFieldNode['encode'] = encodeFieldNode;\nFieldNode['decode'] = decodeFieldNode;\n\nBufferRegion['encode'] = encodeBufferRegion;\nBufferRegion['decode'] = decodeBufferRegion;\n\ndeclare module '../../schema' {\n namespace Field {\n export { encodeField as encode };\n export { decodeField as decode };\n export { fieldFromJSON as fromJSON };\n }\n namespace Schema {\n export { encodeSchema as encode };\n export { decodeSchema as decode };\n export { schemaFromJSON as fromJSON };\n }\n}\n\ndeclare module './message' {\n namespace RecordBatch {\n export { encodeRecordBatch as encode };\n export { decodeRecordBatch as decode };\n export { recordBatchFromJSON as fromJSON };\n }\n namespace DictionaryBatch {\n export { encodeDictionaryBatch as encode };\n export { decodeDictionaryBatch as decode };\n export { dictionaryBatchFromJSON as fromJSON };\n }\n namespace FieldNode {\n export { encodeFieldNode as encode };\n export { decodeFieldNode as decode };\n }\n namespace BufferRegion {\n export { encodeBufferRegion as encode };\n export { decodeBufferRegion as decode };\n }\n}\n\n/** @ignore */\nfunction decodeSchema(_schema: _Schema, dictionaries: Map = new Map()) {\n const fields = decodeSchemaFields(_schema, dictionaries);\n return new Schema(fields, decodeCustomMetadata(_schema), dictionaries);\n}\n\n/** @ignore */\nfunction decodeRecordBatch(batch: _RecordBatch, version = MetadataVersion.V4) {\n return new RecordBatch(batch.length(), decodeFieldNodes(batch), decodeBuffers(batch, version));\n}\n\n/** @ignore */\nfunction decodeDictionaryBatch(batch: _DictionaryBatch, version = MetadataVersion.V4) {\n return new DictionaryBatch(RecordBatch.decode(batch.data()!, version), batch.id(), batch.isDelta());\n}\n\n/** @ignore */\nfunction decodeBufferRegion(b: _Buffer) {\n return new BufferRegion(b.offset(), b.length());\n}\n\n/** @ignore */\nfunction decodeFieldNode(f: _FieldNode) {\n return new FieldNode(f.length(), f.nullCount());\n}\n\n/** @ignore */\nfunction decodeFieldNodes(batch: _RecordBatch) {\n const nodes = [] as FieldNode[];\n for (let f, i = -1, j = -1, n = batch.nodesLength(); ++i < n;) {\n if (f = batch.nodes(i)) {\n nodes[++j] = FieldNode.decode(f);\n }\n }\n return nodes;\n}\n\n/** @ignore */\nfunction decodeBuffers(batch: _RecordBatch, version: MetadataVersion) {\n const bufferRegions = [] as BufferRegion[];\n for (let b, i = -1, j = -1, n = batch.buffersLength(); ++i < n;) {\n if (b = batch.buffers(i)) {\n // If this Arrow buffer was written before version 4,\n // advance the buffer's bb_pos 8 bytes to skip past\n // the now-removed page_id field\n if (version < MetadataVersion.V4) {\n b.bb_pos += (8 * (i + 1));\n }\n bufferRegions[++j] = BufferRegion.decode(b);\n }\n }\n return bufferRegions;\n}\n\n/** @ignore */\nfunction decodeSchemaFields(schema: _Schema, dictionaries?: Map) {\n const fields = [] as Field[];\n for (let f, i = -1, j = -1, n = schema.fieldsLength(); ++i < n;) {\n if (f = schema.fields(i)) {\n fields[++j] = Field.decode(f, dictionaries);\n }\n }\n return fields;\n}\n\n/** @ignore */\nfunction decodeFieldChildren(field: _Field, dictionaries?: Map): Field[] {\n const children = [] as Field[];\n for (let f, i = -1, j = -1, n = field.childrenLength(); ++i < n;) {\n if (f = field.children(i)) {\n children[++j] = Field.decode(f, dictionaries);\n }\n }\n return children;\n}\n\n/** @ignore */\nfunction decodeField(f: _Field, dictionaries?: Map) {\n\n let id: number;\n let field: Field | void;\n let type: DataType;\n let keys: _Int | TKeys | null;\n let dictType: Dictionary;\n let dictMeta: _DictionaryEncoding | null;\n\n // If no dictionary encoding\n if (!dictionaries || !(dictMeta = f.dictionary())) {\n type = decodeFieldType(f, decodeFieldChildren(f, dictionaries));\n field = new Field(f.name()!, type, f.nullable(), decodeCustomMetadata(f));\n }\n // tslint:disable\n // If dictionary encoded and the first time we've seen this dictionary id, decode\n // the data type and child fields, then wrap in a Dictionary type and insert the\n // data type into the dictionary types map.\n else if (!dictionaries.has(id = dictMeta.id().low)) {\n // a dictionary index defaults to signed 32 bit int if unspecified\n keys = (keys = dictMeta.indexType()) ? decodeIndexType(keys) as TKeys : new Int32();\n dictionaries.set(id, type = decodeFieldType(f, decodeFieldChildren(f, dictionaries)));\n dictType = new Dictionary(type, keys, id, dictMeta.isOrdered());\n field = new Field(f.name()!, dictType, f.nullable(), decodeCustomMetadata(f));\n }\n // If dictionary encoded, and have already seen this dictionary Id in the schema, then reuse the\n // data type and wrap in a new Dictionary type and field.\n else {\n // a dictionary index defaults to signed 32 bit int if unspecified\n keys = (keys = dictMeta.indexType()) ? decodeIndexType(keys) as TKeys : new Int32();\n dictType = new Dictionary(dictionaries.get(id)!, keys, id, dictMeta.isOrdered());\n field = new Field(f.name()!, dictType, f.nullable(), decodeCustomMetadata(f));\n }\n return field || null;\n}\n\n/** @ignore */\nfunction decodeCustomMetadata(parent?: _Schema | _Field | null) {\n const data = new Map();\n if (parent) {\n for (let entry, key, i = -1, n = parent.customMetadataLength() | 0; ++i < n;) {\n if ((entry = parent.customMetadata(i)) && (key = entry.key()) != null) {\n data.set(key, entry.value()!);\n }\n }\n }\n return data;\n}\n\n/** @ignore */\nfunction decodeIndexType(_type: _Int) {\n return new Int(_type.isSigned(), _type.bitWidth() as IntBitWidth);\n}\n\n/** @ignore */\nfunction decodeFieldType(f: _Field, children?: Field[]): DataType {\n\n const typeId = f.typeType();\n\n switch (typeId) {\n case Type.NONE: return new Null();\n case Type.Null: return new Null();\n case Type.Binary: return new Binary();\n case Type.Utf8: return new Utf8();\n case Type.Bool: return new Bool();\n case Type.List: return new List((children || [])[0]);\n case Type.Struct_: return new Struct(children || []);\n }\n\n switch (typeId) {\n case Type.Int: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Int())!;\n return new Int(t.isSigned(), t.bitWidth());\n }\n case Type.FloatingPoint: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.FloatingPoint())!;\n return new Float(t.precision());\n }\n case Type.Decimal: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Decimal())!;\n return new Decimal(t.scale(), t.precision());\n }\n case Type.Date: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Date())!;\n return new Date_(t.unit());\n }\n case Type.Time: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Time())!;\n return new Time(t.unit(), t.bitWidth() as TimeBitWidth);\n }\n case Type.Timestamp: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Timestamp())!;\n return new Timestamp(t.unit(), t.timezone());\n }\n case Type.Interval: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Interval())!;\n return new Interval(t.unit());\n }\n case Type.Union: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Union())!;\n return new Union(t.mode(), t.typeIdsArray() || [], children || []);\n }\n case Type.FixedSizeBinary: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.FixedSizeBinary())!;\n return new FixedSizeBinary(t.byteWidth());\n }\n case Type.FixedSizeList: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.FixedSizeList())!;\n return new FixedSizeList(t.listSize(), (children || [])[0]);\n }\n case Type.Map: {\n const t = f.type(new Schema_.org.apache.arrow.flatbuf.Map())!;\n return new Map_((children || [])[0], t.keysSorted());\n }\n }\n throw new Error(`Unrecognized type: \"${Type[typeId]}\" (${typeId})`);\n}\n\n/** @ignore */\nfunction encodeSchema(b: Builder, schema: Schema) {\n\n const fieldOffsets = schema.fields.map((f) => Field.encode(b, f));\n\n _Schema.startFieldsVector(b, fieldOffsets.length);\n\n const fieldsVectorOffset = _Schema.createFieldsVector(b, fieldOffsets);\n\n const metadataOffset = !(schema.metadata && schema.metadata.size > 0) ? -1 :\n _Schema.createCustomMetadataVector(b, [...schema.metadata].map(([k, v]) => {\n const key = b.createString(`${k}`);\n const val = b.createString(`${v}`);\n _KeyValue.startKeyValue(b);\n _KeyValue.addKey(b, key);\n _KeyValue.addValue(b, val);\n return _KeyValue.endKeyValue(b);\n }));\n\n _Schema.startSchema(b);\n _Schema.addFields(b, fieldsVectorOffset);\n _Schema.addEndianness(b, platformIsLittleEndian ? _Endianness.Little : _Endianness.Big);\n\n if (metadataOffset !== -1) { _Schema.addCustomMetadata(b, metadataOffset); }\n\n return _Schema.endSchema(b);\n}\n\n/** @ignore */\nfunction encodeField(b: Builder, field: Field) {\n\n let nameOffset = -1;\n let typeOffset = -1;\n let dictionaryOffset = -1;\n\n let type = field.type;\n let typeId: Type = field.typeId;\n\n if (!DataType.isDictionary(type)) {\n typeOffset = typeAssembler.visit(type, b)!;\n } else {\n typeId = type.dictionary.typeId;\n dictionaryOffset = typeAssembler.visit(type, b)!;\n typeOffset = typeAssembler.visit(type.dictionary, b)!;\n }\n\n const childOffsets = (type.children || []).map((f: Field) => Field.encode(b, f));\n const childrenVectorOffset = _Field.createChildrenVector(b, childOffsets);\n\n const metadataOffset = !(field.metadata && field.metadata.size > 0) ? -1 :\n _Field.createCustomMetadataVector(b, [...field.metadata].map(([k, v]) => {\n const key = b.createString(`${k}`);\n const val = b.createString(`${v}`);\n _KeyValue.startKeyValue(b);\n _KeyValue.addKey(b, key);\n _KeyValue.addValue(b, val);\n return _KeyValue.endKeyValue(b);\n }));\n\n if (field.name) {\n nameOffset = b.createString(field.name);\n }\n\n _Field.startField(b);\n _Field.addType(b, typeOffset);\n _Field.addTypeType(b, typeId);\n _Field.addChildren(b, childrenVectorOffset);\n _Field.addNullable(b, !!field.nullable);\n\n if (nameOffset !== -1) { _Field.addName(b, nameOffset); }\n if (dictionaryOffset !== -1) { _Field.addDictionary(b, dictionaryOffset); }\n if (metadataOffset !== -1) { _Field.addCustomMetadata(b, metadataOffset); }\n\n return _Field.endField(b);\n}\n\n/** @ignore */\nfunction encodeRecordBatch(b: Builder, recordBatch: RecordBatch) {\n\n const nodes = recordBatch.nodes || [];\n const buffers = recordBatch.buffers || [];\n\n _RecordBatch.startNodesVector(b, nodes.length);\n nodes.slice().reverse().forEach((n) => FieldNode.encode(b, n));\n\n const nodesVectorOffset = b.endVector();\n\n _RecordBatch.startBuffersVector(b, buffers.length);\n buffers.slice().reverse().forEach((b_) => BufferRegion.encode(b, b_));\n\n const buffersVectorOffset = b.endVector();\n\n _RecordBatch.startRecordBatch(b);\n _RecordBatch.addLength(b, new Long(recordBatch.length, 0));\n _RecordBatch.addNodes(b, nodesVectorOffset);\n _RecordBatch.addBuffers(b, buffersVectorOffset);\n return _RecordBatch.endRecordBatch(b);\n}\n\n/** @ignore */\nfunction encodeDictionaryBatch(b: Builder, dictionaryBatch: DictionaryBatch) {\n const dataOffset = RecordBatch.encode(b, dictionaryBatch.data);\n _DictionaryBatch.startDictionaryBatch(b);\n _DictionaryBatch.addId(b, new Long(dictionaryBatch.id, 0));\n _DictionaryBatch.addIsDelta(b, dictionaryBatch.isDelta);\n _DictionaryBatch.addData(b, dataOffset);\n return _DictionaryBatch.endDictionaryBatch(b);\n}\n\n/** @ignore */\nfunction encodeFieldNode(b: Builder, node: FieldNode) {\n return _FieldNode.createFieldNode(b, new Long(node.length, 0), new Long(node.nullCount, 0));\n}\n\n/** @ignore */\nfunction encodeBufferRegion(b: Builder, node: BufferRegion) {\n return _Buffer.createBuffer(b, new Long(node.offset, 0), new Long(node.length, 0));\n}\n\n/** @ignore */\nconst platformIsLittleEndian = (function() {\n const buffer = new ArrayBuffer(2);\n new DataView(buffer).setInt16(0, 256, true /* littleEndian */);\n // Int16Array uses the platform's endianness.\n return new Int16Array(buffer)[0] === 256;\n})();\n\n/** @ignore */\ntype MessageHeaderDecoder = () => T extends MessageHeader.Schema ? Schema\n : T extends MessageHeader.RecordBatch ? RecordBatch\n : T extends MessageHeader.DictionaryBatch ? DictionaryBatch : never;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { MessageHeader } from '../enum';\nimport { flatbuffers } from 'flatbuffers';\nimport ByteBuffer = flatbuffers.ByteBuffer;\nimport { Message } from './metadata/message';\nimport { isFileHandle } from '../util/compat';\nimport { AsyncRandomAccessFile } from '../io/file';\nimport { toUint8Array, ArrayBufferViewInput } from '../util/buffer';\nimport { ByteStream, ReadableSource, AsyncByteStream } from '../io/stream';\nimport { ArrowJSON, ArrowJSONLike, ITERATOR_DONE, FileHandle } from '../io/interfaces';\n\n/** @ignore */ const invalidMessageType = (type: MessageHeader) => `Expected ${MessageHeader[type]} Message in stream, but was null or length 0.`;\n/** @ignore */ const nullMessage = (type: MessageHeader) => `Header pointer of flatbuffer-encoded ${MessageHeader[type]} Message is null or length 0.`;\n/** @ignore */ const invalidMessageMetadata = (expected: number, actual: number) => `Expected to read ${expected} metadata bytes, but only read ${actual}.`;\n/** @ignore */ const invalidMessageBodyLength = (expected: number, actual: number) => `Expected to read ${expected} bytes for message body, but only read ${actual}.`;\n\n/** @ignore */\nexport class MessageReader implements IterableIterator {\n protected source: ByteStream;\n constructor(source: ByteStream | ArrayBufferViewInput | Iterable) {\n this.source = source instanceof ByteStream ? source : new ByteStream(source);\n }\n public [Symbol.iterator](): IterableIterator { return this as IterableIterator; }\n public next(): IteratorResult {\n let r;\n if ((r = this.readMetadataLength()).done) { return ITERATOR_DONE; }\n // ARROW-6313: If the first 4 bytes are continuation indicator (-1), read\n // the next 4 for the 32-bit metadata length. Otherwise, assume this is a\n // pre-v0.15 message, where the first 4 bytes are the metadata length.\n if ((r.value === -1) &&\n (r = this.readMetadataLength()).done) { return ITERATOR_DONE; }\n if ((r = this.readMetadata(r.value)).done) { return ITERATOR_DONE; }\n return ( r) as IteratorResult;\n }\n public throw(value?: any) { return this.source.throw(value); }\n public return(value?: any) { return this.source.return(value); }\n public readMessage(type?: T | null) {\n let r: IteratorResult>;\n if ((r = this.next()).done) { return null; }\n if ((type != null) && r.value.headerType !== type) {\n throw new Error(invalidMessageType(type));\n }\n return r.value;\n }\n public readMessageBody(bodyLength: number): Uint8Array {\n if (bodyLength <= 0) { return new Uint8Array(0); }\n const buf = toUint8Array(this.source.read(bodyLength));\n if (buf.byteLength < bodyLength) {\n throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));\n }\n // 1. Work around bugs in fs.ReadStream's internal Buffer pooling, see: https://github.com/nodejs/node/issues/24817\n // 2. Work around https://github.com/whatwg/streams/blob/0ebe4b042e467d9876d80ae045de3843092ad797/reference-implementation/lib/helpers.js#L126\n return /* 1. */ (buf.byteOffset % 8 === 0) &&\n /* 2. */ (buf.byteOffset + buf.byteLength) <= buf.buffer.byteLength ? buf : buf.slice();\n }\n public readSchema(throwIfNull = false) {\n const type = MessageHeader.Schema;\n const message = this.readMessage(type);\n const schema = message && message.header();\n if (throwIfNull && !schema) {\n throw new Error(nullMessage(type));\n }\n return schema;\n }\n protected readMetadataLength(): IteratorResult {\n const buf = this.source.read(PADDING);\n const bb = buf && new ByteBuffer(buf);\n const len = bb && bb.readInt32(0) || 0;\n return { done: len === 0, value: len };\n }\n protected readMetadata(metadataLength: number): IteratorResult {\n const buf = this.source.read(metadataLength);\n if (!buf) { return ITERATOR_DONE; }\n if (buf.byteLength < metadataLength) {\n throw new Error(invalidMessageMetadata(metadataLength, buf.byteLength));\n }\n return { done: false, value: Message.decode(buf) };\n }\n}\n\n/** @ignore */\nexport class AsyncMessageReader implements AsyncIterableIterator {\n protected source: AsyncByteStream;\n constructor(source: ReadableSource);\n constructor(source: FileHandle, byteLength?: number);\n constructor(source: any, byteLength?: number) {\n this.source = source instanceof AsyncByteStream ? source\n : isFileHandle(source)\n ? new AsyncRandomAccessFile(source, byteLength!)\n : new AsyncByteStream(source);\n }\n public [Symbol.asyncIterator](): AsyncIterableIterator { return this as AsyncIterableIterator; }\n public async next(): Promise> {\n let r;\n if ((r = await this.readMetadataLength()).done) { return ITERATOR_DONE; }\n // ARROW-6313: If the first 4 bytes are continuation indicator (-1), read\n // the next 4 for the 32-bit metadata length. Otherwise, assume this is a\n // pre-v0.15 message, where the first 4 bytes are the metadata length.\n if ((r.value === -1) &&\n (r = await this.readMetadataLength()).done) { return ITERATOR_DONE; }\n if ((r = await this.readMetadata(r.value)).done) { return ITERATOR_DONE; }\n return ( r) as IteratorResult;\n }\n public async throw(value?: any) { return await this.source.throw(value); }\n public async return(value?: any) { return await this.source.return(value); }\n public async readMessage(type?: T | null) {\n let r: IteratorResult>;\n if ((r = await this.next()).done) { return null; }\n if ((type != null) && r.value.headerType !== type) {\n throw new Error(invalidMessageType(type));\n }\n return r.value;\n }\n public async readMessageBody(bodyLength: number): Promise {\n if (bodyLength <= 0) { return new Uint8Array(0); }\n const buf = toUint8Array(await this.source.read(bodyLength));\n if (buf.byteLength < bodyLength) {\n throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));\n }\n // 1. Work around bugs in fs.ReadStream's internal Buffer pooling, see: https://github.com/nodejs/node/issues/24817\n // 2. Work around https://github.com/whatwg/streams/blob/0ebe4b042e467d9876d80ae045de3843092ad797/reference-implementation/lib/helpers.js#L126\n return /* 1. */ (buf.byteOffset % 8 === 0) &&\n /* 2. */ (buf.byteOffset + buf.byteLength) <= buf.buffer.byteLength ? buf : buf.slice();\n }\n public async readSchema(throwIfNull = false) {\n const type = MessageHeader.Schema;\n const message = await this.readMessage(type);\n const schema = message && message.header();\n if (throwIfNull && !schema) {\n throw new Error(nullMessage(type));\n }\n return schema;\n }\n protected async readMetadataLength(): Promise> {\n const buf = await this.source.read(PADDING);\n const bb = buf && new ByteBuffer(buf);\n const len = bb && bb.readInt32(0) || 0;\n return { done: len === 0, value: len };\n }\n protected async readMetadata(metadataLength: number): Promise> {\n const buf = await this.source.read(metadataLength);\n if (!buf) { return ITERATOR_DONE; }\n if (buf.byteLength < metadataLength) {\n throw new Error(invalidMessageMetadata(metadataLength, buf.byteLength));\n }\n return { done: false, value: Message.decode(buf) };\n }\n}\n\n/** @ignore */\nexport class JSONMessageReader extends MessageReader {\n private _schema = false;\n private _json: ArrowJSON;\n private _body: any[] = [];\n private _batchIndex = 0;\n private _dictionaryIndex = 0;\n constructor(source: ArrowJSON | ArrowJSONLike) {\n super(new Uint8Array(0));\n this._json = source instanceof ArrowJSON ? source : new ArrowJSON(source);\n }\n public next() {\n const { _json } = this;\n if (!this._schema) {\n this._schema = true;\n const message = Message.fromJSON(_json.schema, MessageHeader.Schema);\n return { done: false, value: message };\n }\n if (this._dictionaryIndex < _json.dictionaries.length) {\n const batch = _json.dictionaries[this._dictionaryIndex++];\n this._body = batch['data']['columns'];\n const message = Message.fromJSON(batch, MessageHeader.DictionaryBatch);\n return { done: false, value: message };\n }\n if (this._batchIndex < _json.batches.length) {\n const batch = _json.batches[this._batchIndex++];\n this._body = batch['columns'];\n const message = Message.fromJSON(batch, MessageHeader.RecordBatch);\n return { done: false, value: message };\n }\n this._body = [];\n return ITERATOR_DONE;\n }\n public readMessageBody(_bodyLength?: number) {\n return flattenDataSources(this._body) as any;\n function flattenDataSources(xs: any[]): any[][] {\n return (xs || []).reduce((buffers, column: any) => [\n ...buffers,\n ...(column['VALIDITY'] && [column['VALIDITY']] || []),\n ...(column['TYPE'] && [column['TYPE']] || []),\n ...(column['OFFSET'] && [column['OFFSET']] || []),\n ...(column['DATA'] && [column['DATA']] || []),\n ...flattenDataSources(column['children'])\n ], [] as any[][]);\n }\n }\n public readMessage(type?: T | null) {\n let r: IteratorResult>;\n if ((r = this.next()).done) { return null; }\n if ((type != null) && r.value.headerType !== type) {\n throw new Error(invalidMessageType(type));\n }\n return r.value;\n }\n public readSchema() {\n const type = MessageHeader.Schema;\n const message = this.readMessage(type);\n const schema = message && message.header();\n if (!message || !schema) {\n throw new Error(nullMessage(type));\n }\n return schema;\n }\n}\n\n/** @ignore */\nexport const PADDING = 4;\n/** @ignore */\nexport const MAGIC_STR = 'ARROW1';\n/** @ignore */\nexport const MAGIC = new Uint8Array(MAGIC_STR.length);\n\nfor (let i = 0; i < MAGIC_STR.length; i += 1 | 0) {\n MAGIC[i] = MAGIC_STR.charCodeAt(i);\n}\n\n/** @ignore */\nexport function checkForMagicArrowString(buffer: Uint8Array, index = 0) {\n for (let i = -1, n = MAGIC.length; ++i < n;) {\n if (MAGIC[i] !== buffer[index + i]) {\n return false;\n }\n }\n return true;\n}\n\n/** @ignore */\nexport const magicLength = MAGIC.length;\n/** @ignore */\nexport const magicAndPadding = magicLength + PADDING;\n/** @ignore */\nexport const magicX2AndPadding = magicLength * 2 + PADDING;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Vector } from '../vector';\nimport { Visitor } from '../visitor';\nimport { Type, UnionMode } from '../enum';\nimport { RecordBatch } from '../recordbatch';\nimport { VectorType as V } from '../interfaces';\nimport { rebaseValueOffsets } from '../util/buffer';\nimport { packBools, truncateBitmap } from '../util/bit';\nimport { selectVectorChildrenArgs } from '../util/args';\nimport { BufferRegion, FieldNode } from '../ipc/metadata/message';\nimport {\n DataType, Dictionary,\n Float, Int, Date_, Interval, Time, Timestamp, Union,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n} from '../type';\n\n/** @ignore */\nexport interface VectorAssembler extends Visitor {\n visit(node: T): this;\n visitMany(nodes: T[]): this[];\n getVisitFn(node: T): (vector: V) => this;\n getVisitFn(node: V | Data | T): (vector: V) => this;\n\n visitBool (vector: V): this;\n visitInt (vector: V): this;\n visitFloat (vector: V): this;\n visitUtf8 (vector: V): this;\n visitBinary (vector: V): this;\n visitFixedSizeBinary (vector: V): this;\n visitDate (vector: V): this;\n visitTimestamp (vector: V): this;\n visitTime (vector: V): this;\n visitDecimal (vector: V): this;\n visitList (vector: V): this;\n visitStruct (vector: V): this;\n visitUnion (vector: V): this;\n visitInterval (vector: V): this;\n visitFixedSizeList (vector: V): this;\n visitMap (vector: V): this;\n}\n\n/** @ignore */\nexport class VectorAssembler extends Visitor {\n\n /** @nocollapse */\n public static assemble(...args: (T | T[])[]) {\n const assembler = new VectorAssembler();\n const vectorChildren = selectVectorChildrenArgs(RecordBatch, args);\n const [assembleResult = assembler] = assembler.visitMany(vectorChildren);\n return assembleResult;\n }\n\n private constructor() { super(); }\n\n public visit(vector: T): this {\n if (!DataType.isDictionary(vector.type)) {\n const { data, length, nullCount } = vector;\n if (length > 2147483647) {\n /* istanbul ignore next */\n throw new RangeError('Cannot write arrays larger than 2^31 - 1 in length');\n }\n if (!DataType.isNull(vector.type)) {\n addBuffer.call(this, nullCount <= 0\n ? new Uint8Array(0) // placeholder validity buffer\n : truncateBitmap(data.offset, length, data.nullBitmap)\n );\n }\n this.nodes.push(new FieldNode(length, nullCount));\n }\n return super.visit(vector);\n }\n\n public visitNull(_nullV: V) {\n return this;\n }\n public visitDictionary(vector: V) {\n // Assemble the indices here, Dictionary assembled separately.\n return this.visit(vector.indices);\n }\n\n public get nodes() { return this._nodes; }\n public get buffers() { return this._buffers; }\n public get byteLength() { return this._byteLength; }\n public get bufferRegions() { return this._bufferRegions; }\n\n protected _byteLength = 0;\n protected _nodes: FieldNode[] = [];\n protected _buffers: ArrayBufferView[] = [];\n protected _bufferRegions: BufferRegion[] = [];\n}\n\n/** @ignore */\nfunction addBuffer(this: VectorAssembler, values: ArrayBufferView) {\n const byteLength = (values.byteLength + 7) & ~7; // Round up to a multiple of 8\n this.buffers.push(values);\n this.bufferRegions.push(new BufferRegion(this._byteLength, byteLength));\n this._byteLength += byteLength;\n return this;\n}\n\n/** @ignore */\nfunction assembleUnion(this: VectorAssembler, vector: V) {\n const { type, length, typeIds, valueOffsets } = vector;\n // All Union Vectors have a typeIds buffer\n addBuffer.call(this, typeIds);\n // If this is a Sparse Union, treat it like all other Nested types\n if (type.mode === UnionMode.Sparse) {\n return assembleNestedVector.call(this, vector);\n } else if (type.mode === UnionMode.Dense) {\n // If this is a Dense Union, add the valueOffsets buffer and potentially slice the children\n if (vector.offset <= 0) {\n // If the Vector hasn't been sliced, write the existing valueOffsets\n addBuffer.call(this, valueOffsets);\n // We can treat this like all other Nested types\n return assembleNestedVector.call(this, vector);\n } else {\n // A sliced Dense Union is an unpleasant case. Because the offsets are different for\n // each child vector, we need to \"rebase\" the valueOffsets for each child\n // Union typeIds are not necessary 0-indexed\n const maxChildTypeId = typeIds.reduce((x, y) => Math.max(x, y), typeIds[0]);\n const childLengths = new Int32Array(maxChildTypeId + 1);\n // Set all to -1 to indicate that we haven't observed a first occurrence of a particular child yet\n const childOffsets = new Int32Array(maxChildTypeId + 1).fill(-1);\n const shiftedOffsets = new Int32Array(length);\n // If we have a non-zero offset, then the value offsets do not start at\n // zero. We must a) create a new offsets array with shifted offsets and\n // b) slice the values array accordingly\n const unshiftedOffsets = rebaseValueOffsets(-valueOffsets[0], length, valueOffsets);\n for (let typeId, shift, index = -1; ++index < length;) {\n if ((shift = childOffsets[typeId = typeIds[index]]) === -1) {\n shift = childOffsets[typeId] = unshiftedOffsets[typeId];\n }\n shiftedOffsets[index] = unshiftedOffsets[index] - shift;\n ++childLengths[typeId];\n }\n addBuffer.call(this, shiftedOffsets);\n // Slice and visit children accordingly\n for (let child: Vector | null, childIndex = -1, numChildren = type.children.length; ++childIndex < numChildren;) {\n if (child = vector.getChildAt(childIndex)) {\n const typeId = type.typeIds[childIndex];\n const childLength = Math.min(length, childLengths[typeId]);\n this.visit(child.slice(childOffsets[typeId], childLength));\n }\n }\n }\n }\n return this;\n}\n\n/** @ignore */\nfunction assembleBoolVector(this: VectorAssembler, vector: V) {\n // Bool vector is a special case of FlatVector, as its data buffer needs to stay packed\n let values: Uint8Array;\n if (vector.nullCount >= vector.length) {\n // If all values are null, just insert a placeholder empty data buffer (fastest path)\n return addBuffer.call(this, new Uint8Array(0));\n } else if ((values = vector.values) instanceof Uint8Array) {\n // If values is already a Uint8Array, slice the bitmap (fast path)\n return addBuffer.call(this, truncateBitmap(vector.offset, vector.length, values));\n }\n // Otherwise if the underlying data *isn't* a Uint8Array, enumerate the\n // values as bools and re-pack them into a Uint8Array. This code isn't\n // reachable unless you're trying to manipulate the Data internals,\n // we we're only doing this for safety.\n /* istanbul ignore next */\n return addBuffer.call(this, packBools(vector));\n}\n\n/** @ignore */\nfunction assembleFlatVector(this: VectorAssembler, vector: V) {\n return addBuffer.call(this, vector.values.subarray(0, vector.length * vector.stride));\n}\n\n/** @ignore */\nfunction assembleFlatListVector(this: VectorAssembler, vector: V) {\n const { length, values, valueOffsets } = vector;\n const firstOffset = valueOffsets[0];\n const lastOffset = valueOffsets[length];\n const byteLength = Math.min(lastOffset - firstOffset, values.byteLength - firstOffset);\n // Push in the order FlatList types read their buffers\n addBuffer.call(this, rebaseValueOffsets(-valueOffsets[0], length, valueOffsets)); // valueOffsets buffer first\n addBuffer.call(this, values.subarray(firstOffset, firstOffset + byteLength)); // sliced values buffer second\n return this;\n}\n\n/** @ignore */\nfunction assembleListVector(this: VectorAssembler, vector: V) {\n const { length, valueOffsets } = vector;\n // If we have valueOffsets (MapVector, ListVector), push that buffer first\n if (valueOffsets) {\n addBuffer.call(this, rebaseValueOffsets(valueOffsets[0], length, valueOffsets));\n }\n // Then insert the List's values child\n return this.visit(vector.getChildAt(0)!);\n}\n\n/** @ignore */\nfunction assembleNestedVector(this: VectorAssembler, vector: V) {\n return this.visitMany(vector.type.children.map((_, i) => vector.getChildAt(i)!).filter(Boolean))[0];\n}\n\nVectorAssembler.prototype.visitBool = assembleBoolVector;\nVectorAssembler.prototype.visitInt = assembleFlatVector;\nVectorAssembler.prototype.visitFloat = assembleFlatVector;\nVectorAssembler.prototype.visitUtf8 = assembleFlatListVector;\nVectorAssembler.prototype.visitBinary = assembleFlatListVector;\nVectorAssembler.prototype.visitFixedSizeBinary = assembleFlatVector;\nVectorAssembler.prototype.visitDate = assembleFlatVector;\nVectorAssembler.prototype.visitTimestamp = assembleFlatVector;\nVectorAssembler.prototype.visitTime = assembleFlatVector;\nVectorAssembler.prototype.visitDecimal = assembleFlatVector;\nVectorAssembler.prototype.visitList = assembleListVector;\nVectorAssembler.prototype.visitStruct = assembleNestedVector;\nVectorAssembler.prototype.visitUnion = assembleUnion;\nVectorAssembler.prototype.visitInterval = assembleFlatVector;\nVectorAssembler.prototype.visitFixedSizeList = assembleListVector;\nVectorAssembler.prototype.visitMap = assembleListVector;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Table } from '../table';\nimport { MAGIC } from './message';\nimport { Vector } from '../vector';\nimport { Column } from '../column';\nimport { DataType } from '../type';\nimport { Schema, Field } from '../schema';\nimport { Message } from './metadata/message';\nimport * as metadata from './metadata/message';\nimport { FileBlock, Footer } from './metadata/file';\nimport { MessageHeader, MetadataVersion } from '../enum';\nimport { WritableSink, AsyncByteQueue } from '../io/stream';\nimport { VectorAssembler } from '../visitor/vectorassembler';\nimport { JSONTypeAssembler } from '../visitor/jsontypeassembler';\nimport { JSONVectorAssembler } from '../visitor/jsonvectorassembler';\nimport { ArrayBufferViewInput, toUint8Array } from '../util/buffer';\nimport { RecordBatch, _InternalEmptyPlaceholderRecordBatch } from '../recordbatch';\nimport { Writable, ReadableInterop, ReadableDOMStreamOptions } from '../io/interfaces';\nimport { isPromise, isAsyncIterable, isWritableDOMStream, isWritableNodeStream, isIterable, isObject } from '../util/compat';\n\nexport interface RecordBatchStreamWriterOptions {\n /**\n *\n */\n autoDestroy?: boolean;\n /**\n * A flag indicating whether the RecordBatchWriter should construct pre-0.15.0\n * encapsulated IPC Messages, which reserves 4 bytes for the Message metadata\n * length instead of 8.\n * @see https://issues.apache.org/jira/browse/ARROW-6313\n */\n writeLegacyIpcFormat?: boolean;\n}\n\nexport class RecordBatchWriter extends ReadableInterop implements Writable> {\n\n /** @nocollapse */\n // @ts-ignore\n public static throughNode(options?: import('stream').DuplexOptions & { autoDestroy: boolean }): import('stream').Duplex {\n throw new Error(`\"throughNode\" not available in this environment`);\n }\n /** @nocollapse */\n public static throughDOM(\n // @ts-ignore\n writableStrategy?: QueuingStrategy> & { autoDestroy: boolean },\n // @ts-ignore\n readableStrategy?: { highWaterMark?: number, size?: any }\n ): { writable: WritableStream | RecordBatch>, readable: ReadableStream } {\n throw new Error(`\"throughDOM\" not available in this environment`);\n }\n\n constructor(options?: RecordBatchStreamWriterOptions) {\n super();\n isObject(options) || (options = { autoDestroy: true, writeLegacyIpcFormat: false });\n this._autoDestroy = (typeof options.autoDestroy === 'boolean') ? options.autoDestroy : true;\n this._writeLegacyIpcFormat = (typeof options.writeLegacyIpcFormat === 'boolean') ? options.writeLegacyIpcFormat : false;\n }\n\n protected _position = 0;\n protected _started = false;\n protected _autoDestroy: boolean;\n protected _writeLegacyIpcFormat: boolean;\n // @ts-ignore\n protected _sink = new AsyncByteQueue();\n protected _schema: Schema | null = null;\n protected _dictionaryBlocks: FileBlock[] = [];\n protected _recordBatchBlocks: FileBlock[] = [];\n protected _dictionaryDeltaOffsets = new Map();\n\n public toString(sync: true): string;\n public toString(sync?: false): Promise;\n public toString(sync: any = false) {\n return this._sink.toString(sync) as Promise | string;\n }\n public toUint8Array(sync: true): Uint8Array;\n public toUint8Array(sync?: false): Promise;\n public toUint8Array(sync: any = false) {\n return this._sink.toUint8Array(sync) as Promise | Uint8Array;\n }\n\n public writeAll(input: Table | Iterable>): this;\n public writeAll(input: AsyncIterable>): Promise;\n public writeAll(input: PromiseLike>>): Promise;\n public writeAll(input: PromiseLike | Iterable>>): Promise;\n public writeAll(input: PromiseLike | Table | Iterable> | AsyncIterable>) {\n if (isPromise(input)) {\n return input.then((x) => this.writeAll(x));\n } else if (isAsyncIterable>(input)) {\n return writeAllAsync(this, input);\n }\n return writeAll(this, input);\n }\n\n public get closed() { return this._sink.closed; }\n public [Symbol.asyncIterator]() { return this._sink[Symbol.asyncIterator](); }\n public toDOMStream(options?: ReadableDOMStreamOptions) { return this._sink.toDOMStream(options); }\n public toNodeStream(options?: import('stream').ReadableOptions) { return this._sink.toNodeStream(options); }\n\n public close() {\n return this.reset()._sink.close();\n }\n public abort(reason?: any) {\n return this.reset()._sink.abort(reason);\n }\n public finish() {\n this._autoDestroy ? this.close() : this.reset(this._sink, this._schema);\n return this;\n }\n public reset(sink: WritableSink = this._sink, schema: Schema | null = null) {\n\n if ((sink === this._sink) || (sink instanceof AsyncByteQueue)) {\n this._sink = sink as AsyncByteQueue;\n } else {\n this._sink = new AsyncByteQueue();\n if (sink && isWritableDOMStream(sink)) {\n this.toDOMStream({ type: 'bytes' }).pipeTo(sink);\n } else if (sink && isWritableNodeStream(sink)) {\n this.toNodeStream({ objectMode: false }).pipe(sink);\n }\n }\n\n if (this._started && this._schema) {\n this._writeFooter(this._schema);\n }\n\n this._started = false;\n this._dictionaryBlocks = [];\n this._recordBatchBlocks = [];\n this._dictionaryDeltaOffsets = new Map();\n\n if (!schema || !(schema.compareTo(this._schema))) {\n if (schema === null) {\n this._position = 0;\n this._schema = null;\n } else {\n this._started = true;\n this._schema = schema;\n this._writeSchema(schema);\n }\n }\n\n return this;\n }\n\n public write(payload?: Table | RecordBatch | Iterable> | null) {\n\n let schema: Schema | null = null;\n\n if (!this._sink) {\n throw new Error(`RecordBatchWriter is closed`);\n } else if (payload === null || payload === undefined) {\n return this.finish() && undefined;\n } else if (payload instanceof Table && !(schema = payload.schema)) {\n return this.finish() && undefined;\n } else if (payload instanceof RecordBatch && !(schema = payload.schema)) {\n return this.finish() && undefined;\n }\n\n if (schema && !schema.compareTo(this._schema)) {\n if (this._started && this._autoDestroy) {\n return this.close();\n }\n this.reset(this._sink, schema);\n }\n\n if (payload instanceof RecordBatch) {\n if (!(payload instanceof _InternalEmptyPlaceholderRecordBatch)) {\n this._writeRecordBatch(payload);\n }\n } else if (payload instanceof Table) {\n this.writeAll(payload.chunks);\n } else if (isIterable(payload)) {\n this.writeAll(payload);\n }\n }\n\n protected _writeMessage(message: Message, alignment = 8) {\n\n const a = alignment - 1;\n const buffer = Message.encode(message);\n const flatbufferSize = buffer.byteLength;\n const prefixSize = !this._writeLegacyIpcFormat ? 8 : 4;\n const alignedSize = (flatbufferSize + prefixSize + a) & ~a;\n const nPaddingBytes = alignedSize - flatbufferSize - prefixSize;\n\n if (message.headerType === MessageHeader.RecordBatch) {\n this._recordBatchBlocks.push(new FileBlock(alignedSize, message.bodyLength, this._position));\n } else if (message.headerType === MessageHeader.DictionaryBatch) {\n this._dictionaryBlocks.push(new FileBlock(alignedSize, message.bodyLength, this._position));\n }\n\n // If not in legacy pre-0.15.0 mode, write the stream continuation indicator\n if (!this._writeLegacyIpcFormat) {\n this._write(Int32Array.of(-1));\n }\n // Write the flatbuffer size prefix including padding\n this._write(Int32Array.of(alignedSize - prefixSize));\n // Write the flatbuffer\n if (flatbufferSize > 0) { this._write(buffer); }\n // Write any padding\n return this._writePadding(nPaddingBytes);\n }\n\n protected _write(chunk: ArrayBufferViewInput) {\n if (this._started) {\n const buffer = toUint8Array(chunk);\n if (buffer && buffer.byteLength > 0) {\n this._sink.write(buffer);\n this._position += buffer.byteLength;\n }\n }\n return this;\n }\n\n protected _writeSchema(schema: Schema) {\n return this._writeMessage(Message.from(schema));\n }\n\n // @ts-ignore\n protected _writeFooter(schema: Schema) {\n // eos bytes\n return this._writeLegacyIpcFormat\n ? this._write(Int32Array.of(0))\n : this._write(Int32Array.of(-1, 0));\n }\n\n protected _writeMagic() {\n return this._write(MAGIC);\n }\n\n protected _writePadding(nBytes: number) {\n return nBytes > 0 ? this._write(new Uint8Array(nBytes)) : this;\n }\n\n protected _writeRecordBatch(batch: RecordBatch) {\n const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(batch);\n const recordBatch = new metadata.RecordBatch(batch.length, nodes, bufferRegions);\n const message = Message.from(recordBatch, byteLength);\n return this\n ._writeDictionaries(batch)\n ._writeMessage(message)\n ._writeBodyBuffers(buffers);\n }\n\n protected _writeDictionaryBatch(dictionary: Vector, id: number, isDelta = false) {\n this._dictionaryDeltaOffsets.set(id, dictionary.length + (this._dictionaryDeltaOffsets.get(id) || 0));\n const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(dictionary);\n const recordBatch = new metadata.RecordBatch(dictionary.length, nodes, bufferRegions);\n const dictionaryBatch = new metadata.DictionaryBatch(recordBatch, id, isDelta);\n const message = Message.from(dictionaryBatch, byteLength);\n return this\n ._writeMessage(message)\n ._writeBodyBuffers(buffers);\n }\n\n protected _writeBodyBuffers(buffers: ArrayBufferView[]) {\n let buffer: ArrayBufferView;\n let size: number, padding: number;\n for (let i = -1, n = buffers.length; ++i < n;) {\n if ((buffer = buffers[i]) && (size = buffer.byteLength) > 0) {\n this._write(buffer);\n if ((padding = ((size + 7) & ~7) - size) > 0) {\n this._writePadding(padding);\n }\n }\n }\n return this;\n }\n\n protected _writeDictionaries(batch: RecordBatch) {\n for (let [id, dictionary] of batch.dictionaries) {\n let offset = this._dictionaryDeltaOffsets.get(id) || 0;\n if (offset === 0 || (dictionary = dictionary.slice(offset)).length > 0) {\n const chunks = 'chunks' in dictionary ? (dictionary as any).chunks : [dictionary];\n for (const chunk of chunks) {\n this._writeDictionaryBatch(chunk, id, offset > 0);\n offset += chunk.length;\n }\n }\n }\n return this;\n }\n}\n\n/** @ignore */\nexport class RecordBatchStreamWriter extends RecordBatchWriter {\n public static writeAll(input: Table | Iterable>, options?: RecordBatchStreamWriterOptions): RecordBatchStreamWriter;\n public static writeAll(input: AsyncIterable>, options?: RecordBatchStreamWriterOptions): Promise>;\n public static writeAll(input: PromiseLike>>, options?: RecordBatchStreamWriterOptions): Promise>;\n public static writeAll(input: PromiseLike | Iterable>>, options?: RecordBatchStreamWriterOptions): Promise>;\n /** @nocollapse */\n public static writeAll(input: any, options?: RecordBatchStreamWriterOptions) {\n const writer = new RecordBatchStreamWriter(options);\n if (isPromise(input)) {\n return input.then((x) => writer.writeAll(x));\n } else if (isAsyncIterable>(input)) {\n return writeAllAsync(writer, input);\n }\n return writeAll(writer, input);\n }\n}\n\n/** @ignore */\nexport class RecordBatchFileWriter extends RecordBatchWriter {\n public static writeAll(input: Table | Iterable>): RecordBatchFileWriter;\n public static writeAll(input: AsyncIterable>): Promise>;\n public static writeAll(input: PromiseLike>>): Promise>;\n public static writeAll(input: PromiseLike | Iterable>>): Promise>;\n /** @nocollapse */\n public static writeAll(input: any) {\n const writer = new RecordBatchFileWriter();\n if (isPromise(input)) {\n return input.then((x) => writer.writeAll(x));\n } else if (isAsyncIterable>(input)) {\n return writeAllAsync(writer, input);\n }\n return writeAll(writer, input);\n }\n\n constructor() {\n super();\n this._autoDestroy = true;\n }\n\n // @ts-ignore\n protected _writeSchema(schema: Schema) {\n return this._writeMagic()._writePadding(2);\n }\n\n protected _writeFooter(schema: Schema) {\n const buffer = Footer.encode(new Footer(\n schema, MetadataVersion.V4,\n this._recordBatchBlocks, this._dictionaryBlocks\n ));\n return super\n ._writeFooter(schema) // EOS bytes for sequential readers\n ._write(buffer) // Write the flatbuffer\n ._write(Int32Array.of(buffer.byteLength)) // then the footer size suffix\n ._writeMagic(); // then the magic suffix\n }\n}\n\n/** @ignore */\nexport class RecordBatchJSONWriter extends RecordBatchWriter {\n\n public static writeAll(this: typeof RecordBatchWriter, input: Table | Iterable>): RecordBatchJSONWriter;\n // @ts-ignore\n public static writeAll(this: typeof RecordBatchWriter, input: AsyncIterable>): Promise>;\n public static writeAll(this: typeof RecordBatchWriter, input: PromiseLike>>): Promise>;\n public static writeAll(this: typeof RecordBatchWriter, input: PromiseLike | Iterable>>): Promise>;\n /** @nocollapse */\n public static writeAll(this: typeof RecordBatchWriter, input: any) {\n return new RecordBatchJSONWriter().writeAll(input as any);\n }\n\n private _recordBatches: RecordBatch[];\n private _dictionaries: RecordBatch[];\n\n constructor() {\n super();\n this._autoDestroy = true;\n this._recordBatches = [];\n this._dictionaries = [];\n }\n\n protected _writeMessage() { return this; }\n // @ts-ignore\n protected _writeFooter(schema: Schema) { return this; }\n protected _writeSchema(schema: Schema) {\n return this._write(`{\\n \"schema\": ${\n JSON.stringify({ fields: schema.fields.map(fieldToJSON) }, null, 2)\n }`);\n }\n protected _writeDictionaries(batch: RecordBatch) {\n if (batch.dictionaries.size > 0) {\n this._dictionaries.push(batch);\n }\n return this;\n }\n protected _writeDictionaryBatch(dictionary: Vector, id: number, isDelta = false) {\n this._dictionaryDeltaOffsets.set(id, dictionary.length + (this._dictionaryDeltaOffsets.get(id) || 0));\n this._write(this._dictionaryBlocks.length === 0 ? ` ` : `,\\n `);\n this._write(`${dictionaryBatchToJSON(dictionary, id, isDelta)}`);\n this._dictionaryBlocks.push(new FileBlock(0, 0, 0));\n return this;\n }\n protected _writeRecordBatch(batch: RecordBatch) {\n this._writeDictionaries(batch);\n this._recordBatches.push(batch);\n return this;\n }\n public close() {\n\n if (this._dictionaries.length > 0) {\n this._write(`,\\n \"dictionaries\": [\\n`);\n for (const batch of this._dictionaries) {\n super._writeDictionaries(batch);\n }\n this._write(`\\n ]`);\n }\n\n if (this._recordBatches.length > 0) {\n for (let i = -1, n = this._recordBatches.length; ++i < n;) {\n this._write(i === 0 ? `,\\n \"batches\": [\\n ` : `,\\n `);\n this._write(`${recordBatchToJSON(this._recordBatches[i])}`);\n this._recordBatchBlocks.push(new FileBlock(0, 0, 0));\n }\n this._write(`\\n ]`);\n }\n\n if (this._schema) {\n this._write(`\\n}`);\n }\n\n this._dictionaries = [];\n this._recordBatches = [];\n\n return super.close();\n }\n}\n\n/** @ignore */\nfunction writeAll(writer: RecordBatchWriter, input: Table | Iterable>) {\n let chunks = input as Iterable>;\n if (input instanceof Table) {\n chunks = input.chunks;\n writer.reset(undefined, input.schema);\n }\n for (const batch of chunks) {\n writer.write(batch);\n }\n return writer.finish();\n}\n\n/** @ignore */\nasync function writeAllAsync(writer: RecordBatchWriter, batches: AsyncIterable>) {\n for await (const batch of batches) {\n writer.write(batch);\n }\n return writer.finish();\n}\n\n/** @ignore */\nfunction fieldToJSON({ name, type, nullable }: Field): object {\n const assembler = new JSONTypeAssembler();\n return {\n 'name': name, 'nullable': nullable,\n 'type': assembler.visit(type),\n 'children': (type.children || []).map(fieldToJSON),\n 'dictionary': !DataType.isDictionary(type) ? undefined : {\n 'id': type.id,\n 'isOrdered': type.isOrdered,\n 'indexType': assembler.visit(type.indices)\n }\n };\n}\n\n/** @ignore */\nfunction dictionaryBatchToJSON(dictionary: Vector, id: number, isDelta = false) {\n const field = new Field(`${id}`, dictionary.type, dictionary.nullCount > 0);\n const columns = JSONVectorAssembler.assemble(new Column(field, [dictionary]));\n return JSON.stringify({\n 'id': id,\n 'isDelta': isDelta,\n 'data': {\n 'count': dictionary.length,\n 'columns': columns\n }\n }, null, 2);\n}\n\n/** @ignore */\nfunction recordBatchToJSON(records: RecordBatch) {\n return JSON.stringify({\n 'count': records.length,\n 'columns': JSONVectorAssembler.assemble(records)\n }, null, 2);\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Column } from '../column';\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\nimport { Data, Buffers } from '../data';\nimport { Schema, Field } from '../schema';\nimport { Chunked } from '../vector/chunked';\nimport { RecordBatch } from '../recordbatch';\n\nconst noopBuf = new Uint8Array(0);\nconst nullBufs = (bitmapLength: number) => [\n noopBuf, noopBuf, new Uint8Array(bitmapLength), noopBuf\n] as Buffers;\n\n/** @ignore */\nexport function ensureSameLengthData(\n schema: Schema,\n chunks: Data[],\n batchLength = chunks.reduce((l, c) => Math.max(l, c.length), 0)\n) {\n let data: Data;\n let field: Field;\n let i = -1, n = chunks.length;\n const fields = [...schema.fields];\n const batchData = [] as Data[];\n const bitmapLength = ((batchLength + 63) & ~63) >> 3;\n while (++i < n) {\n if ((data = chunks[i]) && data.length === batchLength) {\n batchData[i] = data;\n } else {\n (field = fields[i]).nullable || (fields[i] = fields[i].clone({ nullable: true }) as Field);\n batchData[i] = data ? data._changeLengthAndBackfillNullBitmap(batchLength)\n : Data.new(field.type, 0, batchLength, batchLength, nullBufs(bitmapLength)) as Data;\n }\n }\n return [new Schema(fields), batchLength, batchData] as [Schema, number, Data[]];\n}\n\n/** @ignore */\nexport function distributeColumnsIntoRecordBatches(columns: Column[]): [Schema, RecordBatch[]] {\n return distributeVectorsIntoRecordBatches(new Schema(columns.map(({ field }) => field)), columns);\n}\n\n/** @ignore */\nexport function distributeVectorsIntoRecordBatches(schema: Schema, vecs: (Vector | Chunked)[]): [Schema, RecordBatch[]] {\n return uniformlyDistributeChunksAcrossRecordBatches(schema, vecs.map((v) => v instanceof Chunked ? v.chunks.map((c) => c.data) : [v.data]));\n}\n\n/** @ignore */\nfunction uniformlyDistributeChunksAcrossRecordBatches(schema: Schema, columns: Data[][]): [Schema, RecordBatch[]] {\n\n const fields = [...schema.fields];\n const batchArgs = [] as [number, Data[]][];\n const memo = { numBatches: columns.reduce((n, c) => Math.max(n, c.length), 0) };\n\n let numBatches = 0, batchLength = 0;\n let i: number = -1, numColumns = columns.length;\n let child: Data, childData: Data[] = [];\n\n while (memo.numBatches-- > 0) {\n\n for (batchLength = Number.POSITIVE_INFINITY, i = -1; ++i < numColumns;) {\n childData[i] = child = columns[i].shift()!;\n batchLength = Math.min(batchLength, child ? child.length : batchLength);\n }\n\n if (isFinite(batchLength)) {\n childData = distributeChildData(fields, batchLength, childData, columns, memo);\n if (batchLength > 0) {\n batchArgs[numBatches++] = [batchLength, childData.slice()];\n }\n }\n }\n return [\n schema = new Schema(fields, schema.metadata),\n batchArgs.map((xs) => new RecordBatch(schema, ...xs))\n ];\n}\n\n/** @ignore */\nfunction distributeChildData(fields: Field[], batchLength: number, childData: Data[], columns: Data[][], memo: { numBatches: number }) {\n let data: Data;\n let field: Field;\n let length = 0, i = -1, n = columns.length;\n const bitmapLength = ((batchLength + 63) & ~63) >> 3;\n while (++i < n) {\n if ((data = childData[i]) && ((length = data.length) >= batchLength)) {\n if (length === batchLength) {\n childData[i] = data;\n } else {\n childData[i] = data.slice(0, batchLength);\n data = data.slice(batchLength, length - batchLength);\n memo.numBatches = Math.max(memo.numBatches, columns[i].unshift(data));\n }\n } else {\n (field = fields[i]).nullable || (fields[i] = field.clone({ nullable: true }) as Field);\n childData[i] = data ? data._changeLengthAndBackfillNullBitmap(batchLength)\n : Data.new(field.type, 0, batchLength, batchLength, nullBufs(bitmapLength)) as Data;\n }\n }\n return childData;\n}\n","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { DataType } from '../type';\nimport { Chunked } from './chunked';\nimport { clampRange } from '../util/vector';\nimport { VectorType as V } from '../interfaces';\nimport { AbstractVector, Vector, Clonable, Sliceable, Applicative } from '../vector';\n\n/** @ignore */\nexport interface BaseVector extends Clonable>, Sliceable>, Applicative> {\n slice(begin?: number, end?: number): V;\n concat(...others: Vector[]): Chunked;\n clone(data: Data, children?: Vector[]): V;\n}\n\n/** @ignore */\nexport abstract class BaseVector extends AbstractVector\n implements Clonable>, Sliceable>, Applicative> {\n\n protected _children?: Vector[];\n\n constructor(data: Data, children?: Vector[]) {\n super();\n this._children = children;\n this.numChildren = data.childData.length;\n this._bindDataAccessors(this.data = data);\n }\n\n public readonly data: Data;\n public readonly numChildren: number;\n\n public get type() { return this.data.type; }\n public get typeId() { return this.data.typeId; }\n public get length() { return this.data.length; }\n public get offset() { return this.data.offset; }\n public get stride() { return this.data.stride; }\n public get nullCount() { return this.data.nullCount; }\n public get byteLength() { return this.data.byteLength; }\n public get VectorName() { return `${Type[this.typeId]}Vector`; }\n\n public get ArrayType(): T['ArrayType'] { return this.type.ArrayType; }\n\n public get values() { return this.data.values; }\n public get typeIds() { return this.data.typeIds; }\n public get nullBitmap() { return this.data.nullBitmap; }\n public get valueOffsets() { return this.data.valueOffsets; }\n\n public get [Symbol.toStringTag]() { return `${this.VectorName}<${this.type[Symbol.toStringTag]}>`; }\n\n public clone(data: Data, children = this._children) {\n return Vector.new(data, children) as any;\n }\n\n public concat(...others: Vector[]) {\n return Chunked.concat(this, ...others);\n }\n\n public slice(begin?: number, end?: number) {\n // Adjust args similar to Array.prototype.slice. Normalize begin/end to\n // clamp between 0 and length, and wrap around on negative indices, e.g.\n // slice(-1, 5) or slice(5, -1)\n return clampRange(this, begin, end, this._sliceInternal);\n }\n\n public isValid(index: number): boolean {\n if (this.nullCount > 0) {\n const idx = this.offset + index;\n const val = this.nullBitmap[idx >> 3];\n const mask = (val & (1 << (idx % 8)));\n return mask !== 0;\n }\n return true;\n }\n\n public getChildAt(index: number): Vector | null {\n return index < 0 || index >= this.numChildren ? null : (\n (this._children || (this._children = []))[index] ||\n (this._children[index] = Vector.new(this.data.childData[index] as Data))\n ) as Vector;\n }\n\n public toJSON(): any { return [...this]; }\n\n protected _sliceInternal(self: this, begin: number, end: number) {\n return self.clone(self.data.slice(begin, end - begin), null!);\n }\n\n // @ts-ignore\n protected _bindDataAccessors(data: Data) {\n // Implementation in src/vectors/index.ts due to circular dependency/packaging shenanigans\n }\n}\n\n(BaseVector.prototype as any)[Symbol.isConcatSpreadable] = true;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { BaseVector } from './base';\nimport { Binary, Utf8 } from '../type';\n\n/** @ignore */\nexport class BinaryVector extends BaseVector {\n public asUtf8() {\n return Vector.new(this.data.clone(new Utf8()));\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Bool } from '../type';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\n\n/** @ignore */\nexport class BoolVector extends BaseVector {\n public static from(input: Iterable): BoolVector;\n public static from(input: AsyncIterable): Promise;\n public static from(input: VectorBuilderOptions): Chunked;\n public static from(input: VectorBuilderOptionsAsync): Promise>;\n /** @nocollapse */\n public static from(input: Iterable | AsyncIterable | VectorBuilderOptions | VectorBuilderOptionsAsync) {\n return vectorFromValuesWithType(() => new Bool(), input);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DateUnit } from '../enum';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { VectorType as V } from '../interfaces';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\nimport { Date_, DateDay, DateMillisecond } from '../type';\n\n/** @ignore */\ntype FromArgs = [Iterable, T['unit']];\n\n/** @ignore */\nexport class DateVector extends BaseVector {\n public static from(...args: FromArgs): V;\n public static from(...args: FromArgs): V;\n public static from(input: Iterable): V;\n public static from(input: AsyncIterable): Promise>;\n public static from(input: VectorBuilderOptions): Chunked;\n public static from(input: VectorBuilderOptionsAsync): Promise>;\n /** @nocollapse */\n public static from(...args: FromArgs | [Iterable | AsyncIterable | VectorBuilderOptions | VectorBuilderOptionsAsync]) {\n if (args.length === 2) {\n return vectorFromValuesWithType(() => args[1] === DateUnit.DAY ? new DateDay() : new DateMillisecond() as T, args[0]);\n }\n return vectorFromValuesWithType(() => new DateMillisecond() as T, args[0]);\n }\n}\n\n/** @ignore */\nexport class DateDayVector extends DateVector {}\n\n/** @ignore */\nexport class DateMillisecondVector extends DateVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Decimal } from '../type';\nimport { BaseVector } from './base';\n\n/** @ignore */\nexport class DecimalVector extends BaseVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Vector } from '../vector';\nimport { BaseVector } from './base';\nimport { VectorType as V } from '../interfaces';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\nimport { DataType, Dictionary, TKeys } from '../type';\n\n/** @ignore */\ntype FromArgs = [Vector, TKey, ArrayLike | TKey['TArray']];\n\n/** @ignore */\nexport class DictionaryVector extends BaseVector> {\n public static from(...args: FromArgs): V>;\n public static from(input: VectorBuilderOptions>): Vector>;\n public static from(input: VectorBuilderOptionsAsync>): Promise>>;\n /** @nocollapse */\n public static from(...args: any[]) {\n if (args.length === 3) {\n const [values, indices, keys] = args as FromArgs;\n const type = new Dictionary(values.type, indices, null, null);\n return Vector.new(Data.Dictionary(type, 0, keys.length, 0, null, keys, values));\n }\n return vectorFromValuesWithType(() => args[0].type, args[0]);\n }\n\n constructor(data: Data>) {\n super(data);\n this.indices = Vector.new(data.clone(this.type.indices));\n }\n\n public readonly indices: V;\n\n public get dictionary() { return > this.data.dictionary; }\n public reverseLookup(value: T) { return this.dictionary.indexOf(value); }\n public getKey(idx: number): TKey['TValue'] | null { return this.indices.get(idx); }\n public getValue(key: number): T['TValue'] | null { return this.dictionary.get(key); }\n public setKey(idx: number, key: TKey['TValue'] | null) { return this.indices.set(idx, key); }\n public setValue(key: number, value: T['TValue'] | null) { return this.dictionary.set(key, value); }\n}\n\n(DictionaryVector.prototype as any).indices = null;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { FixedSizeBinary } from '../type';\n\n/** @ignore */\nexport class FixedSizeBinaryVector extends BaseVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { DataType, FixedSizeList } from '../type';\n\n/** @ignore */\nexport class FixedSizeListVector extends BaseVector> {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Vector } from '../vector';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\nimport { Float, Float16, Float32, Float64, FloatArray } from '../type';\nimport { VectorType as V, TypedArrayConstructor } from '../interfaces';\n\n/** @ignore */\ntype FloatVectorConstructors =\n typeof FloatVector |\n typeof Float16Vector |\n typeof Float32Vector |\n typeof Float64Vector ;\n\n/** @ignore */\ntype FromInput =\n FloatArray |\n Iterable |\n AsyncIterable |\n VectorBuilderOptions |\n VectorBuilderOptionsAsync ;\n\n/** @ignore */\ntype FloatArrayCtor = TypedArrayConstructor;\n\n/** @ignore */\nexport class FloatVector extends BaseVector {\n\n // Guaranteed zero-copy variants\n public static from(this: typeof FloatVector, input: Uint16Array): Float16Vector;\n public static from(this: typeof FloatVector, input: Float32Array): Float32Vector;\n public static from(this: typeof FloatVector, input: Float64Array): Float64Vector;\n\n // Zero-copy if input is a TypedArray of the same type as the\n // Vector that from is called on, otherwise uses the Builders\n public static from(this: typeof Float16Vector, input: FromInput): Float16Vector;\n public static from(this: typeof Float32Vector, input: FromInput): Float32Vector;\n public static from(this: typeof Float64Vector, input: FromInput): Float64Vector;\n\n // Not zero-copy\n public static from(this: typeof FloatVector, input: Iterable): V;\n public static from(this: typeof FloatVector, input: AsyncIterable): Promise>;\n public static from(this: typeof FloatVector, input: VectorBuilderOptions): Chunked;\n public static from(this: typeof FloatVector, input: VectorBuilderOptionsAsync): Promise>;\n /** @nocollapse */\n public static from(this: FloatVectorConstructors, input: FromInput) {\n\n let ArrowType = vectorTypeToDataType(this);\n\n if ((input instanceof ArrayBuffer) || ArrayBuffer.isView(input)) {\n let InputType = arrayTypeToDataType(input.constructor as FloatArrayCtor) || ArrowType;\n // Special case, infer the Arrow DataType from the input if calling the base\n // FloatVector.from with a TypedArray, e.g. `FloatVector.from(new Float32Array())`\n if (ArrowType === null) {\n ArrowType = InputType;\n }\n // If the DataType inferred from the Vector constructor matches the\n // DataType inferred from the input arguments, return zero-copy view\n if (ArrowType && ArrowType === InputType) {\n let type = new ArrowType();\n let length = input.byteLength / type.ArrayType.BYTES_PER_ELEMENT;\n // If the ArrowType is Float16 but the input type isn't a Uint16Array,\n // let the Float16Builder handle casting the input values to Uint16s.\n if (!convertTo16Bit(ArrowType, input.constructor)) {\n return Vector.new(Data.Float(type, 0, length, 0, null, input as FloatArray));\n }\n }\n }\n\n if (ArrowType) {\n // If the DataType inferred from the Vector constructor is different than\n // the DataType inferred from the input TypedArray, or if input isn't a\n // TypedArray, use the Builders to construct the result Vector\n return vectorFromValuesWithType(() => new ArrowType!() as T, input);\n }\n\n if ((input instanceof DataView) || (input instanceof ArrayBuffer)) {\n throw new TypeError(`Cannot infer float type from instance of ${input.constructor.name}`);\n }\n\n throw new TypeError('Unrecognized FloatVector input');\n }\n}\n\n/** @ignore */\nexport class Float16Vector extends FloatVector {\n // Since JS doesn't have half floats, `toArray()` returns a zero-copy slice\n // of the underlying Uint16Array data. This behavior ensures we don't incur\n // extra compute or copies if you're calling `toArray()` in order to create\n // a buffer for something like WebGL. Buf if you're using JS and want typed\n // arrays of 4-to-8-byte precision, these methods will enumerate the values\n // and clamp to the desired byte lengths.\n public toFloat32Array() { return new Float32Array(this as Iterable); }\n public toFloat64Array() { return new Float64Array(this as Iterable); }\n}\n\n/** @ignore */\nexport class Float32Vector extends FloatVector {}\n/** @ignore */\nexport class Float64Vector extends FloatVector {}\n\nconst convertTo16Bit = (typeCtor: any, dataCtor: any) => {\n return (typeCtor === Float16) && (dataCtor !== Uint16Array);\n};\n\n/** @ignore */\nconst arrayTypeToDataType = (ctor: FloatArrayCtor) => {\n switch (ctor) {\n case Uint16Array: return Float16;\n case Float32Array: return Float32;\n case Float64Array: return Float64;\n default: return null;\n }\n};\n\n/** @ignore */\nconst vectorTypeToDataType = (ctor: FloatVectorConstructors) => {\n switch (ctor) {\n case Float16Vector: return Float16;\n case Float32Vector: return Float32;\n case Float64Vector: return Float64;\n default: return null;\n }\n};\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { Interval, IntervalDayTime, IntervalYearMonth } from '../type';\n\n/** @ignore */\nexport class IntervalVector extends BaseVector {}\n/** @ignore */\nexport class IntervalDayTimeVector extends IntervalVector {}\n/** @ignore */\nexport class IntervalYearMonthVector extends IntervalVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Vector } from '../vector';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\nimport { BigInt64Array, BigUint64Array } from '../util/compat';\nimport { toBigInt64Array, toBigUint64Array } from '../util/buffer';\nimport { Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64, IntArray } from '../type';\nimport { VectorType as V, TypedArrayConstructor, BigIntArrayConstructor, BigIntArray } from '../interfaces';\n\n/** @ignore */\ntype IntVectorConstructors =\n typeof IntVector |\n typeof Int8Vector |\n typeof Int16Vector |\n typeof Int32Vector |\n typeof Uint8Vector |\n typeof Uint16Vector |\n typeof Uint32Vector |\n typeof Int64Vector |\n typeof Uint64Vector ;\n\n/** @ignore */\ntype FromInput =\n IntArray | BigIntArray |\n Iterable |\n AsyncIterable |\n VectorBuilderOptions |\n VectorBuilderOptionsAsync ;\n\n/** @ignore */\ntype FromArgs = [FromInput, boolean?];\n\n/** @ignore */\ntype IntArrayCtor = TypedArrayConstructor | BigIntArrayConstructor;\n\n/** @ignore */\nexport class IntVector extends BaseVector {\n\n // Guaranteed zero-copy variants\n public static from(this: typeof IntVector, input: Int8Array): Int8Vector;\n public static from(this: typeof IntVector, input: Int16Array): Int16Vector;\n public static from(this: typeof IntVector, input: Int32Array): Int32Vector;\n public static from(this: typeof IntVector, input: BigInt64Array): Int64Vector;\n public static from(this: typeof IntVector, input: Int32Array, is64bit: true): Int64Vector;\n public static from(this: typeof IntVector, input: Uint8Array): Uint8Vector;\n public static from(this: typeof IntVector, input: Uint16Array): Uint16Vector;\n public static from(this: typeof IntVector, input: Uint32Array): Uint32Vector;\n public static from(this: typeof IntVector, input: BigUint64Array): Uint64Vector;\n public static from(this: typeof IntVector, input: Uint32Array, is64bit: true): Uint64Vector;\n\n // Zero-copy if input is a TypedArray of the same type as the\n // Vector that from is called on, otherwise uses the Builders\n public static from(this: typeof Int8Vector, input: FromInput): Int8Vector;\n public static from(this: typeof Int16Vector, input: FromInput): Int16Vector;\n public static from(this: typeof Int32Vector, input: FromInput): Int32Vector;\n public static from(this: typeof Int64Vector, input: FromInput): Int64Vector;\n public static from(this: typeof Uint8Vector, input: FromInput): Uint8Vector;\n public static from(this: typeof Uint16Vector, input: FromInput): Uint16Vector;\n public static from(this: typeof Uint32Vector, input: FromInput): Uint32Vector;\n public static from(this: typeof Uint64Vector, input: FromInput): Uint64Vector;\n\n // Not zero-copy\n public static from(this: typeof IntVector, input: Iterable): V;\n public static from(this: typeof IntVector, input: AsyncIterable): Promise>;\n public static from(this: typeof IntVector, input: VectorBuilderOptions): Chunked;\n public static from(this: typeof IntVector, input: VectorBuilderOptionsAsync): Promise>;\n /** @nocollapse */\n public static from(this: IntVectorConstructors, ...args: FromArgs) {\n\n let [input, is64bit = false] = args;\n let ArrowType = vectorTypeToDataType(this, is64bit);\n\n if ((input instanceof ArrayBuffer) || ArrayBuffer.isView(input)) {\n let InputType = arrayTypeToDataType(input.constructor as IntArrayCtor, is64bit) || ArrowType;\n // Special case, infer the Arrow DataType from the input if calling the base\n // IntVector.from with a TypedArray, e.g. `IntVector.from(new Int32Array())`\n if (ArrowType === null) {\n ArrowType = InputType;\n }\n // If the DataType inferred from the Vector constructor matches the\n // DataType inferred from the input arguments, return zero-copy view\n if (ArrowType && ArrowType === InputType) {\n let type = new ArrowType();\n let length = input.byteLength / type.ArrayType.BYTES_PER_ELEMENT;\n // If the ArrowType is 64bit but the input type is 32bit pairs, update the logical length\n if (convert32To64Bit(ArrowType, input.constructor)) {\n length *= 0.5;\n }\n return Vector.new(Data.Int(type, 0, length, 0, null, input as IntArray));\n }\n }\n\n if (ArrowType) {\n // If the DataType inferred from the Vector constructor is different than\n // the DataType inferred from the input TypedArray, or if input isn't a\n // TypedArray, use the Builders to construct the result Vector\n return vectorFromValuesWithType(() => new ArrowType!() as T, input);\n }\n\n if ((input instanceof DataView) || (input instanceof ArrayBuffer)) {\n throw new TypeError(`Cannot infer integer type from instance of ${input.constructor.name}`);\n }\n\n throw new TypeError('Unrecognized IntVector input');\n }\n}\n\n/** @ignore */\nexport class Int8Vector extends IntVector {}\n/** @ignore */\nexport class Int16Vector extends IntVector {}\n/** @ignore */\nexport class Int32Vector extends IntVector {}\n/** @ignore */\nexport class Int64Vector extends IntVector {\n public toBigInt64Array() {\n return toBigInt64Array(this.values);\n }\n // @ts-ignore\n private _values64: BigInt64Array;\n public get values64(): BigInt64Array {\n return this._values64 || (this._values64 = this.toBigInt64Array());\n }\n}\n\n/** @ignore */\nexport class Uint8Vector extends IntVector {}\n/** @ignore */\nexport class Uint16Vector extends IntVector {}\n/** @ignore */\nexport class Uint32Vector extends IntVector {}\n/** @ignore */\nexport class Uint64Vector extends IntVector {\n public toBigUint64Array() {\n return toBigUint64Array(this.values);\n }\n // @ts-ignore\n private _values64: BigUint64Array;\n public get values64(): BigUint64Array {\n return this._values64 || (this._values64 = this.toBigUint64Array());\n }\n}\n\nconst convert32To64Bit = (typeCtor: any, dataCtor: any) => {\n return (typeCtor === Int64 || typeCtor === Uint64) &&\n (dataCtor === Int32Array || dataCtor === Uint32Array);\n};\n\n/** @ignore */\nconst arrayTypeToDataType = (ctor: IntArrayCtor, is64bit: boolean) => {\n switch (ctor) {\n case Int8Array: return Int8;\n case Int16Array: return Int16;\n case Int32Array: return is64bit ? Int64 : Int32;\n case BigInt64Array: return Int64;\n case Uint8Array: return Uint8;\n case Uint16Array: return Uint16;\n case Uint32Array: return is64bit ? Uint64 : Uint32;\n case BigUint64Array: return Uint64;\n default: return null;\n }\n};\n\n/** @ignore */\nconst vectorTypeToDataType = (ctor: IntVectorConstructors, is64bit: boolean) => {\n switch (ctor) {\n case Int8Vector: return Int8;\n case Int16Vector: return Int16;\n case Int32Vector: return is64bit ? Int64 : Int32;\n case Int64Vector: return Int64;\n case Uint8Vector: return Uint8;\n case Uint16Vector: return Uint16;\n case Uint32Vector: return is64bit ? Uint64 : Uint32;\n case Uint64Vector: return Uint64;\n default: return null;\n }\n};\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { DataType, List } from '../type';\n\n/** @ignore */\nexport class ListVector extends BaseVector> {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { MapRow } from './row';\nimport { Field } from '../schema';\nimport { Vector } from '../vector';\nimport { BaseVector } from './base';\nimport { DataType, Map_, Struct, List } from '../type';\n\n/** @ignore */\nexport class MapVector extends BaseVector> {\n public asList() {\n const child = this.type.children[0] as Field>;\n return Vector.new(this.data.clone(new List>(child)));\n }\n public bind(index: number): Map_['TValue'] {\n const child = this.getChildAt>(0);\n const { [index]: begin, [index + 1]: end } = this.valueOffsets;\n return new MapRow(child!.slice(begin, end));\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Null } from '../type';\nimport { BaseVector } from './base';\n\n/** @ignore */\nexport class NullVector extends BaseVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { StructRow } from './row';\nimport { BaseVector } from './base';\nimport { DataType, Struct } from '../type';\n\n/** @ignore */ const kRowIndex = Symbol.for('rowIndex');\n/** @ignore */\nexport class StructVector extends BaseVector> {\n // @ts-ignore\n private _row: StructRow;\n public bind(index: number): Struct['TValue'] {\n const proto = this._row || (this._row = new StructRow(this));\n const bound = Object.create(proto);\n bound[kRowIndex] = index;\n return bound;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond } from '../type';\n\n/** @ignore */\nexport class TimestampVector extends BaseVector {}\n/** @ignore */\nexport class TimestampSecondVector extends TimestampVector {}\n/** @ignore */\nexport class TimestampMillisecondVector extends TimestampVector {}\n/** @ignore */\nexport class TimestampMicrosecondVector extends TimestampVector {}\n/** @ignore */\nexport class TimestampNanosecondVector extends TimestampVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond } from '../type';\n\n/** @ignore */\nexport class TimeVector extends BaseVector {}\n/** @ignore */\nexport class TimeSecondVector extends TimeVector {}\n/** @ignore */\nexport class TimeMillisecondVector extends TimeVector {}\n/** @ignore */\nexport class TimeMicrosecondVector extends TimeVector {}\n/** @ignore */\nexport class TimeNanosecondVector extends TimeVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { BaseVector } from './base';\nimport { Union, DenseUnion, SparseUnion} from '../type';\n\n/** @ignore */\nexport class UnionVector extends BaseVector {\n public get typeIdToChildIndex() { return this.data.type.typeIdToChildIndex; }\n}\n\n/** @ignore */\nexport class DenseUnionVector extends UnionVector {\n public get valueOffsets() { return this.data.valueOffsets!; }\n}\n\n/** @ignore */\nexport class SparseUnionVector extends UnionVector {}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { Binary, Utf8 } from '../type';\nimport { VectorBuilderOptions } from './index';\nimport { vectorFromValuesWithType } from './index';\nimport { VectorBuilderOptionsAsync } from './index';\n\n/** @ignore */\nexport class Utf8Vector extends BaseVector {\n public static from(input: Iterable): Utf8Vector;\n public static from(input: AsyncIterable): Promise;\n public static from(input: VectorBuilderOptions): Chunked;\n public static from(input: VectorBuilderOptionsAsync): Promise>;\n /** @nocollapse */\n public static from(input: Iterable | AsyncIterable | VectorBuilderOptions | VectorBuilderOptionsAsync) {\n return vectorFromValuesWithType(() => new Utf8(), input);\n }\n public asBinary() {\n return Vector.new(this.data.clone(new Binary()));\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\n/** @ignore */\nexport function partial0(visit: (node: T) => any) {\n return function(this: T) { return visit(this); };\n}\n\n/** @ignore */\nexport function partial1(visit: (node: T, a: any) => any) {\n return function(this: T, a: any) { return visit(this, a); };\n}\n\n/** @ignore */\nexport function partial2(visit: (node: T, a: any, b: any) => any) {\n return function(this: T, a: any, b: any) { return visit(this, a, b); };\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { BN } from '../util/bn';\nimport { Visitor } from '../visitor';\nimport { decodeUtf8 } from '../util/utf8';\nimport { VectorType } from '../interfaces';\nimport { uint16ToFloat64 } from '../util/math';\nimport { Type, UnionMode, Precision, DateUnit, TimeUnit, IntervalUnit } from '../enum';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface GetVisitor extends Visitor {\n visit (node: T, index: number): T['TValue'];\n visitMany (nodes: T[], indices: number[]): T['TValue'][];\n getVisitFn (node: T): (vector: VectorType, index: number) => VectorType['TValue'];\n getVisitFn(node: VectorType | Data | T): (vector: VectorType, index: number) => VectorType['TValue'];\n visitNull (vector: VectorType, index: number): T['TValue'];\n visitBool (vector: VectorType, index: number): T['TValue'];\n visitInt (vector: VectorType, index: number): T['TValue'];\n visitInt8 (vector: VectorType, index: number): T['TValue'];\n visitInt16 (vector: VectorType, index: number): T['TValue'];\n visitInt32 (vector: VectorType, index: number): T['TValue'];\n visitInt64 (vector: VectorType, index: number): T['TValue'];\n visitUint8 (vector: VectorType, index: number): T['TValue'];\n visitUint16 (vector: VectorType, index: number): T['TValue'];\n visitUint32 (vector: VectorType, index: number): T['TValue'];\n visitUint64 (vector: VectorType, index: number): T['TValue'];\n visitFloat (vector: VectorType, index: number): T['TValue'];\n visitFloat16 (vector: VectorType, index: number): T['TValue'];\n visitFloat32 (vector: VectorType, index: number): T['TValue'];\n visitFloat64 (vector: VectorType, index: number): T['TValue'];\n visitUtf8 (vector: VectorType, index: number): T['TValue'];\n visitBinary (vector: VectorType, index: number): T['TValue'];\n visitFixedSizeBinary (vector: VectorType, index: number): T['TValue'];\n visitDate (vector: VectorType, index: number): T['TValue'];\n visitDateDay (vector: VectorType, index: number): T['TValue'];\n visitDateMillisecond (vector: VectorType, index: number): T['TValue'];\n visitTimestamp (vector: VectorType, index: number): T['TValue'];\n visitTimestampSecond (vector: VectorType, index: number): T['TValue'];\n visitTimestampMillisecond (vector: VectorType, index: number): T['TValue'];\n visitTimestampMicrosecond (vector: VectorType, index: number): T['TValue'];\n visitTimestampNanosecond (vector: VectorType, index: number): T['TValue'];\n visitTime (vector: VectorType, index: number): T['TValue'];\n visitTimeSecond (vector: VectorType, index: number): T['TValue'];\n visitTimeMillisecond (vector: VectorType, index: number): T['TValue'];\n visitTimeMicrosecond (vector: VectorType, index: number): T['TValue'];\n visitTimeNanosecond (vector: VectorType, index: number): T['TValue'];\n visitDecimal (vector: VectorType, index: number): T['TValue'];\n visitList (vector: VectorType, index: number): T['TValue'];\n visitStruct (vector: VectorType, index: number): T['TValue'];\n visitUnion (vector: VectorType, index: number): T['TValue'];\n visitDenseUnion (vector: VectorType, index: number): T['TValue'];\n visitSparseUnion (vector: VectorType, index: number): T['TValue'];\n visitDictionary (vector: VectorType, index: number): T['TValue'];\n visitInterval (vector: VectorType, index: number): T['TValue'];\n visitIntervalDayTime (vector: VectorType, index: number): T['TValue'];\n visitIntervalYearMonth (vector: VectorType, index: number): T['TValue'];\n visitFixedSizeList (vector: VectorType, index: number): T['TValue'];\n visitMap (vector: VectorType, index: number): T['TValue'];\n}\n\n/** @ignore */\nexport class GetVisitor extends Visitor {}\n\n/** @ignore */const epochDaysToMs = (data: Int32Array, index: number) => 86400000 * data[index];\n/** @ignore */const epochMillisecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1]) + (data[index] >>> 0);\n/** @ignore */const epochMicrosecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1] / 1000) + ((data[index] >>> 0) / 1000);\n/** @ignore */const epochNanosecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1] / 1000000) + ((data[index] >>> 0) / 1000000);\n\n/** @ignore */const epochMillisecondsToDate = (epochMs: number) => new Date(epochMs);\n/** @ignore */const epochDaysToDate = (data: Int32Array, index: number) => epochMillisecondsToDate(epochDaysToMs(data, index));\n/** @ignore */const epochMillisecondsLongToDate = (data: Int32Array, index: number) => epochMillisecondsToDate(epochMillisecondsLongToMs(data, index));\n\n/** @ignore */\nconst getNull = (_vector: VectorType, _index: number): T['TValue'] => null;\n/** @ignore */\nconst getVariableWidthBytes = (values: Uint8Array, valueOffsets: Int32Array, index: number) => {\n const { [index]: x, [index + 1]: y } = valueOffsets;\n return x != null && y != null ? values.subarray(x, y) : null as any;\n};\n\n/** @ignore */\nconst getBool = ({ offset, values }: VectorType, index: number): T['TValue'] => {\n const idx = offset + index;\n const byte = values[idx >> 3];\n return (byte & 1 << (idx % 8)) !== 0;\n};\n\n/** @ignore */\ntype Numeric1X = Int8 | Int16 | Int32 | Uint8 | Uint16 | Uint32 | Float32 | Float64;\n/** @ignore */\ntype Numeric2X = Int64 | Uint64;\n\n/** @ignore */\nconst getDateDay = ({ values }: VectorType, index: number): T['TValue'] => epochDaysToDate(values, index);\n/** @ignore */\nconst getDateMillisecond = ({ values }: VectorType, index: number): T['TValue'] => epochMillisecondsLongToDate(values, index * 2);\n/** @ignore */\nconst getNumeric = ({ stride, values }: VectorType, index: number): T['TValue'] => values[stride * index];\n/** @ignore */\nconst getFloat16 = ({ stride, values }: VectorType, index: number): T['TValue'] => uint16ToFloat64(values[stride * index]);\n/** @ignore */\nconst getBigInts = ({ stride, values, type }: VectorType, index: number): T['TValue'] => BN.new(values.subarray(stride * index, stride * (index + 1)), type.isSigned);\n/** @ignore */\nconst getFixedSizeBinary = ({ stride, values }: VectorType, index: number): T['TValue'] => values.subarray(stride * index, stride * (index + 1));\n\n/** @ignore */\nconst getBinary = ({ values, valueOffsets }: VectorType, index: number): T['TValue'] => getVariableWidthBytes(values, valueOffsets, index);\n/** @ignore */\nconst getUtf8 = ({ values, valueOffsets }: VectorType, index: number): T['TValue'] => {\n const bytes = getVariableWidthBytes(values, valueOffsets, index);\n return bytes !== null ? decodeUtf8(bytes) : null as any;\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst getInt = (vector: VectorType, index: number): T['TValue'] => (\n vector.type.bitWidth < 64\n ? getNumeric(vector as VectorType, index)\n : getBigInts(vector as VectorType, index)\n);\n\n/* istanbul ignore next */\n/** @ignore */\nconst getFloat = (vector: VectorType, index: number): T['TValue'] => (\n vector.type.precision !== Precision.HALF\n ? getNumeric(vector as VectorType, index)\n : getFloat16(vector as VectorType, index)\n);\n\n/* istanbul ignore next */\n/** @ignore */\nconst getDate = (vector: VectorType, index: number): T['TValue'] => (\n vector.type.unit === DateUnit.DAY\n ? getDateDay(vector as VectorType, index)\n : getDateMillisecond(vector as VectorType, index)\n);\n\n/** @ignore */\nconst getTimestampSecond = ({ values }: VectorType, index: number): T['TValue'] => 1000 * epochMillisecondsLongToMs(values, index * 2);\n/** @ignore */\nconst getTimestampMillisecond = ({ values }: VectorType, index: number): T['TValue'] => epochMillisecondsLongToMs(values, index * 2);\n/** @ignore */\nconst getTimestampMicrosecond = ({ values }: VectorType, index: number): T['TValue'] => epochMicrosecondsLongToMs(values, index * 2);\n/** @ignore */\nconst getTimestampNanosecond = ({ values }: VectorType, index: number): T['TValue'] => epochNanosecondsLongToMs(values, index * 2);\n/* istanbul ignore next */\n/** @ignore */\nconst getTimestamp = (vector: VectorType, index: number): T['TValue'] => {\n switch (vector.type.unit) {\n case TimeUnit.SECOND: return getTimestampSecond(vector as VectorType, index);\n case TimeUnit.MILLISECOND: return getTimestampMillisecond(vector as VectorType, index);\n case TimeUnit.MICROSECOND: return getTimestampMicrosecond(vector as VectorType, index);\n case TimeUnit.NANOSECOND: return getTimestampNanosecond(vector as VectorType, index);\n }\n};\n\n/** @ignore */\nconst getTimeSecond = ({ values, stride }: VectorType, index: number): T['TValue'] => values[stride * index];\n/** @ignore */\nconst getTimeMillisecond = ({ values, stride }: VectorType, index: number): T['TValue'] => values[stride * index];\n/** @ignore */\nconst getTimeMicrosecond = ({ values }: VectorType, index: number): T['TValue'] => BN.signed(values.subarray(2 * index, 2 * (index + 1)));\n/** @ignore */\nconst getTimeNanosecond = ({ values }: VectorType, index: number): T['TValue'] => BN.signed(values.subarray(2 * index, 2 * (index + 1)));\n/* istanbul ignore next */\n/** @ignore */\nconst getTime = (vector: VectorType, index: number): T['TValue'] => {\n switch (vector.type.unit) {\n case TimeUnit.SECOND: return getTimeSecond(vector as VectorType, index);\n case TimeUnit.MILLISECOND: return getTimeMillisecond(vector as VectorType, index);\n case TimeUnit.MICROSECOND: return getTimeMicrosecond(vector as VectorType, index);\n case TimeUnit.NANOSECOND: return getTimeNanosecond(vector as VectorType, index);\n }\n};\n\n/** @ignore */\nconst getDecimal = ({ values }: VectorType, index: number): T['TValue'] => BN.decimal(values.subarray(4 * index, 4 * (index + 1)));\n\n/** @ignore */\nconst getList = (vector: VectorType, index: number): T['TValue'] => {\n const child = vector.getChildAt(0)!, { valueOffsets, stride } = vector;\n return child.slice(valueOffsets[index * stride], valueOffsets[(index * stride) + 1]) as T['TValue'];\n};\n\n/** @ignore */\nconst getMap = (vector: VectorType, index: number): T['TValue'] => {\n return vector.bind(index) as T['TValue'];\n};\n\n/** @ignore */\nconst getStruct = (vector: VectorType, index: number): T['TValue'] => {\n return vector.bind(index) as T['TValue'];\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst getUnion = <\n V extends VectorType | VectorType | VectorType\n>(vector: V, index: number): V['TValue'] => {\n return vector.type.mode === UnionMode.Dense ?\n getDenseUnion(vector as VectorType, index) :\n getSparseUnion(vector as VectorType, index);\n};\n\n/** @ignore */\nconst getDenseUnion = (vector: VectorType, index: number): T['TValue'] => {\n const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];\n const child = vector.getChildAt(childIndex);\n return child ? child.get(vector.valueOffsets[index]) : null;\n};\n\n/** @ignore */\nconst getSparseUnion = (vector: VectorType, index: number): T['TValue'] => {\n const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];\n const child = vector.getChildAt(childIndex);\n return child ? child.get(index) : null;\n};\n\n/** @ignore */\nconst getDictionary = (vector: VectorType, index: number): T['TValue'] => {\n return vector.getValue(vector.getKey(index)!);\n};\n\n/* istanbul ignore next */\n/** @ignore */\nconst getInterval = (vector: VectorType, index: number): T['TValue'] =>\n (vector.type.unit === IntervalUnit.DAY_TIME)\n ? getIntervalDayTime(vector as VectorType, index)\n : getIntervalYearMonth(vector as VectorType, index);\n\n/** @ignore */\nconst getIntervalDayTime = ({ values }: VectorType, index: number): T['TValue'] => values.subarray(2 * index, 2 * (index + 1));\n\n/** @ignore */\nconst getIntervalYearMonth = ({ values }: VectorType, index: number): T['TValue'] => {\n const interval = values[index];\n const int32s = new Int32Array(2);\n int32s[0] = interval / 12 | 0; /* years */\n int32s[1] = interval % 12 | 0; /* months */\n return int32s;\n};\n\n/** @ignore */\nconst getFixedSizeList = (vector: VectorType, index: number): T['TValue'] => {\n const child = vector.getChildAt(0)!, { stride } = vector;\n return child.slice(index * stride, (index + 1) * stride) as T['TValue'];\n};\n\nGetVisitor.prototype.visitNull = getNull;\nGetVisitor.prototype.visitBool = getBool;\nGetVisitor.prototype.visitInt = getInt;\nGetVisitor.prototype.visitInt8 = getNumeric;\nGetVisitor.prototype.visitInt16 = getNumeric;\nGetVisitor.prototype.visitInt32 = getNumeric;\nGetVisitor.prototype.visitInt64 = getBigInts;\nGetVisitor.prototype.visitUint8 = getNumeric;\nGetVisitor.prototype.visitUint16 = getNumeric;\nGetVisitor.prototype.visitUint32 = getNumeric;\nGetVisitor.prototype.visitUint64 = getBigInts;\nGetVisitor.prototype.visitFloat = getFloat;\nGetVisitor.prototype.visitFloat16 = getFloat16;\nGetVisitor.prototype.visitFloat32 = getNumeric;\nGetVisitor.prototype.visitFloat64 = getNumeric;\nGetVisitor.prototype.visitUtf8 = getUtf8;\nGetVisitor.prototype.visitBinary = getBinary;\nGetVisitor.prototype.visitFixedSizeBinary = getFixedSizeBinary;\nGetVisitor.prototype.visitDate = getDate;\nGetVisitor.prototype.visitDateDay = getDateDay;\nGetVisitor.prototype.visitDateMillisecond = getDateMillisecond;\nGetVisitor.prototype.visitTimestamp = getTimestamp;\nGetVisitor.prototype.visitTimestampSecond = getTimestampSecond;\nGetVisitor.prototype.visitTimestampMillisecond = getTimestampMillisecond;\nGetVisitor.prototype.visitTimestampMicrosecond = getTimestampMicrosecond;\nGetVisitor.prototype.visitTimestampNanosecond = getTimestampNanosecond;\nGetVisitor.prototype.visitTime = getTime;\nGetVisitor.prototype.visitTimeSecond = getTimeSecond;\nGetVisitor.prototype.visitTimeMillisecond = getTimeMillisecond;\nGetVisitor.prototype.visitTimeMicrosecond = getTimeMicrosecond;\nGetVisitor.prototype.visitTimeNanosecond = getTimeNanosecond;\nGetVisitor.prototype.visitDecimal = getDecimal;\nGetVisitor.prototype.visitList = getList;\nGetVisitor.prototype.visitStruct = getStruct;\nGetVisitor.prototype.visitUnion = getUnion;\nGetVisitor.prototype.visitDenseUnion = getDenseUnion;\nGetVisitor.prototype.visitSparseUnion = getSparseUnion;\nGetVisitor.prototype.visitDictionary = getDictionary;\nGetVisitor.prototype.visitInterval = getInterval;\nGetVisitor.prototype.visitIntervalDayTime = getIntervalDayTime;\nGetVisitor.prototype.visitIntervalYearMonth = getIntervalYearMonth;\nGetVisitor.prototype.visitFixedSizeList = getFixedSizeList;\nGetVisitor.prototype.visitMap = getMap;\n\n/** @ignore */\nexport const instance = new GetVisitor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { getBool, iterateBits } from '../util/bit';\nimport { createElementComparator } from '../util/vector';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface IndexOfVisitor extends Visitor {\n visit (node: T, value: T['TValue'] | null, index?: number): number;\n visitMany (nodes: T[], values: (T['TValue'] | null)[], indices: (number | undefined)[]): number[];\n getVisitFn (node: T): (vector: VectorType, value: VectorType['TValue'] | null, index?: number) => number;\n getVisitFn(node: VectorType | Data | T): (vector: VectorType, value: T['TValue'] | null, index?: number) => number;\n visitNull (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitBool (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInt64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUint64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat16 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat32 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFloat64 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUtf8 (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitBinary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFixedSizeBinary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDate (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDateDay (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDateMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestamp (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampSecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampMicrosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimestampNanosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTime (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeSecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeMillisecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeMicrosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitTimeNanosecond (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDecimal (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitList (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitStruct (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDenseUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitSparseUnion (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitDictionary (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitInterval (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitIntervalDayTime (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitIntervalYearMonth (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitFixedSizeList (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n visitMap (vector: VectorType, value: T['TValue'] | null, index?: number): number;\n}\n\n/** @ignore */\nexport class IndexOfVisitor extends Visitor {}\n\n/** @ignore */\nfunction nullIndexOf(vector: VectorType, searchElement?: null) {\n // if you're looking for nulls and the vector isn't empty, we've got 'em!\n return searchElement === null && vector.length > 0 ? 0 : -1;\n}\n\n/** @ignore */\nfunction indexOfNull(vector: VectorType, fromIndex?: number): number {\n const { nullBitmap } = vector;\n if (!nullBitmap || vector.nullCount <= 0) {\n return -1;\n }\n let i = 0;\n for (const isValid of iterateBits(nullBitmap, vector.data.offset + (fromIndex || 0), vector.length, nullBitmap, getBool)) {\n if (!isValid) { return i; }\n ++i;\n }\n return -1;\n}\n\n/** @ignore */\nfunction indexOfValue(vector: VectorType, searchElement?: T['TValue'] | null, fromIndex?: number): number {\n if (searchElement === undefined) { return -1; }\n if (searchElement === null) { return indexOfNull(vector, fromIndex); }\n const compare = createElementComparator(searchElement);\n for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {\n if (compare(vector.get(i))) {\n return i;\n }\n }\n return -1;\n}\n\n/** @ignore */\nfunction indexOfUnion(vector: VectorType, searchElement?: T['TValue'] | null, fromIndex?: number): number {\n // Unions are special -- they do have a nullBitmap, but so can their children.\n // If the searchElement is null, we don't know whether it came from the Union's\n // bitmap or one of its childrens'. So we don't interrogate the Union's bitmap,\n // since that will report the wrong index if a child has a null before the Union.\n const compare = createElementComparator(searchElement);\n for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {\n if (compare(vector.get(i))) {\n return i;\n }\n }\n return -1;\n}\n\nIndexOfVisitor.prototype.visitNull = nullIndexOf;\nIndexOfVisitor.prototype.visitBool = indexOfValue;\nIndexOfVisitor.prototype.visitInt = indexOfValue;\nIndexOfVisitor.prototype.visitInt8 = indexOfValue;\nIndexOfVisitor.prototype.visitInt16 = indexOfValue;\nIndexOfVisitor.prototype.visitInt32 = indexOfValue;\nIndexOfVisitor.prototype.visitInt64 = indexOfValue;\nIndexOfVisitor.prototype.visitUint8 = indexOfValue;\nIndexOfVisitor.prototype.visitUint16 = indexOfValue;\nIndexOfVisitor.prototype.visitUint32 = indexOfValue;\nIndexOfVisitor.prototype.visitUint64 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat = indexOfValue;\nIndexOfVisitor.prototype.visitFloat16 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat32 = indexOfValue;\nIndexOfVisitor.prototype.visitFloat64 = indexOfValue;\nIndexOfVisitor.prototype.visitUtf8 = indexOfValue;\nIndexOfVisitor.prototype.visitBinary = indexOfValue;\nIndexOfVisitor.prototype.visitFixedSizeBinary = indexOfValue;\nIndexOfVisitor.prototype.visitDate = indexOfValue;\nIndexOfVisitor.prototype.visitDateDay = indexOfValue;\nIndexOfVisitor.prototype.visitDateMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestamp = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampSecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampMicrosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimestampNanosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTime = indexOfValue;\nIndexOfVisitor.prototype.visitTimeSecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeMillisecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeMicrosecond = indexOfValue;\nIndexOfVisitor.prototype.visitTimeNanosecond = indexOfValue;\nIndexOfVisitor.prototype.visitDecimal = indexOfValue;\nIndexOfVisitor.prototype.visitList = indexOfValue;\nIndexOfVisitor.prototype.visitStruct = indexOfValue;\nIndexOfVisitor.prototype.visitUnion = indexOfValue;\nIndexOfVisitor.prototype.visitDenseUnion = indexOfUnion;\nIndexOfVisitor.prototype.visitSparseUnion = indexOfUnion;\nIndexOfVisitor.prototype.visitDictionary = indexOfValue;\nIndexOfVisitor.prototype.visitInterval = indexOfValue;\nIndexOfVisitor.prototype.visitIntervalDayTime = indexOfValue;\nIndexOfVisitor.prototype.visitIntervalYearMonth = indexOfValue;\nIndexOfVisitor.prototype.visitFixedSizeList = indexOfValue;\nIndexOfVisitor.prototype.visitMap = indexOfValue;\n\n/** @ignore */\nexport const instance = new IndexOfVisitor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { iterateBits } from '../util/bit';\nimport { instance as getVisitor } from './get';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface IteratorVisitor extends Visitor {\n visit(node: T): IterableIterator;\n visitMany (nodes: T[]): IterableIterator[];\n getVisitFn(node: T): (vector: VectorType) => IterableIterator['TValue'] | null>;\n getVisitFn(node: VectorType | Data | T): (vector: VectorType) => IterableIterator['TValue'] | null>;\n visitNull (vector: VectorType): IterableIterator;\n visitBool (vector: VectorType): IterableIterator;\n visitInt (vector: VectorType): IterableIterator;\n visitInt8 (vector: VectorType): IterableIterator;\n visitInt16 (vector: VectorType): IterableIterator;\n visitInt32 (vector: VectorType): IterableIterator;\n visitInt64 (vector: VectorType): IterableIterator;\n visitUint8 (vector: VectorType): IterableIterator;\n visitUint16 (vector: VectorType): IterableIterator;\n visitUint32 (vector: VectorType): IterableIterator;\n visitUint64 (vector: VectorType): IterableIterator;\n visitFloat (vector: VectorType): IterableIterator;\n visitFloat16 (vector: VectorType): IterableIterator;\n visitFloat32 (vector: VectorType): IterableIterator;\n visitFloat64 (vector: VectorType): IterableIterator;\n visitUtf8 (vector: VectorType): IterableIterator;\n visitBinary (vector: VectorType): IterableIterator;\n visitFixedSizeBinary (vector: VectorType): IterableIterator;\n visitDate (vector: VectorType): IterableIterator;\n visitDateDay (vector: VectorType): IterableIterator;\n visitDateMillisecond (vector: VectorType): IterableIterator;\n visitTimestamp (vector: VectorType): IterableIterator;\n visitTimestampSecond (vector: VectorType): IterableIterator;\n visitTimestampMillisecond (vector: VectorType): IterableIterator;\n visitTimestampMicrosecond (vector: VectorType): IterableIterator;\n visitTimestampNanosecond (vector: VectorType): IterableIterator;\n visitTime (vector: VectorType): IterableIterator;\n visitTimeSecond (vector: VectorType): IterableIterator;\n visitTimeMillisecond (vector: VectorType): IterableIterator;\n visitTimeMicrosecond (vector: VectorType): IterableIterator;\n visitTimeNanosecond (vector: VectorType): IterableIterator;\n visitDecimal (vector: VectorType): IterableIterator;\n visitList (vector: VectorType): IterableIterator;\n visitStruct (vector: VectorType): IterableIterator;\n visitUnion (vector: VectorType): IterableIterator;\n visitDenseUnion (vector: VectorType): IterableIterator;\n visitSparseUnion (vector: VectorType): IterableIterator;\n visitDictionary (vector: VectorType): IterableIterator;\n visitInterval (vector: VectorType): IterableIterator;\n visitIntervalDayTime (vector: VectorType): IterableIterator;\n visitIntervalYearMonth (vector: VectorType): IterableIterator;\n visitFixedSizeList (vector: VectorType): IterableIterator;\n visitMap (vector: VectorType): IterableIterator;\n}\n\n/** @ignore */\nexport class IteratorVisitor extends Visitor {}\n\n/** @ignore */\nfunction nullableIterator(vector: VectorType): IterableIterator {\n const getFn = getVisitor.getVisitFn(vector);\n return iterateBits(\n vector.nullBitmap, vector.offset, vector.length, vector,\n (vec: VectorType, idx: number, nullByte: number, nullBit: number) =>\n ((nullByte & 1 << nullBit) !== 0) ? getFn(vec, idx) : null\n );\n}\n\n/** @ignore */\nfunction vectorIterator(vector: VectorType): IterableIterator {\n\n // If nullable, iterate manually\n if (vector.nullCount > 0) {\n return nullableIterator(vector);\n }\n\n const { type, typeId, length } = vector;\n\n // Fast case, defer to native iterators if possible\n if (vector.stride === 1 && (\n (typeId === Type.Timestamp) ||\n (typeId === Type.Int && (type as Int).bitWidth !== 64) ||\n (typeId === Type.Time && (type as Time).bitWidth !== 64) ||\n (typeId === Type.Float && (type as Float).precision > 0 /* Precision.HALF */)\n )) {\n return vector.values.subarray(0, length)[Symbol.iterator]();\n }\n\n // Otherwise, iterate manually\n return (function* (getFn) {\n for (let index = -1; ++index < length;) {\n yield getFn(vector, index);\n }\n })(getVisitor.getVisitFn(vector));\n}\n\nIteratorVisitor.prototype.visitNull = vectorIterator;\nIteratorVisitor.prototype.visitBool = vectorIterator;\nIteratorVisitor.prototype.visitInt = vectorIterator;\nIteratorVisitor.prototype.visitInt8 = vectorIterator;\nIteratorVisitor.prototype.visitInt16 = vectorIterator;\nIteratorVisitor.prototype.visitInt32 = vectorIterator;\nIteratorVisitor.prototype.visitInt64 = vectorIterator;\nIteratorVisitor.prototype.visitUint8 = vectorIterator;\nIteratorVisitor.prototype.visitUint16 = vectorIterator;\nIteratorVisitor.prototype.visitUint32 = vectorIterator;\nIteratorVisitor.prototype.visitUint64 = vectorIterator;\nIteratorVisitor.prototype.visitFloat = vectorIterator;\nIteratorVisitor.prototype.visitFloat16 = vectorIterator;\nIteratorVisitor.prototype.visitFloat32 = vectorIterator;\nIteratorVisitor.prototype.visitFloat64 = vectorIterator;\nIteratorVisitor.prototype.visitUtf8 = vectorIterator;\nIteratorVisitor.prototype.visitBinary = vectorIterator;\nIteratorVisitor.prototype.visitFixedSizeBinary = vectorIterator;\nIteratorVisitor.prototype.visitDate = vectorIterator;\nIteratorVisitor.prototype.visitDateDay = vectorIterator;\nIteratorVisitor.prototype.visitDateMillisecond = vectorIterator;\nIteratorVisitor.prototype.visitTimestamp = vectorIterator;\nIteratorVisitor.prototype.visitTimestampSecond = vectorIterator;\nIteratorVisitor.prototype.visitTimestampMillisecond = vectorIterator;\nIteratorVisitor.prototype.visitTimestampMicrosecond = vectorIterator;\nIteratorVisitor.prototype.visitTimestampNanosecond = vectorIterator;\nIteratorVisitor.prototype.visitTime = vectorIterator;\nIteratorVisitor.prototype.visitTimeSecond = vectorIterator;\nIteratorVisitor.prototype.visitTimeMillisecond = vectorIterator;\nIteratorVisitor.prototype.visitTimeMicrosecond = vectorIterator;\nIteratorVisitor.prototype.visitTimeNanosecond = vectorIterator;\nIteratorVisitor.prototype.visitDecimal = vectorIterator;\nIteratorVisitor.prototype.visitList = vectorIterator;\nIteratorVisitor.prototype.visitStruct = vectorIterator;\nIteratorVisitor.prototype.visitUnion = vectorIterator;\nIteratorVisitor.prototype.visitDenseUnion = vectorIterator;\nIteratorVisitor.prototype.visitSparseUnion = vectorIterator;\nIteratorVisitor.prototype.visitDictionary = vectorIterator;\nIteratorVisitor.prototype.visitInterval = vectorIterator;\nIteratorVisitor.prototype.visitIntervalDayTime = vectorIterator;\nIteratorVisitor.prototype.visitIntervalYearMonth = vectorIterator;\nIteratorVisitor.prototype.visitFixedSizeList = vectorIterator;\nIteratorVisitor.prototype.visitMap = vectorIterator;\n\n/** @ignore */\nexport const instance = new IteratorVisitor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { instance as iteratorVisitor } from './iterator';\nimport {\n DataType, Dictionary,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary, List, FixedSizeList, Map_, Struct,\n Float, Float16, Float32, Float64,\n Int, Uint8, Uint16, Uint32, Uint64, Int8, Int16, Int32, Int64,\n Date_, DateDay, DateMillisecond,\n Interval, IntervalDayTime, IntervalYearMonth,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Union, DenseUnion, SparseUnion,\n} from '../type';\n\n/** @ignore */\nexport interface ToArrayVisitor extends Visitor {\n visit(node: T): T['TArray'];\n visitMany(nodes: T[]): T['TArray'][];\n getVisitFn(node: T): (vector: VectorType) => VectorType['TArray'];\n getVisitFn(node: VectorType | Data | T): (vector: VectorType) => VectorType['TArray'];\n visitNull (vector: VectorType): VectorType['TArray'];\n visitBool (vector: VectorType): VectorType['TArray'];\n visitInt (vector: VectorType): VectorType['TArray'];\n visitInt8 (vector: VectorType): VectorType['TArray'];\n visitInt16 (vector: VectorType): VectorType['TArray'];\n visitInt32 (vector: VectorType): VectorType['TArray'];\n visitInt64 (vector: VectorType): VectorType['TArray'];\n visitUint8 (vector: VectorType): VectorType['TArray'];\n visitUint16 (vector: VectorType): VectorType['TArray'];\n visitUint32 (vector: VectorType): VectorType['TArray'];\n visitUint64 (vector: VectorType): VectorType['TArray'];\n visitFloat (vector: VectorType): VectorType['TArray'];\n visitFloat16 (vector: VectorType): VectorType['TArray'];\n visitFloat32 (vector: VectorType): VectorType['TArray'];\n visitFloat64 (vector: VectorType): VectorType['TArray'];\n visitUtf8 (vector: VectorType): VectorType['TArray'];\n visitBinary (vector: VectorType): VectorType['TArray'];\n visitFixedSizeBinary (vector: VectorType): VectorType['TArray'];\n visitDate (vector: VectorType): VectorType['TArray'];\n visitDateDay (vector: VectorType): VectorType['TArray'];\n visitDateMillisecond (vector: VectorType): VectorType['TArray'];\n visitTimestamp (vector: VectorType): VectorType['TArray'];\n visitTimestampSecond (vector: VectorType): VectorType['TArray'];\n visitTimestampMillisecond (vector: VectorType): VectorType['TArray'];\n visitTimestampMicrosecond (vector: VectorType): VectorType['TArray'];\n visitTimestampNanosecond (vector: VectorType): VectorType['TArray'];\n visitTime (vector: VectorType): VectorType['TArray'];\n visitTimeSecond (vector: VectorType): VectorType['TArray'];\n visitTimeMillisecond (vector: VectorType): VectorType['TArray'];\n visitTimeMicrosecond (vector: VectorType): VectorType['TArray'];\n visitTimeNanosecond (vector: VectorType): VectorType['TArray'];\n visitDecimal (vector: VectorType): VectorType['TArray'];\n visitList > (vector: VectorType): VectorType['TArray'];\n visitStruct (vector: VectorType): VectorType['TArray'];\n visitUnion (vector: VectorType): VectorType['TArray'];\n visitDenseUnion (vector: VectorType): VectorType['TArray'];\n visitSparseUnion (vector: VectorType): VectorType['TArray'];\n visitDictionary > (vector: VectorType): VectorType['TArray'];\n visitInterval (vector: VectorType): VectorType['TArray'];\n visitIntervalDayTime (vector: VectorType): VectorType['TArray'];\n visitIntervalYearMonth (vector: VectorType): VectorType['TArray'];\n visitFixedSizeList > (vector: VectorType): VectorType['TArray'];\n visitMap (vector: VectorType): VectorType['TArray'];\n}\n\n/** @ignore */\nexport class ToArrayVisitor extends Visitor {}\n\n/** @ignore */\nfunction arrayOfVector(vector: VectorType): T['TArray'] {\n\n const { type, length, stride } = vector;\n\n // Fast case, return subarray if possible\n switch (type.typeId) {\n case Type.Int:\n case Type.Float: case Type.Decimal:\n case Type.Time: case Type.Timestamp:\n return vector.values.subarray(0, length * stride);\n }\n\n // Otherwise if not primitive, slow copy\n return [...iteratorVisitor.visit(vector)] as T['TArray'];\n}\n\nToArrayVisitor.prototype.visitNull = arrayOfVector;\nToArrayVisitor.prototype.visitBool = arrayOfVector;\nToArrayVisitor.prototype.visitInt = arrayOfVector;\nToArrayVisitor.prototype.visitInt8 = arrayOfVector;\nToArrayVisitor.prototype.visitInt16 = arrayOfVector;\nToArrayVisitor.prototype.visitInt32 = arrayOfVector;\nToArrayVisitor.prototype.visitInt64 = arrayOfVector;\nToArrayVisitor.prototype.visitUint8 = arrayOfVector;\nToArrayVisitor.prototype.visitUint16 = arrayOfVector;\nToArrayVisitor.prototype.visitUint32 = arrayOfVector;\nToArrayVisitor.prototype.visitUint64 = arrayOfVector;\nToArrayVisitor.prototype.visitFloat = arrayOfVector;\nToArrayVisitor.prototype.visitFloat16 = arrayOfVector;\nToArrayVisitor.prototype.visitFloat32 = arrayOfVector;\nToArrayVisitor.prototype.visitFloat64 = arrayOfVector;\nToArrayVisitor.prototype.visitUtf8 = arrayOfVector;\nToArrayVisitor.prototype.visitBinary = arrayOfVector;\nToArrayVisitor.prototype.visitFixedSizeBinary = arrayOfVector;\nToArrayVisitor.prototype.visitDate = arrayOfVector;\nToArrayVisitor.prototype.visitDateDay = arrayOfVector;\nToArrayVisitor.prototype.visitDateMillisecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestamp = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampSecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampMillisecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampMicrosecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimestampNanosecond = arrayOfVector;\nToArrayVisitor.prototype.visitTime = arrayOfVector;\nToArrayVisitor.prototype.visitTimeSecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimeMillisecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimeMicrosecond = arrayOfVector;\nToArrayVisitor.prototype.visitTimeNanosecond = arrayOfVector;\nToArrayVisitor.prototype.visitDecimal = arrayOfVector;\nToArrayVisitor.prototype.visitList = arrayOfVector;\nToArrayVisitor.prototype.visitStruct = arrayOfVector;\nToArrayVisitor.prototype.visitUnion = arrayOfVector;\nToArrayVisitor.prototype.visitDenseUnion = arrayOfVector;\nToArrayVisitor.prototype.visitSparseUnion = arrayOfVector;\nToArrayVisitor.prototype.visitDictionary = arrayOfVector;\nToArrayVisitor.prototype.visitInterval = arrayOfVector;\nToArrayVisitor.prototype.visitIntervalDayTime = arrayOfVector;\nToArrayVisitor.prototype.visitIntervalYearMonth = arrayOfVector;\nToArrayVisitor.prototype.visitFixedSizeList = arrayOfVector;\nToArrayVisitor.prototype.visitMap = arrayOfVector;\n\n/** @ignore */\nexport const instance = new ToArrayVisitor();\n","/* istanbul ignore file */\n\n// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Visitor } from '../visitor';\nimport { VectorType } from '../interfaces';\nimport { Type, TimeUnit } from '../enum';\nimport { Schema, Field } from '../schema';\nimport {\n DataType, Dictionary,\n Float, Int, Date_, Interval, Time, Timestamp,\n Bool, Null, Utf8, Binary, Decimal, FixedSizeBinary,\n List, FixedSizeList, Map_, Struct, Union,\n} from '../type';\n\n/** @ignore */ const sum = (x: number, y: number) => x + y;\n/** @ignore */ const variableWidthColumnErrorMessage = (type: DataType) => `Cannot compute the byte width of variable-width column ${type}`;\n\n/** @ignore */\nexport interface ByteWidthVisitor extends Visitor {\n visit(node: T): number;\n visitMany(nodes: T[]): number[];\n getVisitFn (node: T): (type: DataType) => number;\n getVisitFn(node: VectorType | Data | T): (type: T) => number;\n}\n\n/** @ignore */\nexport class ByteWidthVisitor extends Visitor {\n public visitNull (____: Null ) { return 0; }\n public visitInt (type: Int ) { return type.bitWidth / 8; }\n public visitFloat (type: Float ) { return type.ArrayType.BYTES_PER_ELEMENT; }\n public visitBinary (type: Binary ) { throw new Error(variableWidthColumnErrorMessage(type)); }\n public visitUtf8 (type: Utf8 ) { throw new Error(variableWidthColumnErrorMessage(type)); }\n public visitBool (____: Bool ) { return 1 / 8; }\n public visitDecimal (____: Decimal ) { return 16; }\n public visitDate (type: Date_ ) { return (type.unit + 1) * 4; }\n public visitTime (type: Time ) { return type.bitWidth / 8; }\n public visitTimestamp (type: Timestamp ) { return type.unit === TimeUnit.SECOND ? 4 : 8; }\n public visitInterval (type: Interval ) { return (type.unit + 1) * 4; }\n public visitList (type: List ) { throw new Error(variableWidthColumnErrorMessage(type)); }\n public visitStruct (type: Struct ) { return this.visitFields(type.children).reduce(sum, 0); }\n public visitUnion (type: Union ) { return this.visitFields(type.children).reduce(sum, 0); }\n public visitFixedSizeBinary (type: FixedSizeBinary ) { return type.byteWidth; }\n public visitFixedSizeList (type: FixedSizeList ) { return type.listSize * this.visitFields(type.children).reduce(sum, 0); }\n public visitMap (type: Map_ ) { return this.visitFields(type.children).reduce(sum, 0); }\n public visitDictionary (type: Dictionary ) { return this.visit(type.indices); }\n public visitFields (fields: Field[] ) { return (fields || []).map((field) => this.visit(field.type)); }\n public visitSchema (schema: Schema ) { return this.visitFields(schema.fields).reduce(sum, 0); }\n}\n\n/** @ignore */\nexport const instance = new ByteWidthVisitor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { DataType } from '../type';\nimport { Visitor } from '../visitor';\nimport { VectorType, VectorCtor } from '../interfaces';\n\nimport { BinaryVector } from '../vector/binary';\nimport { BoolVector } from '../vector/bool';\nimport { DateVector, DateDayVector, DateMillisecondVector } from '../vector/date';\nimport { DecimalVector } from '../vector/decimal';\nimport { DictionaryVector } from '../vector/dictionary';\nimport { FixedSizeBinaryVector } from '../vector/fixedsizebinary';\nimport { FixedSizeListVector } from '../vector/fixedsizelist';\nimport { FloatVector, Float16Vector, Float32Vector, Float64Vector } from '../vector/float';\nimport { IntervalVector, IntervalDayTimeVector, IntervalYearMonthVector } from '../vector/interval';\nimport { IntVector, Int8Vector, Int16Vector, Int32Vector, Int64Vector, Uint8Vector, Uint16Vector, Uint32Vector, Uint64Vector } from '../vector/int';\nimport { ListVector } from '../vector/list';\nimport { MapVector } from '../vector/map';\nimport { NullVector } from '../vector/null';\nimport { StructVector } from '../vector/struct';\nimport { TimestampVector, TimestampSecondVector, TimestampMillisecondVector, TimestampMicrosecondVector, TimestampNanosecondVector } from '../vector/timestamp';\nimport { TimeVector, TimeSecondVector, TimeMillisecondVector, TimeMicrosecondVector, TimeNanosecondVector } from '../vector/time';\nimport { UnionVector, DenseUnionVector, SparseUnionVector } from '../vector/union';\nimport { Utf8Vector } from '../vector/utf8';\n\n/** @ignore */\nexport interface GetVectorConstructor extends Visitor {\n visit(node: T): VectorCtor;\n visitMany (nodes: T[]): VectorCtor[];\n getVisitFn(node: T): () => VectorCtor;\n getVisitFn(node: VectorType | Data | T): () => VectorCtor;\n}\n\n/** @ignore */\nexport class GetVectorConstructor extends Visitor {\n public visitNull () { return NullVector; }\n public visitBool () { return BoolVector; }\n public visitInt () { return IntVector; }\n public visitInt8 () { return Int8Vector; }\n public visitInt16 () { return Int16Vector; }\n public visitInt32 () { return Int32Vector; }\n public visitInt64 () { return Int64Vector; }\n public visitUint8 () { return Uint8Vector; }\n public visitUint16 () { return Uint16Vector; }\n public visitUint32 () { return Uint32Vector; }\n public visitUint64 () { return Uint64Vector; }\n public visitFloat () { return FloatVector; }\n public visitFloat16 () { return Float16Vector; }\n public visitFloat32 () { return Float32Vector; }\n public visitFloat64 () { return Float64Vector; }\n public visitUtf8 () { return Utf8Vector; }\n public visitBinary () { return BinaryVector; }\n public visitFixedSizeBinary () { return FixedSizeBinaryVector; }\n public visitDate () { return DateVector; }\n public visitDateDay () { return DateDayVector; }\n public visitDateMillisecond () { return DateMillisecondVector; }\n public visitTimestamp () { return TimestampVector; }\n public visitTimestampSecond () { return TimestampSecondVector; }\n public visitTimestampMillisecond () { return TimestampMillisecondVector; }\n public visitTimestampMicrosecond () { return TimestampMicrosecondVector; }\n public visitTimestampNanosecond () { return TimestampNanosecondVector; }\n public visitTime () { return TimeVector; }\n public visitTimeSecond () { return TimeSecondVector; }\n public visitTimeMillisecond () { return TimeMillisecondVector; }\n public visitTimeMicrosecond () { return TimeMicrosecondVector; }\n public visitTimeNanosecond () { return TimeNanosecondVector; }\n public visitDecimal () { return DecimalVector; }\n public visitList () { return ListVector; }\n public visitStruct () { return StructVector; }\n public visitUnion () { return UnionVector; }\n public visitDenseUnion () { return DenseUnionVector; }\n public visitSparseUnion () { return SparseUnionVector; }\n public visitDictionary () { return DictionaryVector; }\n public visitInterval () { return IntervalVector; }\n public visitIntervalDayTime () { return IntervalDayTimeVector; }\n public visitIntervalYearMonth () { return IntervalYearMonthVector; }\n public visitFixedSizeList () { return FixedSizeListVector; }\n public visitMap () { return MapVector; }\n}\n\n/** @ignore */\nexport const instance = new GetVectorConstructor();\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nexport { Vector } from '../vector';\nexport { BaseVector } from './base';\nexport { BinaryVector } from './binary';\nexport { BoolVector } from './bool';\nexport { Chunked } from './chunked';\nexport { DateVector, DateDayVector, DateMillisecondVector } from './date';\nexport { DecimalVector } from './decimal';\nexport { DictionaryVector } from './dictionary';\nexport { FixedSizeBinaryVector } from './fixedsizebinary';\nexport { FixedSizeListVector } from './fixedsizelist';\nexport { FloatVector, Float16Vector, Float32Vector, Float64Vector } from './float';\nexport { IntervalVector, IntervalDayTimeVector, IntervalYearMonthVector } from './interval';\nexport { IntVector, Int8Vector, Int16Vector, Int32Vector, Int64Vector, Uint8Vector, Uint16Vector, Uint32Vector, Uint64Vector } from './int';\nexport { ListVector } from './list';\nexport { MapVector } from './map';\nexport { NullVector } from './null';\nexport { StructVector } from './struct';\nexport { TimestampVector, TimestampSecondVector, TimestampMillisecondVector, TimestampMicrosecondVector, TimestampNanosecondVector } from './timestamp';\nexport { TimeVector, TimeSecondVector, TimeMillisecondVector, TimeMicrosecondVector, TimeNanosecondVector } from './time';\nexport { UnionVector, DenseUnionVector, SparseUnionVector } from './union';\nexport { Utf8Vector } from './utf8';\nexport { MapRow, StructRow } from './row';\n\nimport * as fn from '../util/fn';\nimport { Data } from '../data';\nimport { Type } from '../enum';\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\nimport { Chunked } from './chunked';\nimport { BaseVector } from './base';\nimport { setBool } from '../util/bit';\nimport { isIterable, isAsyncIterable } from '../util/compat';\nimport { Builder, IterableBuilderOptions } from '../builder';\nimport { VectorType as V, VectorCtorArgs } from '../interfaces';\nimport { instance as getVisitor } from '../visitor/get';\nimport { instance as setVisitor } from '../visitor/set';\nimport { instance as indexOfVisitor } from '../visitor/indexof';\nimport { instance as toArrayVisitor } from '../visitor/toarray';\nimport { instance as iteratorVisitor } from '../visitor/iterator';\nimport { instance as byteWidthVisitor } from '../visitor/bytewidth';\nimport { instance as getVectorConstructor } from '../visitor/vectorctor';\n\ndeclare module '../vector' {\n namespace Vector {\n export { newVector as new };\n export { vectorFrom as from };\n }\n}\n\ndeclare module './base' {\n namespace BaseVector {\n export { vectorFrom as from };\n }\n interface BaseVector {\n get(index: number): T['TValue'] | null;\n set(index: number, value: T['TValue'] | null): void;\n indexOf(value: T['TValue'] | null, fromIndex?: number): number;\n toArray(): T['TArray'];\n getByteWidth(): number;\n [Symbol.iterator](): IterableIterator;\n }\n}\n\n/** @nocollapse */\nVector.new = newVector;\n\n/** @nocollapse */\nVector.from = vectorFrom;\n\n/** @ignore */\nfunction newVector(data: Data, ...args: VectorCtorArgs>): V {\n return new (getVectorConstructor.getVisitFn(data)())(data, ...args) as V;\n}\n\n/** @ignore */\nexport interface VectorBuilderOptions extends IterableBuilderOptions { values: Iterable; }\n/** @ignore */\nexport interface VectorBuilderOptionsAsync extends IterableBuilderOptions { values: AsyncIterable; }\n\n/** @ignore */\nexport function vectorFromValuesWithType(newDataType: () => T, input: Iterable | AsyncIterable | VectorBuilderOptions | VectorBuilderOptionsAsync) {\n if (isIterable(input)) {\n return Vector.from({ 'nullValues': [null, undefined], type: newDataType(), 'values': input }) as V;\n } else if (isAsyncIterable(input)) {\n return Vector.from({ 'nullValues': [null, undefined], type: newDataType(), 'values': input }) as Promise>;\n }\n const {\n 'values': values = [],\n 'type': type = newDataType(),\n 'nullValues': nullValues = [null, undefined],\n } = { ...input };\n return isIterable(values)\n ? Vector.from({ nullValues, ...input, type } as VectorBuilderOptions)\n : Vector.from({ nullValues, ...input, type } as VectorBuilderOptionsAsync);\n}\n\n/** @ignore */\nfunction vectorFrom(input: VectorBuilderOptions): Vector;\nfunction vectorFrom(input: VectorBuilderOptionsAsync): Promise>;\nfunction vectorFrom(input: VectorBuilderOptions | VectorBuilderOptionsAsync) {\n const { 'values': values = [], ...options } = { 'nullValues': [null, undefined], ...input } as VectorBuilderOptions | VectorBuilderOptionsAsync;\n if (isIterable(values)) {\n const chunks = [...Builder.throughIterable(options)(values)];\n return chunks.length === 1 ? chunks[0] : Chunked.concat(chunks);\n }\n return (async (chunks: V[]) => {\n const transform = Builder.throughAsyncIterable(options);\n for await (const chunk of transform(values)) {\n chunks.push(chunk);\n }\n return chunks.length === 1 ? chunks[0] : Chunked.concat(chunks);\n })([]);\n}\n\n//\n// We provide the following method implementations for code navigability purposes only.\n// They're overridden at runtime below with the specific Visitor implementation for each type,\n// short-circuiting the usual Visitor traversal and reducing intermediate lookups and calls.\n// This comment is here to remind you to not set breakpoints in these function bodies, or to inform\n// you why the breakpoints you have already set are not being triggered. Have a great day!\n//\n\nBaseVector.prototype.get = function baseVectorGet(this: BaseVector, index: number): T['TValue'] | null {\n return getVisitor.visit(this, index);\n};\n\nBaseVector.prototype.set = function baseVectorSet(this: BaseVector, index: number, value: T['TValue'] | null): void {\n return setVisitor.visit(this, index, value);\n};\n\nBaseVector.prototype.indexOf = function baseVectorIndexOf(this: BaseVector, value: T['TValue'] | null, fromIndex?: number): number {\n return indexOfVisitor.visit(this, value, fromIndex);\n};\n\nBaseVector.prototype.toArray = function baseVectorToArray(this: BaseVector): T['TArray'] {\n return toArrayVisitor.visit(this);\n};\n\nBaseVector.prototype.getByteWidth = function baseVectorGetByteWidth(this: BaseVector): number {\n return byteWidthVisitor.visit(this.type);\n};\n\nBaseVector.prototype[Symbol.iterator] = function baseVectorSymbolIterator(this: BaseVector): IterableIterator {\n return iteratorVisitor.visit(this);\n};\n\n(BaseVector.prototype as any)._bindDataAccessors = bindBaseVectorDataAccessors;\n\n// Perf: bind and assign the operator Visitor methods to each of the Vector subclasses for each Type\n(Object.keys(Type) as any[])\n .map((T: any) => Type[T] as any)\n .filter((T: any): T is Type => typeof T === 'number')\n .filter((typeId) => typeId !== Type.NONE)\n .forEach((typeId) => {\n const VectorCtor = getVectorConstructor.visit(typeId);\n VectorCtor.prototype['get'] = fn.partial1(getVisitor.getVisitFn(typeId));\n VectorCtor.prototype['set'] = fn.partial2(setVisitor.getVisitFn(typeId));\n VectorCtor.prototype['indexOf'] = fn.partial2(indexOfVisitor.getVisitFn(typeId));\n VectorCtor.prototype['toArray'] = fn.partial0(toArrayVisitor.getVisitFn(typeId));\n VectorCtor.prototype['getByteWidth'] = partialType0(byteWidthVisitor.getVisitFn(typeId));\n VectorCtor.prototype[Symbol.iterator] = fn.partial0(iteratorVisitor.getVisitFn(typeId));\n });\n\n/** @ignore */\nfunction partialType0(visit: (node: T['type']) => any) {\n return function(this: T) { return visit(this.type); };\n}\n\n/** @ignore */\nfunction wrapNullableGet, F extends (i: number) => any>(fn: F): (...args: Parameters) => ReturnType {\n return function(this: V, i: number) { return this.isValid(i) ? fn.call(this, i) : null; };\n}\n\n/** @ignore */\nfunction wrapNullableSet, F extends (i: number, a: any) => void>(fn: F): (...args: Parameters) => void {\n return function(this: V, i: number, a: any) {\n if (setBool(this.nullBitmap, this.offset + i, !(a === null || a === undefined))) {\n fn.call(this, i, a);\n }\n };\n}\n\n/** @ignore */\nfunction bindBaseVectorDataAccessors(this: BaseVector) {\n const nullBitmap = this.nullBitmap;\n if (nullBitmap && nullBitmap.byteLength > 0) {\n this.get = wrapNullableGet(this.get);\n this.set = wrapNullableSet(this.set);\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { Column } from './column';\nimport { Schema, Field } from './schema';\nimport { RecordBatch, _InternalEmptyPlaceholderRecordBatch } from './recordbatch';\nimport { DataFrame } from './compute/dataframe';\nimport { RecordBatchReader } from './ipc/reader';\nimport { DataType, RowLike, Struct } from './type';\nimport { selectColumnArgs, selectArgs } from './util/args';\nimport { Clonable, Sliceable, Applicative } from './vector';\nimport { isPromise, isIterable, isAsyncIterable } from './util/compat';\nimport { RecordBatchFileWriter, RecordBatchStreamWriter } from './ipc/writer';\nimport { distributeColumnsIntoRecordBatches, distributeVectorsIntoRecordBatches } from './util/recordbatch';\nimport { Vector, Chunked, StructVector, VectorBuilderOptions, VectorBuilderOptionsAsync } from './vector/index';\n\ntype VectorMap = { [key: string]: Vector };\ntype Fields = (keyof T)[] | Field[];\ntype ChildData = Data[] | Vector[];\ntype Columns = Column[] | Column[][];\n\nexport interface Table {\n\n get(index: number): Struct['TValue'];\n [Symbol.iterator](): IterableIterator>;\n\n slice(begin?: number, end?: number): Table;\n concat(...others: Vector>[]): Table;\n clone(chunks?: RecordBatch[], offsets?: Uint32Array): Table;\n\n scan(next: import('./compute/dataframe').NextFunc, bind?: import('./compute/dataframe').BindFunc): void;\n scanReverse(next: import('./compute/dataframe').NextFunc, bind?: import('./compute/dataframe').BindFunc): void;\n countBy(name: import('./compute/predicate').Col | string): import('./compute/dataframe').CountByResult;\n filter(predicate: import('./compute/predicate').Predicate): import('./compute/dataframe').FilteredDataFrame;\n}\n\nexport class Table\n extends Chunked>\n implements DataFrame,\n Clonable>,\n Sliceable>,\n Applicative, Table> {\n\n /** @nocollapse */\n public static empty(schema = new Schema([])) { return new Table(schema, []); }\n\n public static from(): Table<{}>;\n public static from(source: RecordBatchReader): Table;\n public static from(source: import('./ipc/reader').FromArg0): Table;\n public static from(source: import('./ipc/reader').FromArg2): Table;\n public static from(source: import('./ipc/reader').FromArg1): Promise>;\n public static from(source: import('./ipc/reader').FromArg3): Promise>;\n public static from(source: import('./ipc/reader').FromArg4): Promise>;\n public static from(source: import('./ipc/reader').FromArg5): Promise>;\n public static from(source: PromiseLike>): Promise>;\n public static from(options: VectorBuilderOptions, TNull>): Table;\n public static from(options: VectorBuilderOptionsAsync, TNull>): Promise>;\n /** @nocollapse */\n public static from(input?: any) {\n\n if (!input) { return Table.empty(); }\n\n if (typeof input === 'object') {\n let table = isIterable(input['values']) ? tableFromIterable(input)\n : isAsyncIterable(input['values']) ? tableFromAsyncIterable(input)\n : null;\n if (table !== null) { return table; }\n }\n\n let reader = RecordBatchReader.from(input) as RecordBatchReader | Promise>;\n\n if (isPromise>(reader)) {\n return (async () => await Table.from(await reader))();\n }\n if (reader.isSync() && (reader = reader.open())) {\n return !reader.schema ? Table.empty() : new Table(reader.schema, [...reader]);\n }\n return (async (opening) => {\n const reader = await opening;\n const schema = reader.schema;\n const batches: RecordBatch[] = [];\n if (schema) {\n for await (let batch of reader) {\n batches.push(batch);\n }\n return new Table(schema, batches);\n }\n return Table.empty();\n })(reader.open());\n }\n\n /** @nocollapse */\n public static async fromAsync(source: import('./ipc/reader').FromArgs): Promise> {\n return await Table.from(source as any);\n }\n\n /** @nocollapse */\n public static fromStruct(vector: Vector>) {\n return Table.new(vector.data.childData as Data[], vector.type.children);\n }\n\n /**\n * @summary Create a new Table from a collection of Columns or Vectors,\n * with an optional list of names or Fields.\n *\n *\n * `Table.new` accepts an Object of\n * Columns or Vectors, where the keys will be used as the field names\n * for the Schema:\n * ```ts\n * const i32s = Int32Vector.from([1, 2, 3]);\n * const f32s = Float32Vector.from([.1, .2, .3]);\n * const table = Table.new({ i32: i32s, f32: f32s });\n * assert(table.schema.fields[0].name === 'i32');\n * ```\n *\n * It also accepts a a list of Vectors with an optional list of names or\n * Fields for the resulting Schema. If the list is omitted or a name is\n * missing, the numeric index of each Vector will be used as the name:\n * ```ts\n * const i32s = Int32Vector.from([1, 2, 3]);\n * const f32s = Float32Vector.from([.1, .2, .3]);\n * const table = Table.new([i32s, f32s], ['i32']);\n * assert(table.schema.fields[0].name === 'i32');\n * assert(table.schema.fields[1].name === '1');\n * ```\n *\n * If the supplied arguments are Columns, `Table.new` will infer the Schema\n * from the Columns:\n * ```ts\n * const i32s = Column.new('i32', Int32Vector.from([1, 2, 3]));\n * const f32s = Column.new('f32', Float32Vector.from([.1, .2, .3]));\n * const table = Table.new(i32s, f32s);\n * assert(table.schema.fields[0].name === 'i32');\n * assert(table.schema.fields[1].name === 'f32');\n * ```\n *\n * If the supplied Vector or Column lengths are unequal, `Table.new` will\n * extend the lengths of the shorter Columns, allocating additional bytes\n * to represent the additional null slots. The memory required to allocate\n * these additional bitmaps can be computed as:\n * ```ts\n * let additionalBytes = 0;\n * for (let vec in shorter_vectors) {\n * additionalBytes += (((longestLength - vec.length) + 63) & ~63) >> 3;\n * }\n * ```\n *\n * For example, an additional null bitmap for one million null values would require\n * 125,000 bytes (`((1e6 + 63) & ~63) >> 3`), or approx. `0.11MiB`\n */\n public static new(...columns: Columns): Table;\n public static new(children: T): Table<{ [P in keyof T]: T[P]['type'] }>;\n public static new(children: ChildData, fields?: Fields): Table;\n /** @nocollapse */\n public static new(...cols: any[]) {\n return new Table(...distributeColumnsIntoRecordBatches(selectColumnArgs(cols)));\n }\n\n constructor(batches: RecordBatch[]);\n constructor(...batches: RecordBatch[]);\n constructor(schema: Schema, batches: RecordBatch[]);\n constructor(schema: Schema, ...batches: RecordBatch[]);\n constructor(...args: any[]) {\n\n let schema: Schema = null!;\n\n if (args[0] instanceof Schema) { schema = args.shift(); }\n\n let chunks = selectArgs>(RecordBatch, args);\n\n if (!schema && !(schema = chunks[0] && chunks[0].schema)) {\n throw new TypeError('Table must be initialized with a Schema or at least one RecordBatch');\n }\n\n chunks[0] || (chunks[0] = new _InternalEmptyPlaceholderRecordBatch(schema));\n\n super(new Struct(schema.fields), chunks);\n\n this._schema = schema;\n this._chunks = chunks;\n }\n\n protected _schema: Schema;\n // List of inner RecordBatches\n protected _chunks: RecordBatch[];\n protected _children?: Column[];\n\n public get schema() { return this._schema; }\n public get length() { return this._length; }\n public get chunks() { return this._chunks; }\n public get numCols() { return this._numChildren; }\n\n public clone(chunks = this._chunks) {\n return new Table(this._schema, chunks);\n }\n\n public getColumn(name: R): Column {\n return this.getColumnAt(this.getColumnIndex(name)) as Column;\n }\n public getColumnAt(index: number): Column | null {\n return this.getChildAt(index);\n }\n public getColumnIndex(name: R) {\n return this._schema.fields.findIndex((f) => f.name === name);\n }\n public getChildAt(index: number): Column | null {\n if (index < 0 || index >= this.numChildren) { return null; }\n let field: Field, child: Column;\n const fields = (this._schema as Schema).fields;\n const columns = this._children || (this._children = []) as Column[];\n if (child = columns[index]) { return child as Column; }\n if (field = fields[index]) {\n const chunks = this._chunks\n .map((chunk) => chunk.getChildAt(index))\n .filter((vec): vec is Vector => vec != null);\n if (chunks.length > 0) {\n return (columns[index] = new Column(field, chunks));\n }\n }\n return null;\n }\n\n // @ts-ignore\n public serialize(encoding = 'binary', stream = true) {\n const Writer = !stream\n ? RecordBatchFileWriter\n : RecordBatchStreamWriter;\n return Writer.writeAll(this).toUint8Array(true);\n }\n public count(): number {\n return this._length;\n }\n public select(...columnNames: K[]) {\n const nameToIndex = this._schema.fields.reduce((m, f, i) => m.set(f.name as K, i), new Map());\n return this.selectAt(...columnNames.map((columnName) => nameToIndex.get(columnName)!).filter((x) => x > -1));\n }\n public selectAt(...columnIndices: number[]) {\n const schema = this._schema.selectAt(...columnIndices);\n return new Table(schema, this._chunks.map(({ length, data: { childData } }) => {\n return new RecordBatch(schema, length, columnIndices.map((i) => childData[i]).filter(Boolean));\n }));\n }\n public assign(other: Table) {\n\n const fields = this._schema.fields;\n const [indices, oldToNew] = other.schema.fields.reduce((memo, f2, newIdx) => {\n const [indices, oldToNew] = memo;\n const i = fields.findIndex((f) => f.name === f2.name);\n ~i ? (oldToNew[i] = newIdx) : indices.push(newIdx);\n return memo;\n }, [[], []] as number[][]);\n\n const schema = this._schema.assign(other.schema);\n const columns = [\n ...fields.map((_f, i, _fs, j = oldToNew[i]) =>\n (j === undefined ? this.getColumnAt(i) : other.getColumnAt(j))!),\n ...indices.map((i) => other.getColumnAt(i)!)\n ].filter(Boolean) as Column<(T & R)[keyof T | keyof R]>[];\n\n return new Table(...distributeVectorsIntoRecordBatches(schema, columns));\n }\n}\n\nfunction tableFromIterable(input: VectorBuilderOptions, TNull>) {\n const { type } = input;\n if (type instanceof Struct) {\n return Table.fromStruct(StructVector.from(input as VectorBuilderOptions, TNull>));\n }\n return null;\n}\n\nfunction tableFromAsyncIterable(input: VectorBuilderOptionsAsync, TNull>) {\n const { type } = input;\n if (type instanceof Struct) {\n return StructVector.from(input as VectorBuilderOptionsAsync, TNull>).then((vector) => Table.fromStruct(vector));\n }\n return null;\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Data } from './data';\nimport { Table } from './table';\nimport { Vector } from './vector';\nimport { Visitor } from './visitor';\nimport { Schema, Field } from './schema';\nimport { isIterable } from './util/compat';\nimport { Chunked } from './vector/chunked';\nimport { selectFieldArgs } from './util/args';\nimport { DataType, Struct, Dictionary } from './type';\nimport { ensureSameLengthData } from './util/recordbatch';\nimport { Clonable, Sliceable, Applicative } from './vector';\nimport { StructVector, VectorBuilderOptions, VectorBuilderOptionsAsync } from './vector/index';\n\ntype VectorMap = { [key: string]: Vector };\ntype Fields = (keyof T)[] | Field[];\ntype ChildData = (Data | Vector)[];\n\nexport interface RecordBatch {\n concat(...others: Vector>[]): Table;\n slice(begin?: number, end?: number): RecordBatch;\n clone(data: Data>, children?: Vector[]): RecordBatch;\n}\n\nexport class RecordBatch\n extends StructVector\n implements Clonable>,\n Sliceable>,\n Applicative, Table> {\n\n public static from(options: VectorBuilderOptions, TNull>): Table;\n public static from(options: VectorBuilderOptionsAsync, TNull>): Promise>;\n /** @nocollapse */\n public static from(options: VectorBuilderOptions, TNull> | VectorBuilderOptionsAsync, TNull>) {\n if (isIterable<(Struct)['TValue'] | TNull>(options['values'])) {\n return Table.from(options as VectorBuilderOptions, TNull>);\n }\n return Table.from(options as VectorBuilderOptionsAsync, TNull>);\n }\n\n public static new(children: T): RecordBatch<{ [P in keyof T]: T[P]['type'] }>;\n public static new(children: ChildData, fields?: Fields): RecordBatch;\n /** @nocollapse */\n public static new(...args: any[]) {\n const [fs, xs] = selectFieldArgs(args);\n const vs = xs.filter((x): x is Vector => x instanceof Vector);\n return new RecordBatch(...ensureSameLengthData(new Schema(fs), vs.map((x) => x.data)));\n }\n\n protected _schema: Schema;\n protected _dictionaries?: Map;\n\n constructor(schema: Schema, length: number, children: (Data | Vector)[]);\n constructor(schema: Schema, data: Data>, children?: Vector[]);\n constructor(...args: any[]) {\n let data: Data>;\n let schema = args[0] as Schema;\n let children: Vector[] | undefined;\n if (args[1] instanceof Data) {\n [, data, children] = (args as [any, Data>, Vector[]?]);\n } else {\n const fields = schema.fields as Field[];\n const [, length, childData] = args as [any, number, Data[]];\n data = Data.Struct(new Struct(fields), 0, length, 0, null, childData);\n }\n super(data, children);\n this._schema = schema;\n }\n\n public clone(data: Data>, children = this._children) {\n return new RecordBatch(this._schema, data, children);\n }\n\n public concat(...others: Vector>[]): Table {\n const schema = this._schema, chunks = Chunked.flatten(this, ...others);\n return new Table(schema, chunks.map(({ data }) => new RecordBatch(schema, data)));\n }\n\n public get schema() { return this._schema; }\n public get numCols() { return this._schema.fields.length; }\n public get dictionaries() {\n return this._dictionaries || (this._dictionaries = DictionaryCollector.collect(this));\n }\n\n public select(...columnNames: K[]) {\n const nameToIndex = this._schema.fields.reduce((m, f, i) => m.set(f.name as K, i), new Map());\n return this.selectAt(...columnNames.map((columnName) => nameToIndex.get(columnName)!).filter((x) => x > -1));\n }\n public selectAt(...columnIndices: number[]) {\n const schema = this._schema.selectAt(...columnIndices);\n const childData = columnIndices.map((i) => this.data.childData[i]).filter(Boolean);\n return new RecordBatch<{ [key: string]: K }>(schema, this.length, childData);\n }\n}\n\n/**\n * An internal class used by the `RecordBatchReader` and `RecordBatchWriter`\n * implementations to differentiate between a stream with valid zero-length\n * RecordBatches, and a stream with a Schema message, but no RecordBatches.\n * @see https://github.com/apache/arrow/pull/4373\n * @ignore\n * @private\n */\n/* tslint:disable:class-name */\nexport class _InternalEmptyPlaceholderRecordBatch extends RecordBatch {\n constructor(schema: Schema) {\n super(schema, 0, schema.fields.map((f) => Data.new(f.type, 0, 0, 0)));\n }\n}\n\n/** @ignore */\nclass DictionaryCollector extends Visitor {\n public dictionaries = new Map();\n public static collect(batch: T) {\n return new DictionaryCollector().visit(\n batch.data, new Struct(batch.schema.fields)\n ).dictionaries;\n }\n public visit(data: Data, type: DataType) {\n if (DataType.isDictionary(type)) {\n return this.visitDictionary(data, type);\n } else {\n data.childData.forEach((child, i) =>\n this.visit(child, type.children[i].type));\n }\n return this;\n }\n public visitDictionary(data: Data, type: Dictionary) {\n const dictionary = data.dictionary;\n if (dictionary && dictionary.length > 0) {\n this.dictionaries.set(type.id, dictionary);\n }\n return this;\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { DataType } from '../type';\nimport { MessageHeader } from '../enum';\nimport { Footer } from './metadata/file';\nimport { Schema, Field } from '../schema';\nimport streamAdapters from '../io/adapters';\nimport { Message } from './metadata/message';\nimport * as metadata from './metadata/message';\nimport { ArrayBufferViewInput } from '../util/buffer';\nimport { ByteStream, AsyncByteStream } from '../io/stream';\nimport { RandomAccessFile, AsyncRandomAccessFile } from '../io/file';\nimport { VectorLoader, JSONVectorLoader } from '../visitor/vectorloader';\nimport { RecordBatch, _InternalEmptyPlaceholderRecordBatch } from '../recordbatch';\nimport {\n FileHandle,\n ArrowJSONLike,\n ITERATOR_DONE,\n ReadableInterop,\n} from '../io/interfaces';\nimport {\n MessageReader, AsyncMessageReader, JSONMessageReader,\n checkForMagicArrowString, magicLength, magicAndPadding, magicX2AndPadding\n} from './message';\nimport {\n isPromise,\n isIterable, isAsyncIterable,\n isIteratorResult, isArrowJSON,\n isFileHandle, isFetchResponse,\n isReadableDOMStream, isReadableNodeStream\n} from '../util/compat';\n\n/** @ignore */ export type FromArg0 = ArrowJSONLike;\n/** @ignore */ export type FromArg1 = PromiseLike;\n/** @ignore */ export type FromArg2 = Iterable | ArrayBufferViewInput;\n/** @ignore */ export type FromArg3 = PromiseLike | ArrayBufferViewInput>;\n/** @ignore */ export type FromArg4 = Response | NodeJS.ReadableStream | ReadableStream | AsyncIterable;\n/** @ignore */ export type FromArg5 = FileHandle | PromiseLike | PromiseLike;\n/** @ignore */ export type FromArgs = FromArg0 | FromArg1 | FromArg2 | FromArg3 | FromArg4 | FromArg5;\n\n/** @ignore */ type OpenOptions = { autoDestroy?: boolean; };\n/** @ignore */ type RecordBatchReaders = RecordBatchFileReader | RecordBatchStreamReader;\n/** @ignore */ type AsyncRecordBatchReaders = AsyncRecordBatchFileReader | AsyncRecordBatchStreamReader;\n/** @ignore */ type RecordBatchFileReaders = RecordBatchFileReader | AsyncRecordBatchFileReader;\n/** @ignore */ type RecordBatchStreamReaders = RecordBatchStreamReader | AsyncRecordBatchStreamReader;\n\nexport class RecordBatchReader extends ReadableInterop> {\n\n protected _impl: RecordBatchReaderImpls;\n protected constructor(impl: RecordBatchReaderImpls) {\n super();\n this._impl = impl;\n }\n\n public get closed() { return this._impl.closed; }\n public get schema() { return this._impl.schema; }\n public get autoDestroy() { return this._impl.autoDestroy; }\n public get dictionaries() { return this._impl.dictionaries; }\n public get numDictionaries() { return this._impl.numDictionaries; }\n public get numRecordBatches() { return this._impl.numRecordBatches; }\n public get footer() { return this._impl.isFile() ? this._impl.footer : null; }\n\n public isSync(): this is RecordBatchReaders { return this._impl.isSync(); }\n public isAsync(): this is AsyncRecordBatchReaders { return this._impl.isAsync(); }\n public isFile(): this is RecordBatchFileReaders { return this._impl.isFile(); }\n public isStream(): this is RecordBatchStreamReaders { return this._impl.isStream(); }\n\n public next() {\n return this._impl.next();\n }\n public throw(value?: any) {\n return this._impl.throw(value);\n }\n public return(value?: any) {\n return this._impl.return(value);\n }\n public cancel() {\n return this._impl.cancel();\n }\n public reset(schema?: Schema | null): this {\n this._impl.reset(schema);\n this._DOMStream = undefined;\n this._nodeStream = undefined;\n return this;\n }\n public open(options?: OpenOptions) {\n const opening = this._impl.open(options);\n return isPromise(opening) ? opening.then(() => this) : this;\n }\n public readRecordBatch(index: number): RecordBatch | null | Promise | null> {\n return this._impl.isFile() ? this._impl.readRecordBatch(index) : null;\n }\n public [Symbol.iterator](): IterableIterator> {\n return (>> this._impl)[Symbol.iterator]();\n }\n public [Symbol.asyncIterator](): AsyncIterableIterator> {\n return (>> this._impl)[Symbol.asyncIterator]();\n }\n public toDOMStream() {\n return streamAdapters.toDOMStream>(\n (this.isSync()\n ? { [Symbol.iterator]: () => this } as Iterable>\n : { [Symbol.asyncIterator]: () => this } as AsyncIterable>));\n }\n public toNodeStream() {\n return streamAdapters.toNodeStream>(\n (this.isSync()\n ? { [Symbol.iterator]: () => this } as Iterable>\n : { [Symbol.asyncIterator]: () => this } as AsyncIterable>),\n { objectMode: true });\n }\n\n /** @nocollapse */\n // @ts-ignore\n public static throughNode(options?: import('stream').DuplexOptions & { autoDestroy: boolean }): import('stream').Duplex {\n throw new Error(`\"throughNode\" not available in this environment`);\n }\n /** @nocollapse */\n public static throughDOM(\n // @ts-ignore\n writableStrategy?: ByteLengthQueuingStrategy,\n // @ts-ignore\n readableStrategy?: { autoDestroy: boolean }\n ): { writable: WritableStream, readable: ReadableStream> } {\n throw new Error(`\"throughDOM\" not available in this environment`);\n }\n\n public static from(source: T): T;\n public static from(source: FromArg0): RecordBatchStreamReader;\n public static from(source: FromArg1): Promise>;\n public static from(source: FromArg2): RecordBatchFileReader | RecordBatchStreamReader;\n public static from(source: FromArg3): Promise | RecordBatchStreamReader>;\n public static from(source: FromArg4): Promise | AsyncRecordBatchReaders>;\n public static from(source: FromArg5): Promise | AsyncRecordBatchStreamReader>;\n /** @nocollapse */\n public static from(source: any) {\n if (source instanceof RecordBatchReader) {\n return source;\n } else if (isArrowJSON(source)) {\n return fromArrowJSON(source);\n } else if (isFileHandle(source)) {\n return fromFileHandle(source);\n } else if (isPromise(source)) {\n return (async () => await RecordBatchReader.from(await source))();\n } else if (isFetchResponse(source) || isReadableDOMStream(source) || isReadableNodeStream(source) || isAsyncIterable(source)) {\n return fromAsyncByteStream(new AsyncByteStream(source));\n }\n return fromByteStream(new ByteStream(source));\n }\n\n public static readAll(source: T): T extends RecordBatchReaders ? IterableIterator : AsyncIterableIterator;\n public static readAll(source: FromArg0): IterableIterator>;\n public static readAll(source: FromArg1): AsyncIterableIterator>;\n public static readAll(source: FromArg2): IterableIterator | RecordBatchStreamReader>;\n public static readAll(source: FromArg3): AsyncIterableIterator | RecordBatchStreamReader>;\n public static readAll(source: FromArg4): AsyncIterableIterator | AsyncRecordBatchReaders>;\n public static readAll(source: FromArg5): AsyncIterableIterator | AsyncRecordBatchStreamReader>;\n /** @nocollapse */\n public static readAll(source: any) {\n if (source instanceof RecordBatchReader) {\n return source.isSync() ? readAllSync(source) : readAllAsync(source as AsyncRecordBatchReaders);\n } else if (isArrowJSON(source) || ArrayBuffer.isView(source) || isIterable(source) || isIteratorResult(source)) {\n return readAllSync(source) as IterableIterator>;\n }\n return readAllAsync(source) as AsyncIterableIterator | AsyncRecordBatchReaders>;\n }\n}\n\n//\n// Since TS is a structural type system, we define the following subclass stubs\n// so that concrete types exist to associate with with the interfaces below.\n//\n// The implementation for each RecordBatchReader is hidden away in the set of\n// `RecordBatchReaderImpl` classes in the second half of this file. This allows\n// us to export a single RecordBatchReader class, and swap out the impl based\n// on the io primitives or underlying arrow (JSON, file, or stream) at runtime.\n//\n// Async/await makes our job a bit harder, since it forces everything to be\n// either fully sync or fully async. This is why the logic for the reader impls\n// has been duplicated into both sync and async variants. Since the RBR\n// delegates to its impl, an RBR with an AsyncRecordBatchFileReaderImpl for\n// example will return async/await-friendly Promises, but one with a (sync)\n// RecordBatchStreamReaderImpl will always return values. Nothing should be\n// different about their logic, aside from the async handling. This is also why\n// this code looks highly structured, as it should be nearly identical and easy\n// to follow.\n//\n\n/** @ignore */\nexport class RecordBatchStreamReader extends RecordBatchReader {\n constructor(protected _impl: RecordBatchStreamReaderImpl) { super (_impl); }\n public [Symbol.iterator]() { return (this._impl as IterableIterator>)[Symbol.iterator](); }\n public async *[Symbol.asyncIterator](): AsyncIterableIterator> { yield* this[Symbol.iterator](); }\n}\n/** @ignore */\nexport class AsyncRecordBatchStreamReader extends RecordBatchReader {\n constructor(protected _impl: AsyncRecordBatchStreamReaderImpl) { super (_impl); }\n public [Symbol.iterator](): IterableIterator> { throw new Error(`AsyncRecordBatchStreamReader is not Iterable`); }\n public [Symbol.asyncIterator]() { return (this._impl as AsyncIterableIterator>)[Symbol.asyncIterator](); }\n}\n/** @ignore */\nexport class RecordBatchFileReader extends RecordBatchStreamReader {\n constructor(protected _impl: RecordBatchFileReaderImpl) { super (_impl); }\n}\n/** @ignore */\nexport class AsyncRecordBatchFileReader extends AsyncRecordBatchStreamReader {\n constructor(protected _impl: AsyncRecordBatchFileReaderImpl) { super (_impl); }\n}\n\n//\n// Now override the return types for each sync/async RecordBatchReader variant\n//\n\n/** @ignore */\nexport interface RecordBatchStreamReader extends RecordBatchReader {\n open(options?: OpenOptions | undefined): this;\n cancel(): void;\n throw(value?: any): IteratorResult;\n return(value?: any): IteratorResult;\n next(value?: any): IteratorResult>;\n}\n\n/** @ignore */\nexport interface AsyncRecordBatchStreamReader extends RecordBatchReader {\n open(options?: OpenOptions | undefined): Promise;\n cancel(): Promise;\n throw(value?: any): Promise>;\n return(value?: any): Promise>;\n next(value?: any): Promise>>;\n}\n\n/** @ignore */\nexport interface RecordBatchFileReader extends RecordBatchStreamReader {\n footer: Footer;\n readRecordBatch(index: number): RecordBatch | null;\n}\n\n/** @ignore */\nexport interface AsyncRecordBatchFileReader extends AsyncRecordBatchStreamReader {\n footer: Footer;\n readRecordBatch(index: number): Promise | null>;\n}\n\n/** @ignore */\ntype RecordBatchReaderImpls =\n RecordBatchJSONReaderImpl |\n RecordBatchFileReaderImpl |\n RecordBatchStreamReaderImpl |\n AsyncRecordBatchFileReaderImpl |\n AsyncRecordBatchStreamReaderImpl;\n\n/** @ignore */\ninterface RecordBatchReaderImpl {\n\n closed: boolean;\n schema: Schema;\n autoDestroy: boolean;\n dictionaries: Map;\n\n isFile(): this is RecordBatchFileReaders;\n isStream(): this is RecordBatchStreamReaders;\n isSync(): this is RecordBatchReaders;\n isAsync(): this is AsyncRecordBatchReaders;\n\n reset(schema?: Schema | null): this;\n}\n\n/** @ignore */\ninterface RecordBatchStreamReaderImpl extends RecordBatchReaderImpl {\n\n open(options?: OpenOptions): this;\n cancel(): void;\n\n throw(value?: any): IteratorResult;\n return(value?: any): IteratorResult;\n next(value?: any): IteratorResult>;\n\n [Symbol.iterator](): IterableIterator>;\n}\n\n/** @ignore */\ninterface AsyncRecordBatchStreamReaderImpl extends RecordBatchReaderImpl {\n\n open(options?: OpenOptions): Promise;\n cancel(): Promise;\n\n throw(value?: any): Promise>;\n return(value?: any): Promise>;\n next(value?: any): Promise>>;\n\n [Symbol.asyncIterator](): AsyncIterableIterator>;\n}\n\n/** @ignore */\ninterface RecordBatchFileReaderImpl extends RecordBatchStreamReaderImpl {\n readRecordBatch(index: number): RecordBatch | null;\n}\n\n/** @ignore */\ninterface AsyncRecordBatchFileReaderImpl extends AsyncRecordBatchStreamReaderImpl {\n readRecordBatch(index: number): Promise | null>;\n}\n\n/** @ignore */\nabstract class RecordBatchReaderImpl implements RecordBatchReaderImpl {\n\n // @ts-ignore\n public schema: Schema;\n public closed = false;\n public autoDestroy = true;\n public dictionaries: Map;\n\n protected _dictionaryIndex = 0;\n protected _recordBatchIndex = 0;\n public get numDictionaries() { return this._dictionaryIndex; }\n public get numRecordBatches() { return this._recordBatchIndex; }\n\n constructor(dictionaries = new Map()) {\n this.dictionaries = dictionaries;\n }\n\n public isSync(): this is RecordBatchReaders { return false; }\n public isAsync(): this is AsyncRecordBatchReaders { return false; }\n public isFile(): this is RecordBatchFileReaders { return false; }\n public isStream(): this is RecordBatchStreamReaders { return false; }\n\n public reset(schema?: Schema | null) {\n this._dictionaryIndex = 0;\n this._recordBatchIndex = 0;\n this.schema = schema;\n this.dictionaries = new Map();\n return this;\n }\n\n protected _loadRecordBatch(header: metadata.RecordBatch, body: any) {\n return new RecordBatch(this.schema, header.length, this._loadVectors(header, body, this.schema.fields));\n }\n protected _loadDictionaryBatch(header: metadata.DictionaryBatch, body: any) {\n const { id, isDelta, data } = header;\n const { dictionaries, schema } = this;\n const dictionary = dictionaries.get(id);\n if (isDelta || !dictionary) {\n const type = schema.dictionaries.get(id)!;\n return (dictionary && isDelta ? dictionary.concat(\n Vector.new(this._loadVectors(data, body, [type])[0])) :\n Vector.new(this._loadVectors(data, body, [type])[0])) as Vector;\n }\n return dictionary;\n }\n protected _loadVectors(header: metadata.RecordBatch, body: any, types: (Field | DataType)[]) {\n return new VectorLoader(body, header.nodes, header.buffers, this.dictionaries).visitMany(types);\n }\n}\n\n/** @ignore */\nclass RecordBatchStreamReaderImpl extends RecordBatchReaderImpl implements IterableIterator> {\n\n protected _reader: MessageReader;\n protected _handle: ByteStream | ArrowJSONLike;\n\n constructor(source: ByteStream | ArrowJSONLike, dictionaries?: Map) {\n super(dictionaries);\n this._reader = !isArrowJSON(source)\n ? new MessageReader(this._handle = source)\n : new JSONMessageReader(this._handle = source);\n }\n\n public isSync(): this is RecordBatchReaders { return true; }\n public isStream(): this is RecordBatchStreamReaders { return true; }\n public [Symbol.iterator](): IterableIterator> {\n return this as IterableIterator>;\n }\n public cancel() {\n if (!this.closed && (this.closed = true)) {\n this.reset()._reader.return();\n this._reader = null;\n this.dictionaries = null;\n }\n }\n public open(options?: OpenOptions) {\n if (!this.closed) {\n this.autoDestroy = shouldAutoDestroy(this, options);\n if (!(this.schema || (this.schema = this._reader.readSchema()!))) {\n this.cancel();\n }\n }\n return this;\n }\n public throw(value?: any): IteratorResult {\n if (!this.closed && this.autoDestroy && (this.closed = true)) {\n return this.reset()._reader.throw(value);\n }\n return ITERATOR_DONE;\n }\n public return(value?: any): IteratorResult {\n if (!this.closed && this.autoDestroy && (this.closed = true)) {\n return this.reset()._reader.return(value);\n }\n return ITERATOR_DONE;\n }\n public next(): IteratorResult> {\n if (this.closed) { return ITERATOR_DONE; }\n let message: Message | null, { _reader: reader } = this;\n while (message = this._readNextMessageAndValidate()) {\n if (message.isSchema()) {\n this.reset(message.header());\n } else if (message.isRecordBatch()) {\n this._recordBatchIndex++;\n const header = message.header();\n const buffer = reader.readMessageBody(message.bodyLength);\n const recordBatch = this._loadRecordBatch(header, buffer);\n return { done: false, value: recordBatch };\n } else if (message.isDictionaryBatch()) {\n this._dictionaryIndex++;\n const header = message.header();\n const buffer = reader.readMessageBody(message.bodyLength);\n const vector = this._loadDictionaryBatch(header, buffer);\n this.dictionaries.set(header.id, vector);\n }\n }\n if (this.schema && this._recordBatchIndex === 0) {\n this._recordBatchIndex++;\n return { done: false, value: new _InternalEmptyPlaceholderRecordBatch(this.schema) };\n }\n return this.return();\n }\n protected _readNextMessageAndValidate(type?: T | null) {\n return this._reader.readMessage(type);\n }\n}\n\n/** @ignore */\nclass AsyncRecordBatchStreamReaderImpl extends RecordBatchReaderImpl implements AsyncIterableIterator> {\n\n protected _handle: AsyncByteStream;\n protected _reader: AsyncMessageReader;\n\n constructor(source: AsyncByteStream, dictionaries?: Map) {\n super(dictionaries);\n this._reader = new AsyncMessageReader(this._handle = source);\n }\n public isAsync(): this is AsyncRecordBatchReaders { return true; }\n public isStream(): this is RecordBatchStreamReaders { return true; }\n public [Symbol.asyncIterator](): AsyncIterableIterator> {\n return this as AsyncIterableIterator>;\n }\n public async cancel() {\n if (!this.closed && (this.closed = true)) {\n await this.reset()._reader.return();\n this._reader = null;\n this.dictionaries = null;\n }\n }\n public async open(options?: OpenOptions) {\n if (!this.closed) {\n this.autoDestroy = shouldAutoDestroy(this, options);\n if (!(this.schema || (this.schema = (await this._reader.readSchema())!))) {\n await this.cancel();\n }\n }\n return this;\n }\n public async throw(value?: any): Promise> {\n if (!this.closed && this.autoDestroy && (this.closed = true)) {\n return await this.reset()._reader.throw(value);\n }\n return ITERATOR_DONE;\n }\n public async return(value?: any): Promise> {\n if (!this.closed && this.autoDestroy && (this.closed = true)) {\n return await this.reset()._reader.return(value);\n }\n return ITERATOR_DONE;\n }\n public async next() {\n if (this.closed) { return ITERATOR_DONE; }\n let message: Message | null, { _reader: reader } = this;\n while (message = await this._readNextMessageAndValidate()) {\n if (message.isSchema()) {\n await this.reset(message.header());\n } else if (message.isRecordBatch()) {\n this._recordBatchIndex++;\n const header = message.header();\n const buffer = await reader.readMessageBody(message.bodyLength);\n const recordBatch = this._loadRecordBatch(header, buffer);\n return { done: false, value: recordBatch };\n } else if (message.isDictionaryBatch()) {\n this._dictionaryIndex++;\n const header = message.header();\n const buffer = await reader.readMessageBody(message.bodyLength);\n const vector = this._loadDictionaryBatch(header, buffer);\n this.dictionaries.set(header.id, vector);\n }\n }\n if (this.schema && this._recordBatchIndex === 0) {\n this._recordBatchIndex++;\n return { done: false, value: new _InternalEmptyPlaceholderRecordBatch(this.schema) };\n }\n return await this.return();\n }\n protected async _readNextMessageAndValidate(type?: T | null) {\n return await this._reader.readMessage(type);\n }\n}\n\n/** @ignore */\nclass RecordBatchFileReaderImpl extends RecordBatchStreamReaderImpl {\n\n // @ts-ignore\n protected _footer?: Footer;\n // @ts-ignore\n protected _handle: RandomAccessFile;\n public get footer() { return this._footer!; }\n public get numDictionaries() { return this._footer ? this._footer.numDictionaries : 0; }\n public get numRecordBatches() { return this._footer ? this._footer.numRecordBatches : 0; }\n\n constructor(source: RandomAccessFile | ArrayBufferViewInput, dictionaries?: Map) {\n super(source instanceof RandomAccessFile ? source : new RandomAccessFile(source), dictionaries);\n }\n public isSync(): this is RecordBatchReaders { return true; }\n public isFile(): this is RecordBatchFileReaders { return true; }\n public open(options?: OpenOptions) {\n if (!this.closed && !this._footer) {\n this.schema = (this._footer = this._readFooter()).schema;\n for (const block of this._footer.dictionaryBatches()) {\n block && this._readDictionaryBatch(this._dictionaryIndex++);\n }\n }\n return super.open(options);\n }\n public readRecordBatch(index: number) {\n if (this.closed) { return null; }\n if (!this._footer) { this.open(); }\n const block = this._footer && this._footer.getRecordBatch(index);\n if (block && this._handle.seek(block.offset)) {\n const message = this._reader.readMessage(MessageHeader.RecordBatch);\n if (message && message.isRecordBatch()) {\n const header = message.header();\n const buffer = this._reader.readMessageBody(message.bodyLength);\n const recordBatch = this._loadRecordBatch(header, buffer);\n return recordBatch;\n }\n }\n return null;\n }\n protected _readDictionaryBatch(index: number) {\n const block = this._footer && this._footer.getDictionaryBatch(index);\n if (block && this._handle.seek(block.offset)) {\n const message = this._reader.readMessage(MessageHeader.DictionaryBatch);\n if (message && message.isDictionaryBatch()) {\n const header = message.header();\n const buffer = this._reader.readMessageBody(message.bodyLength);\n const vector = this._loadDictionaryBatch(header, buffer);\n this.dictionaries.set(header.id, vector);\n }\n }\n }\n protected _readFooter() {\n const { _handle } = this;\n const offset = _handle.size - magicAndPadding;\n const length = _handle.readInt32(offset);\n const buffer = _handle.readAt(offset - length, length);\n return Footer.decode(buffer);\n }\n protected _readNextMessageAndValidate(type?: T | null): Message | null {\n if (!this._footer) { this.open(); }\n if (this._footer && this._recordBatchIndex < this.numRecordBatches) {\n const block = this._footer && this._footer.getRecordBatch(this._recordBatchIndex);\n if (block && this._handle.seek(block.offset)) {\n return this._reader.readMessage(type);\n }\n }\n return null;\n }\n}\n\n/** @ignore */\nclass AsyncRecordBatchFileReaderImpl extends AsyncRecordBatchStreamReaderImpl\n implements AsyncRecordBatchFileReaderImpl {\n\n protected _footer?: Footer;\n // @ts-ignore\n protected _handle: AsyncRandomAccessFile;\n public get footer() { return this._footer!; }\n public get numDictionaries() { return this._footer ? this._footer.numDictionaries : 0; }\n public get numRecordBatches() { return this._footer ? this._footer.numRecordBatches : 0; }\n\n constructor(source: FileHandle, byteLength?: number, dictionaries?: Map);\n constructor(source: FileHandle | AsyncRandomAccessFile, dictionaries?: Map);\n constructor(source: FileHandle | AsyncRandomAccessFile, ...rest: any[]) {\n const byteLength = typeof rest[0] !== 'number' ? rest.shift() : undefined;\n const dictionaries = rest[0] instanceof Map ? > rest.shift() : undefined;\n super(source instanceof AsyncRandomAccessFile ? source : new AsyncRandomAccessFile(source, byteLength), dictionaries);\n }\n public isFile(): this is RecordBatchFileReaders { return true; }\n public isAsync(): this is AsyncRecordBatchReaders { return true; }\n public async open(options?: OpenOptions) {\n if (!this.closed && !this._footer) {\n this.schema = (this._footer = await this._readFooter()).schema;\n for (const block of this._footer.dictionaryBatches()) {\n block && await this._readDictionaryBatch(this._dictionaryIndex++);\n }\n }\n return await super.open(options);\n }\n public async readRecordBatch(index: number) {\n if (this.closed) { return null; }\n if (!this._footer) { await this.open(); }\n const block = this._footer && this._footer.getRecordBatch(index);\n if (block && (await this._handle.seek(block.offset))) {\n const message = await this._reader.readMessage(MessageHeader.RecordBatch);\n if (message && message.isRecordBatch()) {\n const header = message.header();\n const buffer = await this._reader.readMessageBody(message.bodyLength);\n const recordBatch = this._loadRecordBatch(header, buffer);\n return recordBatch;\n }\n }\n return null;\n }\n protected async _readDictionaryBatch(index: number) {\n const block = this._footer && this._footer.getDictionaryBatch(index);\n if (block && (await this._handle.seek(block.offset))) {\n const message = await this._reader.readMessage(MessageHeader.DictionaryBatch);\n if (message && message.isDictionaryBatch()) {\n const header = message.header();\n const buffer = await this._reader.readMessageBody(message.bodyLength);\n const vector = this._loadDictionaryBatch(header, buffer);\n this.dictionaries.set(header.id, vector);\n }\n }\n }\n protected async _readFooter() {\n const { _handle } = this;\n _handle._pending && await _handle._pending;\n const offset = _handle.size - magicAndPadding;\n const length = await _handle.readInt32(offset);\n const buffer = await _handle.readAt(offset - length, length);\n return Footer.decode(buffer);\n }\n protected async _readNextMessageAndValidate(type?: T | null): Promise | null> {\n if (!this._footer) { await this.open(); }\n if (this._footer && this._recordBatchIndex < this.numRecordBatches) {\n const block = this._footer.getRecordBatch(this._recordBatchIndex);\n if (block && await this._handle.seek(block.offset)) {\n return await this._reader.readMessage(type);\n }\n }\n return null;\n }\n}\n\n/** @ignore */\nclass RecordBatchJSONReaderImpl extends RecordBatchStreamReaderImpl {\n constructor(source: ArrowJSONLike, dictionaries?: Map) {\n super(source, dictionaries);\n }\n protected _loadVectors(header: metadata.RecordBatch, body: any, types: (Field | DataType)[]) {\n return new JSONVectorLoader(body, header.nodes, header.buffers, this.dictionaries).visitMany(types);\n }\n}\n\n//\n// Define some helper functions and static implementations down here. There's\n// a bit of branching in the static methods that can lead to the same routines\n// being executed, so we've broken those out here for readability.\n//\n\n/** @ignore */\nfunction shouldAutoDestroy(self: { autoDestroy: boolean }, options?: OpenOptions) {\n return options && (typeof options['autoDestroy'] === 'boolean') ? options['autoDestroy'] : self['autoDestroy'];\n}\n\n/** @ignore */\nfunction* readAllSync(source: RecordBatchReaders | FromArg0 | FromArg2) {\n const reader = RecordBatchReader.from( source) as RecordBatchReaders;\n try {\n if (!reader.open({ autoDestroy: false }).closed) {\n do { yield reader; } while (!(reader.reset().open()).closed);\n }\n } finally { reader.cancel(); }\n}\n\n/** @ignore */\nasync function* readAllAsync(source: AsyncRecordBatchReaders | FromArg1 | FromArg3 | FromArg4 | FromArg5) {\n const reader = await RecordBatchReader.from( source) as RecordBatchReader;\n try {\n if (!(await reader.open({ autoDestroy: false })).closed) {\n do { yield reader; } while (!(await reader.reset().open()).closed);\n }\n } finally { await reader.cancel(); }\n}\n\n/** @ignore */\nfunction fromArrowJSON(source: ArrowJSONLike) {\n return new RecordBatchStreamReader(new RecordBatchJSONReaderImpl(source));\n}\n\n/** @ignore */\nfunction fromByteStream(source: ByteStream) {\n const bytes = source.peek((magicLength + 7) & ~7);\n return bytes && bytes.byteLength >= 4 ? !checkForMagicArrowString(bytes)\n ? new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(source))\n : new RecordBatchFileReader(new RecordBatchFileReaderImpl(source.read()))\n : new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(function*(): any {}()));\n}\n\n/** @ignore */\nasync function fromAsyncByteStream(source: AsyncByteStream) {\n const bytes = await source.peek((magicLength + 7) & ~7);\n return bytes && bytes.byteLength >= 4 ? !checkForMagicArrowString(bytes)\n ? new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(source))\n : new RecordBatchFileReader(new RecordBatchFileReaderImpl(await source.read()))\n : new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(async function*(): any {}()));\n}\n\n/** @ignore */\nasync function fromFileHandle(source: FileHandle) {\n const { size } = await source.stat();\n const file = new AsyncRandomAccessFile(source, size);\n if (size >= magicX2AndPadding) {\n if (checkForMagicArrowString(await file.readAt(0, (magicLength + 7) & ~7))) {\n return new AsyncRecordBatchFileReader(new AsyncRecordBatchFileReaderImpl(file));\n }\n }\n return new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(file));\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DataType } from '../../type';\nimport { Vector } from '../../vector';\nimport { VectorType as V } from '../../interfaces';\nimport { Builder, BuilderOptions } from '../../builder/index';\n\n/** @ignore */\nexport interface BuilderTransformOptions extends BuilderOptions {\n queueingStrategy?: 'bytes' | 'count';\n dictionaryHashFunction?: (value: any) => string | number;\n readableStrategy?: { highWaterMark?: number, size?: any, type?: 'bytes'; };\n writableStrategy?: { highWaterMark?: number, size?: any, type?: 'bytes'; };\n valueToChildTypeId?: (builder: Builder, value: any, offset: number) => number;\n}\n\n/** @ignore */\nexport function builderThroughDOMStream(options: BuilderTransformOptions) {\n return new BuilderTransform(options);\n}\n\n/** @ignore */\nexport class BuilderTransform {\n\n public readable: ReadableStream>;\n public writable: WritableStream;\n public _controller: ReadableStreamDefaultController> | null;\n\n private _numChunks = 0;\n private _finished = false;\n private _bufferedSize = 0;\n private _builder: Builder;\n private _getSize: (builder: Builder) => number;\n\n constructor(options: BuilderTransformOptions) {\n\n // Access properties by string indexers to defeat closure compiler\n\n const {\n ['readableStrategy']: readableStrategy,\n ['writableStrategy']: writableStrategy,\n ['queueingStrategy']: queueingStrategy = 'count',\n ...builderOptions\n } = options;\n\n this._controller = null;\n this._builder = Builder.new(builderOptions);\n this._getSize = queueingStrategy !== 'bytes' ? chunkLength : chunkByteLength;\n\n const { ['highWaterMark']: readableHighWaterMark = queueingStrategy === 'bytes' ? 2 ** 14 : 1000 } = { ...readableStrategy };\n const { ['highWaterMark']: writableHighWaterMark = queueingStrategy === 'bytes' ? 2 ** 14 : 1000 } = { ...writableStrategy };\n\n this['readable'] = new ReadableStream>({\n ['cancel']: () => { this._builder.clear(); },\n ['pull']: (c) => { this._maybeFlush(this._builder, this._controller = c); },\n ['start']: (c) => { this._maybeFlush(this._builder, this._controller = c); },\n }, {\n 'highWaterMark': readableHighWaterMark,\n 'size': queueingStrategy !== 'bytes' ? chunkLength : chunkByteLength,\n });\n\n this['writable'] = new WritableStream({\n ['abort']: () => { this._builder.clear(); },\n ['write']: () => { this._maybeFlush(this._builder, this._controller); },\n ['close']: () => { this._maybeFlush(this._builder.finish(), this._controller); },\n }, {\n 'highWaterMark': writableHighWaterMark,\n 'size': (value: T['TValue'] | TNull) => this._writeValueAndReturnChunkSize(value),\n });\n }\n\n private _writeValueAndReturnChunkSize(value: T['TValue'] | TNull) {\n const bufferedSize = this._bufferedSize;\n this._bufferedSize = this._getSize(this._builder.append(value));\n return this._bufferedSize - bufferedSize;\n }\n\n private _maybeFlush(builder: Builder, controller: ReadableStreamDefaultController> | null) {\n if (controller === null) { return; }\n if (this._bufferedSize >= controller.desiredSize!) {\n ++this._numChunks && this._enqueue(controller, builder.toVector());\n }\n if (builder.finished) {\n if (builder.length > 0 || this._numChunks === 0) {\n ++this._numChunks && this._enqueue(controller, builder.toVector());\n }\n if (!this._finished && (this._finished = true)) {\n this._enqueue(controller, null);\n }\n }\n }\n\n private _enqueue(controller: ReadableStreamDefaultController>, chunk: V | null) {\n this._bufferedSize = 0;\n this._controller = null;\n chunk === null ? controller.close() : controller.enqueue(chunk);\n }\n}\n\n/** @ignore */ const chunkLength = (chunk: Vector | Builder) => chunk.length;\n/** @ignore */ const chunkByteLength = (chunk: Vector | Builder) => chunk.byteLength;\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Vector } from '../vector';\nimport { RecordBatch } from '../recordbatch';\nimport { DictionaryVector } from '../vector/dictionary';\n\n/** @ignore */\nexport type ValueFunc = (idx: number, cols: RecordBatch) => T | null;\n/** @ignore */\nexport type PredicateFunc = (idx: number, cols: RecordBatch) => boolean;\n\n/** @ignore */\nexport abstract class Value {\n eq(other: Value | T): Predicate {\n if (!(other instanceof Value)) { other = new Literal(other); }\n return new Equals(this, other);\n }\n le(other: Value | T): Predicate {\n if (!(other instanceof Value)) { other = new Literal(other); }\n return new LTeq(this, other);\n }\n ge(other: Value | T): Predicate {\n if (!(other instanceof Value)) { other = new Literal(other); }\n return new GTeq(this, other);\n }\n lt(other: Value | T): Predicate {\n return new Not(this.ge(other));\n }\n gt(other: Value | T): Predicate {\n return new Not(this.le(other));\n }\n ne(other: Value | T): Predicate {\n return new Not(this.eq(other));\n }\n}\n\n/** @ignore */\nexport class Literal extends Value {\n constructor(public v: T) { super(); }\n}\n\n/** @ignore */\nexport class Col extends Value {\n // @ts-ignore\n public vector: Vector;\n // @ts-ignore\n public colidx: number;\n\n constructor(public name: string) { super(); }\n bind(batch: RecordBatch): (idx: number, batch?: RecordBatch) => any {\n if (!this.colidx) {\n // Assume column index doesn't change between calls to bind\n //this.colidx = cols.findIndex(v => v.name.indexOf(this.name) != -1);\n this.colidx = -1;\n const fields = batch.schema.fields;\n for (let idx = -1; ++idx < fields.length;) {\n if (fields[idx].name === this.name) {\n this.colidx = idx;\n break;\n }\n }\n if (this.colidx < 0) { throw new Error(`Failed to bind Col \"${this.name}\"`); }\n }\n\n const vec = this.vector = batch.getChildAt(this.colidx)!;\n return (idx: number) => vec.get(idx);\n }\n}\n\n/** @ignore */\nexport abstract class Predicate {\n abstract bind(batch: RecordBatch): PredicateFunc;\n and(...expr: Predicate[]): And { return new And(this, ...expr); }\n or(...expr: Predicate[]): Or { return new Or(this, ...expr); }\n not(): Predicate { return new Not(this); }\n}\n\n/** @ignore */\nexport abstract class ComparisonPredicate extends Predicate {\n constructor(public readonly left: Value, public readonly right: Value) {\n super();\n }\n\n bind(batch: RecordBatch) {\n if (this.left instanceof Literal) {\n if (this.right instanceof Literal) {\n return this._bindLitLit(batch, this.left, this.right);\n } else { // right is a Col\n\n return this._bindLitCol(batch, this.left, this.right as Col);\n }\n } else { // left is a Col\n if (this.right instanceof Literal) {\n return this._bindColLit(batch, this.left as Col, this.right);\n } else { // right is a Col\n return this._bindColCol(batch, this.left as Col, this.right as Col);\n }\n }\n }\n\n protected abstract _bindLitLit(batch: RecordBatch, left: Literal, right: Literal): PredicateFunc;\n protected abstract _bindColCol(batch: RecordBatch, left: Col, right: Col): PredicateFunc;\n protected abstract _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc;\n protected abstract _bindLitCol(batch: RecordBatch, lit: Literal, col: Col): PredicateFunc;\n}\n\n/** @ignore */\nexport abstract class CombinationPredicate extends Predicate {\n readonly children: Predicate[];\n constructor(...children: Predicate[]) {\n super();\n this.children = children;\n }\n}\n// add children to prototype so it doesn't get mangled in es2015/umd\n( CombinationPredicate.prototype).children = Object.freeze([]); // freeze for safety\n\n/** @ignore */\nexport class And extends CombinationPredicate {\n constructor(...children: Predicate[]) {\n // Flatten any Ands\n children = children.reduce((accum: Predicate[], p: Predicate): Predicate[] => {\n return accum.concat(p instanceof And ? p.children : p);\n }, []);\n super(...children);\n }\n bind(batch: RecordBatch) {\n const bound = this.children.map((p) => p.bind(batch));\n return (idx: number, batch: RecordBatch) => bound.every((p) => p(idx, batch));\n }\n}\n\n/** @ignore */\nexport class Or extends CombinationPredicate {\n constructor(...children: Predicate[]) {\n // Flatten any Ors\n children = children.reduce((accum: Predicate[], p: Predicate): Predicate[] => {\n return accum.concat(p instanceof Or ? p.children : p);\n }, []);\n super(...children);\n }\n bind(batch: RecordBatch) {\n const bound = this.children.map((p) => p.bind(batch));\n return (idx: number, batch: RecordBatch) => bound.some((p) => p(idx, batch));\n }\n}\n\n/** @ignore */\nexport class Equals extends ComparisonPredicate {\n // Helpers used to cache dictionary reverse lookups between calls to bind\n private lastDictionary: Vector|undefined;\n private lastKey: number|undefined;\n\n protected _bindLitLit(_batch: RecordBatch, left: Literal, right: Literal): PredicateFunc {\n const rtrn: boolean = left.v == right.v;\n return () => rtrn;\n }\n\n protected _bindColCol(batch: RecordBatch, left: Col, right: Col): PredicateFunc {\n const left_func = left.bind(batch);\n const right_func = right.bind(batch);\n return (idx: number, batch: RecordBatch) => left_func(idx, batch) == right_func(idx, batch);\n }\n\n protected _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc {\n const col_func = col.bind(batch);\n if (col.vector instanceof DictionaryVector) {\n let key: any;\n const vector = col.vector as DictionaryVector;\n if (vector.dictionary !== this.lastDictionary) {\n key = vector.reverseLookup(lit.v);\n this.lastDictionary = vector.dictionary;\n this.lastKey = key;\n } else {\n key = this.lastKey;\n }\n\n if (key === -1) {\n // the value doesn't exist in the dictionary - always return\n // false\n // TODO: special-case of PredicateFunc that encapsulates this\n // \"always false\" behavior. That way filtering operations don't\n // have to bother checking\n return () => false;\n } else {\n return (idx: number) => {\n return vector.getKey(idx) === key;\n };\n }\n } else {\n return (idx: number, cols: RecordBatch) => col_func(idx, cols) == lit.v;\n }\n }\n\n protected _bindLitCol(batch: RecordBatch, lit: Literal, col: Col) {\n // Equals is commutative\n return this._bindColLit(batch, col, lit);\n }\n}\n\n/** @ignore */\nexport class LTeq extends ComparisonPredicate {\n protected _bindLitLit(_batch: RecordBatch, left: Literal, right: Literal): PredicateFunc {\n const rtrn: boolean = left.v <= right.v;\n return () => rtrn;\n }\n\n protected _bindColCol(batch: RecordBatch, left: Col, right: Col): PredicateFunc {\n const left_func = left.bind(batch);\n const right_func = right.bind(batch);\n return (idx: number, cols: RecordBatch) => left_func(idx, cols) <= right_func(idx, cols);\n }\n\n protected _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc {\n const col_func = col.bind(batch);\n return (idx: number, cols: RecordBatch) => col_func(idx, cols) <= lit.v;\n }\n\n protected _bindLitCol(batch: RecordBatch, lit: Literal, col: Col) {\n const col_func = col.bind(batch);\n return (idx: number, cols: RecordBatch) => lit.v <= col_func(idx, cols);\n }\n}\n\n/** @ignore */\nexport class GTeq extends ComparisonPredicate {\n protected _bindLitLit(_batch: RecordBatch, left: Literal, right: Literal): PredicateFunc {\n const rtrn: boolean = left.v >= right.v;\n return () => rtrn;\n }\n\n protected _bindColCol(batch: RecordBatch, left: Col, right: Col): PredicateFunc {\n const left_func = left.bind(batch);\n const right_func = right.bind(batch);\n return (idx: number, cols: RecordBatch) => left_func(idx, cols) >= right_func(idx, cols);\n }\n\n protected _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc {\n const col_func = col.bind(batch);\n return (idx: number, cols: RecordBatch) => col_func(idx, cols) >= lit.v;\n }\n\n protected _bindLitCol(batch: RecordBatch, lit: Literal, col: Col) {\n const col_func = col.bind(batch);\n return (idx: number, cols: RecordBatch) => lit.v >= col_func(idx, cols);\n }\n}\n\n/** @ignore */\nexport class Not extends Predicate {\n constructor(public readonly child: Predicate) {\n super();\n }\n\n bind(batch: RecordBatch) {\n const func = this.child.bind(batch);\n return (idx: number, batch: RecordBatch) => !func(idx, batch);\n }\n}\n\n/** @ignore */\nexport class CustomPredicate extends Predicate {\n constructor(private next: PredicateFunc, private bind_: (batch: RecordBatch) => void) {\n super();\n }\n\n bind(batch: RecordBatch) {\n this.bind_(batch);\n return this.next;\n }\n}\n\nexport function lit(v: any): Value { return new Literal(v); }\nexport function col(n: string): Col { return new Col(n); }\nexport function and(...p: Predicate[]): And { return new And(...p); }\nexport function or(...p: Predicate[]): Or { return new Or(...p); }\nexport function custom(next: PredicateFunc, bind: (batch: RecordBatch) => void) {\n return new CustomPredicate(next, bind);\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Table } from '../table';\nimport { Vector } from '../vector';\nimport { IntVector } from '../vector/int';\nimport { Field, Schema } from '../schema';\nimport { Predicate, Col } from './predicate';\nimport { RecordBatch } from '../recordbatch';\nimport { VectorType as V } from '../interfaces';\nimport { DataType, Int, Struct, Dictionary } from '../type';\n\n/** @ignore */\nexport type BindFunc = (batch: RecordBatch) => void;\n/** @ignore */\nexport type NextFunc = (idx: number, batch: RecordBatch) => void;\n\nTable.prototype.countBy = function(this: Table, name: Col | string) { return new DataFrame(this.chunks).countBy(name); };\nTable.prototype.scan = function(this: Table, next: NextFunc, bind?: BindFunc) { return new DataFrame(this.chunks).scan(next, bind); };\nTable.prototype.scanReverse = function(this: Table, next: NextFunc, bind?: BindFunc) { return new DataFrame(this.chunks).scanReverse(next, bind); };\nTable.prototype.filter = function(this: Table, predicate: Predicate): FilteredDataFrame { return new DataFrame(this.chunks).filter(predicate); };\n\nexport class DataFrame extends Table {\n public filter(predicate: Predicate): FilteredDataFrame {\n return new FilteredDataFrame(this.chunks, predicate);\n }\n public scan(next: NextFunc, bind?: BindFunc) {\n const batches = this.chunks, numBatches = batches.length;\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n if (bind) { bind(batch); }\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n next(index, batch);\n }\n }\n }\n public scanReverse(next: NextFunc, bind?: BindFunc) {\n const batches = this.chunks, numBatches = batches.length;\n for (let batchIndex = numBatches; --batchIndex >= 0;) {\n // load batches\n const batch = batches[batchIndex];\n if (bind) { bind(batch); }\n // yield all indices\n for (let index = batch.length; --index >= 0;) {\n next(index, batch);\n }\n }\n }\n public countBy(name: Col | string) {\n const batches = this.chunks, numBatches = batches.length;\n const count_by = typeof name === 'string' ? new Col(name) : name as Col;\n // Assume that all dictionary batches are deltas, which means that the\n // last record batch has the most complete dictionary\n count_by.bind(batches[numBatches - 1]);\n const vector = count_by.vector as V;\n if (!DataType.isDictionary(vector.type)) {\n throw new Error('countBy currently only supports dictionary-encoded columns');\n }\n\n const countByteLength = Math.ceil(Math.log(vector.length) / Math.log(256));\n const CountsArrayType = countByteLength == 4 ? Uint32Array :\n countByteLength >= 2 ? Uint16Array : Uint8Array;\n\n const counts = new CountsArrayType(vector.dictionary.length);\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n // rebind the countBy Col\n count_by.bind(batch);\n const keys = (count_by.vector as V).indices;\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n let key = keys.get(index);\n if (key !== null) { counts[key]++; }\n }\n }\n return new CountByResult(vector.dictionary, IntVector.from(counts));\n }\n}\n\n/** @ignore */\nexport class CountByResult extends Table<{ values: T, counts: TCount }> {\n constructor(values: Vector, counts: V) {\n type R = { values: T, counts: TCount };\n const schema = new Schema([\n new Field('values', values.type),\n new Field('counts', counts.type)\n ]);\n super(new RecordBatch(schema, counts.length, [values, counts]));\n }\n public toJSON(): Object {\n const values = this.getColumnAt(0)!;\n const counts = this.getColumnAt(1)!;\n const result = {} as { [k: string]: number | null };\n for (let i = -1; ++i < this.length;) {\n result[values.get(i)] = counts.get(i);\n }\n return result;\n }\n}\n\n/** @ignore */\nexport class FilteredDataFrame extends DataFrame {\n private _predicate: Predicate;\n constructor (batches: RecordBatch[], predicate: Predicate) {\n super(batches);\n this._predicate = predicate;\n }\n public scan(next: NextFunc, bind?: BindFunc) {\n // inlined version of this:\n // this.parent.scan((idx, columns) => {\n // if (this.predicate(idx, columns)) next(idx, columns);\n // });\n const batches = this._chunks;\n const numBatches = batches.length;\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n const predicate = this._predicate.bind(batch);\n let isBound = false;\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n if (predicate(index, batch)) {\n // bind batches lazily - if predicate doesn't match anything\n // in the batch we don't need to call bind on the batch\n if (bind && !isBound) {\n bind(batch);\n isBound = true;\n }\n next(index, batch);\n }\n }\n }\n }\n public scanReverse(next: NextFunc, bind?: BindFunc) {\n const batches = this._chunks;\n const numBatches = batches.length;\n for (let batchIndex = numBatches; --batchIndex >= 0;) {\n // load batches\n const batch = batches[batchIndex];\n const predicate = this._predicate.bind(batch);\n let isBound = false;\n // yield all indices\n for (let index = batch.length; --index >= 0;) {\n if (predicate(index, batch)) {\n // bind batches lazily - if predicate doesn't match anything\n // in the batch we don't need to call bind on the batch\n if (bind && !isBound) {\n bind(batch);\n isBound = true;\n }\n next(index, batch);\n }\n }\n }\n }\n public count(): number {\n // inlined version of this:\n // let sum = 0;\n // this.parent.scan((idx, columns) => {\n // if (this.predicate(idx, columns)) ++sum;\n // });\n // return sum;\n let sum = 0;\n const batches = this._chunks;\n const numBatches = batches.length;\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n const predicate = this._predicate.bind(batch);\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n if (predicate(index, batch)) { ++sum; }\n }\n }\n return sum;\n }\n public *[Symbol.iterator](): IterableIterator['TValue']> {\n // inlined version of this:\n // this.parent.scan((idx, columns) => {\n // if (this.predicate(idx, columns)) next(idx, columns);\n // });\n const batches = this._chunks;\n const numBatches = batches.length;\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n // TODO: bind batches lazily\n // If predicate doesn't match anything in the batch we don't need\n // to bind the callback\n const predicate = this._predicate.bind(batch);\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n if (predicate(index, batch)) { yield batch.get(index) as any; }\n }\n }\n }\n public filter(predicate: Predicate): FilteredDataFrame {\n return new FilteredDataFrame(\n this._chunks,\n this._predicate.and(predicate)\n );\n }\n public countBy(name: Col | string) {\n const batches = this._chunks, numBatches = batches.length;\n const count_by = typeof name === 'string' ? new Col(name) : name as Col;\n // Assume that all dictionary batches are deltas, which means that the\n // last record batch has the most complete dictionary\n count_by.bind(batches[numBatches - 1]);\n const vector = count_by.vector as V;\n if (!DataType.isDictionary(vector.type)) {\n throw new Error('countBy currently only supports dictionary-encoded columns');\n }\n\n const countByteLength = Math.ceil(Math.log(vector.length) / Math.log(256));\n const CountsArrayType = countByteLength == 4 ? Uint32Array :\n countByteLength >= 2 ? Uint16Array : Uint8Array;\n\n const counts = new CountsArrayType(vector.dictionary.length);\n\n for (let batchIndex = -1; ++batchIndex < numBatches;) {\n // load batches\n const batch = batches[batchIndex];\n const predicate = this._predicate.bind(batch);\n // rebind the countBy Col\n count_by.bind(batch);\n const keys = (count_by.vector as V).indices;\n // yield all indices\n for (let index = -1, numRows = batch.length; ++index < numRows;) {\n let key = keys.get(index);\n if (key !== null && predicate(index, batch)) { counts[key]++; }\n }\n }\n return new CountByResult(vector.dictionary, IntVector.from(counts));\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nexport { ArrowType, DateUnit, IntervalUnit, MessageHeader, MetadataVersion, Precision, TimeUnit, Type, UnionMode, BufferType } from './enum';\nexport { Data } from './data';\nexport {\n DataType,\n Null,\n Bool,\n Int, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64,\n Float, Float16, Float32, Float64,\n Utf8,\n Binary,\n FixedSizeBinary,\n Date_, DateDay, DateMillisecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Decimal,\n List,\n Struct,\n Union, DenseUnion, SparseUnion,\n Dictionary,\n Interval, IntervalDayTime, IntervalYearMonth,\n FixedSizeList,\n Map_,\n} from './type';\n\nexport { Table } from './table';\nexport { Column } from './column';\nexport { Visitor } from './visitor';\nexport { Schema, Field } from './schema';\nexport {\n Vector,\n BaseVector,\n BinaryVector,\n BoolVector,\n Chunked,\n DateVector, DateDayVector, DateMillisecondVector,\n DecimalVector,\n DictionaryVector,\n FixedSizeBinaryVector,\n FixedSizeListVector,\n FloatVector, Float16Vector, Float32Vector, Float64Vector,\n IntervalVector, IntervalDayTimeVector, IntervalYearMonthVector,\n IntVector, Int8Vector, Int16Vector, Int32Vector, Int64Vector, Uint8Vector, Uint16Vector, Uint32Vector, Uint64Vector,\n ListVector,\n MapVector,\n NullVector,\n StructVector,\n TimestampVector, TimestampSecondVector, TimestampMillisecondVector, TimestampMicrosecondVector, TimestampNanosecondVector,\n TimeVector, TimeSecondVector, TimeMillisecondVector, TimeMicrosecondVector, TimeNanosecondVector,\n UnionVector, DenseUnionVector, SparseUnionVector,\n Utf8Vector,\n} from './vector/index';\n\nexport {\n Builder,\n BinaryBuilder,\n BoolBuilder,\n DateBuilder, DateDayBuilder, DateMillisecondBuilder,\n DecimalBuilder,\n DictionaryBuilder,\n FixedSizeBinaryBuilder,\n FixedSizeListBuilder,\n FloatBuilder, Float16Builder, Float32Builder, Float64Builder,\n IntervalBuilder, IntervalDayTimeBuilder, IntervalYearMonthBuilder,\n IntBuilder, Int8Builder, Int16Builder, Int32Builder, Int64Builder, Uint8Builder, Uint16Builder, Uint32Builder, Uint64Builder,\n ListBuilder,\n MapBuilder,\n NullBuilder,\n StructBuilder,\n TimestampBuilder, TimestampSecondBuilder, TimestampMillisecondBuilder, TimestampMicrosecondBuilder, TimestampNanosecondBuilder,\n TimeBuilder, TimeSecondBuilder, TimeMillisecondBuilder, TimeMicrosecondBuilder, TimeNanosecondBuilder,\n UnionBuilder, DenseUnionBuilder, SparseUnionBuilder,\n Utf8Builder,\n} from './builder/index';\n\nexport { ByteStream, AsyncByteStream, AsyncByteQueue, ReadableSource, WritableSink } from './io/stream';\nexport { RecordBatchReader, RecordBatchFileReader, RecordBatchStreamReader, AsyncRecordBatchFileReader, AsyncRecordBatchStreamReader } from './ipc/reader';\nexport { RecordBatchWriter, RecordBatchFileWriter, RecordBatchStreamWriter, RecordBatchJSONWriter } from './ipc/writer';\nexport { MessageReader, AsyncMessageReader, JSONMessageReader } from './ipc/message';\nexport { Message } from './ipc/metadata/message';\nexport { RecordBatch } from './recordbatch';\nexport { ArrowJSONLike, FileHandle, Readable, Writable, ReadableWritable, ReadableDOMStreamOptions } from './io/interfaces';\nexport { DataFrame, FilteredDataFrame, CountByResult, BindFunc, NextFunc } from './compute/dataframe';\n\nimport * as util_bn_ from './util/bn';\nimport * as util_int_ from './util/int';\nimport * as util_bit_ from './util/bit';\nimport * as util_math_ from './util/math';\nimport * as util_buffer_ from './util/buffer';\nimport * as util_vector_ from './util/vector';\nimport * as predicate from './compute/predicate';\n\nexport { predicate };\n/** @ignore */\nexport const util = {\n ...util_bn_,\n ...util_int_,\n ...util_bit_,\n ...util_math_,\n ...util_buffer_,\n ...util_vector_\n};\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport streamAdapters from './io/adapters';\nimport { Builder } from './builder/index';\nimport { RecordBatchReader } from './ipc/reader';\nimport { RecordBatchWriter } from './ipc/writer';\nimport { toDOMStream } from './io/whatwg/iterable';\nimport { builderThroughDOMStream } from './io/whatwg/builder';\nimport { recordBatchReaderThroughDOMStream } from './io/whatwg/reader';\nimport { recordBatchWriterThroughDOMStream } from './io/whatwg/writer';\n\nstreamAdapters.toDOMStream = toDOMStream;\nBuilder['throughDOM'] = builderThroughDOMStream;\nRecordBatchReader['throughDOM'] = recordBatchReaderThroughDOMStream;\nRecordBatchWriter['throughDOM'] = recordBatchWriterThroughDOMStream;\n\nexport {\n ArrowType, DateUnit, IntervalUnit, MessageHeader, MetadataVersion, Precision, TimeUnit, Type, UnionMode, BufferType,\n Data,\n DataType,\n Null,\n Bool,\n Int, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64,\n Float, Float16, Float32, Float64,\n Utf8,\n Binary,\n FixedSizeBinary,\n Date_, DateDay, DateMillisecond,\n Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond,\n Time, TimeSecond, TimeMillisecond, TimeMicrosecond, TimeNanosecond,\n Decimal,\n List,\n Struct,\n Union, DenseUnion, SparseUnion,\n Dictionary,\n Interval, IntervalDayTime, IntervalYearMonth,\n FixedSizeList,\n Map_,\n Table,\n Column,\n Schema, Field,\n Visitor,\n Vector,\n BaseVector,\n BinaryVector,\n BoolVector,\n Chunked,\n DateVector, DateDayVector, DateMillisecondVector,\n DecimalVector,\n DictionaryVector,\n FixedSizeBinaryVector,\n FixedSizeListVector,\n FloatVector, Float16Vector, Float32Vector, Float64Vector,\n IntervalVector, IntervalDayTimeVector, IntervalYearMonthVector,\n IntVector, Int8Vector, Int16Vector, Int32Vector, Int64Vector, Uint8Vector, Uint16Vector, Uint32Vector, Uint64Vector,\n ListVector,\n MapVector,\n NullVector,\n StructVector,\n TimestampVector, TimestampSecondVector, TimestampMillisecondVector, TimestampMicrosecondVector, TimestampNanosecondVector,\n TimeVector, TimeSecondVector, TimeMillisecondVector, TimeMicrosecondVector, TimeNanosecondVector,\n UnionVector, DenseUnionVector, SparseUnionVector,\n Utf8Vector,\n ByteStream, AsyncByteStream, AsyncByteQueue, ReadableSource, WritableSink,\n RecordBatchReader, RecordBatchFileReader, RecordBatchStreamReader, AsyncRecordBatchFileReader, AsyncRecordBatchStreamReader,\n RecordBatchWriter, RecordBatchFileWriter, RecordBatchStreamWriter, RecordBatchJSONWriter,\n MessageReader, AsyncMessageReader, JSONMessageReader,\n Message,\n RecordBatch,\n ArrowJSONLike, FileHandle, Readable, Writable, ReadableWritable, ReadableDOMStreamOptions,\n DataFrame, FilteredDataFrame, CountByResult, BindFunc, NextFunc,\n predicate,\n util,\n Builder,\n BinaryBuilder,\n BoolBuilder,\n DateBuilder, DateDayBuilder, DateMillisecondBuilder,\n DecimalBuilder,\n DictionaryBuilder,\n FixedSizeBinaryBuilder,\n FixedSizeListBuilder,\n FloatBuilder, Float16Builder, Float32Builder, Float64Builder,\n IntervalBuilder, IntervalDayTimeBuilder, IntervalYearMonthBuilder,\n IntBuilder, Int8Builder, Int16Builder, Int32Builder, Int64Builder, Uint8Builder, Uint16Builder, Uint32Builder, Uint64Builder,\n ListBuilder,\n MapBuilder,\n NullBuilder,\n StructBuilder,\n TimestampBuilder, TimestampSecondBuilder, TimestampMillisecondBuilder, TimestampMicrosecondBuilder, TimestampNanosecondBuilder,\n TimeBuilder, TimeSecondBuilder, TimeMillisecondBuilder, TimeMicrosecondBuilder, TimeNanosecondBuilder,\n UnionBuilder, DenseUnionBuilder, SparseUnionBuilder,\n Utf8Builder,\n} from './Arrow';\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { toUint8Array } from '../../util/buffer';\nimport { ReadableDOMStreamOptions } from '../../io/interfaces';\nimport { isIterable, isAsyncIterable } from '../../util/compat';\n\n/** @ignore */\nexport function toDOMStream(source: Iterable | AsyncIterable, options?: ReadableDOMStreamOptions): ReadableStream {\n if (isAsyncIterable(source)) { return asyncIterableAsReadableDOMStream(source, options); }\n if (isIterable(source)) { return iterableAsReadableDOMStream(source, options); }\n /* istanbul ignore next */\n throw new Error(`toDOMStream() must be called with an Iterable or AsyncIterable`);\n}\n\n/** @ignore */\nfunction iterableAsReadableDOMStream(source: Iterable, options?: ReadableDOMStreamOptions) {\n\n let it: Iterator | null = null;\n const bm = (options && options.type === 'bytes') || false;\n const hwm = options && options.highWaterMark || (2 ** 24);\n\n return new ReadableStream({\n ...options as any,\n start(controller) { next(controller, it || (it = source[Symbol.iterator]())); },\n pull(controller) { it ? (next(controller, it)) : controller.close(); },\n cancel() { (it && (it.return && it.return()) || true) && (it = null); }\n }, { highWaterMark: bm ? hwm : undefined, ...options });\n\n function next(controller: ReadableStreamDefaultController, it: Iterator) {\n let buf: Uint8Array;\n let r: IteratorResult | null = null;\n let size = controller.desiredSize || null;\n while (!(r = it.next(bm ? size : null)).done) {\n if (ArrayBuffer.isView(r.value) && (buf = toUint8Array(r.value))) {\n size != null && bm && (size = size - buf.byteLength + 1);\n r.value = buf;\n }\n controller.enqueue(r.value);\n if (size != null && --size <= 0) { return; }\n }\n controller.close();\n }\n}\n\n/** @ignore */\nfunction asyncIterableAsReadableDOMStream(source: AsyncIterable, options?: ReadableDOMStreamOptions) {\n\n let it: AsyncIterator | null = null;\n const bm = (options && options.type === 'bytes') || false;\n const hwm = options && options.highWaterMark || (2 ** 24);\n\n return new ReadableStream({\n ...options as any,\n async start(controller) { await next(controller, it || (it = source[Symbol.asyncIterator]())); },\n async pull(controller) { it ? (await next(controller, it)) : controller.close(); },\n async cancel() { (it && (it.return && await it.return()) || true) && (it = null); },\n }, { highWaterMark: bm ? hwm : undefined, ...options });\n\n async function next(controller: ReadableStreamDefaultController, it: AsyncIterator) {\n let buf: Uint8Array;\n let r: IteratorResult | null = null;\n let size = controller.desiredSize || null;\n while (!(r = await it.next(bm ? size : null)).done) {\n if (ArrayBuffer.isView(r.value) && (buf = toUint8Array(r.value))) {\n size != null && bm && (size = size - buf.byteLength + 1);\n r.value = buf;\n }\n controller.enqueue(r.value);\n if (size != null && --size <= 0) { return; }\n }\n controller.close();\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DataType } from '../../type';\nimport { RecordBatch } from '../../recordbatch';\nimport { AsyncByteQueue } from '../../io/stream';\nimport { RecordBatchReader } from '../../ipc/reader';\n\n/** @ignore */\nexport function recordBatchReaderThroughDOMStream(writableStrategy?: ByteLengthQueuingStrategy, readableStrategy?: { autoDestroy: boolean }) {\n\n const queue = new AsyncByteQueue();\n let reader: RecordBatchReader | null = null;\n\n const readable = new ReadableStream>({\n async cancel() { await queue.close(); },\n async start(controller) { await next(controller, reader || (reader = await open())); },\n async pull(controller) { reader ? await next(controller, reader) : controller.close(); }\n });\n\n return { writable: new WritableStream(queue, { 'highWaterMark': 2 ** 14, ...writableStrategy }), readable };\n\n async function open() {\n return await (await RecordBatchReader.from(queue)).open(readableStrategy);\n }\n\n async function next(controller: ReadableStreamDefaultController>, reader: RecordBatchReader) {\n let size = controller.desiredSize;\n let r: IteratorResult> | null = null;\n while (!(r = await reader.next()).done) {\n controller.enqueue(r.value);\n if (size != null && --size <= 0) {\n return;\n }\n }\n controller.close();\n }\n}\n","// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DataType } from '../../type';\nimport { RecordBatch } from '../../recordbatch';\nimport { AsyncByteStream } from '../../io/stream';\nimport { RecordBatchWriter } from '../../ipc/writer';\n\n/** @ignore */\nexport function recordBatchWriterThroughDOMStream(\n this: typeof RecordBatchWriter,\n writableStrategy?: QueuingStrategy> & { autoDestroy: boolean },\n readableStrategy?: { highWaterMark?: number, size?: any }\n) {\n\n const writer = new this(writableStrategy);\n const reader = new AsyncByteStream(writer);\n const readable = new ReadableStream({\n type: 'bytes',\n async cancel() { await reader.cancel(); },\n async pull(controller) { await next(controller); },\n async start(controller) { await next(controller); },\n }, { 'highWaterMark': 2 ** 14, ...readableStrategy });\n\n return { writable: new WritableStream(writer, writableStrategy), readable };\n\n async function next(controller: ReadableStreamDefaultController) {\n let buf: Uint8Array | null = null;\n let size = controller.desiredSize;\n while (buf = await reader.read(size || null)) {\n controller.enqueue(buf);\n if (size != null && (size -= buf.byteLength) <= 0) { return; }\n }\n controller.close();\n }\n}\n","/**\n * @license\n * Copyright 2018-2021 Streamlit Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Table, Type } from \"apache-arrow\";\nvar ArrowTable = /** @class */ (function () {\n function ArrowTable(dataBuffer, indexBuffer, columnsBuffer, styler) {\n var _this = this;\n this.getCell = function (rowIndex, columnIndex) {\n var isBlankCell = rowIndex < _this.headerRows && columnIndex < _this.headerColumns;\n var isIndexCell = rowIndex >= _this.headerRows && columnIndex < _this.headerColumns;\n var isColumnsCell = rowIndex < _this.headerRows && columnIndex >= _this.headerColumns;\n if (isBlankCell) {\n var classNames = [\"blank\"];\n if (columnIndex > 0) {\n classNames.push(\"level\" + rowIndex);\n }\n return {\n type: \"blank\",\n classNames: classNames.join(\" \"),\n content: \"\"\n };\n }\n else if (isColumnsCell) {\n var dataColumnIndex = columnIndex - _this.headerColumns;\n var classNames = [\n \"col_heading\",\n \"level\" + rowIndex,\n \"col\" + dataColumnIndex\n ];\n return {\n type: \"columns\",\n classNames: classNames.join(\" \"),\n content: _this.getContent(_this.columnsTable, dataColumnIndex, rowIndex)\n };\n }\n else if (isIndexCell) {\n var dataRowIndex = rowIndex - _this.headerRows;\n var classNames = [\n \"row_heading\",\n \"level\" + columnIndex,\n \"row\" + dataRowIndex\n ];\n return {\n type: \"index\",\n id: \"T_\" + _this.uuid + \"level\" + columnIndex + \"_row\" + dataRowIndex,\n classNames: classNames.join(\" \"),\n content: _this.getContent(_this.indexTable, dataRowIndex, columnIndex)\n };\n }\n else {\n var dataRowIndex = rowIndex - _this.headerRows;\n var dataColumnIndex = columnIndex - _this.headerColumns;\n var classNames = [\n \"data\",\n \"row\" + dataRowIndex,\n \"col\" + dataColumnIndex\n ];\n var content = _this.styler\n ? _this.getContent(_this.styler.displayValuesTable, dataRowIndex, dataColumnIndex)\n : _this.getContent(_this.dataTable, dataRowIndex, dataColumnIndex);\n return {\n type: \"data\",\n id: \"T_\" + _this.uuid + \"row\" + dataRowIndex + \"_col\" + dataColumnIndex,\n classNames: classNames.join(\" \"),\n content: content\n };\n }\n };\n this.getContent = function (table, rowIndex, columnIndex) {\n var column = table.getColumnAt(columnIndex);\n if (column === null) {\n return \"\";\n }\n var columnTypeId = _this.getColumnTypeId(table, columnIndex);\n switch (columnTypeId) {\n case Type.Timestamp: {\n return _this.nanosToDate(column.get(rowIndex));\n }\n default: {\n return column.get(rowIndex);\n }\n }\n };\n this.dataTable = Table.from(dataBuffer);\n this.indexTable = Table.from(indexBuffer);\n this.columnsTable = Table.from(columnsBuffer);\n this.styler = styler\n ? {\n caption: styler.caption,\n displayValuesTable: Table.from(styler.displayValues),\n styles: styler.styles,\n uuid: styler.uuid\n }\n : undefined;\n }\n Object.defineProperty(ArrowTable.prototype, \"rows\", {\n get: function () {\n return this.indexTable.length + this.columnsTable.numCols;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"columns\", {\n get: function () {\n return this.indexTable.numCols + this.columnsTable.length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"headerRows\", {\n get: function () {\n return this.rows - this.dataRows;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"headerColumns\", {\n get: function () {\n return this.columns - this.dataColumns;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"dataRows\", {\n get: function () {\n return this.dataTable.length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"dataColumns\", {\n get: function () {\n return this.dataTable.numCols;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"uuid\", {\n get: function () {\n return this.styler && this.styler.uuid;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"caption\", {\n get: function () {\n return this.styler && this.styler.caption;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"styles\", {\n get: function () {\n return this.styler && this.styler.styles;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"table\", {\n get: function () {\n return this.dataTable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"index\", {\n get: function () {\n return this.indexTable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ArrowTable.prototype, \"columnTable\", {\n get: function () {\n return this.columnsTable;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Serialize arrow table.\n */\n ArrowTable.prototype.serialize = function () {\n return {\n data: this.dataTable.serialize(),\n index: this.indexTable.serialize(),\n columns: this.columnsTable.serialize()\n };\n };\n /**\n * Returns apache-arrow specific typeId of column.\n */\n ArrowTable.prototype.getColumnTypeId = function (table, columnIndex) {\n return table.schema.fields[columnIndex].type.typeId;\n };\n ArrowTable.prototype.nanosToDate = function (nanos) {\n return new Date(nanos / 1e6);\n };\n return ArrowTable;\n}());\nexport { ArrowTable };\n","/**\n * @license\n * Copyright 2018-2021 Streamlit Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n// Safari doesn't support the EventTarget class, so we use a shim.\nimport { EventTarget } from \"event-target-shim\";\nimport { ArrowTable } from \"./ArrowTable\";\n/** Messages from Component -> Streamlit */\nvar ComponentMessageType;\n(function (ComponentMessageType) {\n // A component sends this message when it's ready to receive messages\n // from Streamlit. Streamlit won't send any messages until it gets this.\n // Data: { apiVersion: number }\n ComponentMessageType[\"COMPONENT_READY\"] = \"streamlit:componentReady\";\n // The component has a new widget value. Send it back to Streamlit, which\n // will then re-run the app.\n // Data: { value: any }\n ComponentMessageType[\"SET_COMPONENT_VALUE\"] = \"streamlit:setComponentValue\";\n // The component has a new height for its iframe.\n // Data: { height: number }\n ComponentMessageType[\"SET_FRAME_HEIGHT\"] = \"streamlit:setFrameHeight\";\n})(ComponentMessageType || (ComponentMessageType = {}));\n/**\n * Streamlit communication API.\n *\n * Components can send data to Streamlit via the functions defined here,\n * and receive data from Streamlit via the `events` property.\n */\nvar Streamlit = /** @class */ (function () {\n function Streamlit() {\n }\n /**\n * The Streamlit component API version we're targetting.\n * There's currently only 1!\n */\n Streamlit.API_VERSION = 1;\n Streamlit.RENDER_EVENT = \"streamlit:render\";\n /** Dispatches events received from Streamlit. */\n Streamlit.events = new EventTarget();\n Streamlit.registeredMessageListener = false;\n /**\n * Tell Streamlit that the component is ready to start receiving data.\n * Streamlit will defer emitting RENDER events until it receives the\n * COMPONENT_READY message.\n */\n Streamlit.setComponentReady = function () {\n if (!Streamlit.registeredMessageListener) {\n // Register for message events if we haven't already\n window.addEventListener(\"message\", Streamlit.onMessageEvent);\n Streamlit.registeredMessageListener = true;\n }\n Streamlit.sendBackMsg(ComponentMessageType.COMPONENT_READY, {\n apiVersion: Streamlit.API_VERSION\n });\n };\n /**\n * Report the component's height to Streamlit.\n * This should be called every time the component changes its DOM - that is,\n * when it's first loaded, and any time it updates.\n */\n Streamlit.setFrameHeight = function (height) {\n if (height === undefined) {\n // `height` is optional. If undefined, it defaults to scrollHeight,\n // which is the entire height of the element minus its border,\n // scrollbar, and margin.\n height = document.body.scrollHeight;\n }\n if (height === Streamlit.lastFrameHeight) {\n // Don't bother updating if our height hasn't changed.\n return;\n }\n Streamlit.lastFrameHeight = height;\n Streamlit.sendBackMsg(ComponentMessageType.SET_FRAME_HEIGHT, { height: height });\n };\n /**\n * Set the component's value. This value will be returned to the Python\n * script, and the script will be re-run.\n *\n * For example:\n *\n * JavaScript:\n * Streamlit.setComponentValue(\"ahoy!\")\n *\n * Python:\n * value = st.my_component(...)\n * st.write(value) # -> \"ahoy!\"\n *\n * The value must be an ArrowTable, a typed array, an ArrayBuffer, or be\n * serializable to JSON.\n */\n Streamlit.setComponentValue = function (value) {\n var dataType;\n if (value instanceof ArrowTable) {\n dataType = \"dataframe\";\n value = value.serialize();\n }\n else if (isTypedArray(value)) {\n // All typed arrays get sent as Uint8Array, because that's what our\n // protobuf library uses for the \"bytes\" field type.\n dataType = \"bytes\";\n value = new Uint8Array(value.buffer);\n }\n else if (value instanceof ArrayBuffer) {\n dataType = \"bytes\";\n value = new Uint8Array(value);\n }\n else {\n dataType = \"json\";\n }\n Streamlit.sendBackMsg(ComponentMessageType.SET_COMPONENT_VALUE, {\n value: value,\n dataType: dataType\n });\n };\n /** Receive a ForwardMsg from the Streamlit app */\n Streamlit.onMessageEvent = function (event) {\n var type = event.data[\"type\"];\n switch (type) {\n case Streamlit.RENDER_EVENT:\n Streamlit.onRenderMessage(event.data);\n break;\n }\n };\n /**\n * Handle an untyped Streamlit render event and redispatch it as a\n * StreamlitRenderEvent.\n */\n Streamlit.onRenderMessage = function (data) {\n var args = data[\"args\"];\n if (args == null) {\n console.error(\"Got null args in onRenderMessage. This should never happen\");\n args = {};\n }\n // Parse our dataframe arguments with arrow, and merge them into our args dict\n var dataframeArgs = data[\"dfs\"] && data[\"dfs\"].length > 0\n ? Streamlit.argsDataframeToObject(data[\"dfs\"])\n : {};\n args = __assign(__assign({}, args), dataframeArgs);\n var disabled = Boolean(data[\"disabled\"]);\n var theme = data[\"theme\"];\n if (theme) {\n _injectTheme(theme);\n }\n // Dispatch a render event!\n var eventData = { disabled: disabled, args: args, theme: theme };\n var event = new CustomEvent(Streamlit.RENDER_EVENT, {\n detail: eventData\n });\n Streamlit.events.dispatchEvent(event);\n };\n Streamlit.argsDataframeToObject = function (argsDataframe) {\n var argsDataframeArrow = argsDataframe.map(function (_a) {\n var key = _a.key, value = _a.value;\n return [key, Streamlit.toArrowTable(value)];\n });\n return Object.fromEntries(argsDataframeArrow);\n };\n Streamlit.toArrowTable = function (df) {\n var _a = df.data, data = _a.data, index = _a.index, columns = _a.columns, styler = _a.styler;\n return new ArrowTable(data, index, columns, styler);\n };\n /** Post a message to the Streamlit app. */\n Streamlit.sendBackMsg = function (type, data) {\n window.parent.postMessage(__assign({ isStreamlitMessage: true, type: type }, data), \"*\");\n };\n return Streamlit;\n}());\nexport { Streamlit };\nvar _injectTheme = function (theme) {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n style.innerHTML = \"\\n :root {\\n --primary-color: \" + theme.primaryColor + \";\\n --background-color: \" + theme.backgroundColor + \";\\n --secondary-background-color: \" + theme.secondaryBackgroundColor + \";\\n --text-color: \" + theme.textColor + \";\\n --font: \" + theme.font + \";\\n }\\n\\n body {\\n background-color: var(--background-color);\\n color: var(--text-color);\\n }\\n \";\n};\n/** True if the value is a TypedArray. */\nfunction isTypedArray(value) {\n var isBigIntArray = false;\n try {\n isBigIntArray =\n value instanceof BigInt64Array || value instanceof BigUint64Array;\n }\n catch (e) {\n // Ignore cause Safari does not support this\n // https://caniuse.com/mdn-javascript_builtins_bigint64array\n }\n return (value instanceof Int8Array ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Int16Array ||\n value instanceof Uint16Array ||\n value instanceof Int32Array ||\n value instanceof Uint32Array ||\n value instanceof Float32Array ||\n value instanceof Float64Array ||\n isBigIntArray);\n}\n","/**\n * @license\n * Copyright 2018-2021 Streamlit Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport React from \"react\";\nimport { Streamlit } from \"./streamlit\";\n/**\n * Optional Streamlit React-based component base class.\n *\n * You are not required to extend this base class to create a Streamlit\n * component. If you decide not to extend it, you should implement the\n * `componentDidMount` and `componentDidUpdate` functions in your own class,\n * so that your plugin properly resizes.\n */\nvar StreamlitComponentBase = /** @class */ (function (_super) {\n __extends(StreamlitComponentBase, _super);\n function StreamlitComponentBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n StreamlitComponentBase.prototype.componentDidMount = function () {\n // After we're rendered for the first time, tell Streamlit that our height\n // has changed.\n Streamlit.setFrameHeight();\n };\n StreamlitComponentBase.prototype.componentDidUpdate = function () {\n // After we're updated, tell Streamlit that our height may have changed.\n Streamlit.setFrameHeight();\n };\n return StreamlitComponentBase;\n}(React.PureComponent));\nexport { StreamlitComponentBase };\n/**\n * Wrapper for React-based Streamlit components.\n *\n * Bootstraps the communication interface between Streamlit and the component.\n */\nexport function withStreamlitConnection(WrappedComponent) {\n var ComponentWrapper = /** @class */ (function (_super) {\n __extends(ComponentWrapper, _super);\n function ComponentWrapper(props) {\n var _this = _super.call(this, props) || this;\n _this.componentDidMount = function () {\n // Set up event listeners, and signal to Streamlit that we're ready.\n // We won't render the component until we receive the first RENDER_EVENT.\n Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, _this.onRenderEvent);\n Streamlit.setComponentReady();\n };\n _this.componentDidUpdate = function () {\n // If our child threw an error, we display it in render(). In this\n // case, the child won't be mounted and therefore won't call\n // `setFrameHeight` on its own. We do it here so that the rendered\n // error will be visible.\n if (_this.state.componentError != null) {\n Streamlit.setFrameHeight();\n }\n };\n _this.componentWillUnmount = function () {\n Streamlit.events.removeEventListener(Streamlit.RENDER_EVENT, _this.onRenderEvent);\n };\n /**\n * Streamlit is telling this component to redraw.\n * We save the render data in State, so that it can be passed to the\n * component in our own render() function.\n */\n _this.onRenderEvent = function (event) {\n // Update our state with the newest render data\n var renderEvent = event;\n _this.setState({ renderData: renderEvent.detail });\n };\n _this.render = function () {\n // If our wrapped component threw an error, display it.\n if (_this.state.componentError != null) {\n return (React.createElement(\"div\", null,\n React.createElement(\"h1\", null, \"Component Error\"),\n React.createElement(\"span\", null, _this.state.componentError.message)));\n }\n // Don't render until we've gotten our first RENDER_EVENT from Streamlit.\n if (_this.state.renderData == null) {\n return null;\n }\n return (React.createElement(WrappedComponent, { width: window.innerWidth, disabled: _this.state.renderData.disabled, args: _this.state.renderData.args, theme: _this.state.renderData.theme }));\n };\n _this.state = {\n renderData: undefined,\n componentError: undefined\n };\n return _this;\n }\n /**\n * Error boundary function. This will be called if our wrapped\n * component throws an error. We store the caught error in our state,\n * and display it in the next render().\n */\n ComponentWrapper.getDerivedStateFromError = function (error) {\n return { componentError: error };\n };\n return ComponentWrapper;\n }(React.PureComponent));\n return hoistNonReactStatics(ComponentWrapper, WrappedComponent);\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.14.0\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var l=require(\"object-assign\"),n=\"function\"===typeof Symbol&&Symbol.for,p=n?Symbol.for(\"react.element\"):60103,q=n?Symbol.for(\"react.portal\"):60106,r=n?Symbol.for(\"react.fragment\"):60107,t=n?Symbol.for(\"react.strict_mode\"):60108,u=n?Symbol.for(\"react.profiler\"):60114,v=n?Symbol.for(\"react.provider\"):60109,w=n?Symbol.for(\"react.context\"):60110,x=n?Symbol.for(\"react.forward_ref\"):60112,y=n?Symbol.for(\"react.suspense\"):60113,z=n?Symbol.for(\"react.memo\"):60115,A=n?Symbol.for(\"react.lazy\"):\n60116,B=\"function\"===typeof Symbol&&Symbol.iterator;function C(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k).detail\n\n if (data.theme) {\n labelDiv.style.font = data.theme.font\n labelDiv.style.color = data.theme.textColor\n if (data.theme.base === \"dark\") {\n document.body.querySelectorAll(\".box, .caption\").forEach((el) => {\n el.classList.add(\"dark\")\n })\n } else {\n document.body.querySelectorAll(\".box, .caption\").forEach((el) => {\n el.classList.remove(\"dark\")\n })\n }\n\n // TODO: Gray out the component if it's disabled.\n }\n\n label.textContent = data.args[\"label\"]\n let images = data.args[\"images\"]\n let captions = data.args[\"captions\"]\n // console.log(captions)\n\n if (container.childNodes.length === 0) {\n images.forEach((image: string, i: number) => {\n let item = container.appendChild(document.createElement(\"div\"))\n item.classList.add(\"item\")\n if (data.args[\"use_container_width\"] === true) {\n item.classList.add(\"stretch\")\n }\n\n let box = item.appendChild(document.createElement(\"div\"))\n box.classList.add(\"image-box\")\n\n let img = box.appendChild(document.createElement(\"img\"))\n img.classList.add(\"image\")\n img.src = image\n\n if (captions) {\n let caption = item.appendChild(document.createElement(\"div\"))\n caption.classList.add(\"caption\")\n caption.textContent = captions[i]\n }\n\n if (i === data.args[\"index\"]) {\n box.classList.add(\"selected\")\n img.classList.add(\"selected\")\n }\n\n img.onclick = function () {\n container.querySelectorAll(\".selected\").forEach((el) => {\n el.classList.remove(\"selected\")\n })\n Streamlit.setComponentValue(i)\n box.classList.add(\"selected\")\n img.classList.add(\"selected\")\n }\n })\n }\n\n // We tell Streamlit to update our frameHeight after each render event, in\n // case it has changed. (This isn't strictly necessary for the example\n // because our height stays fixed, but this is a low-cost function, so\n // there's no harm in doing it redundantly.)\n Streamlit.setFrameHeight()\n}\n\n// Attach our `onRender` handler to Streamlit's render event.\nStreamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender)\n\n// Tell Streamlit we're ready to start receiving data. We won't get our\n// first RENDER_EVENT until we call this function.\nStreamlit.setComponentReady()\n\n// Finally, tell Streamlit to update our initial height. We omit the\n// `height` parameter here to have it default to our scrollHeight.\nStreamlit.setFrameHeight()\n"],"sourceRoot":""} \ No newline at end of file diff --git a/streamlit_image_select/frontend/build/static/js/runtime-main.fce4c018.js b/streamlit_image_select/frontend/build/static/js/runtime-main.fce4c018.js new file mode 100644 index 0000000..b60c3df --- /dev/null +++ b/streamlit_image_select/frontend/build/static/js/runtime-main.fce4c018.js @@ -0,0 +1,2 @@ +!function(e){function t(t){for(var n,l,i=t[0],a=t[1],f=t[2],p=0,s=[];p Date: Tue, 26 Mar 2024 06:11:36 +0530 Subject: [PATCH 4/4] center boxes (mobile view) --- .gitignore | 2 +- streamlit_image_select/frontend/build/styles.css | 1 + streamlit_image_select/frontend/public/styles.css | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1a2389d..4f3f2a9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ __pycache__/ # Distribution / packaging .Python -build/ +# build/ develop-eggs/ dist/ downloads/ diff --git a/streamlit_image_select/frontend/build/styles.css b/streamlit_image_select/frontend/build/styles.css index e0be288..bf12158 100644 --- a/streamlit_image_select/frontend/build/styles.css +++ b/streamlit_image_select/frontend/build/styles.css @@ -31,6 +31,7 @@ label { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; + justify-content: center; } .item { diff --git a/streamlit_image_select/frontend/public/styles.css b/streamlit_image_select/frontend/public/styles.css index e0be288..bf12158 100644 --- a/streamlit_image_select/frontend/public/styles.css +++ b/streamlit_image_select/frontend/public/styles.css @@ -31,6 +31,7 @@ label { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; + justify-content: center; } .item {