@ioai/lerobot-studio 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist-lib/{DockviewLayout-DeRL52Yo.js → DockviewLayout-BDK9-nmD.js} +3245 -3221
- package/dist-lib/{LeRobotDataLoader-B8wZijIi.js → LeRobotDataLoader-CgLRJ0U1.js} +1885 -1809
- package/dist-lib/assets/parquetImage.worker-DJN4vgFr.js +7 -0
- package/dist-lib/lerobot-studio.css +39 -1
- package/dist-lib/lerobot.es.js +3618 -2512
- package/dist-lib/{react-window-BIZRp3dx.js → react-window-DufFyc3b.js} +999 -763
- package/dist-lib/workerManager-CvezHmhd.js +436 -0
- package/package.json +13 -10
- package/dist-lib/assets/parquetImage.worker-CsyqAWyH.js +0 -7
- package/dist-lib/workerManager-D6ovn2ln.js +0 -270
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
const e=Symbol(`Comlink.proxy`),t=Symbol(`Comlink.endpoint`),n=Symbol(`Comlink.releaseProxy`),r=Symbol(`Comlink.finalizer`),i=Symbol(`Comlink.thrown`),a=e=>typeof e==`object`&&!!e||typeof e==`function`,o=new Map([[`proxy`,{canHandle:t=>a(t)&&t[e],serialize(e){let{port1:t,port2:n}=new MessageChannel;return c(e,t),[n,[n]]},deserialize(e){return e.start(),ee(e)}}],[`throw`,{canHandle:e=>a(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function s(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function c(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function a(o){if(!o||!o.data)return;if(!s(n,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}let{id:l,type:ee,path:d}=Object.assign({path:[]},o.data),te=(o.data.argumentList||[]).map(pe),ne;try{let t=d.slice(0,-1).reduce((e,t)=>e[t],e),n=d.reduce((e,t)=>e[t],e);switch(ee){case`GET`:ne=n;break;case`SET`:t[d.slice(-1)[0]]=pe(o.data.value),ne=!0;break;case`APPLY`:ne=n.apply(t,te);break;case`CONSTRUCT`:ne=de(new n(...te));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;c(e,n),ne=ue(t,[t])}break;case`RELEASE`:ne=void 0;break;default:return}}catch(e){ne={value:e,[i]:0}}Promise.resolve(ne).catch(e=>({value:e,[i]:0})).then(n=>{let[i,o]=fe(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),o),ee===`RELEASE`&&(t.removeEventListener(`message`,a),u(t),r in e&&typeof e[r]==`function`&&e[r]())}).catch(e=>{let[n,r]=fe({value:TypeError(`Unserializable return value`),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)})}),t.start&&t.start()}function l(e){return e.constructor.name===`MessagePort`}function u(e){l(e)&&e.close()}function ee(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),oe(e,n,[],t)}function d(e){if(e)throw Error(`Proxy has been released and is not useable`)}function te(e){return me(e,new Map,{type:`RELEASE`}).then(()=>{u(e)})}const ne=new WeakMap,re=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(ne.get(e)||0)-1;ne.set(e,t),t===0&&te(e)});function ie(e,t){let n=(ne.get(t)||0)+1;ne.set(t,n),re&&re.register(e,t,e)}function ae(e){re&&re.unregister(e)}function oe(e,r,i=[],a=function(){}){let o=!1,s=new Proxy(a,{get(t,a){if(d(o),a===n)return()=>{ae(s),te(e),r.clear(),o=!0};if(a===`then`){if(i.length===0)return{then:()=>s};let t=me(e,r,{type:`GET`,path:i.map(e=>e.toString())}).then(pe);return t.then.bind(t)}return oe(e,r,[...i,a])},set(t,n,a){d(o);let[s,c]=fe(a);return me(e,r,{type:`SET`,path:[...i,n].map(e=>e.toString()),value:s},c).then(pe)},apply(n,a,s){d(o);let c=i[i.length-1];if(c===t)return me(e,r,{type:`ENDPOINT`}).then(pe);if(c===`bind`)return oe(e,r,i.slice(0,-1));let[l,u]=ce(s);return me(e,r,{type:`APPLY`,path:i.map(e=>e.toString()),argumentList:l},u).then(pe)},construct(t,n){d(o);let[a,s]=ce(n);return me(e,r,{type:`CONSTRUCT`,path:i.map(e=>e.toString()),argumentList:a},s).then(pe)}});return ie(s,e),s}function se(e){return Array.prototype.concat.apply([],e)}function ce(e){let t=e.map(fe);return[t.map(e=>e[0]),se(t.map(e=>e[1]))]}const le=new WeakMap;function ue(e,t){return le.set(e,t),e}function de(t){return Object.assign(t,{[e]:!0})}function fe(e){for(let[t,n]of o)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},le.get(e)||[]]}function pe(e){switch(e.type){case`HANDLER`:return o.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function me(e,t,n,r){return new Promise(i=>{let a=he();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function he(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}let f,ge=null;function _e(){return(ge===null||ge.byteLength===0)&&(ge=new Uint8Array(f.memory.buffer)),ge}let ve=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});ve.decode();let ye=0;function be(e,t){return ye+=t,ye>=2146435072&&(ve=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),ve.decode(),ye=t),ve.decode(_e().subarray(e,e+t))}function xe(e,t){return e>>>=0,be(e,t)}let p=0;const Se=new TextEncoder;`encodeInto`in Se||(Se.encodeInto=function(e,t){let n=Se.encode(e);return t.set(n),{read:e.length,written:n.length}});function Ce(e,t,n){if(n===void 0){let n=Se.encode(e),r=t(n.length,1)>>>0;return _e().subarray(r,r+n.length).set(n),p=n.length,r}let r=e.length,i=t(r,1)>>>0,a=_e(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=_e().subarray(i+o,i+r),a=Se.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return p=o,i}let we=null;function Te(){return(we===null||we.buffer.detached===!0||we.buffer.detached===void 0&&we.buffer!==f.memory.buffer)&&(we=new DataView(f.memory.buffer)),we}function Ee(e){let t=f.__externref_table_alloc();return f.__wbindgen_export_4.set(t,e),t}function m(e,t){try{return e.apply(this,t)}catch(e){let t=Ee(e);f.__wbindgen_exn_store(t)}}function h(e){return e==null}function De(e,t){return e>>>=0,_e().subarray(e/1,e/1+t)}function Oe(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=Oe(e[0]));for(let r=1;r<t;r++)n+=`, `+Oe(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}const ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{f.__wbindgen_export_5.get(e.dtor)(e.a,e.b)});function Ae(e,t,n,r){let i={a:e,b:t,cnt:1,dtor:n},a=(...e)=>{i.cnt++;let t=i.a;i.a=0;try{return r(t,i.b,...e)}finally{--i.cnt===0?(f.__wbindgen_export_5.get(i.dtor)(t,i.b),ke.unregister(i)):i.a=t}};return a.original=i,ke.register(a,i,i),a}function g(e){let t=f.__wbindgen_export_4.get(e);return f.__externref_table_dealloc(e),t}function je(e,t){e>>>=0;let n=Te(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(f.__wbindgen_export_4.get(n.getUint32(i,!0)));return f.__externref_drop_slice(e,t),r}function Me(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function Ne(e,t){let n=t(e.length*1,1)>>>0;return _e().set(e,n/1),p=e.length,n}function Pe(e,t){let n=Ne(e,f.__wbindgen_malloc),r=p,i=f.readParquet(n,r,h(t)?0:Ee(t));if(i[2])throw g(i[1]);return vt.__wrap(i[0])}let Fe=null;function Ie(){return(Fe===null||Fe.byteLength===0)&&(Fe=new Uint32Array(f.memory.buffer)),Fe}function Le(e,t){return e>>>=0,Ie().subarray(e/4,e/4+t)}function Re(e,t,n){f.closure3806_externref_shim(e,t,n)}function ze(e,t){f.wasm_bindgen__convert__closures_____invoke__h7767827484ad8911(e,t)}function Be(e,t,n,r){f.closure3830_externref_shim(e,t,n,r)}Object.freeze({UNCOMPRESSED:0,0:`UNCOMPRESSED`,SNAPPY:1,1:`SNAPPY`,GZIP:2,2:`GZIP`,BROTLI:3,3:`BROTLI`,LZ4:4,4:`LZ4`,ZSTD:5,5:`ZSTD`,LZ4_RAW:6,6:`LZ4_RAW`,LZO:7,7:`LZO`}),Object.freeze({None:0,0:`None`,Chunk:1,1:`Chunk`,Page:2,2:`Page`}),Object.freeze({PLAIN:0,0:`PLAIN`,PLAIN_DICTIONARY:1,1:`PLAIN_DICTIONARY`,RLE:2,2:`RLE`,BIT_PACKED:3,3:`BIT_PACKED`,DELTA_BINARY_PACKED:4,4:`DELTA_BINARY_PACKED`,DELTA_LENGTH_BYTE_ARRAY:5,5:`DELTA_LENGTH_BYTE_ARRAY`,DELTA_BYTE_ARRAY:6,6:`DELTA_BYTE_ARRAY`,RLE_DICTIONARY:7,7:`RLE_DICTIONARY`,BYTE_STREAM_SPLIT:8,8:`BYTE_STREAM_SPLIT`}),Object.freeze({V1:0,0:`V1`,V2:1,1:`V2`});const Ve=[`bytes`],He=[`default`,`no-store`,`reload`,`no-cache`,`force-cache`,`only-if-cached`],Ue=[`omit`,`same-origin`,`include`],We=[`same-origin`,`no-cors`,`cors`,`navigate`],Ge=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_columnchunkmetadata_free(e>>>0,1));var Ke=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ge.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ge.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_columnchunkmetadata_free(e,0)}numValues(){return f.columnchunkmetadata_numValues(this.__wbg_ptr)}columnPath(){let e=f.columnchunkmetadata_columnPath(this.__wbg_ptr);var t=je(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}compression(){return f.columnchunkmetadata_compression(this.__wbg_ptr)}fileOffset(){return f.columnchunkmetadata_fileOffset(this.__wbg_ptr)}compressedSize(){return f.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return f.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}encodings(){let e=f.columnchunkmetadata_encodings(this.__wbg_ptr);var t=je(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}filePath(){let e=f.columnchunkmetadata_filePath(this.__wbg_ptr),t;return e[0]!==0&&(t=xe(e[0],e[1]).slice(),f.__wbindgen_free(e[0],e[1]*1,1)),t}};Symbol.dispose&&(Ke.prototype[Symbol.dispose]=Ke.prototype.free);const qe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_ffidata_free(e>>>0,1));var Je=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,qe.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,qe.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_ffidata_free(e,0)}arrayAddr(){return f.ffidata_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return f.ffidata_schemaAddr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Je.prototype[Symbol.dispose]=Je.prototype.free);const Ye=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_ffischema_free(e>>>0,1));var Xe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ye.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ye.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_ffischema_free(e,0)}addr(){return f.ffischema_addr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Xe.prototype[Symbol.dispose]=Xe.prototype.free);const Ze=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_ffistream_free(e>>>0,1));var Qe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ze.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ze.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_ffistream_free(e,0)}arrayAddr(e){return f.ffistream_arrayAddr(this.__wbg_ptr,e)>>>0}numArrays(){return f.ffistream_numArrays(this.__wbg_ptr)>>>0}arrayAddrs(){let e=f.ffistream_arrayAddrs(this.__wbg_ptr);var t=Le(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}schemaAddr(){return f.ffistream_schemaAddr(this.__wbg_ptr)>>>0}drop(){let e=this.__destroy_into_raw();f.ffistream_drop(e)}};Symbol.dispose&&(Qe.prototype[Symbol.dispose]=Qe.prototype.free);const $e=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_filemetadata_free(e>>>0,1));var et=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,$e.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,$e.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_filemetadata_free(e,0)}createdBy(){let e=f.filemetadata_createdBy(this.__wbg_ptr),t;return e[0]!==0&&(t=xe(e[0],e[1]).slice(),f.__wbindgen_free(e[0],e[1]*1,1)),t}keyValueMetadata(){let e=f.filemetadata_keyValueMetadata(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}version(){return f.filemetadata_version(this.__wbg_ptr)}numRows(){return f.filemetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(et.prototype[Symbol.dispose]=et.prototype.free);const tt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_intounderlyingbytesource_free(e>>>0,1));var nt=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_intounderlyingbytesource_free(e,0)}get autoAllocateChunkSize(){return f.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}pull(e){return f.intounderlyingbytesource_pull(this.__wbg_ptr,e)}start(e){f.intounderlyingbytesource_start(this.__wbg_ptr,e)}get type(){let e=f.intounderlyingbytesource_type(this.__wbg_ptr);return Ve[e]}cancel(){let e=this.__destroy_into_raw();f.intounderlyingbytesource_cancel(e)}};Symbol.dispose&&(nt.prototype[Symbol.dispose]=nt.prototype.free);const rt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_intounderlyingsink_free(e>>>0,1));var it=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,rt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_intounderlyingsink_free(e,0)}abort(e){let t=this.__destroy_into_raw();return f.intounderlyingsink_abort(t,e)}close(){let e=this.__destroy_into_raw();return f.intounderlyingsink_close(e)}write(e){return f.intounderlyingsink_write(this.__wbg_ptr,e)}};Symbol.dispose&&(it.prototype[Symbol.dispose]=it.prototype.free);const at=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_intounderlyingsource_free(e>>>0,1));var ot=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,at.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,at.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_intounderlyingsource_free(e,0)}pull(e){return f.intounderlyingsource_pull(this.__wbg_ptr,e)}cancel(){let e=this.__destroy_into_raw();f.intounderlyingsource_cancel(e)}};Symbol.dispose&&(ot.prototype[Symbol.dispose]=ot.prototype.free);const st=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_parquetfile_free(e>>>0,1));var ct=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,st.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,st.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_parquetfile_free(e,0)}read(e){return f.parquetfile_read(this.__wbg_ptr,h(e)?0:Ee(e))}schema(){let e=f.parquetfile_schema(this.__wbg_ptr);if(e[2])throw g(e[1]);return gt.__wrap(e[0])}stream(e){return f.parquetfile_stream(this.__wbg_ptr,h(e)?0:Ee(e))}static fromUrl(e){let t=Ce(e,f.__wbindgen_malloc,f.__wbindgen_realloc),n=p;return f.parquetfile_fromUrl(t,n)}metadata(){let e=f.parquetfile_metadata(this.__wbg_ptr);if(e[2])throw g(e[1]);return ut.__wrap(e[0])}static fromFile(e){return f.parquetfile_fromFile(e)}};Symbol.dispose&&(ct.prototype[Symbol.dispose]=ct.prototype.free);const lt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_parquetmetadata_free(e>>>0,1));var ut=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,lt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,lt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_parquetmetadata_free(e,0)}rowGroups(){let e=f.parquetmetadata_rowGroups(this.__wbg_ptr);var t=je(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}fileMetadata(){let e=f.parquetmetadata_fileMetadata(this.__wbg_ptr);return et.__wrap(e)}numRowGroups(){return f.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(e){let t=f.parquetmetadata_rowGroup(this.__wbg_ptr,e);return mt.__wrap(t)}};Symbol.dispose&&(ut.prototype[Symbol.dispose]=ut.prototype.free);const dt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_recordbatch_free(e>>>0,1));var ft=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,dt.register(n,n.__wbg_ptr,n),n}static __unwrap(t){return t instanceof e?t.__destroy_into_raw():0}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,dt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_recordbatch_free(e,0)}get numColumns(){return f.recordbatch_numColumns(this.__wbg_ptr)>>>0}withSchema(t){Me(t,gt);var n=t.__destroy_into_raw();let r=f.recordbatch_withSchema(this.__wbg_ptr,n);if(r[2])throw g(r[1]);return e.__wrap(r[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=f.recordbatch_intoIPCStream(e);if(t[3])throw g(t[2]);var n=De(t[0],t[1]).slice();return f.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return f.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}slice(t,n){let r=f.recordbatch_slice(this.__wbg_ptr,t,n);return e.__wrap(r)}get schema(){let e=f.recordbatch_schema(this.__wbg_ptr);return gt.__wrap(e)}toFFI(){let e=f.recordbatch_toFFI(this.__wbg_ptr);if(e[2])throw g(e[1]);return Je.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=f.recordbatch_intoFFI(e);if(t[2])throw g(t[1]);return Je.__wrap(t[0])}get numRows(){return f.recordbatch_numRows(this.__wbg_ptr)>>>0}};Symbol.dispose&&(ft.prototype[Symbol.dispose]=ft.prototype.free);const pt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_rowgroupmetadata_free(e>>>0,1));var mt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,pt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,pt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_rowgroupmetadata_free(e,0)}numColumns(){return f.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}compressedSize(){return f.rowgroupmetadata_compressedSize(this.__wbg_ptr)}totalByteSize(){return f.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}column(e){let t=f.rowgroupmetadata_column(this.__wbg_ptr,e);return Ke.__wrap(t)}columns(){let e=f.rowgroupmetadata_columns(this.__wbg_ptr);var t=je(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}numRows(){return f.rowgroupmetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(mt.prototype[Symbol.dispose]=mt.prototype.free);const ht=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_schema_free(e>>>0,1));var gt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ht.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ht.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_schema_free(e,0)}withMetadata(t){let n=f.schema_withMetadata(this.__wbg_ptr,t);if(n[2])throw g(n[1]);return e.__wrap(n[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=f.schema_intoIPCStream(e);if(t[3])throw g(t[2]);var n=De(t[0],t[1]).slice();return f.__wbindgen_free(t[0],t[1]*1,1),n}toFFI(){let e=f.schema_toFFI(this.__wbg_ptr);if(e[2])throw g(e[1]);return Xe.__wrap(e[0])}indexOf(e){let t=Ce(e,f.__wbindgen_malloc,f.__wbindgen_realloc),n=p,r=f.schema_indexOf(this.__wbg_ptr,t,n);if(r[2])throw g(r[1]);return r[0]>>>0}intoFFI(){let e=this.__destroy_into_raw(),t=f.schema_intoFFI(e);if(t[2])throw g(t[1]);return Xe.__wrap(t[0])}metadata(){let e=f.schema_metadata(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}};Symbol.dispose&&(gt.prototype[Symbol.dispose]=gt.prototype.free);const _t=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_table_free(e>>>0,1));var vt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,_t.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_table_free(e,0)}get numBatches(){return f.table_numBatches(this.__wbg_ptr)>>>0}recordBatch(e){let t=f.table_recordBatch(this.__wbg_ptr,e);return t===0?void 0:ft.__wrap(t)}recordBatches(){let e=f.table_recordBatches(this.__wbg_ptr);var t=je(e[0],e[1]).slice();return f.__wbindgen_free(e[0],e[1]*4,4),t}static fromIPCStream(t){let n=Ne(t,f.__wbindgen_malloc),r=p,i=f.table_fromIPCStream(n,r);if(i[2])throw g(i[1]);return e.__wrap(i[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=f.table_intoIPCStream(e);if(t[3])throw g(t[2]);var n=De(t[0],t[1]).slice();return f.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return f.table_getArrayMemorySize(this.__wbg_ptr)>>>0}get schema(){let e=f.table_schema(this.__wbg_ptr);return gt.__wrap(e)}toFFI(){let e=f.table_toFFI(this.__wbg_ptr);if(e[2])throw g(e[1]);return Qe.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=f.table_intoFFI(e);if(t[2])throw g(t[1]);return Qe.__wrap(t[0])}};Symbol.dispose&&(vt.prototype[Symbol.dispose]=vt.prototype.free);const yt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_writerproperties_free(e>>>0,1));var bt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,yt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,yt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_writerproperties_free(e,0)}};Symbol.dispose&&(bt.prototype[Symbol.dispose]=bt.prototype.free);const xt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>f.__wbg_writerpropertiesbuilder_free(e>>>0,1));var St=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,xt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,xt.unregister(this),e}free(){let e=this.__destroy_into_raw();f.__wbg_writerpropertiesbuilder_free(e,0)}setEncoding(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setEncoding(n,t);return e.__wrap(r)}setCreatedBy(t){let n=this.__destroy_into_raw(),r=Ce(t,f.__wbindgen_malloc,f.__wbindgen_realloc),i=p,a=f.writerpropertiesbuilder_setCreatedBy(n,r,i);return e.__wrap(a)}setCompression(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setCompression(n,t);return e.__wrap(r)}setWriterVersion(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setWriterVersion(n,t);return e.__wrap(r)}setColumnEncoding(t,n){let r=this.__destroy_into_raw(),i=Ce(t,f.__wbindgen_malloc,f.__wbindgen_realloc),a=p,o=f.writerpropertiesbuilder_setColumnEncoding(r,i,a,n);return e.__wrap(o)}setWriteBatchSize(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setWriteBatchSize(n,t);return e.__wrap(r)}setColumnCompression(t,n){let r=this.__destroy_into_raw(),i=Ce(t,f.__wbindgen_malloc,f.__wbindgen_realloc),a=p,o=f.writerpropertiesbuilder_setColumnCompression(r,i,a,n);return e.__wrap(o)}setDictionaryEnabled(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setDictionaryEnabled(n,t);return e.__wrap(r)}setKeyValueMetadata(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setKeyValueMetadata(n,t);if(r[2])throw g(r[1]);return e.__wrap(r[0])}setMaxRowGroupSize(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setMaxRowGroupSize(n,t);return e.__wrap(r)}setStatisticsEnabled(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setStatisticsEnabled(n,t);return e.__wrap(r)}setDataPageSizeLimit(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setDataPageSizeLimit(n,t);return e.__wrap(r)}setColumnDictionaryEnabled(t,n){let r=this.__destroy_into_raw(),i=Ce(t,f.__wbindgen_malloc,f.__wbindgen_realloc),a=p,o=f.writerpropertiesbuilder_setColumnDictionaryEnabled(r,i,a,n);return e.__wrap(o)}setColumnStatisticsEnabled(t,n){let r=this.__destroy_into_raw(),i=Ce(t,f.__wbindgen_malloc,f.__wbindgen_realloc),a=p,o=f.writerpropertiesbuilder_setColumnStatisticsEnabled(r,i,a,n);return e.__wrap(o)}setDictionaryPageSizeLimit(t){let n=this.__destroy_into_raw(),r=f.writerpropertiesbuilder_setDictionaryPageSizeLimit(n,t);return e.__wrap(r)}constructor(){let e=f.writerpropertiesbuilder_new();return this.__wbg_ptr=e>>>0,xt.register(this,this.__wbg_ptr,this),this}build(){let e=this.__destroy_into_raw(),t=f.writerpropertiesbuilder_build(e);return bt.__wrap(t)}};Symbol.dispose&&(St.prototype[Symbol.dispose]=St.prototype.free);const Ct=new Set([`basic`,`cors`,`default`]);async function wt(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&Ct.has(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function Tt(){let e={};return e.wbg={},e.wbg.__wbg_Error_e17e777aac105295=function(e,t){return Error(xe(e,t))},e.wbg.__wbg_Number_998bea33bd87c3e0=function(e){return Number(e)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){let n=Ce(String(t),f.__wbindgen_malloc,f.__wbindgen_realloc),r=p;Te().setInt32(e+4,r,!0),Te().setInt32(e+0,n,!0)},e.wbg.__wbg_abort_67e1b49bf6614565=function(e){e.abort()},e.wbg.__wbg_abort_d830bf2e9aa6ec5b=function(e,t){e.abort(t)},e.wbg.__wbg_append_72a3c0addd2bce38=function(){return m(function(e,t,n,r,i){e.append(xe(t,n),xe(r,i))},arguments)},e.wbg.__wbg_arrayBuffer_2c907ed8e8ef4e35=function(e){return e.arrayBuffer()},e.wbg.__wbg_arrayBuffer_9c99b8e2809e8cbb=function(){return m(function(e){return e.arrayBuffer()},arguments)},e.wbg.__wbg_buffer_8d40b1d762fb3c66=function(e){return e.buffer},e.wbg.__wbg_byobRequest_2c036bceca1e6037=function(e){let t=e.byobRequest;return h(t)?0:Ee(t)},e.wbg.__wbg_byteLength_331a6b5545834024=function(e){return e.byteLength},e.wbg.__wbg_byteOffset_49a5b5608000358b=function(e){return e.byteOffset},e.wbg.__wbg_call_13410aac570ffff7=function(){return m(function(e,t){return e.call(t)},arguments)},e.wbg.__wbg_call_a5400b25a865cfd8=function(){return m(function(e,t,n){return e.call(t,n)},arguments)},e.wbg.__wbg_cancel_8bb5b8f4906b658a=function(e){return e.cancel()},e.wbg.__wbg_catch_c80ecae90cb8ed4e=function(e,t){return e.catch(t)},e.wbg.__wbg_clearTimeout_6222fede17abcb1a=function(e){return clearTimeout(e)},e.wbg.__wbg_close_a1918cff3cac355b=function(e){return e.close()},e.wbg.__wbg_close_cccada6053ee3a65=function(){return m(function(e){e.close()},arguments)},e.wbg.__wbg_close_d71a78219dc23e91=function(){return m(function(e){e.close()},arguments)},e.wbg.__wbg_columnchunkmetadata_new=function(e){return Ke.__wrap(e)},e.wbg.__wbg_done_75ed0ee6dd243d9d=function(e){return e.done},e.wbg.__wbg_enqueue_452bc2343d1c2ff9=function(){return m(function(e,t){e.enqueue(t)},arguments)},e.wbg.__wbg_entries_2be2f15bd5554996=function(e){return Object.entries(e)},e.wbg.__wbg_fetch_87aed7f306ec6d63=function(e,t){return e.fetch(t)},e.wbg.__wbg_fetch_f156d10be9a5c88a=function(e){return fetch(e)},e.wbg.__wbg_getReader_48e00749fe3f6089=function(){return m(function(e){return e.getReader()},arguments)},e.wbg.__wbg_getWriter_03d7689e275ac6a4=function(){return m(function(e){return e.getWriter()},arguments)},e.wbg.__wbg_get_0da715ceaecea5c8=function(e,t){return e[t>>>0]},e.wbg.__wbg_get_458e874b43b18b25=function(){return m(function(e,t){return Reflect.get(e,t)},arguments)},e.wbg.__wbg_getdone_f026246f6bbe58d3=function(e){let t=e.done;return h(t)?16777215:+!!t},e.wbg.__wbg_getvalue_31e5a08f61e5aa42=function(e){return e.value},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){return e[t]},e.wbg.__wbg_has_b89e451f638123e3=function(){return m(function(e,t){return Reflect.has(e,t)},arguments)},e.wbg.__wbg_headers_29fec3c72865cd75=function(e){return e.headers},e.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd=function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_Response_50fde2cd696850bf=function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7=function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_isArray_030cce220591fb41=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_1c0d1af5542e102a=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_f370b34483c71a1c=function(){return Symbol.iterator},e.wbg.__wbg_length_186546c51cd61acd=function(e){return e.length},e.wbg.__wbg_length_6bb7e81f9d7713e4=function(e){return e.length},e.wbg.__wbg_new_19c25a3f2fa63a02=function(){return{}},e.wbg.__wbg_new_2e3c58a15f39f5f9=function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return Be(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=n.b=0}},e.wbg.__wbg_new_2ff1f68f3676ea53=function(){return new Map},e.wbg.__wbg_new_638ebfaedbf32a5e=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_66b9434b4e59b63e=function(){return m(function(){return new AbortController},arguments)},e.wbg.__wbg_new_99a6a948d5b3f607=function(){return m(function(){return new TransformStream},arguments)},e.wbg.__wbg_new_da9dc54c5db29dfa=function(e,t){return Error(xe(e,t))},e.wbg.__wbg_new_f6e53210afea8e45=function(){return m(function(){return new Headers},arguments)},e.wbg.__wbg_newfromslice_074c56947bd43469=function(e,t){return new Uint8Array(De(e,t))},e.wbg.__wbg_newnoargs_254190557c45b4ec=function(e,t){return Function(xe(e,t))},e.wbg.__wbg_newwithbyteoffset_6bd4b2a4ca518883=function(e,t){return new Uint8Array(e,t>>>0)},e.wbg.__wbg_newwithbyteoffsetandlength_e8f53910b4d42b45=function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},e.wbg.__wbg_newwithintounderlyingsource_b47f6a6a596a7f24=function(e,t){return new ReadableStream(ot.__wrap(e),t)},e.wbg.__wbg_newwithstrandinit_b5d168a29a3fd85f=function(){return m(function(e,t,n){return new Request(xe(e,t),n)},arguments)},e.wbg.__wbg_next_5b3530e612fde77d=function(e){return e.next},e.wbg.__wbg_next_692e82279131b03c=function(){return m(function(e){return e.next()},arguments)},e.wbg.__wbg_parquetfile_new=function(e){return ct.__wrap(e)},e.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(e,t,n){Uint8Array.prototype.set.call(De(e,t),n)},e.wbg.__wbg_queueMicrotask_25d0739ac89e8c88=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_4488407636f5bf24=function(e){return e.queueMicrotask},e.wbg.__wbg_read_bc925c758aa4d897=function(e){return e.read()},e.wbg.__wbg_readable_e82cff27b968ed1c=function(e){return e.readable},e.wbg.__wbg_ready_4186da3cb500ae7d=function(e){return e.ready},e.wbg.__wbg_recordbatch_new=function(e){return ft.__wrap(e)},e.wbg.__wbg_recordbatch_unwrap=function(e){return ft.__unwrap(e)},e.wbg.__wbg_releaseLock_62151472ae632176=function(e){e.releaseLock()},e.wbg.__wbg_releaseLock_ff29b586502a8221=function(e){e.releaseLock()},e.wbg.__wbg_resolve_4055c623acdd6a1b=function(e){return Promise.resolve(e)},e.wbg.__wbg_respond_6c2c4e20ef85138e=function(){return m(function(e,t){e.respond(t>>>0)},arguments)},e.wbg.__wbg_rowgroupmetadata_new=function(e){return mt.__wrap(e)},e.wbg.__wbg_setTimeout_2b339866a2aa3789=function(e,t){return setTimeout(e,t)},e.wbg.__wbg_set_1353b2a5e96bc48c=function(e,t,n){e.set(De(t,n))},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,n){e[t]=n},e.wbg.__wbg_set_b7f1cf4fae26fe2a=function(e,t,n){return e.set(t,n)},e.wbg.__wbg_setbody_c8460bdf44147df8=function(e,t){e.body=t},e.wbg.__wbg_setcache_90ca4ad8a8ad40d3=function(e,t){e.cache=He[t]},e.wbg.__wbg_setcredentials_9cd60d632c9d5dfc=function(e,t){e.credentials=Ue[t]},e.wbg.__wbg_setheaders_0052283e2f3503d1=function(e,t){e.headers=t},e.wbg.__wbg_sethighwatermark_3d5961f834647d41=function(e,t){e.highWaterMark=t},e.wbg.__wbg_setmethod_9b504d5b855b329c=function(e,t,n){e.method=xe(t,n)},e.wbg.__wbg_setmode_a23e1a2ad8b512f8=function(e,t){e.mode=We[t]},e.wbg.__wbg_setsignal_8c45ad1247a74809=function(e,t){e.signal=t},e.wbg.__wbg_signal_da4d466ce86118b5=function(e){return e.signal},e.wbg.__wbg_size_8f84e7768fba0589=function(e){return e.size},e.wbg.__wbg_slice_36c55c8c1a260c46=function(){return m(function(e,t,n){return e.slice(t,n)},arguments)},e.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){let e=typeof global>`u`?null:global;return h(e)?0:Ee(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){let e=typeof globalThis>`u`?null:globalThis;return h(e)?0:Ee(e)},e.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){let e=typeof self>`u`?null:self;return h(e)?0:Ee(e)},e.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){let e=typeof window>`u`?null:window;return h(e)?0:Ee(e)},e.wbg.__wbg_status_3fea3036088621d6=function(e){return e.status},e.wbg.__wbg_stringify_b98c93d0a190446a=function(){return m(function(e){return JSON.stringify(e)},arguments)},e.wbg.__wbg_table_new=function(e){return vt.__wrap(e)},e.wbg.__wbg_then_b33a773d723afa3e=function(e,t,n){return e.then(t,n)},e.wbg.__wbg_then_e22500defe16819f=function(e,t){return e.then(t)},e.wbg.__wbg_toString_78df35411a4fd40c=function(e){return e.toString()},e.wbg.__wbg_url_e5720dfacf77b05e=function(e,t){let n=t.url,r=Ce(n,f.__wbindgen_malloc,f.__wbindgen_realloc),i=p;Te().setInt32(e+4,i,!0),Te().setInt32(e+0,r,!0)},e.wbg.__wbg_value_dd9372230531eade=function(e){return e.value},e.wbg.__wbg_view_91cc97d57ab30530=function(e){let t=e.view;return h(t)?0:Ee(t)},e.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1=function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;Te().setBigInt64(e+8,h(r)?BigInt(0):r,!0),Te().setInt32(e+0,!h(r),!0)},e.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746=function(e){let t=e,n=typeof t==`boolean`?t:void 0;return h(n)?16777215:+!!n},e.wbg.__wbg_wbindgencbdrop_eb10308566512b88=function(e){let t=e.original;return t.cnt--==1&&(t.a=0,!0)},e.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(e,t){let n=Ce(Oe(t),f.__wbindgen_malloc,f.__wbindgen_realloc),r=p;Te().setInt32(e+4,r,!0),Te().setInt32(e+0,n,!0)},e.wbg.__wbg_wbindgenfunctiontable_aa1084b2969a9cbe=function(){return f.__wbindgen_export_5},e.wbg.__wbg_wbindgenin_d7a1ee10933d2d55=function(e,t){return e in t},e.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154=function(e){return typeof e==`bigint`},e.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(e){return typeof e==`function`},e.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8=function(e){let t=e;return typeof t==`object`&&!!t},e.wbg.__wbg_wbindgenisstring_d4fa939789f003b0=function(e){return typeof e==`string`},e.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(e){return e===void 0},e.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58=function(e,t){return e===t},e.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1=function(e,t){return e==t},e.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return f.memory},e.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb=function(e,t){let n=t,r=typeof n==`number`?n:void 0;Te().setFloat64(e+8,h(r)?0:r,!0),Te().setInt32(e+0,!h(r),!0)},e.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f=function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=h(r)?0:Ce(r,f.__wbindgen_malloc,f.__wbindgen_realloc),a=p;Te().setInt32(e+4,a,!0),Te().setInt32(e+0,i,!0)},e.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(e,t){throw Error(xe(e,t))},e.wbg.__wbg_writable_e5202c9fd57615db=function(e){return e.writable},e.wbg.__wbg_write_2e39e04a4c8c9e9d=function(e,t){return e.write(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,t){return xe(e,t)},e.wbg.__wbindgen_cast_3fa4d3e7d32dad96=function(e,t){return Ae(e,t,339,ze)},e.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_cast_5c484bf9528b29d7=function(e,t){return Ae(e,t,3805,Re)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},e.wbg.__wbindgen_init_externref_table=function(){let e=f.__wbindgen_export_4,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e}function Et(e,t){return f=e.exports,Dt.__wbindgen_wasm_module=t,we=null,Fe=null,ge=null,f.__wbindgen_start(),f}async function Dt(e){if(f!==void 0)return f;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0)throw Error(`This build requires an explicit parquet-wasm module_or_path.`);let t=Tt();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await wt(await e,t);return Et(n,r)}function _(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Ot(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function kt(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,ee)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){d(a[0][3],e)}}function l(e){e.value instanceof v?Promise.resolve(e.value.v).then(u,ee):d(a[0][2],e)}function u(e){c(`next`,e)}function ee(e){c(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function At(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:!1}:i?i(t):t}:i}}function jt(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ot==`function`?Ot(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const Mt=new TextDecoder(`utf-8`),Nt=Mt.decode.bind(Mt),Pt=new TextEncoder,Ft=e=>Pt.encode(e),It=e=>typeof e==`number`,Lt=e=>typeof e==`boolean`,y=e=>typeof e==`function`,Rt=e=>e!=null&&Object(e)===e,zt=e=>Rt(e)&&y(e.then),Bt=e=>Rt(e)&&y(e[Symbol.iterator]),Vt=e=>Rt(e)&&y(e[Symbol.asyncIterator]),Ht=e=>Rt(e)&&Rt(e.schema),Ut=e=>Rt(e)&&`done`in e&&`value`in e,Wt=e=>Rt(e)&&y(e.stat)&&It(e.fd),Gt=e=>Rt(e)&&qt(e.body),Kt=e=>`_getDOMStream`in e&&`_getNodeStream`in e,qt=e=>Rt(e)&&y(e.cancel)&&y(e.getReader)&&!Kt(e),Jt=e=>Rt(e)&&y(e.read)&&y(e.pipe)&&Lt(e.readable)&&!Kt(e),Yt=e=>Rt(e)&&y(e.clear)&&y(e.bytes)&&y(e.position)&&y(e.setPosition)&&y(e.capacity)&&y(e.getBufferIdentifier)&&y(e.createLong),Xt=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function Zt(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function Qt(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function $t(e,t){let n=Zt(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?Qt(o,a,s):o=a;break}Qt(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function b(e,t){let n=Ut(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=Ft(n)),n instanceof ArrayBuffer||n instanceof Xt?new e(n):Yt(n)?b(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const en=e=>b(Int32Array,e),tn=e=>b(BigInt64Array,e),x=e=>b(Uint8Array,e),nn=e=>(e.next(),e);function*rn(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xt?n(t):Bt(t)?t:n(t);return yield*nn((function*(t){let n=null;do n=t.next(yield b(e,n));while(!n.done)})(r[Symbol.iterator]())),new e}const an=e=>rn(Uint8Array,e);function on(e,t){return kt(this,arguments,function*(){if(zt(t))return yield v(yield v(yield*At(jt(on(e,yield v(t))))));let n=function(e){return kt(this,arguments,function*(){yield yield v(yield v(e))})},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xt?n(t):Bt(t)?function(e){return kt(this,arguments,function*(){yield v(yield*At(jt(nn((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):Vt(t)?t:n(t);return yield v(yield*At(jt(nn((function(t){return kt(this,arguments,function*(){let n=null;do n=yield v(t.next(yield yield v(b(e,n))));while(!n.done)})})(r[Symbol.asyncIterator]()))))),yield v(new e)})}const sn=e=>on(Uint8Array,e);function cn(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var ln={fromIterable(e){return un(dn(e))},fromAsyncIterable(e){return un(fn(e))},fromDOMStream(e){return un(pn(e))},fromNodeStream(e){return un(gn(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}};const un=e=>(e.next(),e);function*dn(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?$t(r,o)[0]:([i,r,s]=$t(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=an(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function fn(e){return kt(this,arguments,function*(){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?$t(r,o)[0]:([i,r,s]=$t(r,o),i)}({cmd:a,size:o}=(yield yield v(null))||{cmd:`read`,size:0});let l=sn(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?yield v(l.next()):yield v(l.next(o-s)),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield v(c()));while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&(yield v(l.throw(e)))}finally{n===!1&&typeof l.return==`function`&&(yield v(l.return(new Uint8Array)))}return yield v(null)})}function pn(e){return kt(this,arguments,function*(){let t=!1,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?$t(r,o)[0]:([i,r,s]=$t(r,o),i)}({cmd:a,size:o}=(yield yield v(null))||{cmd:`read`,size:0});let l=new mn(e);try{do if({done:t,value:i}=Number.isNaN(o-s)?yield v(l.read()):yield v(l.read(o-s)),!t&&i.byteLength>0&&(r.push(x(i)),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield v(c()));while(o<s);while(!t)}catch(e){n=!0,yield v(l.cancel(e))}finally{n===!1?yield v(l.cancel()):e.locked&&l.releaseLock()}return yield v(null)})}var mn=class{constructor(e){this.source=e,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(e){return _(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return _(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=x(t)),t})}};const hn=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function gn(e){return kt(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,o,s=0,c=[],l;function u(){return a===`peek`?$t(c,o)[0]:([l,c,s]=$t(c,o),l)}if({cmd:a,size:o}=(yield yield v(null))||{cmd:`read`,size:0},e.isTTY)return yield yield v(new Uint8Array),yield v(null);try{t[0]=hn(e,`end`),t[1]=hn(e,`error`);do{if(t[2]=hn(e,`readable`),[n,i]=yield v(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(o-s)?(l=x(e.read(o-s)),l.byteLength<o-s&&(l=x(e.read()))):l=x(e.read()),l.byteLength>0&&(c.push(l),s+=l.byteLength)),r||o<=s)do({cmd:a,size:o}=yield yield v(u()));while(o<s)}while(!r)}finally{yield v(ee(t,n===`error`?i:null))}return yield v(null);function ee(t,n){return l=c=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var S;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(S||={});var _n;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(_n||={});var C;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(C||={});var vn;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(vn||={});var w;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(w||={});var T;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(T||={});const yn=new Int32Array(2),bn=new Float32Array(yn.buffer),xn=new Float64Array(yn.buffer),Sn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Cn;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(Cn||={});var wn=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return yn[0]=this.readInt32(e),bn[0]}readFloat64(e){return yn[+!Sn]=this.readInt32(e),yn[+!!Sn]=this.readInt32(e+4),xn[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){bn[0]=t,this.writeInt32(e,yn[0])}writeFloat64(e,t){xn[0]=t,this.writeInt32(e,yn[+!Sn]),this.writeInt32(e+4,yn[+!!Sn])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===Cn.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},Tn=class e{constructor(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;let t;t=e||1024,this.bb=wn.allocate(t),this.space=t}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(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=wn.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)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+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},En;(function(e){e[e.BUFFER=0]=`BUFFER`})(En||={});var Dn;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(Dn||={});var On=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Dn.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):En.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Dn.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,En.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},kn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},An=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},jn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new An).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new kn).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new On).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}},Mn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new jn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},Nn;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(Nn||={});var Pn;(function(e){e[e.DenseArray=0]=`DenseArray`})(Pn||={});var Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},In=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Fn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):Pn.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,Pn.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},E=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},Ln=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},Rn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}},zn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},Bn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):vn.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,vn.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},Vn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},Hn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):w.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,w.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},Wn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},Gn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):C.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,C.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},Kn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):T.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,T.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},Jn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}},Yn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},Xn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},Zn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},Qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},$n=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},er=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):w.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,w.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},tr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):w.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,w.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},nr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_n.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,_n.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},rr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},ir=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}},D;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.ListView=25]=`ListView`,e[e.LargeListView=26]=`LargeListView`})(D||={});var ar=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):D.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new In).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new E).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,D.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},or=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Nn.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new ar).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new E).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,Nn.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},O;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(O||={});var k;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`,e[e.IntervalMonthDayNano=-31]=`IntervalMonthDayNano`})(k||={});var sr;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(sr||={});function cr(e){if(e===null)return`null`;if(e===void 0)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>cr(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function A(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function lr(e,t){return A(e/t)+A(e%t)/A(t)}const ur=Symbol.for(`isArrowBigNum`);function dr(e,...t){return t.length===0?Object.setPrototypeOf(b(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}dr.prototype[ur]=!0,dr.prototype.toJSON=function(){return`"${_r(this)}"`},dr.prototype.valueOf=function(e){return gr(this,e)},dr.prototype.toString=function(){return _r(this)},dr.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return gr(this);case`string`:return _r(this);case`default`:return vr(this)}return _r(this)};function fr(...e){return dr.apply(this,e)}function pr(...e){return dr.apply(this,e)}function mr(...e){return dr.apply(this,e)}Object.setPrototypeOf(fr.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(pr.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(mr.prototype,Object.create(Uint32Array.prototype)),Object.assign(fr.prototype,dr.prototype,{constructor:fr,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(pr.prototype,dr.prototype,{constructor:pr,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(mr.prototype,dr.prototype,{constructor:mr,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const hr=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function gr(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^hr)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`&&t>0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=A(n),a=`${r}`.padStart(t,`0`);return+`${s&&i===0?`-`:``}${i}.${a}`}return A(c)}function _r(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return yr(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return yr(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${yr(t)}`}function vr(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:_r(e)}function yr(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var br=class e{static new(e,t){switch(t){case!0:return new fr(e);case!1:return new pr(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new fr(e)}return e.byteLength===16?new mr(e):new pr(e)}static signed(e){return new fr(e)}static unsigned(e){return new pr(e)}static decimal(e){return new mr(e)}constructor(t,n){return e.new(t,n)}},xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr;const Kr=Symbol.for(`apache-arrow/DataType`);var j=class e{static isDataType(e){return e?.[Kr]===!0}static isNull(e){return e?.typeId===k.Null}static isInt(e){return e?.typeId===k.Int}static isFloat(e){return e?.typeId===k.Float}static isBinary(e){return e?.typeId===k.Binary}static isBinaryView(e){return e?.typeId===k.BinaryView}static isLargeBinary(e){return e?.typeId===k.LargeBinary}static isUtf8(e){return e?.typeId===k.Utf8}static isUtf8View(e){return e?.typeId===k.Utf8View}static isLargeUtf8(e){return e?.typeId===k.LargeUtf8}static isBool(e){return e?.typeId===k.Bool}static isDecimal(e){return e?.typeId===k.Decimal}static isDate(e){return e?.typeId===k.Date}static isTime(e){return e?.typeId===k.Time}static isTimestamp(e){return e?.typeId===k.Timestamp}static isInterval(e){return e?.typeId===k.Interval}static isDuration(e){return e?.typeId===k.Duration}static isList(e){return e?.typeId===k.List}static isLargeList(e){return e?.typeId===k.LargeList}static isStruct(e){return e?.typeId===k.Struct}static isUnion(e){return e?.typeId===k.Union}static isFixedSizeBinary(e){return e?.typeId===k.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===k.FixedSizeList}static isMap(e){return e?.typeId===k.Map}static isDictionary(e){return e?.typeId===k.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===_n.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===_n.Sparse}constructor(e){this.typeId=e}};xr=Symbol.toStringTag,j[xr]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Kr]=!0,e[Symbol.toStringTag]=`DataType`))(j.prototype);var qr=class extends j{constructor(){super(k.Null)}toString(){return`Null`}};Sr=Symbol.toStringTag,qr[Sr]=(e=>e[Symbol.toStringTag]=`Null`)(qr.prototype);var Jr=class extends j{constructor(e,t){super(k.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};Cr=Symbol.toStringTag,Jr[Cr]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(Jr.prototype);var Yr=class extends Jr{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Xr=class extends Jr{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Zr=class extends Jr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Qr=class extends Jr{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},$r=class extends Jr{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ei=class extends Jr{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ti=class extends Jr{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ni=class extends Jr{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Yr.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(Xr.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Zr.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Qr.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty($r.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(ei.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(ti.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(ni.prototype,"ArrayType",{value:BigUint64Array});var ri=class extends j{constructor(e){super(k.Float),this.precision=e}get ArrayType(){switch(this.precision){case C.HALF:return Uint16Array;case C.SINGLE:return Float32Array;case C.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};wr=Symbol.toStringTag,ri[wr]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(ri.prototype);var ii=class extends ri{constructor(){super(C.HALF)}},ai=class extends ri{constructor(){super(C.SINGLE)}},oi=class extends ri{constructor(){super(C.DOUBLE)}};Object.defineProperty(ii.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(ai.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(oi.prototype,"ArrayType",{value:Float64Array});var si=class extends j{constructor(){super(k.Binary)}toString(){return`Binary`}};Tr=Symbol.toStringTag,si[Tr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(si.prototype);var M=class extends j{constructor(){super(k.BinaryView)}toString(){return`BinaryView`}};Er=Symbol.toStringTag,M.ELEMENT_WIDTH=16,M.INLINE_CAPACITY=12,M.LENGTH_OFFSET=0,M.INLINE_OFFSET=4,M.BUFFER_INDEX_OFFSET=8,M.BUFFER_OFFSET_OFFSET=12,M[Er]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`BinaryView`))(M.prototype);var ci=class extends j{constructor(){super(k.LargeBinary)}toString(){return`LargeBinary`}};Dr=Symbol.toStringTag,ci[Dr]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(ci.prototype);var li=class extends j{constructor(){super(k.Utf8)}toString(){return`Utf8`}};Or=Symbol.toStringTag,li[Or]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(li.prototype);var ui=class extends j{constructor(){super(k.Utf8View)}toString(){return`Utf8View`}};kr=Symbol.toStringTag,ui.ELEMENT_WIDTH=M.ELEMENT_WIDTH,ui.INLINE_CAPACITY=M.INLINE_CAPACITY,ui[kr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8View`))(ui.prototype);var di=class extends j{constructor(){super(k.LargeUtf8)}toString(){return`LargeUtf8`}};Ar=Symbol.toStringTag,di[Ar]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(di.prototype);var fi=class extends j{constructor(){super(k.Bool)}toString(){return`Bool`}};jr=Symbol.toStringTag,fi[jr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(fi.prototype);var pi=class extends j{constructor(e,t,n=128){super(k.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};Mr=Symbol.toStringTag,pi[Mr]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(pi.prototype);var mi=class extends j{constructor(e){super(k.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${vn[this.unit]}>`}get ArrayType(){return this.unit===vn.DAY?Int32Array:BigInt64Array}};Nr=Symbol.toStringTag,mi[Nr]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(mi.prototype);var hi=class extends j{constructor(e,t){super(k.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${w[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Pr=Symbol.toStringTag,hi[Pr]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(hi.prototype);var gi=class extends j{constructor(e,t){super(k.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${w[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};Fr=Symbol.toStringTag,gi[Fr]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(gi.prototype);var _i=class extends j{constructor(e){super(k.Interval),this.unit=e}toString(){return`Interval<${T[this.unit]}>`}};Ir=Symbol.toStringTag,_i[Ir]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(_i.prototype);var vi=class extends j{constructor(e){super(k.Duration),this.unit=e}toString(){return`Duration<${w[this.unit]}>`}};Lr=Symbol.toStringTag,vi[Lr]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(vi.prototype);var yi=class extends j{constructor(e){super(k.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Rr=Symbol.toStringTag,yi[Rr]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(yi.prototype);var bi=class extends j{constructor(e){super(k.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};zr=Symbol.toStringTag,bi[zr]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeList`))(bi.prototype);var N=class extends j{constructor(e){super(k.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};Br=Symbol.toStringTag,N[Br]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(N.prototype);var xi=class extends j{constructor(e,t,n){super(k.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};Vr=Symbol.toStringTag,xi[Vr]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(xi.prototype);var Si=class extends j{constructor(e){super(k.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Hr=Symbol.toStringTag,Si[Hr]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(Si.prototype);var Ci=class extends j{constructor(e,t){super(k.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Ur=Symbol.toStringTag,Ci[Ur]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(Ci.prototype);var wi=class extends j{constructor(e,t=!1){if(super(k.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};Wr=Symbol.toStringTag,wi[Wr]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(wi.prototype);const Ti=(e=>()=>++e)(-1);var Ei=class extends j{constructor(e,t,n,r){super(k.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?Ti():A(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Gr=Symbol.toStringTag,Ei[Gr]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(Ei.prototype);function Di(e){let t=e;switch(e.typeId){case k.Decimal:return e.bitWidth/32;case k.Interval:return t.unit===T.MONTH_DAY_NANO?4:1+t.unit;case k.BinaryView:case k.Utf8View:return 16;case k.FixedSizeList:return t.listSize;case k.FixedSizeBinary:return t.byteWidth;default:return 1}}var P=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return Oi(this,e,t)}getVisitFnByTypeId(e,t=!0){return ki(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function Oi(e,t,n=!0){return typeof t==`number`?ki(e,t,n):typeof t==`string`&&t in k?ki(e,k[t],n):t&&t instanceof j?ki(e,Ai(t),n):t?.type&&t.type instanceof j?ki(e,Ai(t.type),n):ki(e,k.NONE,n)}function ki(e,t,n=!0){let r=null;switch(t){case k.Null:r=e.visitNull;break;case k.Bool:r=e.visitBool;break;case k.Int:r=e.visitInt;break;case k.Int8:r=e.visitInt8||e.visitInt;break;case k.Int16:r=e.visitInt16||e.visitInt;break;case k.Int32:r=e.visitInt32||e.visitInt;break;case k.Int64:r=e.visitInt64||e.visitInt;break;case k.Uint8:r=e.visitUint8||e.visitInt;break;case k.Uint16:r=e.visitUint16||e.visitInt;break;case k.Uint32:r=e.visitUint32||e.visitInt;break;case k.Uint64:r=e.visitUint64||e.visitInt;break;case k.Float:r=e.visitFloat;break;case k.Float16:r=e.visitFloat16||e.visitFloat;break;case k.Float32:r=e.visitFloat32||e.visitFloat;break;case k.Float64:r=e.visitFloat64||e.visitFloat;break;case k.Utf8:r=e.visitUtf8;break;case k.LargeUtf8:r=e.visitLargeUtf8;break;case k.Utf8View:r=e.visitUtf8View||e.visitUtf8;break;case k.Binary:r=e.visitBinary;break;case k.LargeBinary:r=e.visitLargeBinary;break;case k.BinaryView:r=e.visitBinaryView||e.visitBinary;break;case k.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case k.Date:r=e.visitDate;break;case k.DateDay:r=e.visitDateDay||e.visitDate;break;case k.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case k.Timestamp:r=e.visitTimestamp;break;case k.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case k.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case k.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case k.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case k.Time:r=e.visitTime;break;case k.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case k.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case k.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case k.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case k.Decimal:r=e.visitDecimal;break;case k.List:r=e.visitList;break;case k.LargeList:r=e.visitLargeList;break;case k.Struct:r=e.visitStruct;break;case k.Union:r=e.visitUnion;break;case k.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case k.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case k.Dictionary:r=e.visitDictionary;break;case k.Interval:r=e.visitInterval;break;case k.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case k.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case k.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case k.Duration:r=e.visitDuration;break;case k.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case k.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case k.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case k.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case k.FixedSizeList:r=e.visitFixedSizeList;break;case k.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${k[t]}'`)}function Ai(e){switch(e.typeId){case k.Null:return k.Null;case k.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?k.Int8:k.Uint8;case 16:return n?k.Int16:k.Uint16;case 32:return n?k.Int32:k.Uint32;case 64:return n?k.Int64:k.Uint64}return k.Int}case k.Float:switch(e.precision){case C.HALF:return k.Float16;case C.SINGLE:return k.Float32;case C.DOUBLE:return k.Float64}return k.Float;case k.Binary:return k.Binary;case k.LargeBinary:return k.LargeBinary;case k.BinaryView:return k.BinaryView;case k.Utf8:return k.Utf8;case k.LargeUtf8:return k.LargeUtf8;case k.Utf8View:return k.Utf8View;case k.Bool:return k.Bool;case k.Decimal:return k.Decimal;case k.Time:switch(e.unit){case w.SECOND:return k.TimeSecond;case w.MILLISECOND:return k.TimeMillisecond;case w.MICROSECOND:return k.TimeMicrosecond;case w.NANOSECOND:return k.TimeNanosecond}return k.Time;case k.Timestamp:switch(e.unit){case w.SECOND:return k.TimestampSecond;case w.MILLISECOND:return k.TimestampMillisecond;case w.MICROSECOND:return k.TimestampMicrosecond;case w.NANOSECOND:return k.TimestampNanosecond}return k.Timestamp;case k.Date:switch(e.unit){case vn.DAY:return k.DateDay;case vn.MILLISECOND:return k.DateMillisecond}return k.Date;case k.Interval:switch(e.unit){case T.DAY_TIME:return k.IntervalDayTime;case T.YEAR_MONTH:return k.IntervalYearMonth;case T.MONTH_DAY_NANO:return k.IntervalMonthDayNano}return k.Interval;case k.Duration:switch(e.unit){case w.SECOND:return k.DurationSecond;case w.MILLISECOND:return k.DurationMillisecond;case w.MICROSECOND:return k.DurationMicrosecond;case w.NANOSECOND:return k.DurationNanosecond}return k.Duration;case k.Map:return k.Map;case k.List:return k.List;case k.LargeList:return k.LargeList;case k.Struct:return k.Struct;case k.Union:switch(e.mode){case _n.Dense:return k.DenseUnion;case _n.Sparse:return k.SparseUnion}return k.Union;case k.FixedSizeBinary:return k.FixedSizeBinary;case k.FixedSizeList:return k.FixedSizeList;case k.Dictionary:return k.Dictionary}throw Error(`Unrecognized type '${k[e.typeId]}'`)}P.prototype.visitInt8=null,P.prototype.visitInt16=null,P.prototype.visitInt32=null,P.prototype.visitInt64=null,P.prototype.visitUint8=null,P.prototype.visitUint16=null,P.prototype.visitUint32=null,P.prototype.visitUint64=null,P.prototype.visitFloat16=null,P.prototype.visitFloat32=null,P.prototype.visitFloat64=null,P.prototype.visitDateDay=null,P.prototype.visitDateMillisecond=null,P.prototype.visitTimestampSecond=null,P.prototype.visitTimestampMillisecond=null,P.prototype.visitTimestampMicrosecond=null,P.prototype.visitTimestampNanosecond=null,P.prototype.visitTimeSecond=null,P.prototype.visitTimeMillisecond=null,P.prototype.visitTimeMicrosecond=null,P.prototype.visitTimeNanosecond=null,P.prototype.visitDenseUnion=null,P.prototype.visitSparseUnion=null,P.prototype.visitIntervalDayTime=null,P.prototype.visitIntervalYearMonth=null,P.prototype.visitIntervalMonthDayNano=null,P.prototype.visitDuration=null,P.prototype.visitDurationSecond=null,P.prototype.visitDurationMillisecond=null,P.prototype.visitDurationMicrosecond=null,P.prototype.visitDurationNanosecond=null;const ji=new Float64Array(1),Mi=new Uint32Array(ji.buffer);function Ni(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Pi(e){if(e!==e)return 32256;ji[0]=e;let t=(Mi[1]&2147483648)>>16&65535,n=Mi[1]&2146435072,r=0;return n>=1089470464?Mi[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Mi[1]&1048575)>>10):n<=1056964608?(r=1048576+(Mi[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Mi[1]&1048575)+512>>10),t|n|r&65535}var F=class extends P{};function I(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Fi=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Ii=(e,t,n,r)=>{if(n+1<t.length){let i=A(t[n]),a=A(t[n+1]);e.set(r.subarray(0,a-i),i)}},Li=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Ri=({values:e},t,n)=>{e[t]=n},zi=({values:e},t,n)=>{e[t]=n},Bi=({values:e},t,n)=>{e[t]=Pi(n)},Vi=(e,t,n)=>{switch(e.type.precision){case C.HALF:return Bi(e,t,n);case C.SINGLE:case C.DOUBLE:return zi(e,t,n)}},Hi=({values:e},t,n)=>{Fi(e,t,n.valueOf())},Ui=({values:e},t,n)=>{e[t]=BigInt(n)},Wi=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Gi=({values:e,valueOffsets:t},n,r)=>Ii(e,t,n,r),Ki=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},qi=(e,t,n)=>{let r=e.values;if(!r)throw Error(`BinaryView data is missing view buffer`);let i=M.ELEMENT_WIDTH,a=t*i,o=a+i;if(a<0||o>r.length)throw RangeError(`BinaryView index ${t} out of bounds`);r.fill(0,a,o);let s=new DataView(r.buffer,r.byteOffset+a,i),c=n.length;if(s.setInt32(M.LENGTH_OFFSET,c,!0),c<=M.INLINE_CAPACITY){r.set(n,a+M.INLINE_OFFSET);return}let l=(n[0]??0)|(n[1]??0)<<8|(n[2]??0)<<16|(n[3]??0)<<24;s.setUint32(M.INLINE_OFFSET,l>>>0,!0);let u=Ki(e),ee=n.slice(),d=u.push(ee)-1;s.setInt32(M.BUFFER_INDEX_OFFSET,d,!0),s.setInt32(M.BUFFER_OFFSET_OFFSET,0,!0)},Ji=(e,t,n)=>{let r=n instanceof Uint8Array?n:new Uint8Array(n);qi(e,t,r)},Yi=({values:e,valueOffsets:t},n,r)=>Ii(e,t,n,Ft(r)),Xi=(e,t,n)=>{let r=Ft(n);qi(e,t,r)},Zi=(e,t,n)=>{e.type.unit===vn.DAY?Hi(e,t,n):Ui(e,t,n)},Qi=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},$i=({values:e},t,n)=>{e[t]=BigInt(n)},ea=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},ta=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},na=(e,t,n)=>{switch(e.type.unit){case w.SECOND:return Qi(e,t,n);case w.MILLISECOND:return $i(e,t,n);case w.MICROSECOND:return ea(e,t,n);case w.NANOSECOND:return ta(e,t,n)}},ra=({values:e},t,n)=>{e[t]=n},ia=({values:e},t,n)=>{e[t]=n},aa=({values:e},t,n)=>{e[t]=n},oa=({values:e},t,n)=>{e[t]=n},sa=(e,t,n)=>{switch(e.type.unit){case w.SECOND:return ra(e,t,n);case w.MILLISECOND:return ia(e,t,n);case w.MICROSECOND:return aa(e,t,n);case w.NANOSECOND:return oa(e,t,n)}},ca=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},la=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=Aa.getVisitFn(r),o=A(i[t]),s=A(i[t+1]);if(Array.isArray(n))for(let e=-1,t=o;t<s;)a(r,t++,n[++e]);else for(let e=-1,t=o;t<s;)a(r,t++,n.get(++e))},ua=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=Aa.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},da=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),fa=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),pa=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),ma=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),ha=(e,t,n)=>{let r=e.type.children.map(e=>Aa.getVisitFn(e.type)),i=n instanceof Map?pa(t,n):n instanceof G?fa(t,n):Array.isArray(n)?da(t,n):ma(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},ga=(e,t,n)=>{e.type.mode===_n.Dense?_a(e,t,n):va(e,t,n)},_a=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Aa.visit(i,e.valueOffsets[t],n)},va=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Aa.visit(i,t,n)},ya=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},ba=(e,t,n)=>{switch(e.type.unit){case T.YEAR_MONTH:return Sa(e,t,n);case T.DAY_TIME:return xa(e,t,n);case T.MONTH_DAY_NANO:return Ca(e,t,n)}},xa=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Sa=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ca=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},wa=({values:e},t,n)=>{e[t]=n},Ta=({values:e},t,n)=>{e[t]=n},Ea=({values:e},t,n)=>{e[t]=n},Da=({values:e},t,n)=>{e[t]=n},Oa=(e,t,n)=>{switch(e.type.unit){case w.SECOND:return wa(e,t,n);case w.MILLISECOND:return Ta(e,t,n);case w.MICROSECOND:return Ea(e,t,n);case w.NANOSECOND:return Da(e,t,n)}},ka=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=Aa.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};F.prototype.visitBool=I(Li),F.prototype.visitInt=I(Ri),F.prototype.visitInt8=I(Ri),F.prototype.visitInt16=I(Ri),F.prototype.visitInt32=I(Ri),F.prototype.visitInt64=I(Ri),F.prototype.visitUint8=I(Ri),F.prototype.visitUint16=I(Ri),F.prototype.visitUint32=I(Ri),F.prototype.visitUint64=I(Ri),F.prototype.visitFloat=I(Vi),F.prototype.visitFloat16=I(Bi),F.prototype.visitFloat32=I(zi),F.prototype.visitFloat64=I(zi),F.prototype.visitUtf8=I(Yi),F.prototype.visitLargeUtf8=I(Yi),F.prototype.visitUtf8View=I(Xi),F.prototype.visitBinary=I(Gi),F.prototype.visitLargeBinary=I(Gi),F.prototype.visitBinaryView=I(Ji),F.prototype.visitFixedSizeBinary=I(Wi),F.prototype.visitDate=I(Zi),F.prototype.visitDateDay=I(Hi),F.prototype.visitDateMillisecond=I(Ui),F.prototype.visitTimestamp=I(na),F.prototype.visitTimestampSecond=I(Qi),F.prototype.visitTimestampMillisecond=I($i),F.prototype.visitTimestampMicrosecond=I(ea),F.prototype.visitTimestampNanosecond=I(ta),F.prototype.visitTime=I(sa),F.prototype.visitTimeSecond=I(ra),F.prototype.visitTimeMillisecond=I(ia),F.prototype.visitTimeMicrosecond=I(aa),F.prototype.visitTimeNanosecond=I(oa),F.prototype.visitDecimal=I(ca),F.prototype.visitList=I(la),F.prototype.visitLargeList=I(la),F.prototype.visitStruct=I(ha),F.prototype.visitUnion=I(ga),F.prototype.visitDenseUnion=I(_a),F.prototype.visitSparseUnion=I(va),F.prototype.visitDictionary=I(ya),F.prototype.visitInterval=I(ba),F.prototype.visitIntervalDayTime=I(xa),F.prototype.visitIntervalYearMonth=I(Sa),F.prototype.visitIntervalMonthDayNano=I(Ca),F.prototype.visitDuration=I(Oa),F.prototype.visitDurationSecond=I(wa),F.prototype.visitDurationMillisecond=I(Ta),F.prototype.visitDurationMicrosecond=I(Ea),F.prototype.visitDurationNanosecond=I(Da),F.prototype.visitFixedSizeList=I(ka),F.prototype.visitMap=I(ua);const Aa=new F,ja=Symbol.for(`parent`),Ma=Symbol.for(`rowIndex`);var Na=class{constructor(e,t){return this[ja]=e,this[Ma]=t,new Proxy(this,Fa)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Ma],t=this[ja],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=ko.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${cr(e)}: ${cr(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new Pa(this[ja],this[Ma])}},Pa=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,ko.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Na.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[ja]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ma]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});const Fa=new class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[ja].type.children.map(e=>e.name)}has(e,t){return e[ja].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[ja].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[ja].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=ko.visit(e[ja].children[n],e[Ma]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[ja].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(Aa.visit(e[ja].children[r],e[Ma],n),Reflect.set(e,t,n))}};var L=class extends P{};function R(e){return(t,n)=>t.getValid(n)?e(t,n):null}const Ia=(e,t)=>864e5*e[t],La=(e,t)=>null,Ra=(e,t,n)=>{if(n+1>=t.length)return null;let r=A(t[n]),i=A(t[n+1]);return e.subarray(r,i)},za=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},Ba=({values:e},t)=>Ia(e,t),Va=({values:e},t)=>A(e[t]),Ha=({stride:e,values:t},n)=>t[e*n],Ua=({stride:e,values:t},n)=>Ni(t[e*n]),Wa=({values:e},t)=>e[t],Ga=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Ka=({values:e,valueOffsets:t},n)=>Ra(e,t,n),qa=(e,t)=>{let n=e.values;if(!n)throw Error(`BinaryView data is missing view buffer`);let r=t*16,i=r+16;if(r<0||i>n.length)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${Math.max(0,n.length-r)}`);let a=n.subarray(r,i);if(a.length<16)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${a.length}`);let o=new DataView(n.buffer,a.byteOffset,16),s=o.getInt32(0,!0);if(s<=0)return new Uint8Array;if(s<=12)return a.subarray(4,4+s);let c=o.getInt32(8,!0),l=o.getInt32(12,!0),u=e.variadicBuffers?.[c];if(!u)throw Error(`BinaryView variadic buffer ${c} is missing`);return u.subarray(l,l+s)},Ja=(e,t)=>qa(e,t),Ya=({values:e,valueOffsets:t},n)=>{let r=Ra(e,t,n);return r===null?null:Nt(r)},Xa=(e,t)=>{let n=qa(e,t);return Nt(n)},Za=({values:e},t)=>e[t],Qa=({type:e,values:t},n)=>e.precision===C.HALF?Ni(t[n]):t[n],$a=(e,t)=>e.type.unit===vn.DAY?Ba(e,t):Va(e,t),eo=({values:e},t)=>1e3*A(e[t]),to=({values:e},t)=>A(e[t]),no=({values:e},t)=>lr(e[t],BigInt(1e3)),ro=({values:e},t)=>lr(e[t],BigInt(1e6)),io=(e,t)=>{switch(e.type.unit){case w.SECOND:return eo(e,t);case w.MILLISECOND:return to(e,t);case w.MICROSECOND:return no(e,t);case w.NANOSECOND:return ro(e,t)}},ao=({values:e},t)=>e[t],oo=({values:e},t)=>e[t],so=({values:e},t)=>e[t],co=({values:e},t)=>e[t],lo=(e,t)=>{switch(e.type.unit){case w.SECOND:return ao(e,t);case w.MILLISECOND:return oo(e,t);case w.MICROSECOND:return so(e,t);case w.NANOSECOND:return co(e,t)}},uo=({values:e,stride:t},n)=>br.decimal(e.subarray(t*n,t*(n+1))),fo=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,a=A(n[t*r]),o=A(n[t*r+1]);return new G([i[0].slice(a,o-a)])},po=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new Po(o.slice(i,a-i))},mo=(e,t)=>new Na(e,t),ho=(e,t)=>e.type.mode===_n.Dense?go(e,t):_o(e,t),go=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return ko.visit(r,e.valueOffsets[t])},_o=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return ko.visit(r,t)},vo=(e,t)=>e.dictionary?.get(e.values[t]),yo=(e,t)=>e.type.unit===T.MONTH_DAY_NANO?So(e,t):e.type.unit===T.DAY_TIME?bo(e,t):xo(e,t),bo=({values:e},t)=>e.subarray(2*t,2*(t+1)),xo=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},So=({values:e},t)=>e.subarray(4*t,4*(t+1)),Co=({values:e},t)=>e[t],wo=({values:e},t)=>e[t],To=({values:e},t)=>e[t],Eo=({values:e},t)=>e[t],Do=(e,t)=>{switch(e.type.unit){case w.SECOND:return Co(e,t);case w.MILLISECOND:return wo(e,t);case w.MICROSECOND:return To(e,t);case w.NANOSECOND:return Eo(e,t)}},Oo=(e,t)=>{let{stride:n,children:r}=e;return new G([r[0].slice(t*n,n)])};L.prototype.visitNull=R(La),L.prototype.visitBool=R(za),L.prototype.visitInt=R(Za),L.prototype.visitInt8=R(Ha),L.prototype.visitInt16=R(Ha),L.prototype.visitInt32=R(Ha),L.prototype.visitInt64=R(Wa),L.prototype.visitUint8=R(Ha),L.prototype.visitUint16=R(Ha),L.prototype.visitUint32=R(Ha),L.prototype.visitUint64=R(Wa),L.prototype.visitFloat=R(Qa),L.prototype.visitFloat16=R(Ua),L.prototype.visitFloat32=R(Ha),L.prototype.visitFloat64=R(Ha),L.prototype.visitUtf8=R(Ya),L.prototype.visitLargeUtf8=R(Ya),L.prototype.visitUtf8View=R(Xa),L.prototype.visitBinary=R(Ka),L.prototype.visitLargeBinary=R(Ka),L.prototype.visitBinaryView=R(Ja),L.prototype.visitFixedSizeBinary=R(Ga),L.prototype.visitDate=R($a),L.prototype.visitDateDay=R(Ba),L.prototype.visitDateMillisecond=R(Va),L.prototype.visitTimestamp=R(io),L.prototype.visitTimestampSecond=R(eo),L.prototype.visitTimestampMillisecond=R(to),L.prototype.visitTimestampMicrosecond=R(no),L.prototype.visitTimestampNanosecond=R(ro),L.prototype.visitTime=R(lo),L.prototype.visitTimeSecond=R(ao),L.prototype.visitTimeMillisecond=R(oo),L.prototype.visitTimeMicrosecond=R(so),L.prototype.visitTimeNanosecond=R(co),L.prototype.visitDecimal=R(uo),L.prototype.visitList=R(fo),L.prototype.visitLargeList=R(fo),L.prototype.visitStruct=R(mo),L.prototype.visitUnion=R(ho),L.prototype.visitDenseUnion=R(go),L.prototype.visitSparseUnion=R(_o),L.prototype.visitDictionary=R(vo),L.prototype.visitInterval=R(yo),L.prototype.visitIntervalDayTime=R(bo),L.prototype.visitIntervalYearMonth=R(xo),L.prototype.visitIntervalMonthDayNano=R(So),L.prototype.visitDuration=R(Do),L.prototype.visitDurationSecond=R(Co),L.prototype.visitDurationMillisecond=R(wo),L.prototype.visitDurationMicrosecond=R(To),L.prototype.visitDurationNanosecond=R(Eo),L.prototype.visitFixedSizeList=R(Oo),L.prototype.visitMap=R(po);const ko=new L,Ao=Symbol.for(`keys`),jo=Symbol.for(`vals`),Mo=Symbol.for(`kKeysAsStrings`),No=Symbol.for(`_kKeysAsStrings`);var Po=class{constructor(e){return this[Ao]=new G([e.children[0]]).memoize(),this[jo]=e.children[1],new Proxy(this,new Io)}get[Mo](){return this[No]||(this[No]=Array.from(this[Ao].toArray(),String))}[Symbol.iterator](){return new Fo(this[Ao],this[jo])}get size(){return this[Ao].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Ao],t=this[jo],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=ko.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${cr(e)}: ${cr(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},Fo=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),ko.visit(this.vals,e)]})}},Io=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Mo]}has(e,t){return e[Mo].includes(t)}getOwnPropertyDescriptor(e,t){if(e[Mo].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Mo].indexOf(t);if(n!==-1){let r=ko.visit(Reflect.get(e,jo),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Mo].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(Aa.visit(Reflect.get(e,jo),r,n),Reflect.set(e,t,n))}};Object.defineProperties(Po.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ao]:{writable:!0,enumerable:!1,configurable:!1,value:null},[jo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[No]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Lo;function Ro(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Lo=a,a=o,o=Lo),o>i&&(o=i),r?r(e,a,o):[a,o]}const zo=(e,t)=>e<0?t+e:e,Bo=e=>e!==e;function Vo(e){if(typeof e!=`object`||!e)return Bo(e)?Bo:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?cn(e,t):!1:e instanceof Map?Uo(e):Array.isArray(e)?Ho(e):e instanceof G?Wo(e):Go(e,!0)}function Ho(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Vo(e[n]);return Ko(t)}function Uo(e){let t=-1,n=[];for(let r of e.values())n[++t]=Vo(r);return Ko(n)}function Wo(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Vo(e.get(n));return Ko(t)}function Go(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=Vo(e[n[t]]);return Ko(r,n)}function Ko(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return qo(e,n);case Map:return Yo(e,n,n.keys());case Po:case Na:case Object:case void 0:return Yo(e,n,t||Object.keys(n))}return n instanceof G&&Jo(e,n)}}function qo(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Jo(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Yo(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function Xo(e,t,n,r){return!!(n&1<<r)}function Zo(e,t,n,r){return(n&1<<r)>>r}function Qo(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):$o(new es(n,e,t,null,Xo)).subarray(0,r)),i}return n}function $o(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var es=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ts(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new es(e,t,n-t,e,Zo))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return ts(e,t,i)+ts(e,r,n)+ns(e,i>>3,r-i>>3)}function ns(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=rs(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=rs(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=rs(a.getUint8(i)),i+=1;return r}function rs(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const is=Symbol.for(`apache-arrow/Data`);var z=class e{static isData(e){return e?.[is]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return j.isSparseUnion(e)||j.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((e,t)=>e+(t?.byteLength??0),0),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(j.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-ts(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s,c=[]){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets,this.variadicBuffers=a.variadicBuffers):(this.stride=Di(t),a&&((l=a[0])&&(this.valueOffsets=l),(l=a[1])&&(this.values=l),(l=a[2])&&(this.nullBitmap=l),(l=a[3])&&(this.typeIds=l)),this.variadicBuffers=c),this.variadicBuffers??=[]}getValid(e){let{type:t}=this;if(j.isUnion(t)){let n=t,r=this.typeIds[e],i=n.typeIdToChildIndex[r],a=this.children[i],o=this.valueOffsets,s=n.mode===_n.Dense&&o?Number(o[e]):e;return a.getValid(s)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(j.isUnion(r)){let i=r,a=this.typeIds[e],o=i.typeIdToChildIndex[a],s=this.children[o],c=this.valueOffsets,l=i.mode===_n.Dense&&c?Number(c[e]):e;n=s.getValid(l),s.setValid(l,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Qo(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children,s=this.variadicBuffers){return new e(t,n,r,i,a,o,this.dictionary,s)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===k.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(Qo(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[sr.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;if((i=a[sr.TYPE])&&(a[sr.TYPE]=i.subarray(e,e+t)),j.isBinaryView(this.type)||j.isUtf8View(this.type)){let n=M.ELEMENT_WIDTH;(i=a[sr.DATA])&&(a[sr.DATA]=i.subarray(e*n,(e+t)*n))}else(i=a[sr.OFFSET])&&(a[sr.OFFSET]=i.subarray(e,e+t+1))||(i=a[sr.DATA])&&(a[sr.DATA]=r===6?i:i.subarray(n*e,n*(e+t)));return a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};z.prototype.children=Object.freeze([]),z.prototype[is]=!0,Object.defineProperty(z,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===z&&z.isData(e)}});const as=new class e extends P{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new z(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=x(e.data),i=x(e.nullBitmap),a=en(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitUtf8View(e){let{type:t,offset:n=0}=e,r=b(t.ArrayType,e.views),i=x(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>x(e));return new z(t,n,e.length??Math.trunc(r.length/ui.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=x(e.data),i=x(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=x(e.data),i=x(e.nullBitmap),a=en(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitBinaryView(e){let{type:t,offset:n=0}=e,r=b(t.ArrayType,e.views),i=x(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>x(e));return new z(t,n,e.length??Math.trunc(r.length/M.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=x(e.data),i=x(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=x(e.nullBitmap),a=en(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,void 0,i],[r])}visitLargeList(e){let{type:t,offset:n=0,child:r}=e,i=x(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=x(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=b(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return j.isSparseUnion(t)?new z(t,n,a,o,[void 0,void 0,void 0,i],r):new z(t,n,a,o,[en(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=x(t.nullBitmap),a=b(n.indices.ArrayType,t.data),{dictionary:o=new G([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new z(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length/Di(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=x(e.nullBitmap),i=b(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=x(t.nullBitmap),{length:o=i.length/Di(n),nullCount:s=t.nullBitmap?-1:0}=t;return new z(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=x(t.nullBitmap),o=en(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new z(n,r,s,c,[o,void 0,a],[i])}};function B(e){return as.visit(e)}var os=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function ss(e){return e.some(e=>e.nullable)}function cs(e){return e.reduce((e,t)=>e+t.nullCount,0)}function ls(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function us(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function ds(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function fs(e,t){return e.getValid(t)}function ps(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return ds(n,this._offsets,e,t)}}function ms(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=ds(i,this._offsets,e,n);return t=void 0,a}}function hs(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?ds(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var V=class extends P{};function gs(e,t){return t===null&&e.length>0?0:-1}function _s(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new es(n,e.offset+(t||0),e.length,n,Xo)){if(!i)return r;++r}return-1}function H(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case k.Union:break;case k.Dictionary:break;default:return _s(e,n)}let r=ko.getVisitFn(e),i=Vo(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function vs(e,t,n){let r=ko.getVisitFn(e),i=Vo(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}V.prototype.visitNull=gs,V.prototype.visitBool=H,V.prototype.visitInt=H,V.prototype.visitInt8=H,V.prototype.visitInt16=H,V.prototype.visitInt32=H,V.prototype.visitInt64=H,V.prototype.visitUint8=H,V.prototype.visitUint16=H,V.prototype.visitUint32=H,V.prototype.visitUint64=H,V.prototype.visitFloat=H,V.prototype.visitFloat16=H,V.prototype.visitFloat32=H,V.prototype.visitFloat64=H,V.prototype.visitUtf8=H,V.prototype.visitLargeUtf8=H,V.prototype.visitUtf8View=H,V.prototype.visitBinary=H,V.prototype.visitLargeBinary=H,V.prototype.visitBinaryView=H,V.prototype.visitFixedSizeBinary=H,V.prototype.visitDate=H,V.prototype.visitDateDay=H,V.prototype.visitDateMillisecond=H,V.prototype.visitTimestamp=H,V.prototype.visitTimestampSecond=H,V.prototype.visitTimestampMillisecond=H,V.prototype.visitTimestampMicrosecond=H,V.prototype.visitTimestampNanosecond=H,V.prototype.visitTime=H,V.prototype.visitTimeSecond=H,V.prototype.visitTimeMillisecond=H,V.prototype.visitTimeMicrosecond=H,V.prototype.visitTimeNanosecond=H,V.prototype.visitDecimal=H,V.prototype.visitList=H,V.prototype.visitLargeList=H,V.prototype.visitStruct=H,V.prototype.visitUnion=H,V.prototype.visitDenseUnion=vs,V.prototype.visitSparseUnion=vs,V.prototype.visitDictionary=H,V.prototype.visitInterval=H,V.prototype.visitIntervalDayTime=H,V.prototype.visitIntervalYearMonth=H,V.prototype.visitIntervalMonthDayNano=H,V.prototype.visitDuration=H,V.prototype.visitDurationSecond=H,V.prototype.visitDurationMillisecond=H,V.prototype.visitDurationMicrosecond=H,V.prototype.visitDurationNanosecond=H,V.prototype.visitFixedSizeList=H,V.prototype.visitMap=H;const ys=new V;var U=class extends P{};function W(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(j.isInt(t)&&t.bitWidth!==64||j.isTime(t)&&t.bitWidth!==64||j.isFloat(t)&&t.precision!==C.HALF))return new os(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new os(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new bs(i)})}var bs=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};U.prototype.visitNull=W,U.prototype.visitBool=W,U.prototype.visitInt=W,U.prototype.visitInt8=W,U.prototype.visitInt16=W,U.prototype.visitInt32=W,U.prototype.visitInt64=W,U.prototype.visitUint8=W,U.prototype.visitUint16=W,U.prototype.visitUint32=W,U.prototype.visitUint64=W,U.prototype.visitFloat=W,U.prototype.visitFloat16=W,U.prototype.visitFloat32=W,U.prototype.visitFloat64=W,U.prototype.visitUtf8=W,U.prototype.visitLargeUtf8=W,U.prototype.visitUtf8View=W,U.prototype.visitBinary=W,U.prototype.visitLargeBinary=W,U.prototype.visitBinaryView=W,U.prototype.visitFixedSizeBinary=W,U.prototype.visitDate=W,U.prototype.visitDateDay=W,U.prototype.visitDateMillisecond=W,U.prototype.visitTimestamp=W,U.prototype.visitTimestampSecond=W,U.prototype.visitTimestampMillisecond=W,U.prototype.visitTimestampMicrosecond=W,U.prototype.visitTimestampNanosecond=W,U.prototype.visitTime=W,U.prototype.visitTimeSecond=W,U.prototype.visitTimeMillisecond=W,U.prototype.visitTimeMicrosecond=W,U.prototype.visitTimeNanosecond=W,U.prototype.visitDecimal=W,U.prototype.visitList=W,U.prototype.visitLargeList=W,U.prototype.visitStruct=W,U.prototype.visitUnion=W,U.prototype.visitDenseUnion=W,U.prototype.visitSparseUnion=W,U.prototype.visitDictionary=W,U.prototype.visitInterval=W,U.prototype.visitIntervalDayTime=W,U.prototype.visitIntervalYearMonth=W,U.prototype.visitIntervalMonthDayNano=W,U.prototype.visitDuration=W,U.prototype.visitDurationSecond=W,U.prototype.visitDurationMillisecond=W,U.prototype.visitDurationMicrosecond=W,U.prototype.visitDurationNanosecond=W,U.prototype.visitFixedSizeList=W,U.prototype.visitMap=W;const xs=new U;var Ss;const Cs=Symbol.for(`apache-arrow/Vector`),ws={},Ts={};var G=class e{static isVector(e){return e?.[Cs]===!0}constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof z)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=ws[r.typeId],a=n[0];this.isValid=e=>fs(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,Ts[r.typeId]),this._offsets=ls(n)}this.data=n,this.type=r,this.stride=Di(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return ss(this.data)}get nullCount(){return cs(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${k[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(zo(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return xs.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(Ro(this,t,n,({data:e,_offsets:t},n,r)=>us(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case k.Int:case k.Float:case k.Decimal:case k.Time:case k.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return j.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(j.isDictionary(this.type)){let t=new Es(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new Es(this)}unmemoize(){if(j.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};Ss=Symbol.toStringTag,G[Ss]=(e=>{e.type=j.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[Cs]=!0;let t=Object.keys(k).map(e=>k[e]).filter(e=>typeof e==`number`&&e!==k.NONE);for(let n of t){let t=ko.getVisitFnByTypeId(n),r=Aa.getVisitFnByTypeId(n),i=ys.getVisitFnByTypeId(n);ws[n]={get:t,set:r,indexOf:i},Ts[n]=Object.create(e,{isValid:{value:ps(fs)},get:{value:ps(ko.getVisitFnByTypeId(n))},set:{value:ms(Aa.getVisitFnByTypeId(n))},indexOf:{value:hs(ys.getVisitFnByTypeId(n))}})}return`Vector`})(G.prototype),Object.defineProperty(G,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===G&&G.isVector(e)}});var Es=class e extends G{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new G(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},Ds=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,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(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},Os=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):S.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new or).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Ds).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Ds).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new E).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,S.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}};const ks=Symbol.for(`apache-arrow/Schema`),As=Symbol.for(`apache-arrow/Field`);var K=class e{static isSchema(e){return e?.[ks]===!0}constructor(e=[],t,n,r=S.V5){this.fields=e||[],this.metadata=t||new Map,n||=Ms(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=js(js(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:js(js(new Map,r[t].metadata),e.metadata)}))&&!1}),o=Ms(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};K.prototype.fields=null,K.prototype.metadata=null,K.prototype.dictionaries=null,K.prototype[ks]=!0,Object.defineProperty(K,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===K&&K.isSchema(e)}});var q=class e{static isField(e){return e?.[As]===!0}static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};q.prototype.type=null,q.prototype.name=null,q.prototype.nullable=null,q.prototype.metadata=null,q.prototype[As]=!0,Object.defineProperty(q,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===q&&q.isField(e)}});function js(e,t){return new Map([...e||new Map,...t||new Map])}function Ms(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(j.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&Ms(r.children,t)}return t}var Ns=Tn,Ps=wn,Fs=class{static decode(e){e=new Ps(x(e));let t=Os.getRootAsFooter(e);return new Is(K.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new Ns,n=K.encode(t,e.schema);Os.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())Ls.encode(t,n);let r=t.endVector();Os.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())Ls.encode(t,n);let i=t.endVector();return Os.startFooter(t),Os.addSchema(t,n),Os.addVersion(t,S.V5),Os.addRecordBatches(t,r),Os.addDictionaries(t,i),Os.finishFooterBuffer(t,Os.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=S.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},Is=class extends Fs{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Ls.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Ls.decode(t)}return null}},Ls=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return Ds.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=A(n),this.bodyLength=A(t)}},Rs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):S.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):O.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new E).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,S.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,O.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt(`0`))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}};const zs=new class extends P{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return Qn.startNull(t),Qn.endNull(t)}visitInt(e,t){return Fn.startInt(t),Fn.addBitWidth(t,e.bitWidth),Fn.addIsSigned(t,e.isSigned),Fn.endInt(t)}visitFloat(e,t){return Gn.startFloatingPoint(t),Gn.addPrecision(t,e.precision),Gn.endFloatingPoint(t)}visitBinary(e,t){return Ln.startBinary(t),Ln.endBinary(t)}visitBinaryView(e,t){return Rn.startBinaryView(t),Rn.endBinaryView(t)}visitLargeBinary(e,t){return qn.startLargeBinary(t),qn.endLargeBinary(t)}visitBool(e,t){return zn.startBool(t),zn.endBool(t)}visitUtf8(e,t){return rr.startUtf8(t),rr.endUtf8(t)}visitUtf8View(e,t){return ir.startUtf8View(t),ir.endUtf8View(t)}visitLargeUtf8(e,t){return Yn.startLargeUtf8(t),Yn.endLargeUtf8(t)}visitDecimal(e,t){return Vn.startDecimal(t),Vn.addScale(t,e.scale),Vn.addPrecision(t,e.precision),Vn.addBitWidth(t,e.bitWidth),Vn.endDecimal(t)}visitDate(e,t){return Bn.startDate(t),Bn.addUnit(t,e.unit),Bn.endDate(t)}visitTime(e,t){return er.startTime(t),er.addUnit(t,e.unit),er.addBitWidth(t,e.bitWidth),er.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return tr.startTimestamp(t),tr.addUnit(t,e.unit),n!==void 0&&tr.addTimezone(t,n),tr.endTimestamp(t)}visitInterval(e,t){return Kn.startInterval(t),Kn.addUnit(t,e.unit),Kn.endInterval(t)}visitDuration(e,t){return Hn.startDuration(t),Hn.addUnit(t,e.unit),Hn.endDuration(t)}visitList(e,t){return Xn.startList(t),Xn.endList(t)}visitLargeList(e,t){return Jn.startLargeList(t),Jn.endLargeList(t)}visitStruct(e,t){return $n.startStruct_(t),$n.endStruct_(t)}visitUnion(e,t){nr.startTypeIdsVector(t,e.typeIds.length);let n=nr.createTypeIdsVector(t,e.typeIds);return nr.startUnion(t),nr.addMode(t,e.mode),nr.addTypeIds(t,n),nr.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return In.startDictionaryEncoding(t),In.addId(t,BigInt(e.id)),In.addIsOrdered(t,e.isOrdered),n!==void 0&&In.addIndexType(t,n),In.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return Un.startFixedSizeBinary(t),Un.addByteWidth(t,e.byteWidth),Un.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return Wn.startFixedSizeList(t),Wn.addListSize(t,e.listSize),Wn.endFixedSizeList(t)}visitMap(e,t){return Zn.startMap(t),Zn.addKeysSorted(t,e.keysSorted),Zn.endMap(t)}};function Bs(e,t=new Map){return new K(Us(e,t),Xs(e.metadata),t)}function Vs(e){return new nc(e.count,Gs(e.columns),Ks(e.columns),null,Js(e.columns))}function Hs(e){return new rc(Vs(e.data),e.id,e.isDelta)}function Us(e,t){return(e.fields||[]).filter(Boolean).map(e=>q.fromJSON(e,t))}function Ws(e,t){return(e.children||[]).filter(Boolean).map(e=>q.fromJSON(e,t))}function Gs(e){return(e||[]).reduce((e,t)=>[...e,new ac(t.count,qs(t.VALIDITY)),...Gs(t.children)],[])}function Ks(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let r=e[n];if(r.VALIDITY&&t.push(new ic(t.length,r.VALIDITY.length)),r.TYPE_ID&&t.push(new ic(t.length,r.TYPE_ID.length)),r.OFFSET&&t.push(new ic(t.length,r.OFFSET.length)),r.DATA&&t.push(new ic(t.length,r.DATA.length)),r.VIEWS&&t.push(new ic(t.length,r.VIEWS.length)),r.VARIADIC_DATA_BUFFERS)for(let e of r.VARIADIC_DATA_BUFFERS)t.push(new ic(t.length,e.length));t=Ks(r.children,t)}return t}function qs(e){return(e||[]).reduce((e,t)=>e+ +(t===0),0)}function Js(e){return(e||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...Js(t.children)],[])}function Ys(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=Qs(e,Ws(e,t)),i=new q(e.name,o,e.nullable,Xs(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?Zs(r):new Zr,s=new Ei(t.get(n),r,n,a.isOrdered),i=new q(e.name,s,e.nullable,Xs(e.metadata))):(r=(r=a.indexType)?Zs(r):new Zr,t.set(n,o=Qs(e,Ws(e,t))),s=new Ei(o,r,n,a.isOrdered),i=new q(e.name,s,e.nullable,Xs(e.metadata))),i||null}function Xs(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function Zs(e){return new Jr(e.isSigned,e.bitWidth)}function Qs(e,t){let n=e.type.name;switch(n){case`NONE`:return new qr;case`null`:return new qr;case`binary`:return new si;case`largebinary`:return new ci;case`binaryview`:return new M;case`utf8`:return new li;case`largeutf8`:return new di;case`utf8view`:return new ui;case`bool`:return new fi;case`list`:return new yi((t||[])[0]);case`largelist`:return new bi((t||[])[0]);case`struct`:return new N(t||[]);case`struct_`:return new N(t||[])}switch(n){case`int`:{let t=e.type;return new Jr(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new ri(C[t.precision])}case`decimal`:{let t=e.type;return new pi(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new mi(vn[t.unit])}case`time`:{let t=e.type;return new hi(w[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new gi(w[t.unit],t.timezone)}case`interval`:{let t=e.type;return new _i(T[t.unit])}case`duration`:{let t=e.type;return new vi(w[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new xi(_n[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new Si(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new Ci(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new wi((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var $s=Tn,ec=wn,tc=class e{static fromJSON(t,n){let r=new e(0,S.V5,n);return r._createHeader=sc(t,n),r}static decode(t){t=new ec(x(t));let n=Rs.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=xc(n),s=new e(r,i,a,void 0,o);return s._createHeader=cc(n,a),s}static encode(e){let t=new $s,n=-1;e.isSchema()?n=K.encode(t,e.header()):e.isRecordBatch()?n=nc.encode(t,e.header()):e.isDictionaryBatch()&&(n=rc.encode(t,e.header()));let r=e.metadata&&e.metadata.size>0?Rs.createCustomMetadataVector(t,[...e.metadata].map(([e,n])=>{let r=t.createString(`${e}`),i=t.createString(`${n}`);return E.startKeyValue(t),E.addKey(t,r),E.addValue(t,i),E.endKeyValue(t)})):-1;return Rs.startMessage(t),Rs.addVersion(t,S.V5),Rs.addHeader(t,n),Rs.addHeaderType(t,e.headerType),Rs.addBodyLength(t,BigInt(e.bodyLength)),r!==-1&&Rs.addCustomMetadata(t,r),Rs.finishMessageBuffer(t,Rs.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof K)return new e(0,S.V5,O.Schema,t);if(t instanceof nc)return new e(n,S.V5,O.RecordBatch,t,t.metadata);if(t instanceof rc)return new e(n,S.V5,O.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===O.Schema}isRecordBatch(){return this.headerType===O.RecordBatch}isDictionaryBatch(){return this.headerType===O.DictionaryBatch}constructor(e,t,n,r,i){this._version=t,this._headerType=n,this.body=new Uint8Array,this._compression=r?.compression,r&&(this._createHeader=()=>r),this._bodyLength=A(e),this._metadata=i||new Map}},nc=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,r,i=[],a){this._nodes=t,this._buffers=n,this._length=A(e),this._compression=r,this._variadicBufferCounts=i,this._metadata=a||new Map}},rc=class{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(e,t,n=!1){this._data=e,this._isDelta=n,this._id=A(t)}},ic=class{constructor(e,t){this.offset=A(e),this.length=A(t)}},ac=class{constructor(e,t){this.length=A(e),this.nullCount=A(t)}},oc=class{constructor(e,t=En.BUFFER){this.type=e,this.method=t}};function sc(e,t){return(()=>{switch(t){case O.Schema:return K.fromJSON(e);case O.RecordBatch:return nc.fromJSON(e);case O.DictionaryBatch:return rc.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${O[t]}, type: ${t} }`)})}function cc(e,t){return(()=>{switch(t){case O.Schema:return K.decode(e.header(new or),new Map,e.version());case O.RecordBatch:return nc.decode(e.header(new jn),e.version());case O.DictionaryBatch:return rc.decode(e.header(new Mn),e.version())}throw Error(`Unrecognized Message type: { name: ${O[t]}, type: ${t} }`)})}q.encode=Ec,q.decode=yc,q.fromJSON=Ys,K.encode=Tc,K.decode=lc,K.fromJSON=Bs,nc.encode=Dc,nc.decode=uc,nc.fromJSON=Vs,rc.encode=kc,rc.decode=dc,rc.fromJSON=Hs,ac.encode=Ac,ac.decode=pc,ic.encode=jc,ic.decode=fc,oc.encode=Oc,oc.decode=wc;function lc(e,t=new Map,n=S.V5){return new K(_c(e,t),bc(e),t,n)}function uc(e,t=S.V5){return new nc(e.length(),mc(e),hc(e,t),wc(e.compression()),gc(e))}function dc(e,t=S.V5){return new rc(nc.decode(e.data(),t),e.id(),e.isDelta())}function fc(e){return new ic(e.offset(),e.length())}function pc(e){return new ac(e.length(),e.nullCount())}function mc(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++r<a;)(n=e.nodes(r))&&(t[++i]=ac.decode(n));return t}function hc(e,t){let n=[];for(let r,i=-1,a=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<S.V4&&(r.bb_pos+=8*(i+1)),n[++a]=ic.decode(r));return n}function gc(e){let t=[],n=Math.trunc(e.variadicBufferCountsLength());for(let r=0;r<n;++r)t.push(A(e.variadicBufferCounts(r)));return t}function _c(e,t){let n=[];for(let r,i=-1,a=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++a]=q.decode(r,t));return n}function vc(e,t){let n=[];for(let r,i=-1,a=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++a]=q.decode(r,t));return n}function yc(e,t){let n,r,i,a,o,s;return!t||!(s=e.dictionary())?(i=Cc(e,vc(e,t)),r=new q(e.name(),i,e.nullable(),bc(e))):t.has(n=A(s.id()))?(a=(a=s.indexType())?Sc(a):new Zr,o=new Ei(t.get(n),a,n,s.isOrdered()),r=new q(e.name(),o,e.nullable(),bc(e))):(a=(a=s.indexType())?Sc(a):new Zr,t.set(n,i=Cc(e,vc(e,t))),o=new Ei(i,a,n,s.isOrdered()),r=new q(e.name(),o,e.nullable(),bc(e))),r||null}function bc(e){let t=new Map;if(e)for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function xc(e){let t=new Map;for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Sc(e){return new Jr(e.isSigned(),e.bitWidth())}function Cc(e,t){let n=e.typeType();switch(n){case D.NONE:return new qr;case D.Null:return new qr;case D.Binary:return new si;case D.LargeBinary:return new ci;case D.BinaryView:return new M;case D.Utf8:return new li;case D.LargeUtf8:return new di;case D.Utf8View:return new ui;case D.Bool:return new fi;case D.List:return new yi((t||[])[0]);case D.LargeList:return new bi((t||[])[0]);case D.Struct_:return new N(t||[])}switch(n){case D.Int:{let t=e.type(new Fn);return new Jr(t.isSigned(),t.bitWidth())}case D.FloatingPoint:return new ri(e.type(new Gn).precision());case D.Decimal:{let t=e.type(new Vn);return new pi(t.scale(),t.precision(),t.bitWidth())}case D.Date:return new mi(e.type(new Bn).unit());case D.Time:{let t=e.type(new er);return new hi(t.unit(),t.bitWidth())}case D.Timestamp:{let t=e.type(new tr);return new gi(t.unit(),t.timezone())}case D.Interval:return new _i(e.type(new Kn).unit());case D.Duration:return new vi(e.type(new Hn).unit());case D.Union:{let n=e.type(new nr);return new xi(n.mode(),n.typeIdsArray()||[],t||[])}case D.FixedSizeBinary:return new Si(e.type(new Un).byteWidth());case D.FixedSizeList:return new Ci(e.type(new Wn).listSize(),(t||[])[0]);case D.Map:{let n=e.type(new Zn);return new wi((t||[])[0],n.keysSorted())}}throw Error(`Unrecognized type: "${D[n]}" (${n})`)}function wc(e){return e?new oc(e.codec(),e.method()):null}function Tc(e,t){let n=t.fields.map(t=>q.encode(e,t));or.startFieldsVector(e,n.length);let r=or.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?or.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return E.startKeyValue(e),E.addKey(e,r),E.addValue(e,i),E.endKeyValue(e)})):-1;return or.startSchema(e),or.addFields(e,r),or.addEndianness(e,Mc?Nn.Little:Nn.Big),i!==-1&&or.addCustomMetadata(e,i),or.endSchema(e)}function Ec(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;j.isDictionary(a)?(o=a.dictionary.typeId,i=zs.visit(a,e),r=zs.visit(a.dictionary,e)):r=zs.visit(a,e);let s=(a.children||[]).map(t=>q.encode(e,t)),c=ar.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?ar.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return E.startKeyValue(e),E.addKey(e,r),E.addValue(e,i),E.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),ar.startField(e),ar.addType(e,r),ar.addTypeType(e,o),ar.addChildren(e,c),ar.addNullable(e,!!t.nullable),n!==-1&&ar.addName(e,n),i!==-1&&ar.addDictionary(e,i),l!==-1&&ar.addCustomMetadata(e,l),ar.endField(e)}function Dc(e,t){let n=t.nodes||[],r=t.buffers||[],i=t.variadicBufferCounts||[];jn.startNodesVector(e,n.length);for(let t of n.slice().reverse())ac.encode(e,t);let a=e.endVector();jn.startBuffersVector(e,r.length);for(let t of r.slice().reverse())ic.encode(e,t);let o=e.endVector(),s=null;t.compression!==null&&(s=Oc(e,t.compression));let c=-1;return i.length>0&&(c=jn.createVariadicBufferCountsVector(e,i.map(BigInt))),jn.startRecordBatch(e),jn.addLength(e,BigInt(t.length)),jn.addNodes(e,a),jn.addBuffers(e,o),t.compression!==null&&s&&jn.addCompression(e,s),c!==-1&&jn.addVariadicBufferCounts(e,c),jn.endRecordBatch(e)}function Oc(e,t){return On.startBodyCompression(e),On.addCodec(e,t.type),On.addMethod(e,t.method),On.endBodyCompression(e)}function kc(e,t){let n=nc.encode(e,t.data);return Mn.startDictionaryBatch(e),Mn.addId(e,BigInt(t.id)),Mn.addIsDelta(e,t.isDelta),Mn.addData(e,n),Mn.endDictionaryBatch(e)}function Ac(e,t){return An.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function jc(e,t){return kn.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Mc=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),J=Object.freeze({done:!0,value:void 0});var Nc=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Pc=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},Fc=class extends Pc{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return _(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(J);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return ln.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return ln.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return _(this,void 0,void 0,function*(){return yield this.abort(e),J})}return(e){return _(this,void 0,void 0,function*(){return yield this.close(),J})}read(e){return _(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return _(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){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((e,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(J)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Ic=class extends Fc{write(e){if((e=x(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Nt(this.toUint8Array(!0)):this.toUint8Array(!1).then(Nt)}toUint8Array(e=!1){return e?$t(this._values)[0]:_(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=jt(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return $t(i,a)[0]})}},Lc=class{constructor(e){e&&(this.source=new zc(ln.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Rc=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Ic?this.source=new Bc(ln.fromAsyncIterable(t)):Jt(t)?this.source=new Bc(ln.fromNodeStream(t)):qt(t)?this.source=new Bc(ln.fromDOMStream(t)):Gt(t)?this.source=new Bc(ln.fromDOMStream(t.body)):Bt(t)?this.source=new Bc(ln.fromIterable(t)):(zt(t)||Vt(t))&&(this.source=new Bc(ln.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},zc=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,`peek`).value}read(e){return this.next(e,`read`).value}next(e,t=`read`){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||J)}return(e){return Object.create(this.source.return&&this.source.return(e)||J)}},Bc=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return _(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return _(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return _(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return _(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return _(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return _(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},Vc=class extends Lc{constructor(e,t){super(),this.position=0,this.buffer=x(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},Hc=class extends Rc{constructor(e,t){super(),this.position=0,this._handle=e,typeof t==`number`?this.size=t:this._pending=_(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return _(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return _(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return _(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,t){return _(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r}=this;if(n&&e+t<r){let i=Math.min(r,e+t),a=new Uint8Array(i-e);return(yield n.read(a,0,t,e)).buffer}return new Uint8Array(t)})}close(){return _(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}};function Uc(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const Wc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];var Gc=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Uc(this.buffer[1])} ${Uc(this.buffer[0])}`}},Y=class e extends Gc{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=8<r-n?8:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([Wc[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Kc=class e extends Gc{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([Wc[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},qc=class e{constructor(e){this.buffer=e}high(){return new Kc(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Kc(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],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){let t=new Y(new Uint32Array([this.buffer[3],0])),n=new Y(new Uint32Array([this.buffer[2],0])),r=new Y(new Uint32Array([this.buffer[1],0])),i=new Y(new Uint32Array([this.buffer[0],0])),a=new Y(new Uint32Array([e.buffer[3],0])),o=new Y(new Uint32Array([e.buffer[2],0])),s=new Y(new Uint32Array([e.buffer[1],0])),c=new Y(new Uint32Array([e.buffer[0],0])),l=Y.multiply(i,c);this.buffer[0]=l.low();let u=new Y(new Uint32Array([l.high(),0]));return l=Y.multiply(r,c),u.plus(l),l=Y.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new Y(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Y.multiply(n,c)).plus(Y.multiply(r,s)).plus(Y.multiply(i,o)),this.buffer[3]+=Y.multiply(t,c).plus(Y.multiply(n,s)).plus(Y.multiply(r,o)).plus(Y.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Uc(this.buffer[3])} ${Uc(this.buffer[2])} ${Uc(this.buffer[1])} ${Uc(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([Wc[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}};function Jc(e){let t=e.length,n=new Int32Array(t*2);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.days??0,n[i++]=t.milliseconds??0}return n}function Yc(e){let t=e.length,n=new Int32Array(t*4);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.months??0,n[i++]=t.days??0;let a=t.nanoseconds;if(a){let e=BigInt(a);n[i++]=Number(e&BigInt(4294967295))>>>0,n[i++]=Number(e>>BigInt(32))>>>0}else i+=2}return n}var Xc=class extends P{constructor(e,t,n,r,i=S.V5,a=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i,this.variadicBufferCounts=a}visit(e){return super.visit(e instanceof q?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return B({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<S.V5&&this.readNullBitmap(e,n),e.mode===_n.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){return this.variadicBufferCounts[++this.variadicBufferIndex]??0}readDictionary(e){return this.dictionaries.get(e.id)}},Zc=class extends Xc{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:$o(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return b(Uint8Array,b(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return b(Uint8Array,b(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(j.isTimestamp(e)||(j.isInt(e)||j.isTime(e))&&e.bitWidth===64||j.isDuration(e)||j.isDate(e)&&e.unit===vn.MILLISECOND)return b(Uint8Array,Kc.convertArray(n[t]));if(j.isDecimal(e))return b(Uint8Array,qc.convertArray(n[t]));if(j.isBinary(e)||j.isLargeBinary(e)||j.isFixedSizeBinary(e))return $c(n[t]);if(j.isBinaryView(e))return tl(n[t]);if(j.isUtf8View(e))return nl(n[t]);if(j.isBool(e))return $o(n[t]);if(j.isUtf8(e)||j.isLargeUtf8(e))return Ft(n[t].join(``));if(j.isInterval(e))switch(e.unit){case T.DAY_TIME:return Jc(n[t]);case T.MONTH_DAY_NANO:return Yc(n[t])}return b(Uint8Array,b(e.ArrayType,n[t].map(e=>+e)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:e}=this.nextBufferRange(),n=this.sources[e];t.push(Qc(n))}return t}};function Qc(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t}function $c(e){return Qc(e.join(``))}function el(e,t){let n=new Uint8Array(e.length*16),r=new DataView(n.buffer);for(let[i,a]of e.entries()){let e=i*16,o=a.SIZE;if(r.setInt32(e,o,!0),a.INLINED!==void 0){let r=t(a.INLINED);for(let t=0;t<r.length&&t<12;t++)n[e+4+t]=r[t]}else{let t=a.PREFIX_HEX;for(let r=0;r<8&&r<t.length;r+=2)n[e+4+(r>>1)]=Number.parseInt(t.slice(r,r+2),16);r.setInt32(e+8,a.BUFFER_INDEX,!0),r.setInt32(e+12,a.OFFSET,!0)}}return n}function tl(e){return el(e,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function nl(e){return el(e,e=>new TextEncoder().encode(e))}var rl=class extends Xc{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}},X=class extends P{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function Z(e,t){return t instanceof e.constructor}function il(e,t){return e===t||Z(e,t)}function al(e,t){return e===t||Z(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function ol(e,t){return e===t||Z(e,t)&&e.precision===t.precision}function sl(e,t){return e===t||Z(e,t)&&e.byteWidth===t.byteWidth}function cl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function ll(e,t){return e===t||Z(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ul(e,t){return e===t||Z(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function dl(e,t){return e===t||Z(e,t)&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function fl(e,t){return e===t||Z(e,t)&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function pl(e,t){return e===t||Z(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&yl.compareManyFields(e.children,t.children)}function ml(e,t){return e===t||Z(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&yl.visit(e.indices,t.indices)&&yl.visit(e.dictionary,t.dictionary)}function hl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function gl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function _l(e,t){return e===t||Z(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function vl(e,t){return e===t||Z(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}X.prototype.visitNull=il,X.prototype.visitBool=il,X.prototype.visitInt=al,X.prototype.visitInt8=al,X.prototype.visitInt16=al,X.prototype.visitInt32=al,X.prototype.visitInt64=al,X.prototype.visitUint8=al,X.prototype.visitUint16=al,X.prototype.visitUint32=al,X.prototype.visitUint64=al,X.prototype.visitFloat=ol,X.prototype.visitFloat16=ol,X.prototype.visitFloat32=ol,X.prototype.visitFloat64=ol,X.prototype.visitUtf8=il,X.prototype.visitLargeUtf8=il,X.prototype.visitUtf8View=il,X.prototype.visitBinary=il,X.prototype.visitLargeBinary=il,X.prototype.visitBinaryView=il,X.prototype.visitFixedSizeBinary=sl,X.prototype.visitDate=cl,X.prototype.visitDateDay=cl,X.prototype.visitDateMillisecond=cl,X.prototype.visitTimestamp=ll,X.prototype.visitTimestampSecond=ll,X.prototype.visitTimestampMillisecond=ll,X.prototype.visitTimestampMicrosecond=ll,X.prototype.visitTimestampNanosecond=ll,X.prototype.visitTime=ul,X.prototype.visitTimeSecond=ul,X.prototype.visitTimeMillisecond=ul,X.prototype.visitTimeMicrosecond=ul,X.prototype.visitTimeNanosecond=ul,X.prototype.visitDecimal=il,X.prototype.visitList=dl,X.prototype.visitLargeList=dl,X.prototype.visitStruct=fl,X.prototype.visitUnion=pl,X.prototype.visitDenseUnion=pl,X.prototype.visitSparseUnion=pl,X.prototype.visitDictionary=ml,X.prototype.visitInterval=hl,X.prototype.visitIntervalDayTime=hl,X.prototype.visitIntervalYearMonth=hl,X.prototype.visitIntervalMonthDayNano=hl,X.prototype.visitDuration=gl,X.prototype.visitDurationSecond=gl,X.prototype.visitDurationMillisecond=gl,X.prototype.visitDurationMicrosecond=gl,X.prototype.visitDurationNanosecond=gl,X.prototype.visitFixedSizeList=_l,X.prototype.visitMap=vl;const yl=new X;function bl(e,t){return yl.compareSchemas(e,t)}function xl(e,t){return Sl(e,t.map(e=>e.data.concat()))}function Sl(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Cl(n,o,u,t,i),o>0&&(r[a++]=B({type:new N(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new kl(e,t))]}function Cl(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??B({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var wl;const Tl=Symbol.for(`apache-arrow/Table`);var El=class e{static isTable(e){return e?.[Tl]===!0}constructor(...t){if(t.length===0)return this.batches=[],this.schema=new K([]),this._offsets=[0],this;let n,r;t[0]instanceof K&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof kl)return[t];if(t instanceof e)return t.batches;if(t instanceof z){if(t.type instanceof N)return[new kl(new K(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new G([t[e]])),[,i]=xl(n??new K(e.map((e,t)=>new q(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new kl(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new K([]),!(n instanceof K))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof kl))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!bl(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??ls(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=cs(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(zo(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?xs.visit(new G(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
|
|
7
|
+
`)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new kl(n,e)))}slice(t,n){let r=this.schema;[t,n]=Ro({length:this.numRows},t,n);let i=us(this.data,this._offsets,t,n);return new e(r,i.map(e=>new kl(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(t=>t.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=B({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new G(t)}return null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||=new G([B({type:new qr,length:this.numRows})]);let e=r.fields.slice(),a=e[t].clone({type:n.type}),o=this.schema.fields.map((e,t)=>this.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=xl(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...xl(a,o))}};wl=Symbol.toStringTag,El[wl]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[Tl]=!0,e.isValid=ps(fs),e.get=ps(ko.getVisitFn(k.Struct)),e.set=ms(Aa.getVisitFn(k.Struct)),e.indexOf=hs(ys.getVisitFn(k.Struct)),`Table`))(El.prototype),Object.defineProperty(El,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===El&&El.isTable(e)}});var Dl;const Ol=Symbol.for(`apache-arrow/RecordBatch`);var kl=class e{static isRecordBatch(e){return e?.[Ol]===!0}constructor(...e){switch(e.length){case 3:case 2:if([this.schema]=e,!(this.schema instanceof K)||([,this.data=B({nullCount:0,type:new N(this.schema.fields),children:this.schema.fields.map(e=>B({type:e.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof z)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=Al(this.schema,this.data.children,this.data.length);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=q.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new K(n),o=B({type:new N(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Al(a,o.children,i),this._metadata=new Map;break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||=jl(this.schema.fields,this.data.children)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return ko.visit(this.data,e)}at(e){return this.get(zo(e,this.numRows))}set(e,t){return Aa.visit(this.data,e,t)}indexOf(e,t){return ys.visit(this.data,e,t)}[Symbol.iterator](){return xs.visit(new G([this.data]))}toArray(){return[...this]}concat(...e){return new El(this.schema,[this,...e])}slice(t,n){let[r]=new G([this.data]).slice(t,n).data;return new e(this.schema,r,this._metadata)}getChild(e){return this.getChildAt(this.schema.fields?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new G([this.data.children[e]]):null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||=new G([B({type:new qr,length:this.numRows})]);let e=r.fields.slice(),a=i.children.slice(),o=e[t].clone({type:n.type});[e[t],a[t]]=[o,n.data[0]],r=new K(e,new Map(this.schema.metadata)),i=B({type:new N(e),length:i.length,children:a})}return new e(r,i,this._metadata)}select(t){let n=this.schema.select(t),r=new N(n.fields),i=[];for(let e of t){let t=this.schema.fields.findIndex(t=>t.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,B({type:r,length:this.numRows,children:i}),this._metadata)}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=B({type:new N(n.fields),length:this.numRows,children:r});return new e(n,i,this._metadata)}};Dl=Symbol.toStringTag,kl[Dl]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[Ol]=!0,`RecordBatch`))(kl.prototype),Object.defineProperty(kl,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===kl&&kl.isRecordBatch(e)}});function Al(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){let r=[...e.fields],i=[...t],a=(n+63&-64)>>3;for(let[o,s]of e.fields.entries()){let e=t[o];(!e||e.length!==n)&&(r[o]=s.clone({nullable:!0}),i[o]=e?._changeLengthAndBackfillNullBitmap(n)??B({type:s.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(r),B({type:new N(r),length:n,children:i})]}function jl(e,t,n=new Map){if((e?.length??0)>0&&e?.length===t?.length)for(let r=-1,i=e.length;++r<i;){let{type:i}=e[r],a=t[r];for(let e of[a,...a?.dictionary?.data||[]])jl(i.children,e?.children,n);if(j.isDictionary(i)){let{id:e}=i;if(!n.has(e))a?.dictionary&&n.set(e,a.dictionary);else if(n.get(e)!==a.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}}return n}var Ml=class extends kl{constructor(e,t){let n=e.fields.map(e=>B({type:e.type})),r=B({type:new N(e.fields),length:0,nullCount:0,children:n});super(e,r,t||new Map)}};const Nl=e=>`Expected ${O[e]} Message in stream, but was null or length 0.`,Pl=e=>`Header pointer of flatbuffer-encoded ${O[e]} Message is null or length 0.`,Fl=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Il=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;var Ll=class{constructor(e){this.source=e instanceof Lc?e:new Lc(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?J:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=x(this.source.read(e));if(t.byteLength<e)throw Error(Il(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=O.Schema,n=this.readMessage(t)?.header();if(e&&!n)throw Error(Pl(t));return n}readMetadataLength(){let e=this.source.read(4),t=(e&&new wn(e))?.readInt32(0)||0;return{done:t===0,value:t}}readMetadata(e){let t=this.source.read(e);if(!t)return J;if(t.byteLength<e)throw Error(Fl(e,t.byteLength));return{done:!1,value:tc.decode(t)}}},Rl=class{constructor(e,t){this.source=e instanceof Rc?e:Wt(e)?new Hc(e,t):new Rc(e)}[Symbol.asyncIterator](){return this}next(){return _(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?J:e})}throw(e){return _(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return _(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return _(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value})}readMessageBody(e){return _(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array;let t=x(yield this.source.read(e));if(t.byteLength<e)throw Error(Il(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return _(this,arguments,void 0,function*(e=!1){let t=O.Schema,n=(yield this.readMessage(t))?.header();if(e&&!n)throw Error(Pl(t));return n})}readMetadataLength(){return _(this,void 0,void 0,function*(){let e=yield this.source.read(4),t=(e&&new wn(e))?.readInt32(0)||0;return{done:t===0,value:t}})}readMetadata(e){return _(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return J;if(t.byteLength<e)throw Error(Fl(e,t.byteLength));return{done:!1,value:tc.decode(t)}})}},zl=class extends Ll{constructor(e){super(new Uint8Array),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Nc?e:new Nc(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:tc.fromJSON(e.schema,O.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:tc.fromJSON(t,O.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:tc.fromJSON(t,O.RecordBatch)}}return this._body=[],J}readMessageBody(e){return t(this._body);function t(e){return(e||[]).reduce((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...n.VIEWS&&[n.VIEWS]||[],...n.VARIADIC_DATA_BUFFERS||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value}readSchema(){let e=O.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(Pl(e));return n}};const Bl=new Uint8Array(6);for(let e=0;e<6;e+=1)Bl[e]=`ARROW1`.codePointAt(e);function Vl(e,t=0){for(let n=-1,r=Bl.length;++n<r;)if(Bl[n]!==e[t+n])return!1;return!0}const Hl=Bl.length,Ul=Hl+4,Wl=Hl*2+4;var Gl=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6==1}},Kl=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}};const ql={[Dn.LZ4_FRAME]:new Gl,[Dn.ZSTD]:new Kl},Jl=new class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode==`function`&&!ql[e].isValidCodecEncode(t))throw Error(`Encoder for ${Dn[e]} is not valid.`);this.registry[e]=t}get(e){return this.registry?.[e]||null}};var Yl=class e extends Pc{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return zt(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return ln.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ln.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:Ht(t)?lu(t):Wt(t)?fu(t):zt(t)?_(this,void 0,void 0,function*(){return yield e.from(yield t)}):Gt(t)||qt(t)||Jt(t)||Vt(t)?du(new Rc(t)):uu(new Lc(t))}static readAll(t){return t instanceof e?t.isSync()?su(t):cu(t):Ht(t)||ArrayBuffer.isView(t)||Bt(t)||Ut(t)?su(t):cu(t)}},Xl=class extends Yl{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return kt(this,arguments,function*(){yield v(yield*At(jt(this[Symbol.iterator]())))})}},Zl=class extends Yl{constructor(e){super(e),this._impl=e}readAll(){return _(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=jt(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ql=class extends Xl{constructor(e){super(e),this._impl=e}},$l=class extends Zl{constructor(e){super(e),this._impl=e}},eu=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let r;if(e.compression!=null){let n=Jl.get(e.compression.type);if(n?.decode&&typeof n.decode==`function`){let{decommpressedBody:i,buffers:a}=this._decompressBuffers(e,t,n);r=this._loadCompressedVectors(e,i,this.schema.fields),e=new nc(e.length,e.nodes,a,null)}else throw Error(`Record batch is compressed but codec not found`)}else r=this._loadVectors(e,t,this.schema.fields);let i=B({type:new N(this.schema.fields),length:e.length,children:r});return new kl(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c;if(e.data.compression!=null){let i=Jl.get(e.data.compression.type);if(i?.decode&&typeof i.decode==`function`){let{decommpressedBody:a,buffers:o}=this._decompressBuffers(e.data,t,i);c=this._loadCompressedVectors(e.data,a,[s]),e=new rc(new nc(e.data.length,e.data.nodes,o,null,e.data.variadicBufferCounts),n,r)}else throw Error(`Dictionary batch is compressed but codec not found`)}else c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new G(c)):new G(c)).memoize()}_loadVectors(e,t,n){return new Xc(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new rl(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let r=[],i=[],a=0;for(let{offset:o,length:s}of e.buffers){if(s===0){r.push(new Uint8Array),i.push(new ic(a,0));continue}let e=new wn(t.subarray(o,o+s)),c=A(e.readInt64(0)),l=e.bytes().subarray(8),u=c===-1?l:n.decode(l);r.push(u);let ee=(a+7&-8)-a;a+=ee,i.push(new ic(a,u.length)),a+=u.length}return{decommpressedBody:r,buffers:i}}},tu=class extends eu{constructor(e,t){super(t),this._reader=Ht(e)?new zl(this._handle=e):new Ll(this._handle=e)}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(e){return this.closed||(this.autoDestroy=ou(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):J}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):J}next(){if(this.closed)return J;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ml(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},nu=class extends eu{constructor(e,t){super(t),this._reader=new Rl(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return _(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return _(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=ou(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):J})}return(e){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):J})}next(){return _(this,void 0,void 0,function*(){if(this.closed)return J;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ml(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return _(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},ru=class extends tu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof Vc?e:new Vc(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer?.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(O.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null}_readDictionaryBatch(e){let t=this._footer?.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(O.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-Ul,n=e.readInt32(t),r=e.readAt(t-n,n);return Fs.decode(r)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer?.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},iu=class extends nu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]==`number`?void 0:t.shift(),r=t[0]instanceof Map?t.shift():void 0;super(e instanceof Hc?e:new Hc(e,n),r)}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return _(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return _(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer?.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(O.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null})}_readDictionaryBatch(e){return _(this,void 0,void 0,function*(){let t=this._footer?.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(O.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return _(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Ul,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return Fs.decode(r)})}_readNextMessageAndValidate(e){return _(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},au=class extends tu{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new Zc(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}};function ou(e,t){return t&&typeof t.autoDestroy==`boolean`?t.autoDestroy:e.autoDestroy}function*su(e){let t=Yl.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function cu(e){return kt(this,arguments,function*(){let t=yield v(Yl.from(e));try{if(!(yield v(t.open({autoDestroy:!1}))).closed)do yield yield v(t);while(!(yield v(t.reset().open())).closed)}finally{yield v(t.cancel())}})}function lu(e){return new Xl(new au(e))}function uu(e){let t=e.peek(Hl+7&-8);return t&&t.byteLength>=4?Vl(t)?new Ql(new ru(e.read())):new Xl(new tu(e)):new Xl(new tu(function*(){}()))}function du(e){return _(this,void 0,void 0,function*(){let t=yield e.peek(Hl+7&-8);return t&&t.byteLength>=4?Vl(t)?new Ql(new ru(yield e.read())):new Zl(new nu(e)):new Zl(new nu(function(){return kt(this,arguments,function*(){})}()))})}function fu(e){return _(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Hc(e,t);return t>=Wl&&Vl(yield n.readAt(0,Hl+7&-8))?new $l(new iu(n)):new Zl(new nu(n))})}function pu(e){let t=Yl.from(e);return zt(t)?t.then(e=>pu(e)):t.isAsync()?t.readAll().then(e=>new El(e)):new El(t.readAll())}function mu(e){return e===`observation.image`||e.startsWith(`observation.images`)}function hu(e){return e.filter(mu)}function gu(e){return e.length>=2&&e[0]===255&&e[1]===216?`jpeg`:e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?`png`:e.length>=4&&e[0]===73&&e[1]===73&&e[2]===42&&e[3]===0||e.length>=4&&e[0]===77&&e[1]===77&&e[2]===0&&e[3]===42?`tiff`:e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?`webp`:null}function _u(e){return e===`png`?`image/png`:e===`tiff`?`image/tiff`:e===`webp`?`image/webp`:`image/jpeg`}function vu(e,t,n){return n?e[t]|e[t+1]<<8:e[t]<<8|e[t+1]}function yu(e,t,n){return n?(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0:(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function bu(e,t,n,r,i){let a=n===3?2:n===4?4:1,o=a*r<=4?t:yu(e,t,i),s=[];for(let t=0;t<r;t++){let r=o+t*a;n===3?s.push(vu(e,r,i)):n===4?s.push(yu(e,r,i)):s.push(e[r])}return s}function xu(e){if(gu(e)!==`tiff`)throw Error(`Not a TIFF image`);let t=e[0]===73;if(vu(e,2,t)!==42)throw Error(`Invalid TIFF magic`);let n=yu(e,4,t),r=vu(e,n,t),i=new Map;for(let a=0;a<r;a++){let r=n+2+a*12,o=vu(e,r,t),s=vu(e,r+2,t),c=yu(e,r+4,t);i.set(o,bu(e,r+8,s,c,t))}let a=i.get(256)?.[0],o=i.get(257)?.[0],s=i.get(258)?.[0]??16,c=i.get(259)?.[0]??1,l=i.get(277)?.[0]??1,u=i.get(273),ee=i.get(279);if(!a||!o||!u?.length)throw Error(`TIFF is missing width, height, or strip offsets`);if(c!==1)throw Error(`Unsupported TIFF compression ${c}`);if(l!==1||s!==8&&s!==16)throw Error(`Unsupported TIFF layout bits=${s} samples=${l}`);let d=new Uint16Array(a*o),te=0;for(let n=0;n<u.length;n++){let r=u[n],i=ee?.[n]??e.length-r;if(s===8)for(let t=0;t<i&&te<d.length;t++)d[te++]=e[r+t];else for(let n=0;n+1<i&&te<d.length;n+=2)d[te++]=vu(e,r+n,t)}if(te!==d.length)throw Error(`TIFF strip size mismatch: got ${te} pixels, expected ${d.length}`);return{width:a,height:o,bitsPerSample:s===8?8:16,littleEndian:t,pixels:d}}function Su(e){let t=Math.min(1,Math.max(0,e)),n=[[0,13,8,135],[.25,31,150,139],[.5,201,221,52],[.75,253,141,9],[1,144,12,0]];for(let e=0;e<n.length-1;e++){let r=n[e],i=n[e+1];if(t<=i[0]){let e=i[0]-r[0]||1,n=(t-r[0])/e;return[Math.round(r[1]+(i[1]-r[1])*n),Math.round(r[2]+(i[2]-r[2])*n),Math.round(r[3]+(i[3]-r[3])*n)]}}return[144,12,0]}function Cu(e,t,n){let r=65535,i=0;for(let t=0;t<e.length;t++){let n=e[t];n!==0&&(n<r&&(r=n),n>i&&(i=n))}let a=Math.max(1,i-r),o=new Uint8ClampedArray(t*n*4);for(let t=0;t<e.length;t++){let n=e[t],s=t*4;if(n===0||i===0){o[s+3]=255;continue}let[c,l,u]=Su((n-r)/a);o[s]=c,o[s+1]=l,o[s+2]=u,o[s+3]=255}return{width:t,height:n,rgba:o}}function wu(e){let t=xu(e);return Cu(t.pixels,t.width,t.height)}let Tu=!1,Eu=null,Du=null,Ou=null;const ku=new Promise((e,t)=>{Du=e,Ou=t});let Q=null;const $=new Map;function Au(e){let t=$.get(e);if(t)return $.delete(e),$.set(e,t),t}function ju(e,t){if($.has(e)){let t=$.get(e);$.delete(e);try{t?.close()}catch{}}for($.set(e,t);$.size>24;){let e=$.keys().next().value;if(e===void 0)break;let t=$.get(e);$.delete(e);try{t?.close()}catch{}}}function Mu(){for(let e of $.values())try{e.close()}catch{}$.clear()}let Nu=0,Pu=null;self.onmessage=async e=>{let{type:t}=e.data;if(t===`init-wasm`){Du?.(e.data.wasmBuffer);return}if(t===`init-wasm-error`){Ou?.(Error(`Main thread failed to load WASM: ${String(e.data.message)}`));return}if(t===`preload-episode`){let{episodeKey:t,column:n,startRow:r,endRow:i,reqId:a}=e.data;try{if(await Iu(),Pu=t,!Q){self.postMessage({type:`preload-error`,reqId:a,error:`No file loaded`});return}let e=Q.columns.get(n);if(!e){self.postMessage({type:`preload-error`,reqId:a,error:`Column ${n} not found`});return}let o=Math.max(0,i-r),s=Math.min(o,8),c=0,l=0;for(let i=0;i<s;i++){if(Pu!==t){self.postMessage({type:`preload-aborted`,reqId:a});return}let o=r+i,u=Lu(e.get(o));if(!u){l++;continue}if(c+=u.byteLength,c>67108864)break;try{let e=`${n}:${i}`;$.has(e)||ju(e,await zu(u))}catch{}l++,(l%4==0||l===s)&&self.postMessage({type:`preload-progress`,reqId:a,completed:l,total:s})}self.postMessage({type:`preload-done`,reqId:a,total:l})}catch(e){self.postMessage({type:`preload-error`,reqId:a,error:e instanceof Error?e.message:String(e)})}return}if(t===`get-frame-bitmap`){let{column:t,relRow:n,startRow:r,reqId:i}=e.data;try{if(await Iu(),!Q){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-file`});return}let e=Q.columns.get(t);if(!e){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-column`});return}let a=`${t}:${n}`,o=Au(a);if(o)$.delete(a);else{let t=Lu(e.get(r+n));if(!t){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-bytes`});return}o=await zu(t)}self.postMessage({type:`frame-bitmap`,reqId:i,bitmap:o},[o]),Fu(t,n,r,e)}catch(e){self.postMessage({type:`frame-bitmap-error`,reqId:i,error:e instanceof Error?e.message:String(e)})}return}if(t===`clear-preload`){Mu(),Pu=null,Nu++,self.postMessage({type:`clear-preload-done`});return}};function Fu(e,t,n,r){let i=++Nu;(async()=>{for(let a=1;a<=4;a++){if(i!==Nu)return;let o=t+a,s=`${e}:${o}`;if(!$.has(s)){try{let e=Lu(r.get(n+o));if(!e)continue;let t=await zu(e);if(i!==Nu){try{t.close()}catch{}return}ju(s,t)}catch{}await new Promise(e=>setTimeout(e,0))}}})()}async function Iu(){if(!Tu)return Eu||(Eu=(async()=>{try{await Dt(await ku),Tu=!0}catch(e){throw console.error(`Worker: Failed to initialize WASM`,e),Eu=null,e}})(),Eu)}function Lu(e){if(!e)return null;if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(typeof e==`object`&&e){let t=e;if(`bytes`in t){let e=t.bytes;if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(Array.isArray(e))return new Uint8Array(e)}if(`data`in t&&t.data instanceof Uint8Array)return t.data}return null}function Ru(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}async function zu(e){let t=gu(e);if(t===`tiff`){let t=wu(e),n=new ImageData(t.width,t.height);return n.data.set(t.rgba),createImageBitmap(n)}return createImageBitmap(new Blob([Ru(e)],{type:_u(t)}))}c({async init(){await Iu()},async loadFile(e,t,n){await Iu();let r=new Uint8Array(t),i=n?.filter(Boolean)??[];if(i.length===0&&(i=hu(pu(Pe(r).intoIPCStream()).schema.fields.map(e=>e.name))),i.length===0)throw Error(`No image columns requested or detected. Expected 'observation.image' or 'observation.images.*'`);let a=pu(Pe(r,{columns:i}).intoIPCStream()),o=new Map;for(let e of i){let t=a.getChild(e);t&&o.set(e,t)}(!Q||Q.filePath!==e)&&Mu();let s=Array.from(o.keys());return Q={filePath:e,columns:o,requestedColumns:i,numRows:a.numRows},{columns:s,numRows:a.numRows}},async getImageCached(e,t){if(!Q)throw Error(`No file loaded`);let n=Q.columns.get(e);if(!n)throw Error(`Column ${e} not found in file ${Q.filePath}. Requested: ${Q.requestedColumns.join(`, `)||`(none)`}. Available: ${Array.from(Q.columns.keys()).join(`, `)||`(none)`}`);if(t<0||t>=Q.numRows)throw Error(`Row ${t} out of range [0, ${Q.numRows-1}]`);let r=Lu(n.get(t));if(!r)throw Error(`No image data at row ${t} for column ${e}`);let i=new Uint8Array(r.length);return i.set(r),ue(i.buffer,[i.buffer])},async clearCache(){Q=null,Mu(),Pu=null,Nu++}});
|