1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6981],{86981:(t,e,i)=>{i.r(e),i.d(e,{AsyncDuckDB:()=>ia,AsyncDuckDBConnection:()=>e8,AsyncDuckDBDispatcher:()=>id,AsyncPreparedStatement:()=>e5,AsyncResultStreamIterator:()=>e6,ConsoleLogger:()=>eJ,DuckDBAccessMode:()=>ej,DuckDBDataProtocol:()=>io,IsArrowBuffer:()=>e3,IsDuckDBWasmRetry:()=>e4,LogEvent:()=>eK,LogLevel:()=>eQ,LogOrigin:()=>eq,LogTopic:()=>eY,PACKAGE_NAME:()=>i_,PACKAGE_VERSION:()=>ib,PACKAGE_VERSION_MAJOR:()=>iy,PACKAGE_VERSION_MINOR:()=>ig,PACKAGE_VERSION_PATCH:()=>im,StatusCode:()=>e2,TokenType:()=>eG,VoidLogger:()=>eZ,WorkerRequestType:()=>e9,WorkerResponseType:()=>e7,WorkerTask:()=>it,createWorker:()=>iL,getJsDelivrBundles:()=>iR,getLogEventLabel:()=>eX,getLogLevelLabel:()=>e$,getLogOriginLabel:()=>e1,getLogTopicLabel:()=>e0,getPlatformFeatures:()=>iN,isFirefox:()=>iE,isNode:()=>iI,isSafari:()=>iS,selectBundle:()=>iB});var s,r,n,a,o,d,h,l=i(38230),c=i(12841),u=i(23172),_=i(75401);!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"}(s||(s={}));class b{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,i,s){return t.prep(8,24),t.writeInt64(BigInt(null!=s?s:0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}let f=new Int32Array(2),p=new Float32Array(f.buffer),y=new Float64Array(f.buffer),g=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(r||(r={}));class m{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new m(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return f[0]=this.readInt32(t),p[0]}readFloat64(t){return f[+!g]=this.readInt32(t),f[+!!g]=this.readInt32(t+4),y[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){p[0]=e,this.writeInt32(t,f[0])}writeFloat64(t,e){y[0]=e,this.writeInt32(t,f[+!g]),this.writeInt32(t+4,f[+!!g])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+i);return e===r.UTF8_BYTES?s:this.text_decoder_.decode(s)}
1__union_with_string(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let i=[];for(let s=0;s<e;++s){let e=t(s);null!==e&&i.push(e)}return i}createObjList(t,e){let i=[];for(let s=0;s<e;++s){let e=t(s);null!==e&&i.push(e.unpack())}return i}}class I{constructor(t){let 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,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=m.allocate(e),this.space=e}clear(){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,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){let t=this.bb.capacity();this.bb=I.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){null!==this.vtable&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(0xc0000000&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=e<<1,s=m.allocate(i);return s.setPosition(i-e),s.bytes().set(t.bytes(),i-e),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&0==this.vtable[e];e--);let i=e+1;for(;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);let s=(i+2)*2;this.addInt16(s);let r=0,n=this.space;t:for(e=0;e<this.vtables.length;e++){let t=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(t)){for(let e=2;e<s;e+=2)if(this.bb.readInt16(n+e)!=this.bb.readInt16(t+e))continue t;r=this.vtables[e];break}}return r?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,r-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){let s=4*!!i;if(e){if(this.prep(this.minalign,8+s),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(s)&&0!=this.bb.readInt16(s+e)))throw TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){let e;return null==t?0:(e=t instanceof Uint8Array?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createByteVector(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let i=0;i<t.length;++i){let s=t[i];if(null!==s)e.push(this.createObjectOffset(s));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}class w{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new w).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new w).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return w.startKeyValue(t),w.addKey(t,e),w.addValue(t,i),w.endKeyValue(t)}}var E=i(44922);!function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(n||(n={}
1)),function(t){t[t.DenseArray=0]="DenseArray"}(a||(a={}));class S{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new S).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new S).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return S.startInt(t),S.addBitWidth(t,e),S.addIsSigned(t,i),S.endInt(t)}}class R{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new R).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new R).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new S).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):a.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,a.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",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.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"}(o||(o={}));class v{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new v).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new v).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):o.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new R).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let i=this.bb.__offset(this.bb_pos,14);return i?(e||new v).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,16);return i?(e||new w).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,o.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}class T{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new T).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new T).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):n.Little}fields(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new v).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new w).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,n.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}
1static createSchema(t,e,i,s,r){return T.startSchema(t),T.addEndianness(t,e),T.addFields(t,i),T.addCustomMetadata(t,s),T.addFeatures(t,r),T.endSchema(t)}}class O{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new O).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new O).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):E.W.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new T).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new b).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let i=this.bb.__offset(this.bb_pos,10);return i?(e||new b).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new w).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,E.W.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}var F=i(20704),A=i(33156),N=i(27867);class B{static decode(t){t=new m((0,A.Fo)(t));let e=O.getRootAsFooter(t);return new D(F.S.decode(e.schema(),new Map,e.version()),e)}static encode(t){let e=new I,i=F.S.encode(e,t.schema);for(let i of(O.startRecordBatchesVector(e,t.numRecordBatches),[...t.recordBatches()].slice().reverse()))L.encode(e,i);let s=e.endVector();for(let i of(O.startDictionariesVector(e,t.numDictionaries),[...t.dictionaryBatches()].slice().reverse()))L.encode(e,i);let r=e.endVector();return O.startFooter(e),O.addSchema(e,i),O.addVersion(e,E.W.V5),O.addRecordBatches(e,s),O.addDictionaries(e,r),O.finishFooterBuffer(e,O.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=E.W.V5,i,s){this.schema=t,this.version=e,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,e=-1,i=this.numRecordBatches;++e<i;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,i=this.numDictionaries;++e<i;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}}class D extends B{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return L.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return L.decode(e)}return null}}class L{static decode(t){return new L(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:i}=e,s=BigInt(e.offset),r=BigInt(e.bodyLength);return b.createBlock(t,s,i,r)}constructor(t,e,i){this.metaDataLength=t,this.offset=(0,N.i)(i),this.bodyLength=(0,N.i)(e)}}let U={fromIterable:t=>P(function*(t){let e,i=!1,s=[],r,n,a,o=0;({cmd:n,size:a}=(yield null)||{cmd:"read",size:0});let d=(0,A.tL)(t)[Symbol.iterator]();try{do if({done:e,value:r}=Number.isNaN(a-o)?d.next():d.next(a-o),!e&&r.byteLength>0&&(s.push(r),o+=r.byteLength),e||a<=o)do({cmd:n,size:a}=yield"peek"===n?(0,A.vd)(s,a)[0]:([r,s,o]=(0,A.vd)(s,a),r));while(a<o);while(!e)}catch(t){i=!0,"function"==typeof d.throw&&d.throw(t)}finally{!1===i&&"function"==typeof d.return&&d.return(null)}return null}(t)),fromAsyncIterable:t=>P(function(t){return(0,l.AQ)(this,arguments,function*(){let e,i=!1,s=[],r,n,a,o=0;({cmd:n,size:a}=(yield yield(0,l.N3)(null))||{cmd:"read",size:0});let d=(0,A.Fw)(t)[Symbol.asyncIterator]();try{do if({done:e,value:r}=Number.isNaN(a-o)?yield(0,l.N3)(d.next()):yield(0,l.N3)(d.next(a-o)),!e&&r.byteLength>0&&(s.push(r),o+=r.byteLength),e||a<=o)do({cmd:n,size:a}=yield yield(0,l.N3)("peek"===n?(0,A.vd)(s,a)[0]:([r,s,o]=(0,A.vd)(s,a),r)));while(a<o);while(!e)}catch(t){i=!0,"function"==typeof d.throw&&(yield(0,l.N3)(d.throw(t)))}
1finally{!1===i&&"function"==typeof d.return&&(yield(0,l.N3)(d.return(new Uint8Array(0))))}return yield(0,l.N3)(null)})}(t)),fromDOMStream:t=>P(function(t){return(0,l.AQ)(this,arguments,function*(){let e=!1,i=!1,s=[],r,n,a,o=0;({cmd:n,size:a}=(yield yield(0,l.N3)(null))||{cmd:"read",size:0});let d=new M(t);try{do if({done:e,value:r}=Number.isNaN(a-o)?yield(0,l.N3)(d.read()):yield(0,l.N3)(d.read(a-o)),!e&&r.byteLength>0&&(s.push((0,A.Fo)(r)),o+=r.byteLength),e||a<=o)do({cmd:n,size:a}=yield yield(0,l.N3)("peek"===n?(0,A.vd)(s,a)[0]:([r,s,o]=(0,A.vd)(s,a),r)));while(a<o);while(!e)}catch(t){i=!0,yield(0,l.N3)(d.cancel(t))}finally{!1===i?yield(0,l.N3)(d.cancel()):t.locked&&d.releaseLock()}return yield(0,l.N3)(null)})}(t)),fromNodeStream:t=>P(function(t){return(0,l.AQ)(this,arguments,function*(){let e=[],i="error",s=!1,r=null,n,a,o=0,d=[],h;if({cmd:n,size:a}=(yield yield(0,l.N3)(null))||{cmd:"read",size:0},t.isTTY)return yield yield(0,l.N3)(new Uint8Array(0)),yield(0,l.N3)(null);try{e[0]=x(t,"end"),e[1]=x(t,"error");do{if(e[2]=x(t,"readable"),[i,r]=yield(0,l.N3)(Promise.race(e.map(t=>t[2]))),"error"===i)break;if((s="end"===i)||(Number.isFinite(a-o)?(h=(0,A.Fo)(t.read(a-o))).byteLength<a-o&&(h=(0,A.Fo)(t.read())):h=(0,A.Fo)(t.read()),h.byteLength>0&&(d.push(h),o+=h.byteLength)),s||a<=o)do({cmd:n,size:a}=yield yield(0,l.N3)("peek"===n?(0,A.vd)(d,a)[0]:([h,d,o]=(0,A.vd)(d,a),h)));while(a<o)}while(!s)}finally{var c,u;yield(0,l.N3)((c=e,u="error"===i?r:null,h=d=null,new Promise((e,i)=>{for(let[e,i]of c)t.off(e,i);try{let e=t.destroy;e&&e.call(t,u),u=void 0}catch(t){u=t||u}finally{null!=u?i(u):e()}})))}return yield(0,l.N3)(null)})}(t)),toDOMStream(t,e){throw Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw Error('"toNodeStream" not available in this environment')}},P=t=>(t.next(),t);class M{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return(0,l.sH)(this,void 0,void 0,function*(){let{reader:e,source:i}=this;e&&(yield e.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return(0,l.sH)(this,void 0,void 0,function*(){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};let e=yield this.reader.read();return e.done||(e.value=(0,A.Fo)(e)),e})}}let x=(t,e)=>{let i,s=t=>i([e,t]);return[e,s,new Promise(r=>(i=r)&&t.once(e,s))]};var C=i(68499);let k=Object.freeze({done:!0,value:void 0});class V{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class H{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class z extends H{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return(0,l.sH)(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(k);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return U.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return U.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.abort(t),k})}return(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.close(),k})}read(t){return(0,l.sH)(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return(0,l.sH)(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(){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((t,e)=>{this.resolvers.push({resolve:t,reject:e})}):Promise.resolve(k)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error("AsyncQueue is closed")}}var W=i(90160);
1class j extends z{write(t){if((t=(0,A.Fo)(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?(0,C._)(this.toUint8Array(!0)):this.toUint8Array(!1).then(C._)}toUint8Array(t=!1){return t?(0,A.vd)(this._values)[0]:(0,l.sH)(this,void 0,void 0,function*(){var t,e,i,s;let r=[],n=0;try{for(var a,o=!0,d=(0,l.xN)(this);!(t=(a=yield d.next()).done);o=!0)s=a.value,o=!1,r.push(s),n+=s.byteLength}catch(t){e={error:t}}finally{try{!o&&!t&&(i=d.return)&&(yield i.call(d))}finally{if(e)throw e.error}}return(0,A.vd)(r,n)[0]})}}class G{constructor(t){t&&(this.source=new Y(U.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Q{constructor(t){t instanceof Q?this.source=t.source:t instanceof j?this.source=new K(U.fromAsyncIterable(t)):(0,W.hy)(t)?this.source=new K(U.fromNodeStream(t)):(0,W.Rv)(t)?this.source=new K(U.fromDOMStream(t)):(0,W.es)(t)?this.source=new K(U.fromDOMStream(t.body)):(0,W.xZ)(t)?this.source=new K(U.fromIterable(t)):(0,W.yL)(t)?this.source=new K(U.fromAsyncIterable(t)):(0,W.Td)(t)&&(this.source=new K(U.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Y{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||k)}return(t){return Object.create(this.source.return&&this.source.return(t)||k)}}class K{constructor(t){this.source=t,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(t){return(0,l.sH)(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return(0,l.sH)(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return(0,l.sH)(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return(0,l.sH)(this,arguments,void 0,function*(t,e="read"){return yield this.source.next({cmd:e,size:t})})}throw(t){return(0,l.sH)(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||k;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return(0,l.sH)(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||k;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class q extends G{constructor(t,e){super(),this.position=0,this.buffer=(0,A.Fo)(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:i,position:s}=this;return e&&s<i?("number"!=typeof t&&(t=1/0),this.position=Math.min(i,s+Math.min(i-s,t)),e.subarray(s,this.position)):null}readAt(t,e){let i=this.buffer,s=Math.min(this.size,t+e);return i?i.subarray(t,s):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class Z extends Q{constructor(t,e){super(),this.position=0,this._handle=t,"number"==typeof e?this.size=e:this._pending=(0,l.sH)(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return(0,l.sH)(this,void 0,void 0,function*(){let{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)})}seek(t){return(0,l.sH)(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return(0,l.sH)(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:i,position:s}=this;if(e&&s<i){"number"!=typeof t&&(t=1/0);let r=s,n=0,a=0,o=Math.min(i,r+Math.min(i-r,t)),d=new Uint8Array(Math.max(0,(this.position=o)-r));for(;(r+=a)<o&&(n+=a)<d.byteLength;)({bytesRead:a}=yield e.read(d,n,d.byteLength-n,r));return d}return null})}readAt(t,e){return(0,l.sH)(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:s}=this;if(i&&t+e<s){let r=new Uint8Array(Math.min(s,t+e)-t);return(yield i.read(r,0,e,t)).buffer}return new Uint8Array(e)})}close(){return(0,l.sH)(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}var J=i(7495),$=i(68157);function X(t){return t<0&&(t=0xffffffff+t+1),`0x${t.toString(16)}`}let tt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class te{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),i=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]),s=e[3]*i[3];this.buffer[0]=65535&s;let r=s>>>16;return r+=(s=e[2]*i[3])+(s=e[3]*i[2]>>>0),this.buffer[0]+=r<<16,this.buffer[1]=65536*(r>>>0<s),this.buffer[1]+=r>>>16,this.buffer[1]+=e[1]*i[3]+e[2]*i[2]+e[3]*i[1],this.buffer[1]+=e[0]*i[3]+e[1]*i[2]+e[2]*i[1]+e[3]*i[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${X(this.buffer[1])} ${X(this.buffer[0])}`}}class ti extends te{times(t){return this._times(t),this}plus(t){return this._plus(t),this}
1static from(t,e=new Uint32Array(2)){return ti.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return ti.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.length,s=new ti(e);for(let e=0;e<i;){let r=8<i-e?8:i-e,n=new ti(new Uint32Array([Number.parseInt(t.slice(e,e+r),10),0])),a=new ti(new Uint32Array([tt[r],0]));s.times(a),s.plus(n),e+=r}return s}static convertArray(t){let e=new Uint32Array(2*t.length);for(let i=-1,s=t.length;++i<s;)ti.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new ti(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ti(new Uint32Array(t.buffer)).plus(e)}}class ts extends te{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],0==this.buffer[0]&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=0|this.buffer[1],i=0|t.buffer[1];return e<i||e===i&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return ts.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return ts.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.startsWith("-"),s=t.length,r=new ts(e);for(let e=+!!i;e<s;){let i=8<s-e?8:s-e,n=new ts(new Uint32Array([Number.parseInt(t.slice(e,e+i),10),0])),a=new ts(new Uint32Array([tt[i],0]));r.times(a),r.plus(n),e+=i}return i?r.negate():r}static convertArray(t){let e=new Uint32Array(2*t.length);for(let i=-1,s=t.length;++i<s;)ts.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new ts(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ts(new Uint32Array(t.buffer)).plus(e)}}class tr{constructor(t){this.buffer=t}high(){return new ts(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ts(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],0==this.buffer[0]&&++this.buffer[1],0==this.buffer[1]&&++this.buffer[2],0==this.buffer[2]&&++this.buffer[3],this}times(t){let e=new ti(new Uint32Array([this.buffer[3],0])),i=new ti(new Uint32Array([this.buffer[2],0])),s=new ti(new Uint32Array([this.buffer[1],0])),r=new ti(new Uint32Array([this.buffer[0],0])),n=new ti(new Uint32Array([t.buffer[3],0])),a=new ti(new Uint32Array([t.buffer[2],0])),o=new ti(new Uint32Array([t.buffer[1],0])),d=new ti(new Uint32Array([t.buffer[0],0])),h=ti.multiply(r,d);this.buffer[0]=h.low();let l=new ti(new Uint32Array([h.high(),0]));return h=ti.multiply(s,d),l.plus(h),h=ti.multiply(r,o),l.plus(h),this.buffer[1]=l.low(),this.buffer[3]=+!!l.lessThan(h),this.buffer[2]=l.high(),new ti(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(ti.multiply(i,d)).plus(ti.multiply(s,o)).plus(ti.multiply(r,a)),this.buffer[3]+=ti.multiply(e,d).plus(ti.multiply(i,o)).plus(ti.multiply(s,a)).plus(ti.multiply(r,n)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>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]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[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}hex(){return`${X(this.buffer[3])} ${X(this.buffer[2])} ${X(this.buffer[1])} ${X(this.buffer[0])}`}static multiply(t,e){return new tr(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new tr(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return tr.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return tr.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let i=t.startsWith("-"),s=t.length,r=new tr(e);for(let e=+!!i;e<s;){let i=8<s-e?8:s-e,n=new tr(new Uint32Array([Number.parseInt(t.slice(e,e+i),10),0,0,0])),a=new tr(new Uint32Array([tt[i],0,0,0]));r.times(a),r.plus(n),e+=i}return i?r.negate():r}static convertArray(t){let e=new Uint32Array(4*t.length);for(let i=-1,s=t.length;++i<s;)tr.from(t[i],new Uint32Array(e.buffer,e.byteOffset+16*i,4));return e}}var tn=i(74621),ta=i(2619);class to extends J.l{constructor(t,e,i,s,r=E.W.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=i,this.dictionaries=s,this.metadataVersion=r}visit(t){return super.visit(t instanceof F.D?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<E.W.V5&&this.readNullBitmap(t,i),t.mode===tn.R.Sparse?this.visitSparseUnion(t,{length:e,nullCount:i}):this.visitDenseUnion(t,{length:e,nullCount:i})}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:i}=this.nextFieldNode()){return(0,c.Hg)({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,i=this.nextBufferRange()){return e>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class td extends to{constructor(t,e,i,s,r){super(new Uint8Array(0),e,i,s,r),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):(0,$.FQ)(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return(0,A.Q_)(Uint8Array,(0,A.Q_)(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return(0,A.Q_)(Uint8Array,(0,A.Q_)(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:i}=this;if(_.pe.isTimestamp(t)||(_.pe.isInt(t)||_.pe.isTime(t))&&64===t.bitWidth||_.pe.isDuration(t))return(0,A.Q_)(Uint8Array,ts.convertArray(i[e]));if(_.pe.isDate(t)&&t.unit===ta.f.MILLISECOND)return(0,A.Q_)(Uint8Array,ts.convertArray(i[e]));if(_.pe.isDecimal(t))return(0,A.Q_)(Uint8Array,tr.convertArray(i[e]));if(_.pe.isBinary(t)||_.pe.isLargeBinary(t)||_.pe.isFixedSizeBinary(t))return function(t){let e=t.join(""),i=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)i[t>>1]=Number.parseInt(e.slice(t,t+2),16);return i}(i[e]);else if(_.pe.isBool(t))return(0,$.FQ)(i[e]);else if(_.pe.isUtf8(t)||_.pe.isLargeUtf8(t))return(0,C.A)(i[e].join(""));return(0,A.Q_)(Uint8Array,(0,A.Q_)(t.ArrayType,i[e].map(t=>+t)))}}
1var th=i(56844);!function(t){t[t.BUFFER=0]="BUFFER"}(d||(d={})),function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"}(h||(h={}));class tl{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new tl).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new tl).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):h.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):d.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,h.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,d.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return tl.startBodyCompression(t),tl.addCodec(t,e),tl.addMethod(t,i),tl.endBodyCompression(t)}}class tc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class tu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class t_{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new t_).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new t_).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new tu).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new tc).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new tl).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}}class tb{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new tb).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new tb).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new t_).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}var tf=i(98164);class tp{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new tp).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new tp).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tf.j.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,tf.j.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return tp.startFloatingPoint(t),tp.addPrecision(t,e),tp.endFloatingPoint(t)}}class ty{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new ty).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new ty).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,s){return ty.startDecimal(t),ty.addPrecision(t,e),ty.addScale(t,i),ty.addBitWidth(t,s),ty.endDecimal(t)}}class tg{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new tg).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new tg).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ta.f.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ta.f.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return tg.startDate(t),tg.addUnit(t,e),tg.endDate(t)}}var tm=i(806);class tI{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new tI).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new tI).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tm.y.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,tm.y.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return tI.startTime(t),tI.addUnit(t,e),tI.addBitWidth(t,i),tI.endTime(t)}}class tw{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new tw).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new tw).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tm.y.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,tm.y.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}
1static createTimestamp(t,e,i){return tw.startTimestamp(t),tw.addUnit(t,e),tw.addTimezone(t,i),tw.endTimestamp(t)}}var tE=i(17878);class tS{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new tS).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new tS).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tE.a.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,tE.a.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return tS.startInterval(t),tS.addUnit(t,e),tS.endInterval(t)}}class tR{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new tR).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new tR).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tm.y.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,tm.y.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return tR.startDuration(t),tR.addUnit(t,e),tR.endDuration(t)}}class tv{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new tv).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new tv).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tn.R.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,tn.R.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,i){return tv.startUnion(t),tv.addMode(t,e),tv.addTypeIds(t,i),tv.endUnion(t)}}class tT{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new tT).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new tT).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return tT.startFixedSizeBinary(t),tT.addByteWidth(t,e),tT.endFixedSizeBinary(t)}}class tO{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new tO).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new tO).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return tO.startFixedSizeList(t),tO.addListSize(t,e),tO.endFixedSizeList(t)}}class tF{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new tF).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new tF).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return tF.startMap(t),tF.addKeysSorted(t,e),tF.endMap(t)}}class tA{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new tA).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new tA).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):E.W.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):s.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new w).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,E.W.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,s.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,i,s,r,n){return tA.startMessage(t),tA.addVersion(t,e),tA.addHeaderType(t,i),tA.addHeader(t,s),tA.addBodyLength(t,r),tA.addCustomMetadata(t,n),tA.endMessage(t)}}class tN{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new tN).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new tN).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return tN.startNull(t),tN.endNull(t)}}class tB{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new tB).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new tB).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return tB.startBinary(t),tB.endBinary(t)}}class tD{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new tD).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new tD).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return tD.startLargeBinary(t),tD.endLargeBinary(t)}}class tL{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new tL).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new tL).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return tL.startBool(t),tL.endBool(t)}}class tU{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new tU).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new tU).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return tU.startUtf8(t),tU.endUtf8(t)}}class tP{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new tP).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new tP).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return tP.startLargeUtf8(t),tP.endLargeUtf8(t)}}class tM{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new tM).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new tM).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return tM.startList(t),tM.endList(t)}}class tx{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new tx).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new tx).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return tx.startStruct_(t),tx.endStruct_(t)}}class tC extends J.l{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return tN.startNull(e),tN.endNull(e)}visitInt(t,e){return S.startInt(e),S.addBitWidth(e,t.bitWidth),S.addIsSigned(e,t.isSigned),S.endInt(e)}visitFloat(t,e){return tp.startFloatingPoint(e),tp.addPrecision(e,t.precision),tp.endFloatingPoint(e)}visitBinary(t,e){return tB.startBinary(e),tB.endBinary(e)}visitLargeBinary(t,e){return tD.startLargeBinary(e),tD.endLargeBinary(e)}visitBool(t,e){return tL.startBool(e),tL.endBool(e)}visitUtf8(t,e){return tU.startUtf8(e),tU.endUtf8(e)}visitLargeUtf8(t,e){return tP.startLargeUtf8(e),tP.endLargeUtf8(e)}visitDecimal(t,e){return ty.startDecimal(e),ty.addScale(e,t.scale),ty.addPrecision(e,t.precision),ty.addBitWidth(e,t.bitWidth),ty.endDecimal(e)}visitDate(t,e){return tg.startDate(e),tg.addUnit(e,t.unit),tg.endDate(e)}visitTime(t,e){return tI.startTime(e),tI.addUnit(e,t.unit),tI.addBitWidth(e,t.bitWidth),tI.endTime(e)}
1visitTimestamp(t,e){let i=t.timezone&&e.createString(t.timezone)||void 0;return tw.startTimestamp(e),tw.addUnit(e,t.unit),void 0!==i&&tw.addTimezone(e,i),tw.endTimestamp(e)}visitInterval(t,e){return tS.startInterval(e),tS.addUnit(e,t.unit),tS.endInterval(e)}visitDuration(t,e){return tR.startDuration(e),tR.addUnit(e,t.unit),tR.endDuration(e)}visitList(t,e){return tM.startList(e),tM.endList(e)}visitStruct(t,e){return tx.startStruct_(e),tx.endStruct_(e)}visitUnion(t,e){tv.startTypeIdsVector(e,t.typeIds.length);let i=tv.createTypeIdsVector(e,t.typeIds);return tv.startUnion(e),tv.addMode(e,t.mode),tv.addTypeIds(e,i),tv.endUnion(e)}visitDictionary(t,e){let i=this.visit(t.indices,e);return R.startDictionaryEncoding(e),R.addId(e,BigInt(t.id)),R.addIsOrdered(e,t.isOrdered),void 0!==i&&R.addIndexType(e,i),R.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return tT.startFixedSizeBinary(e),tT.addByteWidth(e,t.byteWidth),tT.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return tO.startFixedSizeList(e),tO.addListSize(e,t.listSize),tO.endFixedSizeList(e)}visitMap(t,e){return tF.startMap(e),tF.addKeysSorted(e,t.keysSorted),tF.endMap(e)}}let tk=new tC;function tV(t){return new tQ(t.count,function t(e){return(e||[]).reduce((e,i)=>[...e,new tq(i.count,(i.VALIDITY||[]).reduce((t,e)=>t+ +(0===e),0)),...t(i.children)],[])}(t.columns),function t(e,i=[]){for(let s=-1,r=(e||[]).length;++s<r;){let r=e[s];r.VALIDITY&&i.push(new tK(i.length,r.VALIDITY.length)),r.TYPE_ID&&i.push(new tK(i.length,r.TYPE_ID.length)),r.OFFSET&&i.push(new tK(i.length,r.OFFSET.length)),r.DATA&&i.push(new tK(i.length,r.DATA.length)),i=t(r.children,i)}return i}(t.columns))}function tH(t,e){return(t.children||[]).filter(Boolean).map(t=>F.D.fromJSON(t,e))}function tz(t=[]){return new Map(t.map(({key:t,value:e})=>[t,e]))}function tW(t){return new _.Ai(t.isSigned,t.bitWidth)}function tj(t,e){let i=t.type.name;switch(i){case"NONE":case"null":return new _.Uv;case"binary":return new _.yI;case"largebinary":return new _.BS;case"utf8":return new _.YE;case"largeutf8":return new _.Jb;case"bool":return new _.x;case"list":return new _.B8((e||[])[0]);case"struct":case"struct_":return new _._k(e||[])}switch(i){case"int":{let e=t.type;return new _.Ai(e.isSigned,e.bitWidth)}case"floatingpoint":{let e=t.type;return new _.nt(tf.j[e.precision])}case"decimal":{let e=t.type;return new _.Ww(e.scale,e.precision,e.bitWidth)}case"date":{let e=t.type;return new _.OD(ta.f[e.unit])}case"time":{let e=t.type;return new _.gX(tm.y[e.unit],e.bitWidth)}case"timestamp":{let e=t.type;return new _.Dc(tm.y[e.unit],e.timezone)}case"interval":{let e=t.type;return new _.IX(tE.a[e.unit])}case"duration":{let e=t.type;return new _.dw(tm.y[e.unit])}case"union":{let i=t.type,[s,...r]=(i.mode+"").toLowerCase(),n=s.toUpperCase()+r.join("");return new _.gP(tn.R[n],i.typeIds||[],e||[])}case"fixedsizebinary":{let e=t.type;return new _.Pv(e.byteWidth)}case"fixedsizelist":{let i=t.type;return new _.Y1(i.listSize,(e||[])[0])}case"map":{let i=t.type;return new _.WD((e||[])[0],i.keysSorted)}}throw Error(`Unrecognized type: "${i}"`)}class tG{static fromJSON(t,e){var i,r;let n=new tG(0,E.W.V5,e);return i=t,r=e,n._createHeader=()=>{switch(r){case s.Schema:return F.S.fromJSON(i);case s.RecordBatch:return tQ.fromJSON(i);case s.DictionaryBatch:return tY.fromJSON(i)}throw Error(`Unrecognized Message type: { name: ${s[r]}, type: ${r} }`)},n}static decode(t){var e,i;t=new m((0,A.Fo)(t));let r=tA.getRootAsMessage(t),n=r.bodyLength(),a=r.version(),o=r.headerType(),d=new tG(n,a,o);return e=r,i=o,d._createHeader=()=>{switch(i){case s.Schema:return F.S.decode(e.header(new T),new Map,e.version());case s.RecordBatch:return tQ.decode(e.header(new t_),e.version());case s.DictionaryBatch:return tY.decode(e.header(new tb),e.version())}throw Error(`Unrecognized Message type: { name: ${s[i]}, type: ${i} }`)},d}static encode(t){let e=new I,i=-1;return t.isSchema()?i=F.S.encode(e,t.header()):t.isRecordBatch()?i=tQ.encode(e,t.header()):t.isDictionaryBatch()&&(i=tY.encode(e,t.header())),tA.startMessage(e),tA.addVersion(e,E.W.V5),tA.addHeader(e,i),tA.addHeaderType(e,t.headerType),tA.addBodyLength(e,BigInt(t.bodyLength)),tA.finishMessageBuffer(e,tA.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof F.S)return new tG(0,E.W.V5,s.Schema,t);if(t instanceof tQ)return new tG(e,E.W.V5,s.RecordBatch,t);
1if(t instanceof tY)return new tG(e,E.W.V5,s.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===s.Schema}isRecordBatch(){return this.headerType===s.RecordBatch}isDictionaryBatch(){return this.headerType===s.DictionaryBatch}constructor(t,e,i,s){this._version=e,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=(0,N.i)(t)}}class tQ{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=(0,N.i)(t)}}class tY{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=(0,N.i)(e)}}class tK{constructor(t,e){this.offset=(0,N.i)(t),this.length=(0,N.i)(e)}}class tq{constructor(t,e){this.length=(0,N.i)(t),this.nullCount=(0,N.i)(e)}}function tZ(t,e){let i=[];for(let s,r=-1,n=-1,a=t.childrenLength();++r<a;)(s=t.children(r))&&(i[++n]=F.D.decode(s,e));return i}function tJ(t){let e=new Map;if(t)for(let i,s,r=-1,n=Math.trunc(t.customMetadataLength());++r<n;)(i=t.customMetadata(r))&&null!=(s=i.key())&&e.set(s,i.value());return e}function t$(t){return new _.Ai(t.isSigned(),t.bitWidth())}function tX(t,e){let i=t.typeType();switch(i){case o.NONE:case o.Null:return new _.Uv;case o.Binary:return new _.yI;case o.LargeBinary:return new _.BS;case o.Utf8:return new _.YE;case o.LargeUtf8:return new _.Jb;case o.Bool:return new _.x;case o.List:return new _.B8((e||[])[0]);case o.Struct_:return new _._k(e||[])}switch(i){case o.Int:{let e=t.type(new S);return new _.Ai(e.isSigned(),e.bitWidth())}case o.FloatingPoint:{let e=t.type(new tp);return new _.nt(e.precision())}case o.Decimal:{let e=t.type(new ty);return new _.Ww(e.scale(),e.precision(),e.bitWidth())}case o.Date:{let e=t.type(new tg);return new _.OD(e.unit())}case o.Time:{let e=t.type(new tI);return new _.gX(e.unit(),e.bitWidth())}case o.Timestamp:{let e=t.type(new tw);return new _.Dc(e.unit(),e.timezone())}case o.Interval:{let e=t.type(new tS);return new _.IX(e.unit())}case o.Duration:{let e=t.type(new tR);return new _.dw(e.unit())}case o.Union:{let i=t.type(new tv);return new _.gP(i.mode(),i.typeIdsArray()||[],e||[])}case o.FixedSizeBinary:{let e=t.type(new tT);return new _.Pv(e.byteWidth())}case o.FixedSizeList:{let i=t.type(new tO);return new _.Y1(i.listSize(),(e||[])[0])}case o.Map:{let i=t.type(new tF);return new _.WD((e||[])[0],i.keysSorted())}}throw Error(`Unrecognized type: "${o[i]}" (${i})`)}F.D.encode=function(t,e){let i=-1,s=-1,r=-1,n=e.type,a=e.typeId;_.pe.isDictionary(n)?(a=n.dictionary.typeId,r=tk.visit(n,t),s=tk.visit(n.dictionary,t)):s=tk.visit(n,t);let o=(n.children||[]).map(e=>F.D.encode(t,e)),d=v.createChildrenVector(t,o),h=e.metadata&&e.metadata.size>0?v.createCustomMetadataVector(t,[...e.metadata].map(([e,i])=>{let s=t.createString(`${e}`),r=t.createString(`${i}`);return w.startKeyValue(t),w.addKey(t,s),w.addValue(t,r),w.endKeyValue(t)})):-1;return e.name&&(i=t.createString(e.name)),v.startField(t),v.addType(t,s),v.addTypeType(t,a),v.addChildren(t,d),v.addNullable(t,!!e.nullable),-1!==i&&v.addName(t,i),-1!==r&&v.addDictionary(t,r),-1!==h&&v.addCustomMetadata(t,h),v.endField(t)},F.D.decode=function(t,e){let i,s,r,n,a,o;return e&&(o=t.dictionary())?(e.has(i=(0,N.i)(o.id()))?(n=(n=o.indexType())?t$(n):new _.P_,a=new _.bT(e.get(i),n,i,o.isOrdered())):(n=(n=o.indexType())?t$(n):new _.P_,e.set(i,r=tX(t,tZ(t,e))),a=new _.bT(r,n,i,o.isOrdered())),s=new F.D(t.name(),a,t.nullable(),tJ(t))):(r=tX(t,tZ(t,e)),s=new F.D(t.name(),r,t.nullable(),tJ(t))),s||null},F.D.fromJSON=function(t,e){let i,s,r,n,a,o;return e&&(n=t.dictionary)?(e.has(i=n.id)?(s=(s=n.indexType)?tW(s):new _.P_,o=new _.bT(e.get(i),s,i,n.isOrdered)):(s=(s=n.indexType)?tW(s):new _.P_,e.
1set(i,a=tj(t,tH(t,e))),o=new _.bT(a,s,i,n.isOrdered)),r=new F.D(t.name,o,t.nullable,tz(t.metadata))):(a=tj(t,tH(t,e)),r=new F.D(t.name,a,t.nullable,tz(t.metadata))),r||null},F.S.encode=function(t,e){let i=e.fields.map(e=>F.D.encode(t,e));T.startFieldsVector(t,i.length);let s=T.createFieldsVector(t,i),r=e.metadata&&e.metadata.size>0?T.createCustomMetadataVector(t,[...e.metadata].map(([e,i])=>{let s=t.createString(`${e}`),r=t.createString(`${i}`);return w.startKeyValue(t),w.addKey(t,s),w.addValue(t,r),w.endKeyValue(t)})):-1;return T.startSchema(t),T.addFields(t,s),T.addEndianness(t,t0?n.Little:n.Big),-1!==r&&T.addCustomMetadata(t,r),T.endSchema(t)},F.S.decode=function(t,e=new Map,i=E.W.V5){let s=function(t,e){let i=[];for(let s,r=-1,n=-1,a=t.fieldsLength();++r<a;)(s=t.fields(r))&&(i[++n]=F.D.decode(s,e));return i}(t,e);return new F.S(s,tJ(t),e,i)},F.S.fromJSON=function(t,e=new Map){var i,s;return new F.S((i=t,s=e,(i.fields||[]).filter(Boolean).map(t=>F.D.fromJSON(t,s))),tz(t.metadata),e)},tQ.encode=function(t,e){let i=e.nodes||[],s=e.buffers||[];for(let e of(t_.startNodesVector(t,i.length),i.slice().reverse()))tq.encode(t,e);let r=t.endVector();for(let e of(t_.startBuffersVector(t,s.length),s.slice().reverse()))tK.encode(t,e);let n=t.endVector();return t_.startRecordBatch(t),t_.addLength(t,BigInt(e.length)),t_.addNodes(t,r),t_.addBuffers(t,n),t_.endRecordBatch(t)},tQ.decode=function(t,e=E.W.V5){if(null!==t.compression())throw Error("Record batch compression not implemented");return new tQ(t.length(),function(t){let e=[];for(let i,s=-1,r=-1,n=t.nodesLength();++s<n;)(i=t.nodes(s))&&(e[++r]=tq.decode(i));return e}(t),function(t,e){let i=[];for(let s,r=-1,n=-1,a=t.buffersLength();++r<a;)(s=t.buffers(r))&&(e<E.W.V4&&(s.bb_pos+=8*(r+1)),i[++n]=tK.decode(s));return i}(t,e))},tQ.fromJSON=tV,tY.encode=function(t,e){let i=tQ.encode(t,e.data);return tb.startDictionaryBatch(t),tb.addId(t,BigInt(e.id)),tb.addIsDelta(t,e.isDelta),tb.addData(t,i),tb.endDictionaryBatch(t)},tY.decode=function(t,e=E.W.V5){return new tY(tQ.decode(t.data(),e),t.id(),t.isDelta())},tY.fromJSON=function(t){return new tY(tV(t.data),t.id,t.isDelta)},tq.encode=function(t,e){return tu.createFieldNode(t,BigInt(e.length),BigInt(e.nullCount))},tq.decode=function(t){return new tq(t.length(),t.nullCount())},tK.encode=function(t,e){return tc.createBuffer(t,BigInt(e.offset),BigInt(e.length))},tK.decode=function(t){return new tK(t.offset(),t.length())};let t0=(()=>{let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})(),t1=t=>`Expected ${s[t]} Message in stream, but was null or length 0.`,t2=t=>`Header pointer of flatbuffer-encoded ${s[t]} Message is null or length 0.`,t3=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,t4=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class t8{constructor(t){this.source=t instanceof G?t:new G(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?k:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw Error(t1(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=(0,A.Fo)(this.source.read(t));if(e.byteLength<t)throw Error(t4(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=s.Schema,i=this.readMessage(e),r=null==i?void 0:i.header();if(t&&!r)throw Error(t2(e));return r}readMetadataLength(){let t=this.source.read(t9),e=t&&new m(t),i=(null==e?void 0:e.readInt32(0))||0;return{done:0===i,value:i}}readMetadata(t){let e=this.source.read(t);if(!e)return k;if(e.byteLength<t)throw Error(t3(t,e.byteLength));return{done:!1,value:tG.decode(e)}}}class t6{constructor(t,e){this.source=t instanceof Q?t:(0,W.zP)(t)?new Z(t,e):new Q(t)}[Symbol.asyncIterator](){return this}next(){return(0,l.sH)(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||-1===t.value&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?k:t})}throw(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return(0,l.sH)(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw Error(t1(t));return e.value})}readMessageBody(t){return(0,l.sH)(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=(0,A.Fo)((yield this.source.read(t)));if(e.byteLength<t)throw Error(t4(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return(0,l.sH)(this,arguments,void 0,function*(t=!1){let e=s.Schema,i=yield this.readMessage(e),r=null==i?void 0:i.header();if(t&&!r)throw Error(t2(e));return r})}readMetadataLength(){return(0,l.sH)(this,void 0,void 0,function*(){let t=yield this.source.read(t9),e=t&&new m(t),i=(null==e?void 0:e.readInt32(0))||0;return{done:0===i,value:i}})}readMetadata(t){return(0,l.sH)(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return k;if(e.byteLength<t)throw Error(t3(t,e.byteLength));return{done:!1,value:tG.decode(e)}})}}class t5 extends t8{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof V?t:new V(t)}
1next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:tG.fromJSON(t.schema,s.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:tG.fromJSON(e,s.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:tG.fromJSON(e,s.RecordBatch)}}return this._body=[],k}readMessageBody(t){return function t(e){return(e||[]).reduce((e,i)=>[...e,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...t(i.children)],[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw Error(t1(t));return e.value}readSchema(){let t=s.Schema,e=this.readMessage(t),i=null==e?void 0:e.header();if(!e||!i)throw Error(t2(t));return i}}let t9=4,t7="ARROW1",et=new Uint8Array(t7.length);for(let t=0;t<t7.length;t+=1)et[t]=t7.codePointAt(t);function ee(t,e=0){for(let i=-1,s=et.length;++i<s;)if(et[i]!==t[e+i])return!1;return!0}let ei=et.length,es=ei+t9,er=2*ei+t9;class en extends H{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return(0,W.yL)(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return U.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return U.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw Error('"throughDOM" not available in this environment')}static from(t){if(t instanceof en)return t;if((0,W.qO)(t))return new ea(new ef(t));if((0,W.zP)(t))return function(t){return(0,l.sH)(this,void 0,void 0,function*(){let{size:e}=yield t.stat(),i=new Z(t,e);return e>=er&&ee((yield i.readAt(0,ei+7&-8)))?new eh(new eb(i)):new eo(new eu(i))})}(t);if((0,W.yL)(t))return(0,l.sH)(this,void 0,void 0,function*(){return yield en.from((yield t))});if((0,W.es)(t)||(0,W.Rv)(t)||(0,W.hy)(t)||(0,W.Td)(t))return function(t){return(0,l.sH)(this,void 0,void 0,function*(){let e=yield t.peek(ei+7&-8);return e&&e.byteLength>=4?ee(e)?new ed(new e_((yield t.read()))):new eo(new eu(t)):new eo(new eu(function(){return(0,l.AQ)(this,arguments,function*(){})}()))})}(new Q(t));var e=new G(t);let i=e.peek(ei+7&-8);return i&&i.byteLength>=4?ee(i)?new ed(new e_(e.read())):new ea(new ec(e)):new ea(new ec(function*(){}()))}static readAll(t){return t instanceof en?t.isSync()?ey(t):eg(t):(0,W.qO)(t)||ArrayBuffer.isView(t)||(0,W.xZ)(t)||(0,W.o_)(t)?ey(t):eg(t)}}class ea extends en{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return(0,l.AQ)(this,arguments,function*(){yield(0,l.N3)((yield*(0,l.Me)((0,l.xN)(this[Symbol.iterator]()))))})}}class eo extends en{constructor(t){super(t),this._impl=t}readAll(){return(0,l.sH)(this,void 0,void 0,function*(){var t,e,i,s;let r=[];try{for(var n,a=!0,o=(0,l.xN)(this);!(t=(n=yield o.next()).done);a=!0)s=n.value,a=!1,r.push(s)}catch(t){e={error:t}}finally{try{!a&&!t&&(i=o.return)&&(yield i.call(o))}finally{if(e)throw e.error}}return r})}[Symbol.iterator](){throw Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class ed extends ea{constructor(t){super(t),this._impl=t}}class eh extends eo{constructor(t){super(t),this._impl=t}}class el{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let i=this._loadVectors(t,e,this.schema.fields),s=(0,c.Hg)({type:new _._k(this.schema.fields),length:t.length,children:i});return new th.g(this.schema,s)}_loadDictionaryBatch(t,e){let{id:i,isDelta:s}=t,{dictionaries:r,schema:n}=this,a=r.get(i),o=n.dictionaries.get(i),d=this._loadVectors(t.data,e,[o]);return(a&&s?a.concat(new u.M(d)):new u.M(d)).memoize()}_loadVectors(t,e,i){return new to(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}class ec extends el{constructor(t,e){super(e),this._reader=(0,W.qO)(t)?new t5(this._handle=t):new t8(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return!this.closed&&(this.autoDestroy=ep(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):k}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):k}
1next(){let t;if(this.closed)return k;let{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,r)}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new th.M(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class eu extends el{constructor(t,e){super(e),this._reader=new t6(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return(0,l.sH)(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return(0,l.sH)(this,void 0,void 0,function*(){return!this.closed&&(this.autoDestroy=ep(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return(0,l.sH)(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):k})}return(t){return(0,l.sH)(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):k})}next(){return(0,l.sH)(this,void 0,void 0,function*(){let t;if(this.closed)return k;let{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,r)}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new th.M(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return(0,l.sH)(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class e_ extends ec{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof q?t:new q(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer)for(let t of(this.schema=(this._footer=this._readFooter()).schema,this._footer.dictionaryBatches()))t&&this._readDictionaryBatch(this._dictionaryIndex++);return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let i=null==(e=this._footer)?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let t=this._reader.readMessage(s.RecordBatch);if(null==t?void 0:t.isRecordBatch()){let e=t.header(),i=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null}_readDictionaryBatch(t){var e;let i=null==(e=this._footer)?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let t=this._reader.readMessage(s.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){let e=t.header(),i=this._reader.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,s)}}}_readFooter(){let{_handle:t}=this,e=t.size-es,i=t.readInt32(e),s=t.readAt(e-i,i);return B.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=null==(e=this._footer)?void 0:e.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}}class eb extends eu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){super(t instanceof Z?t:new Z(t,"number"!=typeof e[0]?e.shift():void 0),e[0]instanceof Map?e.shift():void 0)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return(0,l.sH)(this,void 0,void 0,function*(){if(!this.closed&&!this._footer)for(let t of(this.schema=(this._footer=yield this._readFooter()).schema,this._footer.dictionaryBatches()))t&&(yield this._readDictionaryBatch(this._dictionaryIndex++));return yield e.open.call(this,t)})}readRecordBatch(t){return(0,l.sH)(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let i=null==(e=this._footer)?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let t=yield this._reader.readMessage(s.RecordBatch);if(null==t?void 0:t.isRecordBatch()){let e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null})}_readDictionaryBatch(t){return(0,l.sH)(this,void 0,void 0,function*(){var e;let i=null==(e=this._footer)?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let t=yield this._reader.readMessage(s.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){let e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,s)}}})}_readFooter(){return(0,l.sH)(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-es,i=yield t.readInt32(e),s=yield t.readAt(e-i,i);return B.decode(s)})}_readNextMessageAndValidate(t){return(0,l.sH)(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class ef extends ec{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new td(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}function ep(t,e){return e&&"boolean"==typeof e.autoDestroy?e.autoDestroy:t.autoDestroy}function*ey(t){let e=en.from(t);try{if(!e.open({autoDestroy:!1}
1).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function eg(t){return(0,l.AQ)(this,arguments,function*(){let e=yield(0,l.N3)(en.from(t));try{if(!(yield(0,l.N3)(e.open({autoDestroy:!1}))).closed)do yield yield(0,l.N3)(e);while(!(yield(0,l.N3)(e.reset().open())).closed)}finally{yield(0,l.N3)(e.cancel())}})}var em=i(54839),eI=i(93572);class ew extends J.l{static assemble(...t){let e=t=>t.flatMap(t=>Array.isArray(t)?e(t):t instanceof th.g?t.data.children:t.data),i=new ew;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof u.M)return this.visitMany(t.data),this;let{type:e}=t;if(!_.pe.isDictionary(e)){let{length:i}=t;if(i>0x7fffffff)throw RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(_.pe.isUnion(e))this.nodes.push(new tq(i,0));else{let{nullCount:s}=t;_.pe.isNull(e)||eE.call(this,s<=0?new Uint8Array(0):(0,$.mu)(t.offset,i,t.nullBitmap)),this.nodes.push(new tq(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function eE(t){let e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new tK(this._byteLength,e)),this._byteLength+=e,this}function eS(t){return eE.call(this,t.values.subarray(0,t.length*t.stride))}function eR(t){let{length:e,values:i,valueOffsets:s}=t,r=(0,N.i)(s[0]),n=Math.min((0,N.i)(s[e])-r,i.byteLength-r);return eE.call(this,(0,A.EW)(-r,e+1,s)),eE.call(this,i.subarray(r,r+n)),this}function ev(t){let{length:e,valueOffsets:i}=t;if(i){let{0:s,[e]:r}=i;return eE.call(this,(0,A.EW)(-s,e+1,i)),this.visit(t.children[0].slice(s,r-s))}return this.visit(t.children[0])}function eT(t){return this.visitMany(t.type.children.map((e,i)=>t.children[i]).filter(Boolean))[0]}ew.prototype.visitBool=function(t){let e;return t.nullCount>=t.length?eE.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?eE.call(this,(0,$.mu)(t.offset,t.length,e)):eE.call(this,(0,$.FQ)(t.values))},ew.prototype.visitInt=eS,ew.prototype.visitFloat=eS,ew.prototype.visitUtf8=eR,ew.prototype.visitLargeUtf8=eR,ew.prototype.visitBinary=eR,ew.prototype.visitLargeBinary=eR,ew.prototype.visitFixedSizeBinary=eS,ew.prototype.visitDate=eS,ew.prototype.visitTimestamp=eS,ew.prototype.visitTime=eS,ew.prototype.visitDecimal=eS,ew.prototype.visitList=ev,ew.prototype.visitStruct=eT,ew.prototype.visitUnion=function(t){var e;let{type:i,length:s,typeIds:r,valueOffsets:n}=t;if(eE.call(this,r),i.mode===tn.R.Sparse)return eT.call(this,t);if(i.mode===tn.R.Dense)if(t.offset<=0)return eE.call(this,n),eT.call(this,t);else{let a=new Int32Array(s),o=Object.create(null),d=Object.create(null);for(let t,i,h=-1;++h<s;)void 0!==(t=r[h])&&(void 0===(i=o[t])&&(i=o[t]=n[h]),a[h]=n[h]-i,d[t]=(null!=(e=d[t])?e:0)+1);eE.call(this,a),this.visitMany(t.children.map((t,e)=>{let r=i.typeIds[e],n=o[r],a=d[r];return t.slice(n,Math.min(s,a))}))}return this},ew.prototype.visitInterval=eS,ew.prototype.visitDuration=eS,ew.prototype.visitFixedSizeList=ev,ew.prototype.visitMap=ev,J.l;var eO=i(53234),eF=i(34206);class eA extends J.l{static assemble(...t){let e=new eA;return t.map(({schema:t,data:i})=>e.visitMany(t.fields,i.children))}visit({name:t},e){let{length:i}=e,{offset:s,nullCount:r,nullBitmap:n}=e,a=_.pe.isDictionary(e.type)?e.type.indices:e.type,o=Object.assign([],e.buffers,{[eF.NZ.VALIDITY]:void 0});return Object.assign({name:t,count:i,VALIDITY:_.pe.isNull(a)||_.pe.isUnion(a)?void 0:r<=0?Array.from({length:i},()=>1):[...new $.kE(n,s,i,null,$.mh)]},super.visit(e.clone(a,s,i,0,o)))}visitNull(){return{}}visitBool({values:t,offset:e,length:i}){return{DATA:[...new $.kE(t,e,i,null,$.Jz)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...eB(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new u.M([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new u.M([t])],OFFSET:[...eB(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...eN(new u.M([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...eN(new u.M([t]))],OFFSET:[...eB(t.valueOffsets,2)]}}visitFixedSizeBinary(t){return{DATA:[...eN(new u.M([t]))]}}visitDate(t){return{DATA:t.type.unit===ta.f.DAY?[...t.values]:[...eB(t.values,2)]}}visitTimestamp(t){return{DATA:[...eB(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<tm.y.MICROSECOND?[...t.values]:[...eB(t.values,2)]}}visitDecimal(t){return{DATA:[...eB(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===tn.R.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){return{DATA:[...t.values]}}visitDuration(t){return{DATA:[...eB(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}function*eN(t){for(let e of t)yield e.reduce((t,e)=>`${t}${("0"+(255&e).toString(16)).slice(-2)}`,"").toUpperCase()}function*eB(t,e){let i=new Uint32Array(t.buffer);for(let t=-1,s=i.length/e;++t<s;)yield`${eO.BN.new(i.subarray((t+0)*e,(t+1)*e),!1)}`}class eD extends H{static throughNode(t){throw Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new j,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(0,W.Gv)(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy="boolean"!=typeof t.autoDestroy||t.autoDestroy,this._writeLegacyIpcFormat="boolean"==typeof t.writeLegacyIpcFormat&&t.writeLegacyIpcFormat}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return(0,W.yL)(t)?t.then(t=>this.writeAll(t)):(0,W.Td)(t)?eM(this,t):eP(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof j?this._sink=t:(this._sink=new j,t&&(0,W.DC)(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&(0,W.JO)(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,e&&(0,eI._e)(e,this._schema)||(null==e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(null==t)return this.finish()&&void 0;else if(t instanceof em.XI&&!(e=t.schema))return this.finish()&&void 0;else if(t instanceof th.g&&!(e=t.schema))return this.finish()&&void 0}else throw Error("RecordBatchWriter is closed");
1if(e&&!(0,eI._e)(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof th.g?t instanceof th.M||this._writeRecordBatch(t):t instanceof em.XI?this.writeAll(t.batches):(0,W.xZ)(t)&&this.writeAll(t)}_writeMessage(t,e=8){let i=e-1,r=tG.encode(t),n=r.byteLength,a=this._writeLegacyIpcFormat?4:8,o=n+a+i&~i,d=o-n-a;return t.headerType===s.RecordBatch?this._recordBatchBlocks.push(new L(o,t.bodyLength,this._position)):t.headerType===s.DictionaryBatch&&this._dictionaryBlocks.push(new L(o,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-a)),n>0&&this._write(r),this._writePadding(d)}_write(t){if(this._started){let e=(0,A.Fo)(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(tG.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(et)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:i,bufferRegions:s,buffers:r}=ew.assemble(t),n=new tQ(t.numRows,i,s),a=tG.from(n,e);
1return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,i=!1){let{byteLength:s,nodes:r,bufferRegions:n,buffers:a}=ew.assemble(new u.M([t])),o=new tY(new tQ(t.length,r,n),e,i),d=tG.from(o,s);return this._writeMessage(d)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,s;for(let r=-1,n=t.length;++r<n;)(e=t[r])&&(i=e.byteLength)>0&&(this._write(e),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){var e,i;for(let[s,r]of t.dictionaries){let t=null!=(e=null==r?void 0:r.data)?e:[],n=this._seenDictionaries.get(s),a=null!=(i=this._dictionaryDeltaOffsets.get(s))?i:0;if(n&&n.data[0]===t[0]){if(a<t.length)for(let e of t.slice(a))this._writeDictionaryBatch(e,s,!0)}else for(let[e,i]of t.entries())this._writeDictionaryBatch(i,s,e>0);this._seenDictionaries.set(s,r),this._dictionaryDeltaOffsets.set(s,t.length)}return this}}class eL extends eD{static writeAll(t,e){let i=new eL(e);return(0,W.yL)(t)?t.then(t=>i.writeAll(t)):(0,W.Td)(t)?eM(i,t):eP(i,t)}}class eU extends eD{static writeAll(t){let e=new eU;return(0,W.yL)(t)?t.then(t=>e.writeAll(t)):(0,W.Td)(t)?eM(e,t):eP(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,i=!1){if(!i&&this._seenDictionaries.has(e))throw Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,i)}_writeFooter(t){let e=B.encode(new B(t,E.W.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function eP(t,e){let i=e;for(let s of(e instanceof em.XI&&(i=e.batches,t.reset(void 0,e.schema)),i))t.write(s);return t.finish()}function eM(t,e){return(0,l.sH)(this,void 0,void 0,function*(){var i,s,r,n,a,o,d;try{for(i=!0,s=(0,l.xN)(e);!(n=(r=yield s.next()).done);i=!0)d=r.value,i=!1,t.write(d)}catch(t){a={error:t}}finally{try{!i&&!n&&(o=s.return)&&(yield o.call(s))}finally{if(a)throw a.error}}return t.finish()})}var ex=Object.create,eC=Object.defineProperty,ek=Object.getOwnPropertyDescriptor,eV=Object.getOwnPropertyNames,eH=Object.getPrototypeOf,ez=Object.prototype.hasOwnProperty,eW=((t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports))((t,e)=>{e.exports=Worker}),ej=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.AUTOMATIC=1]="AUTOMATIC",t[t.READ_ONLY=2]="READ_ONLY",t[t.READ_WRITE=3]="READ_WRITE",t))(ej||{}),eG=(t=>(t[t.IDENTIFIER=0]="IDENTIFIER",t[t.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",t[t.STRING_CONSTANT=2]="STRING_CONSTANT",t[t.OPERATOR=3]="OPERATOR",t[t.KEYWORD=4]="KEYWORD",t[t.COMMENT=5]="COMMENT",t))(eG||{}),eQ=(t=>(t[t.NONE=0]="NONE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR",t))(eQ||{}),eY=(t=>(t[t.NONE=0]="NONE",t[t.CONNECT=1]="CONNECT",t[t.DISCONNECT=2]="DISCONNECT",t[t.OPEN=3]="OPEN",t[t.QUERY=4]="QUERY",t[t.INSTANTIATE=5]="INSTANTIATE",t))(eY||{}),eK=(t=>(t[t.NONE=0]="NONE",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR",t[t.START=3]="START",t[t.RUN=4]="RUN",t[t.CAPTURE=5]="CAPTURE",t))(eK||{}),eq=(t=>(t[t.NONE=0]="NONE",t[t.WEB_WORKER=1]="WEB_WORKER",t[t.NODE_WORKER=2]="NODE_WORKER",t[t.BINDINGS=3]="BINDINGS",t[t.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",t))(eq||{}),eZ=class{log(t){}},eJ=class{constructor(t=2){this.level=t}log(t){t.level>=this.level&&console.log(t)}};function e$(t){switch(t){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function eX(t){switch(t){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function e0(t){switch(t){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function e1(t){switch(t){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var e2=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",t[t.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",t))(e2||{});function e3(t){return t<=255}function e4(t){return 256===t}var e8=class{constructor(t,e){this._bindings=t,this._conn=e}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}async query(t){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:t});let e=await this._bindings.runQuery(this._conn,t),i=en.from(e);return console.assert(i.isSync(),"Reader is not sync"),console.assert(i.isFile(),"Reader is not file"),new em.XI(i)}async send(t,e=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:t});let i=await this._bindings.startPendingQuery(this._conn,t,e);for(;null==i;){if(this._bindings.isDetached())return void console.error("cannot send a message since the worker is not set!");i=await this._bindings.pollPendingQuery(this._conn)}
1let s=new e6(this._bindings,this._conn,i),r=await en.from(s);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(t){return await this._bindings.getTableNames(this._conn,t)}async prepare(t){let e=await this._bindings.createPrepared(this._conn,t);return new e5(this._bindings,this._conn,e)}async insertArrowTable(t,e){let i=function(t,e="stream"){return("stream"===e?eL:eU).writeAll(t).toUint8Array(!0)}(t,"stream");await this.insertArrowFromIPCStream(i,e)}async insertArrowFromIPCStream(t,e){await this._bindings.insertArrowFromIPCStream(this._conn,t,e)}async insertCSVFromPath(t,e){await this._bindings.insertCSVFromPath(this._conn,t,e)}async insertJSONFromPath(t,e){await this._bindings.insertJSONFromPath(this._conn,t,e)}},e6=class{constructor(t,e,i){this.db=t,this.conn=e,this.header=i,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let t=null;for(null!=this._inFlight&&(t=await this._inFlight,this._inFlight=null);null==t;)t=await this.db.fetchQueryResults(this.conn);return this._depleted=0==t.length,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:t}}[Symbol.asyncIterator](){return this}},e5=class{constructor(t,e,i){this.bindings=t,this.connectionId=e,this.statementId=i}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...t){let e=await this.bindings.runPrepared(this.connectionId,this.statementId,t),i=en.from(e);return console.assert(i.isSync()),console.assert(i.isFile()),new em.XI(i)}async send(...t){let e=await this.bindings.sendPrepared(this.connectionId,this.statementId,t),i=new e6(this.bindings,this.connectionId,e),s=await en.from(i);return console.assert(s.isAsync()),console.assert(s.isStream()),s}},e9=(t=>(t.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",t.CLOSE_PREPARED="CLOSE_PREPARED",t.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",t.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",t.CONNECT="CONNECT",t.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",t.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",t.CREATE_PREPARED="CREATE_PREPARED",t.DISCONNECT="DISCONNECT",t.DROP_FILE="DROP_FILE",t.DROP_FILES="DROP_FILES",t.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",t.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",t.FLUSH_FILES="FLUSH_FILES",t.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",t.GET_TABLE_NAMES="GET_TABLE_NAMES",t.GET_VERSION="GET_VERSION",t.GLOB_FILE_INFOS="GLOB_FILE_INFOS",t.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",t.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",t.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",t.INSTANTIATE="INSTANTIATE",t.OPEN="OPEN",t.PING="PING",t.POLL_PENDING_QUERY="POLL_PENDING_QUERY",t.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",t.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",t.REGISTER_FILE_URL="REGISTER_FILE_URL",t.RESET="RESET",t.RUN_PREPARED="RUN_PREPARED",t.RUN_QUERY="RUN_QUERY",t.SEND_PREPARED="SEND_PREPARED",t.START_PENDING_QUERY="START_PENDING_QUERY",t.TOKENIZE="TOKENIZE",t))(e9||{}),e7=(t=>(t.CONNECTION_INFO="CONNECTION_INFO",t.ERROR="ERROR",t.FEATURE_FLAGS="FEATURE_FLAGS",t.FILE_BUFFER="FILE_BUFFER",t.FILE_INFOS="FILE_INFOS",t.FILE_SIZE="FILE_SIZE",t.FILE_STATISTICS="FILE_STATISTICS",t.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",t.LOG="LOG",t.PROGRESS_UPDATE="PROGRESS_UPDATE",t.OK="OK",t.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",t.QUERY_PLAN="QUERY_PLAN",t.QUERY_RESULT="QUERY_RESULT",t.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",t.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",t.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",t.REGISTERED_FILE="REGISTERED_FILE",t.SCRIPT_TOKENS="SCRIPT_TOKENS",t.SUCCESS="SUCCESS",t.TABLE_NAMES="TABLE_NAMES",t.VERSION_STRING="VERSION_STRING",t))(e7||{}),it=class{constructor(t,e){this.promiseResolver=()=>{}
1,this.promiseRejecter=()=>{},this.type=t,this.data=e,this.promise=new Promise((t,e)=>{this.promiseResolver=t,this.promiseRejecter=e})}};function ie(t,e){let i=function t(e){switch(e.typeId){case eF.ZU.Binary:return{sqlType:"binary"};case eF.ZU.Bool:return{sqlType:"bool"};case eF.ZU.Date:return{sqlType:"date"};case eF.ZU.DateDay:return{sqlType:"date32[d]"};case eF.ZU.DateMillisecond:return{sqlType:"date64[ms]"};case eF.ZU.Decimal:return{sqlType:"decimal",precision:e.precision,scale:e.scale};case eF.ZU.Float:return{sqlType:"float"};case eF.ZU.Float16:return{sqlType:"float16"};case eF.ZU.Float32:return{sqlType:"float32"};case eF.ZU.Float64:return{sqlType:"float64"};case eF.ZU.Int:return{sqlType:"int32"};case eF.ZU.Int16:return{sqlType:"int16"};case eF.ZU.Int32:return{sqlType:"int32"};case eF.ZU.Int64:return{sqlType:"int64"};case eF.ZU.Uint16:return{sqlType:"uint16"};case eF.ZU.Uint32:return{sqlType:"uint32"};case eF.ZU.Uint64:return{sqlType:"uint64"};case eF.ZU.Uint8:return{sqlType:"uint8"};case eF.ZU.IntervalDayTime:return{sqlType:"interval[dt]"};case eF.ZU.IntervalYearMonth:return{sqlType:"interval[m]"};case eF.ZU.List:return{sqlType:"list",valueType:t(e.valueType)};case eF.ZU.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case eF.ZU.Null:return{sqlType:"null"};case eF.ZU.Utf8:return{sqlType:"utf8"};case eF.ZU.Struct:return{sqlType:"struct",fields:e.children.map(t=>ie(t.name,t.type))};case eF.ZU.Map:return{sqlType:"map",keyType:t(e.keyType),valueType:t(e.valueType)};case eF.ZU.Time:return{sqlType:"time[s]"};case eF.ZU.TimeMicrosecond:return{sqlType:"time[us]"};case eF.ZU.TimeMillisecond:return{sqlType:"time[ms]"};case eF.ZU.TimeNanosecond:return{sqlType:"time[ns]"};case eF.ZU.TimeSecond:return{sqlType:"time[s]"};case eF.ZU.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case eF.ZU.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case eF.ZU.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case eF.ZU.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case eF.ZU.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw Error("unsupported arrow type: ".concat(e.toString()))}(e);return i.name=t,i}var ii=/'(opfs:\/\/\S*?)'/g,is=/(opfs:\/\/\S*?)/g,ir=new TextEncoder,ia=class{constructor(t,e=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._config={},this._logger=t,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),null!=e&&this.attach(e)}get logger(){return this._logger}get config(){return this._config}attach(t){this._worker=t,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,e)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(t,e=[]){if(!this._worker)return void console.error("cannot send a message since the worker is not set!:"+t.type+","+t.data);let i=this._nextMessageId++;return this._pendingRequests.set(i,t),this._worker.postMessage({messageId:i,type:t.type,data:t.data},e),await t.promise}onMessage(t){var e;let i=t.data;switch(i.type){case"PROGRESS_UPDATE":for(let t of this._onExecutionProgress)t(i.data);return;case"LOG":return void this._logger.log(i.data);case"INSTANTIATE_PROGRESS":for(let t of this._onInstantiationProgress)t(i.data);return}
1let s=this._pendingRequests.get(i.requestId);if(!s)return void console.warn("unassociated response: [".concat(i.requestId,", ").concat(i.type.toString(),"]"));if(this._pendingRequests.delete(i.requestId),"ERROR"==i.type){let t=Error(i.data.message);t.name=i.data.name,null!=(e=Object.getOwnPropertyDescriptor(t,"stack"))&&e.writable&&(t.stack=i.data.stack),s.promiseRejecter(t);return}switch(s.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if("OK"==i.type)return void s.promiseResolver(i.data);break;case"INSTANTIATE":if(this._onInstantiationProgress=[],"OK"==i.type)return void s.promiseResolver(i.data);break;case"GLOB_FILE_INFOS":if("FILE_INFOS"==i.type)return void s.promiseResolver(i.data);break;case"GET_VERSION":if("VERSION_STRING"==i.type)return void s.promiseResolver(i.data);break;case"GET_FEATURE_FLAGS":if("FEATURE_FLAGS"==i.type)return void s.promiseResolver(i.data);break;case"GET_TABLE_NAMES":if("TABLE_NAMES"==i.type)return void s.promiseResolver(i.data);break;case"TOKENIZE":if("SCRIPT_TOKENS"==i.type)return void s.promiseResolver(i.data);break;case"COPY_FILE_TO_BUFFER":if("FILE_BUFFER"==i.type)return void s.promiseResolver(i.data);break;case"EXPORT_FILE_STATISTICS":if("FILE_STATISTICS"==i.type)return void s.promiseResolver(i.data);break;case"CONNECT":if("CONNECTION_INFO"==i.type)return void s.promiseResolver(i.data);break;case"RUN_PREPARED":case"RUN_QUERY":if("QUERY_RESULT"==i.type)return void s.promiseResolver(i.data);break;case"SEND_PREPARED":if("QUERY_RESULT_HEADER"==i.type)return void s.promiseResolver(i.data);break;case"START_PENDING_QUERY":case"POLL_PENDING_QUERY":if("QUERY_RESULT_HEADER_OR_NULL"==i.type)return void s.promiseResolver(i.data);break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],"SUCCESS"==i.type)return void s.promiseResolver(i.data);break;case"FETCH_QUERY_RESULTS":if("QUERY_RESULT_CHUNK"==i.type)return void s.promiseResolver(i.data);break;case"CREATE_PREPARED":if("PREPARED_STATEMENT_ID"==i.type)return void s.promiseResolver(i.data)}s.promiseRejecter(Error("unexpected response type: ".concat(i.type.toString())))}onError(t){console.error(t),console.error("error in duckdb worker: ".concat(t.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),0!=this._pendingRequests.size)return void console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));this._pendingRequests.clear()}isDetached(){return!this._worker}async reset(){let t=new it("RESET",null);return await this.postTask(t)}async ping(){let t=new it("PING",null);await this.postTask(t)}async dropFile(t){let e=new it("DROP_FILE",t);return await this.postTask(e)}async dropFiles(t){let e=new it("DROP_FILES",t);return await this.postTask(e)}async flushFiles(){let t=new it("FLUSH_FILES",null);return await this.postTask(t)}async instantiate(t,e=null,i=t=>{}){this._onInstantiationProgress.push(i);let s=new it("INSTANTIATE",[t,e]);return await this.postTask(s)}async getVersion(){let t=new it("GET_VERSION",null);return await this.postTask(t)}async getFeatureFlags(){let t=new it("GET_FEATURE_FLAGS",null);return await this.postTask(t)}async open(t){this._config=t;let e=new it("OPEN",t);await this.postTask(e)}async tokenize(t){let e=new it("TOKENIZE",t);return await this.postTask(e)}async connectInternal(){let t=new it("CONNECT",null);return await this.postTask(t)}async connect(){return new e8(this,await this.connectInternal())}async disconnect(t){let e=new it("DISCONNECT",t);await this.postTask(e)}async runQuery(t,e){if(!this.shouldOPFSFileHandling())return await this._runQueryAsync(t,e);{let i=await this.registerOPFSFileFromSQL(e);try{return await this._runQueryAsync(t,e)}finally{i.length>0&&await this.dropFiles(i)}}}async _runQueryAsync(t,e){let i=new it("RUN_QUERY",[t,e]);return await this.postTask(i)}async startPendingQuery(t,e,i=!1){if(!this.shouldOPFSFileHandling())return await this._startPendingQueryAsync(t,e,i);{let s=await this.registerOPFSFileFromSQL(e);try{return await this._startPendingQueryAsync(t,e,i)}finally{s.length>0&&await this.dropFiles(s)}}}async _startPendingQueryAsync(t,e,i=!1){let s=new it("START_PENDING_QUERY",[t,e,i]);return await this.postTask(s)}async pollPendingQuery(t){let e=new it("POLL_PENDING_QUERY",t);return await this.postTask(e)}async cancelPendingQuery(t){let e=new it("CANCEL_PENDING_QUERY",t);return await this.postTask(e)}async fetchQueryResults(t){let e=new it("FETCH_QUERY_RESULTS",t);return await this.postTask(e)}async getTableNames(t,e){let i=new it("GET_TABLE_NAMES",[t,e]);return await this.postTask(i)}async createPrepared(t,e){let i=new it("CREATE_PREPARED",[t,e]);return await this.postTask(i)}async closePrepared(t,e){let i=new it("CLOSE_PREPARED",[t,e]);await this.postTask(i)}async runPrepared(t,e,i){let s=new it("RUN_PREPARED",[t,e,i]);return await this.postTask(s)}async sendPrepared(t,e,i){let s=new it("SEND_PREPARED",[t,e,i]);return await this.postTask(s)}async globFiles(t){let e=new it("GLOB_FILE_INFOS",t);return await this.postTask(e)}async registerFileText(t,e){let i=ir.encode(e);await this.registerFileBuffer(t,i)}
1async registerFileURL(t,e,i,s){void 0===e&&(e=t);let r=new it("REGISTER_FILE_URL",[t,e,i,s]);await this.postTask(r)}async registerEmptyFileBuffer(t){}async registerFileBuffer(t,e){let i=new it("REGISTER_FILE_BUFFER",[t,e]);await this.postTask(i,[e.buffer])}async registerFileHandle(t,e,i,s){let r=new it("REGISTER_FILE_HANDLE",[t,e,i,s]);await this.postTask(r,[])}async registerOPFSFileName(t){let e=new it("REGISTER_OPFS_FILE_NAME",[t]);await this.postTask(e,[])}async collectFileStatistics(t,e){let i=new it("COLLECT_FILE_STATISTICS",[t,e]);await this.postTask(i,[])}async exportFileStatistics(t){let e=new it("EXPORT_FILE_STATISTICS",t);return await this.postTask(e,[])}async copyFileToBuffer(t){let e=new it("COPY_FILE_TO_BUFFER",t);return await this.postTask(e)}async copyFileToPath(t,e){let i=new it("COPY_FILE_TO_PATH",[t,e]);await this.postTask(i)}async insertArrowFromIPCStream(t,e,i){if(0==e.length)return;let s=new it("INSERT_ARROW_FROM_IPC_STREAM",[t,e,i]);await this.postTask(s,[e.buffer])}async insertCSVFromPath(t,e,i){if(void 0!==i.columns){let t=[];for(let e in i.columns){let s=i.columns[e];t.push(ie(e,s))}i.columnsFlat=t,delete i.columns}let s=new it("IMPORT_CSV_FROM_PATH",[t,e,i]);await this.postTask(s)}async insertJSONFromPath(t,e,i){if(void 0!==i.columns){let t=[];for(let e in i.columns){let s=i.columns[e];t.push(ie(e,s))}i.columnsFlat=t,delete i.columns}let s=new it("IMPORT_JSON_FROM_PATH",[t,e,i]);await this.postTask(s)}shouldOPFSFileHandling(){var t,e;return(null!=(t=this.config.path)?t:"").search(is)>-1&&(null==(e=this.config.opfs)?void 0:e.fileHandling)=="auto"}async registerOPFSFileFromSQL(t){let e=[...t.matchAll(ii)].map(t=>t[1]),i=[];for(let t of e)try{await this.registerOPFSFileName(t),i.push(t)}catch(e){throw console.error(e),Error("File Not found:"+t)}return i}};!function(){new TextDecoder}();var io=(t=>(t[t.BUFFER=0]="BUFFER",t[t.NODE_FS=1]="NODE_FS",t[t.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",t[t.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",t[t.HTTP=4]="HTTP",t[t.S3=5]="S3",t))(io||{}),id=class{constructor(){this._bindings=null,this._nextMessageId=0}log(t){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:t},[])}sendOK(t){this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"OK",data:null},[])}failWith(t,e){let i={name:e.name,message:e.message,stack:e.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"ERROR",data:i},[])}async onMessage(t){switch(t.type){case"PING":this.sendOK(t);return;case"INSTANTIATE":null!=this._bindings&&this.failWith(t,Error("duckdb already initialized"));try{this._bindings=await this.instantiate(t.data[0],t.data[1],e=>{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"INSTANTIATE_PROGRESS",data:e},[])}),this.sendOK(t)}catch(e){console.log(e),this._bindings=null,this.failWith(t,e)}return}if(!this._bindings)return this.failWith(t,Error("duckdb is not initialized"));try{switch(t.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(t);break;case"OPEN":{let e=t.data.path;null!=e&&e.startsWith("opfs://")&&(await this._bindings.prepareDBFileHandle(e,3),t.data.useDirectIO=!0),this._bindings.open(t.data),this.sendOK(t);break}case"DROP_FILE":this._bindings.dropFile(t.data),this.sendOK(t);break;case"DROP_FILES":this._bindings.dropFiles(t.data),this.sendOK(t);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(t);break;case"CONNECT":{let e=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"CONNECTION_INFO",data:e.useUnsafe((t,e)=>e)},[]);break}case"DISCONNECT":this._bindings.disconnect(t.data),this.sendOK(t);break;case"CREATE_PREPARED":{let e=this._bindings.createPrepared(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"PREPARED_STATE
1MENT_ID",data:e},[]);break}case"CLOSE_PREPARED":this._bindings.closePrepared(t.data[0],t.data[1]),this.sendOK(t);break;case"RUN_PREPARED":{let e=this._bindings.runPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"RUN_QUERY":{let e=this._bindings.runQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"SEND_PREPARED":{let e=this._bindings.sendPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER",data:e},[e.buffer]);break}case"START_PENDING_QUERY":{let e=this._bindings.startPendingQuery(t.data[0],t.data[1],t.data[2]),i=[];e&&i.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},i);break}case"POLL_PENDING_QUERY":{let e=this._bindings.pollPendingQuery(t.data),i=[];e&&i.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},i);break}case"CANCEL_PENDING_QUERY":{let e=this._bindings.cancelPendingQuery(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SUCCESS",data:e},[]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data),i=e?[e.buffer]:[];this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},i);break}case"GET_TABLE_NAMES":{let e=this._bindings.getTableNames(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"TABLE_NAMES",data:e},[]);break}case"GLOB_FILE_INFOS":{let e=this._bindings.globFiles(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_INFOS",data:e},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":await this._bindings.registerFileHandleAsync(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_OPFS_FILE_NAME":await this._bindings.registerOPFSFileName(t.data[0]),this.sendOK(t);break;case"EXPORT_FILE_STATISTICS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(t.data)},[]);break;case"INSERT_ARROW_FROM_IPC_STREAM":this._bindings.insertArrowFromIPCStream(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break;case"IMPORT_CSV_FROM_PATH":this._bindings.insertCSVFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break;case"IMPORT_JSON_FROM_PATH":this._bindings.insertJSONFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break;case"TOKENIZE":{let e=this._bindings.tokenize(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SCRIPT_TOKENS",data:e},[])}}}catch(e){return console.log(e),this.failWith(t,e)}}},ih=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),il=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),ic=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),iu={name:"@duckdb/duckdb-wasm",version:"1.32.0"},i_=iu.name,ib=iu.version,ip=iu.version.split("."),iy=ip[0],ig=ip[1],im=ip[2],iI=()=>typeof navigator>"u",iw=()=>iI()?"node":navigator.userAgent,iE=()=>iw().includes("Firefox"),iS=()=>/^((?!chrome|android).)*safari/i.test(iw());function iR(){let t="https://cdn.jsdelivr.net/npm/".concat(i_,"@").concat(ib,"/dist/");return{mvp:{mainModule:"".concat(t,"duckdb-mvp.wasm"),mainWorker:"".concat(t,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(t,"duckdb-eh.wasm"),mainWorker:"".concat(t,"duckdb-browser-eh.worker.js")}}}var iv=null,iT=null,iO=null,iF=null,iA=null;async function iN(){return null==iv&&(iv="u">typeof BigInt64Array),null==iT&&(iT=await il()),null==iO&&(iO=await (async t=>{try{return"u">typeof MessageChannel&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch(t){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))),null==iF&&(iF=await ic()),null==iA&&(iA=await ih()),{bigInt64Array:iv,crossOriginIsolated:iI()||globalThis.crossOriginIsolated||!1,wasmExceptions:iT,wasmSIMD:iF,wasmThreads:iO,wasmBulkMemory:iA}}async function iB(t){let e=await iN();if(e.wasmExceptions){if(e.wasmSIMD&&e.wasmThreads&&e.crossOriginIsolated&&t.coi)return{mainModule:t.coi.mainModule,mainWorker:t.coi.mainWorker,pthreadWorker:t.coi.pthreadWorker};if(t.eh)return{mainModule:t.eh.mainModule,mainWorker:t.eh.mainWorker,pthreadWorker:null}}return{mainModule:t.mvp.mainModule,mainWorker:t.mvp.mainWorker,pthreadWorker:null}}
1var iD=((t,e,i)=>(i=null!=t?ex(eH(t)):{},((t,e,i,s)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let r of eV(e))ez.call(t,r)||r===i||eC(t,r,{get:()=>e[r],enumerable:!(s=ek(e,r))||s.enumerable});return t})(!e&&t&&t.__esModule?i:eC(i,"default",{value:t,enumerable:!0}),t)))(eW());async function iL(t){let e=new Request(t),i=await fetch(e),s=URL.createObjectURL(await i.blob());return new iD.default(s)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.