@duckdb/duckdb-wasm 1.13.1-dev98.0 → 1.14.2
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/README.md +68 -4
- package/dist/duckdb-browser-blocking.cjs +15 -45
- package/dist/duckdb-browser-blocking.cjs.map +3 -3
- package/dist/duckdb-browser-blocking.mjs +15 -45
- package/dist/duckdb-browser-blocking.mjs.map +3 -3
- package/dist/duckdb-browser-coi.pthread.worker.js +14 -43
- package/dist/duckdb-browser-coi.pthread.worker.js.map +3 -3
- package/dist/duckdb-browser-coi.worker.js +18 -25
- package/dist/duckdb-browser-coi.worker.js.map +3 -3
- package/dist/duckdb-browser-eh.worker.js +16 -23
- package/dist/duckdb-browser-eh.worker.js.map +3 -3
- package/dist/duckdb-browser-mvp.worker.js +18 -25
- package/dist/duckdb-browser-mvp.worker.js.map +3 -3
- package/dist/duckdb-browser.cjs +1 -31
- package/dist/duckdb-browser.cjs.map +3 -3
- package/dist/duckdb-browser.mjs +1 -31
- package/dist/duckdb-browser.mjs.map +3 -3
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +4 -4
- package/dist/duckdb-node-blocking.cjs.map +3 -3
- package/dist/duckdb-node-eh.worker.cjs +4 -4
- package/dist/duckdb-node-eh.worker.cjs.map +3 -3
- package/dist/duckdb-node-mvp.worker.cjs +3 -3
- package/dist/duckdb-node-mvp.worker.cjs.map +3 -3
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/img/duckdb.svg +8 -0
- package/dist/img/duckdb_version_badge.svg +1 -1
- package/dist/tests-browser.js +12905 -16221
- package/dist/tests-browser.js.map +3 -3
- package/dist/tests-node.cjs +1820 -1588
- package/dist/tests-node.cjs.map +3 -3
- package/dist/types/src/bindings/config.d.ts +0 -2
- package/dist/types/src/bindings/insert_options.d.ts +3 -3
- package/dist/types/src/bindings/progress.d.ts +1 -0
- package/dist/types/src/bindings/runtime.d.ts +1 -1
- package/dist/types/src/bindings/udf_function.d.ts +2 -2
- package/dist/types/src/bindings/udf_runtime.d.ts +1 -1
- package/dist/types/src/json_typedef.d.ts +17 -0
- package/dist/types/src/log.d.ts +2 -0
- package/dist/types/src/platform.d.ts +3 -0
- package/dist/types/src/targets/duckdb-browser-blocking.d.ts +1 -0
- package/dist/types/src/targets/duckdb-node-blocking.d.ts +1 -0
- package/dist/types/src/targets/duckdb.d.ts +1 -0
- package/dist/types/src/utils/s3_helper.d.ts +1 -0
- package/package.json +24 -24
- package/dist/types/src/flat_arrow.d.ts +0 -15
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
var duckdb=(()=>{var iw=Object.create;var bs=Object.defineProperty,sw=Object.defineProperties,ow=Object.getOwnPropertyDescriptor,aw=Object.getOwnPropertyDescriptors,cw=Object.getOwnPropertyNames,ep=Object.getOwnPropertySymbols,uw=Object.getPrototypeOf,tp=Object.prototype.hasOwnProperty,lw=Object.prototype.propertyIsEnumerable;var rp=(r,e,t)=>e in r?bs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zr=(r,e)=>{for(var t in e||(e={}))tp.call(e,t)&&rp(r,t,e[t]);if(ep)for(var t of ep(e))lw.call(e,t)&&rp(r,t,e[t]);return r},gs=(r,e)=>sw(r,aw(e)),np=r=>bs(r,"__esModule",{value:!0});var dw=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fw=(r,e)=>{for(var t in e)bs(r,t,{get:e[t],enumerable:!0})},ip=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cw(e))!tp.call(r,i)&&(t||i!=="default")&&bs(r,i,{get:()=>e[i],enumerable:!(n=ow(e,i))||n.enumerable});return r},nr=(r,e)=>ip(np(bs(r!=null?iw(uw(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),hw=(r=>(e,t)=>r&&r.get(e)||(t=ip(np({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var ct=w((yD,Uo)=>{var sp,op,ap,cp,up,lp,dp,fp,hp,Mo,Jc,pp,yp,_p,si,mp,bp,gp,vp,wp,Bp,Ip,Tp,Eo;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(t(e,t(n)))}):typeof Uo=="object"&&typeof Uo.exports=="object"?r(t(e,t(Uo.exports))):r(t(e));function t(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};sp=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function s(){this.constructor=n}n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},op=Object.assign||function(n){for(var i,s=1,o=arguments.length;s<o;s++){i=arguments[s];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(n[u]=i[u])}return n},ap=function(n,i){var s={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.indexOf(o)<0&&(s[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,o=Object.getOwnPropertySymbols(n);u<o.length;u++)i.indexOf(o[u])<0&&Object.prototype.propertyIsEnumerable.call(n,o[u])&&(s[o[u]]=n[o[u]]);return s},cp=function(n,i,s,o){var u=arguments.length,a=u<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,i,s,o);else for(var _=n.length-1;_>=0;_--)(h=n[_])&&(a=(u<3?h(a):u>3?h(i,s,a):h(i,s))||a);return u>3&&a&&Object.defineProperty(i,s,a),a},up=function(n,i){return function(s,o){i(s,o,n)}},lp=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},dp=function(n,i,s,o){function u(a){return a instanceof s?a:new s(function(h){h(a)})}return new(s||(s=Promise))(function(a,h){function _(E){try{M(o.next(E))}catch(q){h(q)}}function T(E){try{M(o.throw(E))}catch(q){h(q)}}function M(E){E.done?a(E.value):u(E.value).then(_,T)}M((o=o.apply(n,i||[])).next())})},fp=function(n,i){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,u,a,h;return h={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function _(M){return function(E){return T([M,E])}}function T(M){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,u&&(a=M[0]&2?u.return:M[0]?u.throw||((a=u.return)&&a.call(u),0):u.next)&&!(a=a.call(u,M[1])).done)return a;switch(u=0,a&&(M=[M[0]&2,a.value]),M[0]){case 0:case 1:a=M;break;case 4:return s.label++,{value:M[1],done:!1};case 5:s.label++,u=M[1],M=[0];continue;case 7:M=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(M[0]===6||M[0]===2)){s=0;continue}if(M[0]===3&&(!a||M[1]>a[0]&&M[1]<a[3])){s.label=M[1];break}if(M[0]===6&&s.label<a[1]){s.label=a[1],a=M;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(M);break}a[2]&&s.ops.pop(),s.trys.pop();continue}M=i.call(n,s)}catch(E){M=[6,E],u=0}finally{o=a=0}if(M[0]&5)throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}},hp=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&Eo(i,n,s)},Eo=Object.create?function(n,i,s,o){o===void 0&&(o=s),Object.defineProperty(n,o,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},Mo=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],o=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Jc=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),u,a=[],h;try{for(;(i===void 0||i-- >0)&&!(u=o.next()).done;)a.push(u.value)}catch(_){h={error:_}}finally{try{u&&!u.done&&(s=o.return)&&s.call(o)}finally{if(h)throw h.error}}return a},pp=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Jc(arguments[i]));return n},yp=function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var o=Array(n),u=0,i=0;i<s;i++)for(var a=arguments[i],h=0,_=a.length;h<_;h++,u++)o[u]=a[h];return o},_p=function(n,i,s){if(s||arguments.length===2)for(var o=0,u=i.length,a;o<u;o++)(a||!(o in i))&&(a||(a=Array.prototype.slice.call(i,0,o)),a[o]=i[o]);return n.concat(a||Array.prototype.slice.call(i))},si=function(n){return this instanceof si?(this.v=n,this):new si(n)},mp=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),u,a=[];return u={},h("next"),h("throw"),h("return"),u[Symbol.asyncIterator]=function(){return this},u;function h(re){o[re]&&(u[re]=function(le){return new Promise(function(de,Me){a.push([re,le,de,Me])>1||_(re,le)})})}function _(re,le){try{T(o[re](le))}catch(de){q(a[0][3],de)}}function T(re){re.value instanceof si?Promise.resolve(re.value.v).then(M,E):q(a[0][2],re)}function M(re){_("next",re)}function E(re){_("throw",re)}function q(re,le){re(le),a.shift(),a.length&&_(a[0][0],a[0][1])}},bp=function(n){var i,s;return i={},o("next"),o("throw",function(u){throw u}),o("return"),i[Symbol.iterator]=function(){return this},i;function o(u,a){i[u]=n[u]?function(h){return(s=!s)?{value:si(n[u](h)),done:u==="return"}:a?a(h):h}:a}},gp=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof Mo=="function"?Mo(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(a){s[a]=n[a]&&function(h){return new Promise(function(_,T){h=n[a](h),u(_,T,h.done,h.value)})}}function u(a,h,_,T){Promise.resolve(T).then(function(M){a({value:M,done:_})},h)}},vp=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var t=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};wp=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&Eo(i,n,s);return t(i,n),i},Bp=function(n){return n&&n.__esModule?n:{default:n}},Ip=function(n,i,s,o){if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!o:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?o:s==="a"?o.call(n):o?o.value:i.get(n)},Tp=function(n,i,s,o,u){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!u)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!u:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?u.call(n,s):u?u.value=s:i.set(n,s),s},r("__extends",sp),r("__assign",op),r("__rest",ap),r("__decorate",cp),r("__param",up),r("__metadata",lp),r("__awaiter",dp),r("__generator",fp),r("__exportStar",hp),r("__createBinding",Eo),r("__values",Mo),r("__read",Jc),r("__spread",pp),r("__spreadArrays",yp),r("__spreadArray",_p),r("__await",si),r("__asyncGenerator",mp),r("__asyncDelegator",bp),r("__asyncValues",gp),r("__makeTemplateObject",vp),r("__importStar",wp),r("__importDefault",Bp),r("__classPrivateFieldGet",Ip),r("__classPrivateFieldSet",Tp)})});var Ar=w(Sp=>{var b={};b.Offset;b.Table;b.SIZEOF_SHORT=2;b.SIZEOF_INT=4;b.FILE_IDENTIFIER_LENGTH=4;b.SIZE_PREFIX_LENGTH=4;b.Encoding={UTF8_BYTES:1,UTF16_STRING:2};b.int32=new Int32Array(2);b.float32=new Float32Array(b.int32.buffer);b.float64=new Float64Array(b.int32.buffer);b.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;b.Long=function(r,e){this.low=r|0,this.high=e|0};b.Long.create=function(r,e){return r==0&&e==0?b.Long.ZERO:new b.Long(r,e)};b.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296};b.Long.prototype.equals=function(r){return this.low==r.low&&this.high==r.high};b.Long.ZERO=new b.Long(0,0);b.Builder=function(r){if(r)var e=r;else var e=1024;this.bb=b.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};b.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};b.Builder.prototype.forceDefaults=function(r){this.force_defaults=r};b.Builder.prototype.dataBuffer=function(){return this.bb};b.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())};b.Builder.prototype.prep=function(r,e){r>this.minalign&&(this.minalign=r);for(var t=~(this.bb.capacity()-this.space+e)+1&r-1;this.space<t+r+e;){var n=this.bb.capacity();this.bb=b.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(t)};b.Builder.prototype.pad=function(r){for(var e=0;e<r;e++)this.bb.writeInt8(--this.space,0)};b.Builder.prototype.writeInt8=function(r){this.bb.writeInt8(this.space-=1,r)};b.Builder.prototype.writeInt16=function(r){this.bb.writeInt16(this.space-=2,r)};b.Builder.prototype.writeInt32=function(r){this.bb.writeInt32(this.space-=4,r)};b.Builder.prototype.writeInt64=function(r){this.bb.writeInt64(this.space-=8,r)};b.Builder.prototype.writeFloat32=function(r){this.bb.writeFloat32(this.space-=4,r)};b.Builder.prototype.writeFloat64=function(r){this.bb.writeFloat64(this.space-=8,r)};b.Builder.prototype.addInt8=function(r){this.prep(1,0),this.writeInt8(r)};b.Builder.prototype.addInt16=function(r){this.prep(2,0),this.writeInt16(r)};b.Builder.prototype.addInt32=function(r){this.prep(4,0),this.writeInt32(r)};b.Builder.prototype.addInt64=function(r){this.prep(8,0),this.writeInt64(r)};b.Builder.prototype.addFloat32=function(r){this.prep(4,0),this.writeFloat32(r)};b.Builder.prototype.addFloat64=function(r){this.prep(8,0),this.writeFloat64(r)};b.Builder.prototype.addFieldInt8=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt8(e),this.slot(r))};b.Builder.prototype.addFieldInt16=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt16(e),this.slot(r))};b.Builder.prototype.addFieldInt32=function(r,e,t){(this.force_defaults||e!=t)&&(this.addInt32(e),this.slot(r))};b.Builder.prototype.addFieldInt64=function(r,e,t){(this.force_defaults||!e.equals(t))&&(this.addInt64(e),this.slot(r))};b.Builder.prototype.addFieldFloat32=function(r,e,t){(this.force_defaults||e!=t)&&(this.addFloat32(e),this.slot(r))};b.Builder.prototype.addFieldFloat64=function(r,e,t){(this.force_defaults||e!=t)&&(this.addFloat64(e),this.slot(r))};b.Builder.prototype.addFieldOffset=function(r,e,t){(this.force_defaults||e!=t)&&(this.addOffset(e),this.slot(r))};b.Builder.prototype.addFieldStruct=function(r,e,t){e!=t&&(this.nested(e),this.slot(r))};b.Builder.prototype.nested=function(r){if(r!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")};b.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")};b.Builder.prototype.slot=function(r){this.vtable[r]=this.offset()};b.Builder.prototype.offset=function(){return this.bb.capacity()-this.space};b.Builder.growByteBuffer=function(r){var e=r.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var t=e<<1,n=b.ByteBuffer.allocate(t);return n.setPosition(t-e),n.bytes().set(r.bytes(),t-e),n};b.Builder.prototype.addOffset=function(r){this.prep(b.SIZEOF_INT,0),this.writeInt32(this.offset()-r+b.SIZEOF_INT)};b.Builder.prototype.startObject=function(r){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=r;for(var e=0;e<r;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()};b.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var r=this.offset(),e=this.vtable_in_use-1;e>=0&&this.vtable[e]==0;e--);for(var t=e+1;e>=0;e--)this.addInt16(this.vtable[e]!=0?r-this.vtable[e]:0);var n=2;this.addInt16(r-this.object_start);var i=(t+n)*b.SIZEOF_SHORT;this.addInt16(i);var s=0,o=this.space;e:for(e=0;e<this.vtables.length;e++){var u=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(u)){for(var a=b.SIZEOF_SHORT;a<i;a+=b.SIZEOF_SHORT)if(this.bb.readInt16(o+a)!=this.bb.readInt16(u+a))continue e;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-r,this.bb.writeInt32(this.space,s-r)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-r,this.offset()-r)),this.isNested=!1,r};b.Builder.prototype.finish=function(r,e,t){var n=t?b.SIZE_PREFIX_LENGTH:0;if(e){var i=e;if(this.prep(this.minalign,b.SIZEOF_INT+b.FILE_IDENTIFIER_LENGTH+n),i.length!=b.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+b.FILE_IDENTIFIER_LENGTH);for(var s=b.FILE_IDENTIFIER_LENGTH-1;s>=0;s--)this.writeInt8(i.charCodeAt(s))}this.prep(this.minalign,b.SIZEOF_INT+n),this.addOffset(r),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)};b.Builder.prototype.finishSizePrefixed=function(r,e){this.finish(r,e,!0)};b.Builder.prototype.requiredField=function(r,e){var t=this.bb.capacity()-r,n=t-this.bb.readInt32(t),i=this.bb.readInt16(n+e)!=0;if(!i)throw new Error("FlatBuffers: field "+e+" must be set")};b.Builder.prototype.startVector=function(r,e,t){this.notNested(),this.vector_num_elems=e,this.prep(b.SIZEOF_INT,r*e),this.prep(t,r*e)};b.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()};b.Builder.prototype.createString=function(r){if(r instanceof Uint8Array)var e=r;else for(var e=[],t=0;t<r.length;){var n,i=r.charCodeAt(t++);if(i<55296||i>=56320)n=i;else{var s=r.charCodeAt(t++);n=(i<<10)+s+(65536-(55296<<10)-56320)}n<128?e.push(n):(n<2048?e.push(n>>6&31|192):(n<65536?e.push(n>>12&15|224):e.push(n>>18&7|240,n>>12&63|128),e.push(n>>6&63|128)),e.push(n&63|128))}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(var t=0,o=this.space,u=this.bb.bytes();t<e.length;t++)u[o++]=e[t];return this.endVector()};b.Builder.prototype.createLong=function(r,e){return b.Long.create(r,e)};b.ByteBuffer=function(r){this.bytes_=r,this.position_=0};b.ByteBuffer.allocate=function(r){return new b.ByteBuffer(new Uint8Array(r))};b.ByteBuffer.prototype.clear=function(){this.position_=0};b.ByteBuffer.prototype.bytes=function(){return this.bytes_};b.ByteBuffer.prototype.position=function(){return this.position_};b.ByteBuffer.prototype.setPosition=function(r){this.position_=r};b.ByteBuffer.prototype.capacity=function(){return this.bytes_.length};b.ByteBuffer.prototype.readInt8=function(r){return this.readUint8(r)<<24>>24};b.ByteBuffer.prototype.readUint8=function(r){return this.bytes_[r]};b.ByteBuffer.prototype.readInt16=function(r){return this.readUint16(r)<<16>>16};b.ByteBuffer.prototype.readUint16=function(r){return this.bytes_[r]|this.bytes_[r+1]<<8};b.ByteBuffer.prototype.readInt32=function(r){return this.bytes_[r]|this.bytes_[r+1]<<8|this.bytes_[r+2]<<16|this.bytes_[r+3]<<24};b.ByteBuffer.prototype.readUint32=function(r){return this.readInt32(r)>>>0};b.ByteBuffer.prototype.readInt64=function(r){return new b.Long(this.readInt32(r),this.readInt32(r+4))};b.ByteBuffer.prototype.readUint64=function(r){return new b.Long(this.readUint32(r),this.readUint32(r+4))};b.ByteBuffer.prototype.readFloat32=function(r){return b.int32[0]=this.readInt32(r),b.float32[0]};b.ByteBuffer.prototype.readFloat64=function(r){return b.int32[b.isLittleEndian?0:1]=this.readInt32(r),b.int32[b.isLittleEndian?1:0]=this.readInt32(r+4),b.float64[0]};b.ByteBuffer.prototype.writeInt8=function(r,e){this.bytes_[r]=e};b.ByteBuffer.prototype.writeUint8=function(r,e){this.bytes_[r]=e};b.ByteBuffer.prototype.writeInt16=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8};b.ByteBuffer.prototype.writeUint16=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8};b.ByteBuffer.prototype.writeInt32=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8,this.bytes_[r+2]=e>>16,this.bytes_[r+3]=e>>24};b.ByteBuffer.prototype.writeUint32=function(r,e){this.bytes_[r]=e,this.bytes_[r+1]=e>>8,this.bytes_[r+2]=e>>16,this.bytes_[r+3]=e>>24};b.ByteBuffer.prototype.writeInt64=function(r,e){this.writeInt32(r,e.low),this.writeInt32(r+4,e.high)};b.ByteBuffer.prototype.writeUint64=function(r,e){this.writeUint32(r,e.low),this.writeUint32(r+4,e.high)};b.ByteBuffer.prototype.writeFloat32=function(r,e){b.float32[0]=e,this.writeInt32(r,b.int32[0])};b.ByteBuffer.prototype.writeFloat64=function(r,e){b.float64[0]=e,this.writeInt32(r,b.int32[b.isLittleEndian?0:1]),this.writeInt32(r+4,b.int32[b.isLittleEndian?1:0])};b.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+b.SIZEOF_INT+b.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var r="",e=0;e<b.FILE_IDENTIFIER_LENGTH;e++)r+=String.fromCharCode(this.readInt8(this.position_+b.SIZEOF_INT+e));return r};b.ByteBuffer.prototype.__offset=function(r,e){var t=r-this.readInt32(r);return e<this.readInt16(t)?this.readInt16(t+e):0};b.ByteBuffer.prototype.__union=function(r,e){return r.bb_pos=e+this.readInt32(e),r.bb=this,r};b.ByteBuffer.prototype.__string=function(r,e){r+=this.readInt32(r);var t=this.readInt32(r),n="",i=0;if(r+=b.SIZEOF_INT,e===b.Encoding.UTF8_BYTES)return this.bytes_.subarray(r,r+t);for(;i<t;){var s,o=this.readUint8(r+i++);if(o<192)s=o;else{var u=this.readUint8(r+i++);if(o<224)s=(o&31)<<6|u&63;else{var a=this.readUint8(r+i++);if(o<240)s=(o&15)<<12|(u&63)<<6|a&63;else{var h=this.readUint8(r+i++);s=(o&7)<<18|(u&63)<<12|(a&63)<<6|h&63}}}s<65536?n+=String.fromCharCode(s):(s-=65536,n+=String.fromCharCode((s>>10)+55296,(s&(1<<10)-1)+56320))}return n};b.ByteBuffer.prototype.__indirect=function(r){return r+this.readInt32(r)};b.ByteBuffer.prototype.__vector=function(r){return r+this.readInt32(r)+b.SIZEOF_INT};b.ByteBuffer.prototype.__vector_len=function(r){return this.readInt32(r+this.readInt32(r))};b.ByteBuffer.prototype.__has_identifier=function(r){if(r.length!=b.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+b.FILE_IDENTIFIER_LENGTH);for(var e=0;e<b.FILE_IDENTIFIER_LENGTH;e++)if(r.charCodeAt(e)!=this.readInt8(this.position_+b.SIZEOF_INT+e))return!1;return!0};b.ByteBuffer.prototype.createLong=function(r,e){return b.Long.create(r,e)};Sp.flatbuffers=b});var xn=w(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.encodeUtf8=oi.decodeUtf8=void 0;var pw=new TextDecoder("utf-8");oi.decodeUtf8=r=>pw.decode(r);var yw=new TextEncoder;oi.encodeUtf8=r=>yw.encode(r)});var ai=w(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.AsyncQueue=ht.ReadableInterop=ht.ArrowJSON=ht.ITERATOR_DONE=void 0;var vs=ct(),Ap=ws();ht.ITERATOR_DONE=Object.freeze({done:!0,value:void 0});var Fp=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}};ht.ArrowJSON=Fp;var Kc=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._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}};ht.ReadableInterop=Kc;var Dp=class extends Kc{constructor(){super();this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return vs.__awaiter(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(ht.ITERATOR_DONE);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ap.default.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ap.default.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return vs.__awaiter(this,void 0,void 0,function*(){return yield this.abort(e),ht.ITERATOR_DONE})}return(e){return vs.__awaiter(this,void 0,void 0,function*(){return yield this.close(),ht.ITERATOR_DONE})}read(e){return vs.__awaiter(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return vs.__awaiter(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((t,n)=>{this.resolvers.push({resolve:t,reject:n})}):Promise.resolve(ht.ITERATOR_DONE)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};ht.AsyncQueue=Dp});var ut=w(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.isReadableNodeStream=x.isWritableNodeStream=x.isReadableDOMStream=x.isWritableDOMStream=x.isFetchResponse=x.isFSReadStream=x.isFileHandle=x.isUnderlyingSink=x.isIteratorResult=x.isArrayLike=x.isArrowJSON=x.isAsyncIterable=x.isIterable=x.isObservable=x.isPromise=x.isObject=x.BigUint64ArrayAvailable=x.BigUint64Array=x.BigInt64ArrayAvailable=x.BigInt64Array=x.BigIntAvailable=x.BigInt=void 0;var Ro=ai(),[_w,mw]=(()=>{let r=()=>{throw new Error("BigInt is not available in this environment")};function e(){throw r()}return e.asIntN=()=>{throw r()},e.asUintN=()=>{throw r()},typeof BigInt!="undefined"?[BigInt,!0]:[e,!1]})();x.BigInt=_w;x.BigIntAvailable=mw;var[bw,gw]=(()=>{let r=()=>{throw new Error("BigInt64Array is not available in this environment")};class e{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigInt64Array!="undefined"?[BigInt64Array,!0]:[e,!1]})();x.BigInt64Array=bw;x.BigInt64ArrayAvailable=gw;var[vw,ww]=(()=>{let r=()=>{throw new Error("BigUint64Array is not available in this environment")};class e{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigUint64Array!="undefined"?[BigUint64Array,!0]:[e,!1]})();x.BigUint64Array=vw;x.BigUint64ArrayAvailable=ww;var Xc=r=>typeof r=="number",Op=r=>typeof r=="boolean",nt=r=>typeof r=="function";x.isObject=r=>r!=null&&Object(r)===r;x.isPromise=r=>x.isObject(r)&&nt(r.then);x.isObservable=r=>x.isObject(r)&&nt(r.subscribe);x.isIterable=r=>x.isObject(r)&&nt(r[Symbol.iterator]);x.isAsyncIterable=r=>x.isObject(r)&&nt(r[Symbol.asyncIterator]);x.isArrowJSON=r=>x.isObject(r)&&x.isObject(r.schema);x.isArrayLike=r=>x.isObject(r)&&Xc(r.length);x.isIteratorResult=r=>x.isObject(r)&&"done"in r&&"value"in r;x.isUnderlyingSink=r=>x.isObject(r)&&nt(r.abort)&&nt(r.close)&&nt(r.start)&&nt(r.write);x.isFileHandle=r=>x.isObject(r)&&nt(r.stat)&&Xc(r.fd);x.isFSReadStream=r=>x.isReadableNodeStream(r)&&Xc(r.bytesRead);x.isFetchResponse=r=>x.isObject(r)&&x.isReadableDOMStream(r.body);x.isWritableDOMStream=r=>x.isObject(r)&&nt(r.abort)&&nt(r.getWriter)&&!(r instanceof Ro.ReadableInterop);x.isReadableDOMStream=r=>x.isObject(r)&&nt(r.cancel)&&nt(r.getReader)&&!(r instanceof Ro.ReadableInterop);x.isWritableNodeStream=r=>x.isObject(r)&&nt(r.end)&&nt(r.write)&&Op(r.writable)&&!(r instanceof Ro.ReadableInterop);x.isReadableNodeStream=r=>x.isObject(r)&&nt(r.read)&&nt(r.pipe)&&Op(r.readable)&&!(r instanceof Ro.ReadableInterop)});var Je=w(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.compareArrayLike=U.rebaseValueOffsets=U.toUint8ClampedArrayAsyncIterator=U.toFloat64ArrayAsyncIterator=U.toFloat32ArrayAsyncIterator=U.toUint32ArrayAsyncIterator=U.toUint16ArrayAsyncIterator=U.toUint8ArrayAsyncIterator=U.toInt32ArrayAsyncIterator=U.toInt16ArrayAsyncIterator=U.toInt8ArrayAsyncIterator=U.toArrayBufferViewAsyncIterator=U.toUint8ClampedArrayIterator=U.toFloat64ArrayIterator=U.toFloat32ArrayIterator=U.toUint32ArrayIterator=U.toUint16ArrayIterator=U.toUint8ArrayIterator=U.toInt32ArrayIterator=U.toInt16ArrayIterator=U.toInt8ArrayIterator=U.toArrayBufferViewIterator=U.toUint8ClampedArray=U.toFloat64Array=U.toFloat32Array=U.toBigUint64Array=U.toUint32Array=U.toUint16Array=U.toUint8Array=U.toBigInt64Array=U.toInt32Array=U.toInt16Array=U.toInt8Array=U.toArrayBufferView=U.joinUint8Arrays=U.memcpy=void 0;var ze=ct(),Bw=Ar(),Iw=xn(),Tw=Bw.flatbuffers.ByteBuffer,Vn=ut(),Zc=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:ArrayBuffer;function Sw(r){let e=r[0]?[r[0]]:[],t,n,i,s;for(let o,u,a=0,h=0,_=r.length;++a<_;){if(o=e[h],u=r[a],!o||!u||o.buffer!==u.buffer||u.byteOffset<o.byteOffset){u&&(e[++h]=u);continue}if({byteOffset:t,byteLength:i}=o,{byteOffset:n,byteLength:s}=u,t+i<n||n+s<t){u&&(e[++h]=u);continue}e[h]=new Uint8Array(o.buffer,t,n-t+s)}return e}function Qc(r,e,t=0,n=e.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,i));return s.set(o,t),r}U.memcpy=Qc;function Aw(r,e){let t=Sw(r),n=t.reduce((_,T)=>_+T.byteLength,0),i,s,o,u=0,a=-1,h=Math.min(e||1/0,n);for(let _=t.length;++a<_;){if(i=t[a],s=i.subarray(0,Math.min(i.length,h-u)),h<=u+s.length){s.length<i.length?t[a]=i.subarray(s.length):s.length===i.length&&a++,o?Qc(o,s,u):o=s;break}Qc(o||(o=new Uint8Array(h)),s,u),u+=s.length}return[o||new Uint8Array(0),t.slice(a),n-(o?o.byteLength:0)]}U.joinUint8Arrays=Aw;function dt(r,e){let t=Vn.isIteratorResult(e)?e.value:e;return t instanceof r?r===Uint8Array?new r(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=Iw.encodeUtf8(t)),t instanceof ArrayBuffer?new r(t):t instanceof Zc?new r(t):t instanceof Tw?dt(r,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new r(0):new r(t.buffer,t.byteOffset,t.byteLength/r.BYTES_PER_ELEMENT):r.from(t)):new r(0)}U.toArrayBufferView=dt;U.toInt8Array=r=>dt(Int8Array,r);U.toInt16Array=r=>dt(Int16Array,r);U.toInt32Array=r=>dt(Int32Array,r);U.toBigInt64Array=r=>dt(Vn.BigInt64Array,r);U.toUint8Array=r=>dt(Uint8Array,r);U.toUint16Array=r=>dt(Uint16Array,r);U.toUint32Array=r=>dt(Uint32Array,r);U.toBigUint64Array=r=>dt(Vn.BigUint64Array,r);U.toFloat32Array=r=>dt(Float32Array,r);U.toFloat64Array=r=>dt(Float64Array,r);U.toUint8ClampedArray=r=>dt(Uint8ClampedArray,r);var eu=r=>(r.next(),r);function*ir(r,e){let t=function*(i){yield i},n=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Zc?t(e):Vn.isIterable(e)?e:t(e);return yield*eu(function*(i){let s=null;do s=i.next(yield dt(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}U.toArrayBufferViewIterator=ir;U.toInt8ArrayIterator=r=>ir(Int8Array,r);U.toInt16ArrayIterator=r=>ir(Int16Array,r);U.toInt32ArrayIterator=r=>ir(Int32Array,r);U.toUint8ArrayIterator=r=>ir(Uint8Array,r);U.toUint16ArrayIterator=r=>ir(Uint16Array,r);U.toUint32ArrayIterator=r=>ir(Uint32Array,r);U.toFloat32ArrayIterator=r=>ir(Float32Array,r);U.toFloat64ArrayIterator=r=>ir(Float64Array,r);U.toUint8ClampedArrayIterator=r=>ir(Uint8ClampedArray,r);function Yt(r,e){return ze.__asyncGenerator(this,arguments,function*(){if(Vn.isPromise(e))return yield ze.__await(yield ze.__await(yield*ze.__asyncDelegator(ze.__asyncValues(Yt(r,yield ze.__await(e))))));let n=function(o){return ze.__asyncGenerator(this,arguments,function*(){yield yield ze.__await(yield ze.__await(o))})},i=function(o){return ze.__asyncGenerator(this,arguments,function*(){yield ze.__await(yield*ze.__asyncDelegator(ze.__asyncValues(eu(function*(u){let a=null;do a=u.next(yield a==null?void 0:a.value);while(!a.done)}(o[Symbol.iterator]())))))})},s=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Zc?n(e):Vn.isIterable(e)?i(e):Vn.isAsyncIterable(e)?e:n(e);return yield ze.__await(yield*ze.__asyncDelegator(ze.__asyncValues(eu(function(o){return ze.__asyncGenerator(this,arguments,function*(){let u=null;do u=yield ze.__await(o.next(yield yield ze.__await(dt(r,u))));while(!u.done)})}(s[Symbol.asyncIterator]()))))),yield ze.__await(new r)})}U.toArrayBufferViewAsyncIterator=Yt;U.toInt8ArrayAsyncIterator=r=>Yt(Int8Array,r);U.toInt16ArrayAsyncIterator=r=>Yt(Int16Array,r);U.toInt32ArrayAsyncIterator=r=>Yt(Int32Array,r);U.toUint8ArrayAsyncIterator=r=>Yt(Uint8Array,r);U.toUint16ArrayAsyncIterator=r=>Yt(Uint16Array,r);U.toUint32ArrayAsyncIterator=r=>Yt(Uint32Array,r);U.toFloat32ArrayAsyncIterator=r=>Yt(Float32Array,r);U.toFloat64ArrayAsyncIterator=r=>Yt(Float64Array,r);U.toUint8ClampedArrayAsyncIterator=r=>Yt(Uint8ClampedArray,r);function Fw(r,e,t){if(r!==0){t=t.slice(0,e+1);for(let n=-1;++n<=e;)t[n]+=r}return t}U.rebaseValueOffsets=Fw;function Dw(r,e){let t=0,n=r.length;if(n!==e.length)return!1;if(n>0)do if(r[t]!==e[t])return!1;while(++t<n);return!0}U.compareArrayLike=Dw});var ws=w(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});var ge=ct(),ft=Je();ru.default={fromIterable(r){return xo(Ow(r))},fromAsyncIterable(r){return xo(Mw(r))},fromDOMStream(r){return xo(Ew(r))},fromNodeStream(r){return xo(Uw(r))},toDOMStream(r,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,e){throw new Error('"toNodeStream" not available in this environment')}};var xo=r=>(r.next(),r);function*Ow(r){let e,t=!1,n=[],i,s,o,u=0;function a(){return s==="peek"?ft.joinUint8Arrays(n,o)[0]:([i,n,u]=ft.joinUint8Arrays(n,o),i)}({cmd:s,size:o}=yield null);let h=ft.toUint8ArrayIterator(r)[Symbol.iterator]();try{do if({done:e,value:i}=isNaN(o-u)?h.next(void 0):h.next(o-u),!e&&i.byteLength>0&&(n.push(i),u+=i.byteLength),e||o<=u)do({cmd:s,size:o}=yield a());while(o<u);while(!e)}catch(_){(t=!0)&&typeof h.throw=="function"&&h.throw(_)}finally{t===!1&&typeof h.return=="function"&&h.return(null)}return null}function Mw(r){return ge.__asyncGenerator(this,arguments,function*(){let t,n=!1,i=[],s,o,u,a=0;function h(){return o==="peek"?ft.joinUint8Arrays(i,u)[0]:([s,i,a]=ft.joinUint8Arrays(i,u),s)}({cmd:o,size:u}=yield yield ge.__await(null));let _=ft.toUint8ArrayAsyncIterator(r)[Symbol.asyncIterator]();try{do if({done:t,value:s}=isNaN(u-a)?yield ge.__await(_.next(void 0)):yield ge.__await(_.next(u-a)),!t&&s.byteLength>0&&(i.push(s),a+=s.byteLength),t||u<=a)do({cmd:o,size:u}=yield yield ge.__await(h()));while(u<a);while(!t)}catch(T){(n=!0)&&typeof _.throw=="function"&&(yield ge.__await(_.throw(T)))}finally{n===!1&&typeof _.return=="function"&&(yield ge.__await(_.return(new Uint8Array(0))))}return yield ge.__await(null)})}function Ew(r){return ge.__asyncGenerator(this,arguments,function*(){let t=!1,n=!1,i=[],s,o,u,a=0;function h(){return o==="peek"?ft.joinUint8Arrays(i,u)[0]:([s,i,a]=ft.joinUint8Arrays(i,u),s)}({cmd:o,size:u}=yield yield ge.__await(null));let _=new Mp(r);try{do if({done:t,value:s}=isNaN(u-a)?yield ge.__await(_.read(void 0)):yield ge.__await(_.read(u-a)),!t&&s.byteLength>0&&(i.push(ft.toUint8Array(s)),a+=s.byteLength),t||u<=a)do({cmd:o,size:u}=yield yield ge.__await(h()));while(u<a);while(!t)}catch(T){(n=!0)&&(yield ge.__await(_.cancel(T)))}finally{n===!1?yield ge.__await(_.cancel()):r.locked&&_.releaseLock()}return yield ge.__await(null)})}var Mp=class{constructor(e){this.source=e,this.byobReader=null,this.defaultReader=null;try{this.supportsBYOB=!!(this.reader=this.getBYOBReader())}catch(t){this.supportsBYOB=!(this.reader=this.getDefaultReader())}}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=this.byobReader=this.defaultReader=null}cancel(e){return ge.__awaiter(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 ge.__awaiter(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};let t=!this.supportsBYOB||typeof e!="number"?yield this.getDefaultReader().read():yield this.readFromBYOBReader(e);return!t.done&&(t.value=ft.toUint8Array(t)),t})}getDefaultReader(){return this.byobReader&&this.releaseLock(),this.defaultReader||(this.defaultReader=this.source.getReader(),this.defaultReader.closed.catch(()=>{})),this.reader=this.defaultReader}getBYOBReader(){return this.defaultReader&&this.releaseLock(),this.byobReader||(this.byobReader=this.source.getReader({mode:"byob"}),this.byobReader.closed.catch(()=>{})),this.reader=this.byobReader}readFromBYOBReader(e){return ge.__awaiter(this,void 0,void 0,function*(){return yield Ep(this.getBYOBReader(),new ArrayBuffer(e),0,e)})}};function Ep(r,e,t,n){return ge.__awaiter(this,void 0,void 0,function*(){if(t>=n)return{done:!1,value:new Uint8Array(e,0,n)};let{done:i,value:s}=yield r.read(new Uint8Array(e,t,n-t));return(t+=s.byteLength)<n&&!i?yield Ep(r,s.buffer,t,n):{done:i,value:new Uint8Array(s.buffer,0,t)}})}var tu=(r,e)=>{let t=i=>n([e,i]),n;return[e,t,new Promise(i=>(n=i)&&r.once(e,t))]};function Uw(r){return ge.__asyncGenerator(this,arguments,function*(){let t=[],n="error",i=!1,s=null,o,u,a=0,h=[],_;function T(){return o==="peek"?ft.joinUint8Arrays(h,u)[0]:([_,h,a]=ft.joinUint8Arrays(h,u),_)}if({cmd:o,size:u}=yield yield ge.__await(null),r.isTTY)return yield yield ge.__await(new Uint8Array(0)),yield ge.__await(null);try{t[0]=tu(r,"end"),t[1]=tu(r,"error");do{if(t[2]=tu(r,"readable"),[n,s]=yield ge.__await(Promise.race(t.map(E=>E[2]))),n==="error")break;if((i=n==="end")||(isFinite(u-a)?(_=ft.toUint8Array(r.read(u-a)),_.byteLength<u-a&&(_=ft.toUint8Array(r.read(void 0)))):_=ft.toUint8Array(r.read(void 0)),_.byteLength>0&&(h.push(_),a+=_.byteLength)),i||u<=a)do({cmd:o,size:u}=yield yield ge.__await(T()));while(u<a)}while(!i)}finally{yield ge.__await(M(t,n==="error"?s:null))}return yield ge.__await(null);function M(E,q){return _=h=null,new Promise((re,le)=>{for(let[de,Me]of E)r.off(de,Me);try{let de=r.destroy;de&&de.call(r,q),q=void 0}catch(de){q=de||q}finally{q!=null?le(q):re()}})}})}});var je=w(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.Vector=ci.AbstractVector=void 0;var Vo=class{};ci.AbstractVector=Vo;ci.Vector=Vo;Vo.prototype.data=null});var Zr=w(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.Schema=O.Buffer=O.Field=O.DictionaryEncoding=O.KeyValue=O.Duration=O.Interval=O.Timestamp=O.Time=O.Date=O.Decimal=O.Bool=O.FixedSizeBinary=O.LargeBinary=O.LargeUtf8=O.Binary=O.Utf8=O.FloatingPoint=O.Int=O.Union=O.Map=O.FixedSizeList=O.LargeList=O.List=O.Struct_=O.Null=O.Endianness=O.DictionaryKind=O.Type=O.IntervalUnit=O.TimeUnit=O.DateUnit=O.Precision=O.UnionMode=O.Feature=O.MetadataVersion=void 0;var Ie=Ar(),Rw;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Rw=O.MetadataVersion||(O.MetadataVersion={}));var xw;(function(r){r[r.UNUSED=0]="UNUSED",r[r.DICTIONARY_REPLACEMENT=1]="DICTIONARY_REPLACEMENT",r[r.COMPRESSED_BODY=2]="COMPRESSED_BODY"})(xw=O.Feature||(O.Feature={}));var nu;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(nu=O.UnionMode||(O.UnionMode={}));var iu;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(iu=O.Precision||(O.Precision={}));var su;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(su=O.DateUnit||(O.DateUnit={}));var Pn;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Pn=O.TimeUnit||(O.TimeUnit={}));var ou;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME"})(ou=O.IntervalUnit||(O.IntervalUnit={}));var au;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList"})(au=O.Type||(O.Type={}));var cu;(function(r){r[r.DenseArray=0]="DenseArray"})(cu=O.DictionaryKind||(O.DictionaryKind={}));var uu;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(uu=O.Endianness||(O.Endianness={}));var Ln=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(e,t){return(t||new Ln).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Ln).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return Ln.startNull(e),Ln.endNull(e)}};O.Null=Ln;var Nn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(e,t){return(t||new Nn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Nn).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return Nn.startStruct_(e),Nn.endStruct_(e)}};O.Struct_=Nn;var kn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(e,t){return(t||new kn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new kn).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return kn.startList(e),kn.endList(e)}};O.List=kn;var Cn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(e,t){return(t||new Cn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeList(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Cn).__init(e.readInt32(e.position())+e.position(),e)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(e){return Cn.startLargeList(e),Cn.endLargeList(e)}};O.LargeList=Cn;var Wr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(e,t){return(t||new Wr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Wr).__init(e.readInt32(e.position())+e.position(),e)}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(e,t){return Wr.startFixedSizeList(e),Wr.addListSize(e,t),Wr.endFixedSizeList(e)}};O.FixedSizeList=Wr;var Yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(e,t){return(t||new Yr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Yr).__init(e.readInt32(e.position())+e.position(),e)}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(e,t){return Yr.startMap(e),Yr.addKeysSorted(e,t),Yr.endMap(e)}};O.Map=Yr;var Fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(e,t){return(t||new Fr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Fr).__init(e.readInt32(e.position())+e.position(),e)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):nu.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,nu.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(e,t,n){return Fr.startUnion(e),Fr.addMode(e,t),Fr.addTypeIds(e,n),Fr.endUnion(e)}};O.Union=Fr;var sr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(e,t){return(t||new sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new sr).__init(e.readInt32(e.position())+e.position(),e)}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(e,t,n){return sr.startInt(e),sr.addBitWidth(e,t),sr.addIsSigned(e,n),sr.endInt(e)}};O.Int=sr;var Gr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(e,t){return(t||new Gr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Gr).__init(e.readInt32(e.position())+e.position(),e)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):iu.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,iu.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,t){return Gr.startFloatingPoint(e),Gr.addPrecision(e,t),Gr.endFloatingPoint(e)}};O.FloatingPoint=Gr;var jn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(e,t){return(t||new jn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new jn).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return jn.startUtf8(e),jn.endUtf8(e)}};O.Utf8=jn;var qn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(e,t){return(t||new qn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new qn).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return qn.startBinary(e),qn.endBinary(e)}};O.Binary=qn;var Hn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(e,t){return(t||new Hn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Hn).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return Hn.startLargeUtf8(e),Hn.endLargeUtf8(e)}};O.LargeUtf8=Hn;var zn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(e,t){return(t||new zn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new zn).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return zn.startLargeBinary(e),zn.endLargeBinary(e)}};O.LargeBinary=zn;var $r=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(e,t){return(t||new $r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new $r).__init(e.readInt32(e.position())+e.position(),e)}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(e,t){return $r.startFixedSizeBinary(e),$r.addByteWidth(e,t),$r.endFixedSizeBinary(e)}};O.FixedSizeBinary=$r;var Wn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(e,t){return(t||new Wn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Wn).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return Wn.startBool(e),Wn.endBool(e)}};O.Bool=Wn;var or=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(e,t){return(t||new or).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new or).__init(e.readInt32(e.position())+e.position(),e)}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(e,t,n,i){return or.startDecimal(e),or.addPrecision(e,t),or.addScale(e,n),or.addBitWidth(e,i),or.endDecimal(e)}};O.Decimal=or;var Jr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(e,t){return(t||new Jr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Jr).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):su.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,su.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,t){return Jr.startDate(e),Jr.addUnit(e,t),Jr.endDate(e)}};O.Date=Jr;var Dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(e,t){return(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pn.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,Pn.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(e,t,n){return Dr.startTime(e),Dr.addUnit(e,t),Dr.addBitWidth(e,n),Dr.endTime(e)}};O.Time=Dr;var Or=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(e,t){return(t||new Or).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Or).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pn.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,Pn.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,t,n){return Or.startTimestamp(e),Or.addUnit(e,t),Or.addTimezone(e,n),Or.endTimestamp(e)}};O.Timestamp=Or;var Kr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(e,t){return(t||new Kr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Kr).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ou.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ou.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,t){return Kr.startInterval(e),Kr.addUnit(e,t),Kr.endInterval(e)}};O.Interval=Kr;var Xr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(e,t){return(t||new Xr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Xr).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pn.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,Pn.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,t){return Xr.startDuration(e),Xr.addUnit(e,t),Xr.endDuration(e)}};O.Duration=Xr;var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(e,t){return(t||new Gt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Gt).__init(e.readInt32(e.position())+e.position(),e)}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(e,t,n){return Gt.startKeyValue(e),Gt.addKey(e,t),Gt.addValue(e,n),Gt.endKeyValue(e)}};O.KeyValue=Gt;var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(e,t){return(t||new Tt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new Tt).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new sr).__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):cu.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,e.createLong(0,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,cu.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}static createDictionaryEncoding(e,t,n,i,s){return Tt.startDictionaryEncoding(e),Tt.addId(e,t),Tt.addIndexType(e,n),Tt.addIsOrdered(e,i),Tt.addDictionaryKind(e,s),Tt.endDictionaryEncoding(e)}};O.DictionaryEncoding=Tt;var lt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(e,t){return(t||new lt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new lt).__init(e.readInt32(e.position())+e.position(),e)}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):au.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 Tt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(e,t){let n=this.bb.__offset(this.bb_pos,14);return n?(t||new lt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*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 Gt).__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,au.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()}static createField(e,t,n,i,s,o,u,a){return lt.startField(e),lt.addName(e,t),lt.addNullable(e,n),lt.addTypeType(e,i),lt.addType(e,s),lt.addDictionary(e,o),lt.addChildren(e,u),lt.addCustomMetadata(e,a),lt.endField(e)}};O.Field=lt;var Up=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 createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(n),e.writeInt64(t),e.offset()}};O.Buffer=Up;var $t=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(e,t){return(t||new $t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,t){return e.setPosition(e.position()+Ie.flatbuffers.SIZE_PREFIX_LENGTH),(t||new $t).__init(e.readInt32(e.position())+e.position(),e)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):uu.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new lt).__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 Gt).__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):this.bb.createLong(0,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,uu.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 finishSchemaBuffer(e,t){e.finish(t)}static finishSizePrefixedSchemaBuffer(e,t){e.finish(t,void 0,!0)}static createSchema(e,t,n,i,s){return $t.startSchema(e),$t.addEndianness(e,t),$t.addFields(e,n),$t.addCustomMetadata(e,i),$t.addFeatures(e,s),$t.endSchema(e)}};O.Schema=$t});var No=w(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.Message=qe.DictionaryBatch=qe.RecordBatch=qe.BodyCompression=qe.FieldNode=qe.MessageHeader=qe.BodyCompressionMethod=qe.CompressionType=void 0;var Po=Ar(),Lo=Zr(),lu;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(lu=qe.CompressionType||(qe.CompressionType={}));var du;(function(r){r[r.BUFFER=0]="BUFFER"})(du=qe.BodyCompressionMethod||(qe.BodyCompressionMethod={}));var fu;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(fu=qe.MessageHeader||(qe.MessageHeader={}));var hu=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 createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(n),e.writeInt64(t),e.offset()}};qe.FieldNode=hu;var ar=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new ar).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+Po.flatbuffers.SIZE_PREFIX_LENGTH),(t||new ar).__init(e.readInt32(e.position())+e.position(),e)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):lu.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):du.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,lu.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,du.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,n){return ar.startBodyCompression(e),ar.addCodec(e,t),ar.addMethod(e,n),ar.endBodyCompression(e)}};qe.BodyCompression=ar;var St=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new St).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+Po.flatbuffers.SIZE_PREFIX_LENGTH),(t||new St).__init(e.readInt32(e.position())+e.position(),e)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new hu).__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 Lo.Buffer).__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 ar).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,t){e.addFieldInt64(0,t,e.createLong(0,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 endRecordBatch(e){return e.endObject()}static createRecordBatch(e,t,n,i,s){return St.startRecordBatch(e),St.addLength(e,t),St.addNodes(e,n),St.addBuffers(e,i),St.addCompression(e,s),St.endRecordBatch(e)}};qe.RecordBatch=St;var cr=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new cr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+Po.flatbuffers.SIZE_PREFIX_LENGTH),(t||new cr).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new St).__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,e.createLong(0,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()}static createDictionaryBatch(e,t,n,i){return cr.startDictionaryBatch(e),cr.addId(e,t),cr.addData(e,n),cr.addIsDelta(e,i),cr.endDictionaryBatch(e)}};qe.DictionaryBatch=cr;var At=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new At).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+Po.flatbuffers.SIZE_PREFIX_LENGTH),(t||new At).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Lo.MetadataVersion.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):fu.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):this.bb.createLong(0,0)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Lo.KeyValue).__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,Lo.MetadataVersion.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,fu.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,e.createLong(0,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(e,t,n,i,s,o){return At.startMessage(e),At.addVersion(e,t),At.addHeaderType(e,n),At.addHeader(e,i),At.addBodyLength(e,s),At.addCustomMetadata(e,o),At.endMessage(e)}};qe.Message=At});var we=w(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.BufferType=Ue.Type=Ue.MessageHeader=Ue.MetadataVersion=Ue.IntervalUnit=Ue.UnionMode=Ue.Precision=Ue.TimeUnit=Ue.DateUnit=void 0;var ui=Zr();Object.defineProperty(Ue,"DateUnit",{enumerable:!0,get:function(){return ui.DateUnit}});Object.defineProperty(Ue,"TimeUnit",{enumerable:!0,get:function(){return ui.TimeUnit}});Object.defineProperty(Ue,"Precision",{enumerable:!0,get:function(){return ui.Precision}});Object.defineProperty(Ue,"UnionMode",{enumerable:!0,get:function(){return ui.UnionMode}});Object.defineProperty(Ue,"IntervalUnit",{enumerable:!0,get:function(){return ui.IntervalUnit}});Object.defineProperty(Ue,"MetadataVersion",{enumerable:!0,get:function(){return ui.MetadataVersion}});var Vw=No();Object.defineProperty(Ue,"MessageHeader",{enumerable:!0,get:function(){return Vw.MessageHeader}});var Pw;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth"})(Pw=Ue.Type||(Ue.Type={}));var Lw;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Lw=Ue.BufferType||(Ue.BufferType={}))});var ur=w(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.popcnt_uint32=We.popcnt_array=We.popcnt_bit_range=We.BitIterator=We.packBools=We.truncateBitmap=We.setBool=We.getBit=We.getBool=void 0;function Rp(r,e,t,n){return(t&1<<n)!==0}We.getBool=Rp;function xp(r,e,t,n){return(t&1<<n)>>n}We.getBit=xp;function Nw(r,e,t){return t?!!(r[e>>3]|=1<<e%8)||!0:!(r[e>>3]&=~(1<<e%8))&&!1}We.setBool=Nw;function kw(r,e,t){let n=t.byteLength+7&~7;if(r>0||t.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?t.subarray(r>>3):Vp(new ko(t,r,e,null,Rp)).subarray(0,n)),i}return t}We.truncateBitmap=kw;function Vp(r){let e=[],t=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(e[t++]=i,i=n=0);(t===0||n>0)&&(e[t++]=i);let s=new Uint8Array(e.length+7&~7);return s.set(e),s}We.packBools=Vp;var ko=class{constructor(e,t,n,i,s){this.bytes=e,this.length=n,this.context=i,this.get=s,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}};We.BitIterator=ko;function pu(r,e,t){if(t-e<=0)return 0;if(t-e<8){let s=0;for(let o of new ko(r,e,t-e,r,xp))s+=o;return s}let n=t>>3<<3,i=e+(e%8===0?0:8-e%8);return pu(r,e,i)+pu(r,n,t)+Pp(r,i>>3,n-i>>3)}We.popcnt_bit_range=pu;function Pp(r,e,t){let n=0,i=e|0,s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=t===void 0?r.byteLength:i+t;for(;o-i>=4;)n+=Co(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Co(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Co(s.getUint8(i)),i+=1;return n}We.popcnt_array=Pp;function Co(r){let e=r|0;return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}We.popcnt_uint32=Co});var he=w(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.strideForType=S.Dictionary=S.Map_=S.FixedSizeList=S.FixedSizeBinary=S.SparseUnion=S.DenseUnion=S.Union=S.Struct=S.List=S.IntervalYearMonth=S.IntervalDayTime=S.Interval=S.TimestampNanosecond=S.TimestampMicrosecond=S.TimestampMillisecond=S.TimestampSecond=S.Timestamp=S.TimeNanosecond=S.TimeMicrosecond=S.TimeMillisecond=S.TimeSecond=S.Time=S.DateMillisecond=S.DateDay=S.Date_=S.Decimal=S.Bool=S.Utf8=S.Binary=S.Float64=S.Float32=S.Float16=S.Float=S.Uint64=S.Uint32=S.Uint16=S.Uint8=S.Int64=S.Int32=S.Int16=S.Int8=S.Int=S.Null=S.DataType=void 0;var R=we(),Re=class{static isNull(e){return(e==null?void 0:e.typeId)===R.Type.Null}static isInt(e){return(e==null?void 0:e.typeId)===R.Type.Int}static isFloat(e){return(e==null?void 0:e.typeId)===R.Type.Float}static isBinary(e){return(e==null?void 0:e.typeId)===R.Type.Binary}static isUtf8(e){return(e==null?void 0:e.typeId)===R.Type.Utf8}static isBool(e){return(e==null?void 0:e.typeId)===R.Type.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===R.Type.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===R.Type.Date}static isTime(e){return(e==null?void 0:e.typeId)===R.Type.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===R.Type.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===R.Type.Interval}static isList(e){return(e==null?void 0:e.typeId)===R.Type.List}static isStruct(e){return(e==null?void 0:e.typeId)===R.Type.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===R.Type.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===R.Type.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===R.Type.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===R.Type.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===R.Type.Dictionary}get typeId(){return R.Type.NONE}};S.DataType=Re;Re[Symbol.toStringTag]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(Re.prototype);var jo=class extends Re{toString(){return"Null"}get typeId(){return R.Type.Null}};S.Null=jo;jo[Symbol.toStringTag]=(r=>r[Symbol.toStringTag]="Null")(jo.prototype);var Ft=class extends Re{constructor(e,t){super();this.isSigned=e,this.bitWidth=t}get typeId(){return R.Type.Int}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?Int32Array:Uint32Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};S.Int=Ft;Ft[Symbol.toStringTag]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ft.prototype);var yu=class extends Ft{constructor(){super(!0,8)}};S.Int8=yu;var _u=class extends Ft{constructor(){super(!0,16)}};S.Int16=_u;var mu=class extends Ft{constructor(){super(!0,32)}};S.Int32=mu;var bu=class extends Ft{constructor(){super(!0,64)}};S.Int64=bu;var gu=class extends Ft{constructor(){super(!1,8)}};S.Uint8=gu;var vu=class extends Ft{constructor(){super(!1,16)}};S.Uint16=vu;var wu=class extends Ft{constructor(){super(!1,32)}};S.Uint32=wu;var Bu=class extends Ft{constructor(){super(!1,64)}};S.Uint64=Bu;Object.defineProperty(yu.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(_u.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(mu.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(bu.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(gu.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(vu.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(wu.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Bu.prototype,"ArrayType",{value:Uint32Array});var Yn=class extends Re{constructor(e){super();this.precision=e}get typeId(){return R.Type.Float}get ArrayType(){switch(this.precision){case R.Precision.HALF:return Uint16Array;case R.Precision.SINGLE:return Float32Array;case R.Precision.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};S.Float=Yn;Yn[Symbol.toStringTag]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Yn.prototype);var Iu=class extends Yn{constructor(){super(R.Precision.HALF)}};S.Float16=Iu;var Tu=class extends Yn{constructor(){super(R.Precision.SINGLE)}};S.Float32=Tu;var Su=class extends Yn{constructor(){super(R.Precision.DOUBLE)}};S.Float64=Su;Object.defineProperty(Iu.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Tu.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Su.prototype,"ArrayType",{value:Float64Array});var qo=class extends Re{constructor(){super()}get typeId(){return R.Type.Binary}toString(){return"Binary"}};S.Binary=qo;qo[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(qo.prototype);var Ho=class extends Re{constructor(){super()}get typeId(){return R.Type.Utf8}toString(){return"Utf8"}};S.Utf8=Ho;Ho[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Ho.prototype);var zo=class extends Re{constructor(){super()}get typeId(){return R.Type.Bool}toString(){return"Bool"}};S.Bool=zo;zo[Symbol.toStringTag]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(zo.prototype);var Wo=class extends Re{constructor(e,t){super();this.scale=e,this.precision=t}get typeId(){return R.Type.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};S.Decimal=Wo;Wo[Symbol.toStringTag]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Wo.prototype);var li=class extends Re{constructor(e){super();this.unit=e}get typeId(){return R.Type.Date}toString(){return`Date${(this.unit+1)*32}<${R.DateUnit[this.unit]}>`}};S.Date_=li;li[Symbol.toStringTag]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(li.prototype);var Lp=class extends li{constructor(){super(R.DateUnit.DAY)}};S.DateDay=Lp;var Np=class extends li{constructor(){super(R.DateUnit.MILLISECOND)}};S.DateMillisecond=Np;var Qr=class extends Re{constructor(e,t){super();this.unit=e,this.bitWidth=t}get typeId(){return R.Type.Time}toString(){return`Time${this.bitWidth}<${R.TimeUnit[this.unit]}>`}};S.Time=Qr;Qr[Symbol.toStringTag]=(r=>(r.unit=null,r.bitWidth=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Time"))(Qr.prototype);var kp=class extends Qr{constructor(){super(R.TimeUnit.SECOND,32)}};S.TimeSecond=kp;var Cp=class extends Qr{constructor(){super(R.TimeUnit.MILLISECOND,32)}};S.TimeMillisecond=Cp;var jp=class extends Qr{constructor(){super(R.TimeUnit.MICROSECOND,64)}};S.TimeMicrosecond=jp;var qp=class extends Qr{constructor(){super(R.TimeUnit.NANOSECOND,64)}};S.TimeNanosecond=qp;var en=class extends Re{constructor(e,t){super();this.unit=e,this.timezone=t}get typeId(){return R.Type.Timestamp}toString(){return`Timestamp<${R.TimeUnit[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};S.Timestamp=en;en[Symbol.toStringTag]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(en.prototype);var Hp=class extends en{constructor(e){super(R.TimeUnit.SECOND,e)}};S.TimestampSecond=Hp;var zp=class extends en{constructor(e){super(R.TimeUnit.MILLISECOND,e)}};S.TimestampMillisecond=zp;var Wp=class extends en{constructor(e){super(R.TimeUnit.MICROSECOND,e)}};S.TimestampMicrosecond=Wp;var Yp=class extends en{constructor(e){super(R.TimeUnit.NANOSECOND,e)}};S.TimestampNanosecond=Yp;var di=class extends Re{constructor(e){super();this.unit=e}get typeId(){return R.Type.Interval}toString(){return`Interval<${R.IntervalUnit[this.unit]}>`}};S.Interval=di;di[Symbol.toStringTag]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(di.prototype);var Gp=class extends di{constructor(){super(R.IntervalUnit.DAY_TIME)}};S.IntervalDayTime=Gp;var $p=class extends di{constructor(){super(R.IntervalUnit.YEAR_MONTH)}};S.IntervalYearMonth=$p;var Yo=class extends Re{constructor(e){super();this.children=[e]}get typeId(){return R.Type.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};S.List=Yo;Yo[Symbol.toStringTag]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Yo.prototype);var Go=class extends Re{constructor(e){super();this.children=e}get typeId(){return R.Type.Struct}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};S.Struct=Go;Go[Symbol.toStringTag]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Go.prototype);var fi=class extends Re{constructor(e,t,n){super();this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return R.Type.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}};S.Union=fi;fi[Symbol.toStringTag]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(fi.prototype);var Jp=class extends fi{constructor(e,t){super(R.UnionMode.Dense,e,t)}};S.DenseUnion=Jp;var Kp=class extends fi{constructor(e,t){super(R.UnionMode.Sparse,e,t)}};S.SparseUnion=Kp;var $o=class extends Re{constructor(e){super();this.byteWidth=e}get typeId(){return R.Type.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};S.FixedSizeBinary=$o;$o[Symbol.toStringTag]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))($o.prototype);var Jo=class extends Re{constructor(e,t){super();this.listSize=e,this.children=[t]}get typeId(){return R.Type.FixedSizeList}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}>`}};S.FixedSizeList=Jo;Jo[Symbol.toStringTag]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Jo.prototype);var Ko=class extends Re{constructor(e,t=!1){super();this.children=[e],this.keysSorted=t}get typeId(){return R.Type.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};S.Map_=Ko;Ko[Symbol.toStringTag]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ko.prototype);var Cw=(r=>()=>++r)(-1),Xo=class extends Re{constructor(e,t,n,i){super();this.indices=t,this.dictionary=e,this.isOrdered=i||!1,this.id=n==null?Cw():typeof n=="number"?n:n.low}get typeId(){return R.Type.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};S.Dictionary=Xo;Xo[Symbol.toStringTag]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Xo.prototype);function jw(r){let e=r;switch(r.typeId){case R.Type.Decimal:return 4;case R.Type.Timestamp:return 2;case R.Type.Date:return 1+e.unit;case R.Type.Interval:return 1+e.unit;case R.Type.Int:return 1+ +(e.bitWidth>32);case R.Type.Time:return 1+ +(e.bitWidth>32);case R.Type.FixedSizeList:return e.listSize;case R.Type.FixedSizeBinary:return e.byteWidth;default:return 1}}S.strideForType=jw});var Jt=w(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.Data=Gn.kUnknownNullCount=void 0;var qw=ur(),Hw=ur(),V=we(),zw=he(),ae=Je();Gn.kUnknownNullCount=-1;var J=class{constructor(e,t,n,i,s,o,u){this.type=e,this.dictionary=u,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1)),this.childData=(o||[]).map(h=>h instanceof J?h:h.data);let a;s instanceof J?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=zw.strideForType(e),s&&((a=s[0])&&(this.valueOffsets=a),(a=s[1])&&(this.values=a),(a=s[2])&&(this.nullBitmap=a),(a=s[3])&&(this.typeIds=a)))}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:i,typeIds:s}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),i&&(e+=i.byteLength),s&&(e+=s.byteLength),this.childData.reduce((o,u)=>o+u.byteLength,e)}get nullCount(){let e=this._nullCount,t;return e<=Gn.kUnknownNullCount&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-Hw.popcnt_bit_range(t,this.offset,this.offset+this.length)),e}clone(e,t=this.offset,n=this.length,i=this._nullCount,s=this,o=this.childData){return new J(e,t,n,i,s,o,this.dictionary)}slice(e,t){let{stride:n,typeId:i,childData:s}=this,o=+(this._nullCount===0)-1,u=i===16?n:1,a=this._sliceBuffers(e,t,n,i);return this.clone(this.type,this.offset+e,t,o,a,!s.length||this.valueOffsets?s:this._sliceChildren(s,u*e,u*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===V.Type.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,i=new Uint8Array((e+63&~63)>>3).fill(255,0,t>>3);i[t>>3]=(1<<t-(t&~7))-1,n>0&&i.set(qw.truncateBitmap(this.offset,t,this.nullBitmap),0);let s=this.buffers;return s[V.BufferType.VALIDITY]=i,this.clone(this.type,0,e,n+(e-t),s)}_sliceBuffers(e,t,n,i){let s,{buffers:o}=this;return(s=o[V.BufferType.TYPE])&&(o[V.BufferType.TYPE]=s.subarray(e,e+t)),(s=o[V.BufferType.OFFSET])&&(o[V.BufferType.OFFSET]=s.subarray(e,e+t+1))||(s=o[V.BufferType.DATA])&&(o[V.BufferType.DATA]=i===6?s:s.subarray(n*e,n*(e+t))),o}_sliceChildren(e,t,n){return e.map(i=>i.slice(t,n))}static new(e,t,n,i,s,o,u){switch(s instanceof J?s=s.buffers:s||(s=[]),e.typeId){case V.Type.Null:return J.Null(e,t,n);case V.Type.Int:return J.Int(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Dictionary:return J.Dictionary(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[],u);case V.Type.Float:return J.Float(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Bool:return J.Bool(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Decimal:return J.Decimal(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Date:return J.Date(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Time:return J.Time(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Timestamp:return J.Timestamp(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Interval:return J.Interval(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.FixedSizeBinary:return J.FixedSizeBinary(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.DATA]||[]);case V.Type.Binary:return J.Binary(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.OFFSET]||[],s[V.BufferType.DATA]||[]);case V.Type.Utf8:return J.Utf8(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.OFFSET]||[],s[V.BufferType.DATA]||[]);case V.Type.List:return J.List(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.OFFSET]||[],(o||[])[0]);case V.Type.FixedSizeList:return J.FixedSizeList(e,t,n,i||0,s[V.BufferType.VALIDITY],(o||[])[0]);case V.Type.Struct:return J.Struct(e,t,n,i||0,s[V.BufferType.VALIDITY],o||[]);case V.Type.Map:return J.Map(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.OFFSET]||[],(o||[])[0]);case V.Type.Union:return J.Union(e,t,n,i||0,s[V.BufferType.VALIDITY],s[V.BufferType.TYPE]||[],s[V.BufferType.OFFSET]||o,o)}throw new Error(`Unrecognized typeId ${e.typeId}`)}static Null(e,t,n){return new J(e,t,n,0)}static Int(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Dictionary(e,t,n,i,s,o,u){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.indices.ArrayType,o),ae.toUint8Array(s)],[],u)}static Float(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Bool(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Decimal(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Date(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Time(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Timestamp(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Interval(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static FixedSizeBinary(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,ae.toArrayBufferView(e.ArrayType,o),ae.toUint8Array(s)])}static Binary(e,t,n,i,s,o,u){return new J(e,t,n,i,[ae.toInt32Array(o),ae.toUint8Array(u),ae.toUint8Array(s)])}static Utf8(e,t,n,i,s,o,u){return new J(e,t,n,i,[ae.toInt32Array(o),ae.toUint8Array(u),ae.toUint8Array(s)])}static List(e,t,n,i,s,o,u){return new J(e,t,n,i,[ae.toInt32Array(o),void 0,ae.toUint8Array(s)],u?[u]:[])}static FixedSizeList(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,void 0,ae.toUint8Array(s)],o?[o]:[])}static Struct(e,t,n,i,s,o){return new J(e,t,n,i,[void 0,void 0,ae.toUint8Array(s)],o)}static Map(e,t,n,i,s,o,u){return new J(e,t,n,i,[ae.toInt32Array(o),void 0,ae.toUint8Array(s)],u?[u]:[])}static Union(e,t,n,i,s,o,u,a){let h=[void 0,void 0,ae.toUint8Array(s),ae.toArrayBufferView(e.ArrayType,o)];return e.mode===V.UnionMode.Sparse?new J(e,t,n,i,h,u):(h[V.BufferType.OFFSET]=ae.toInt32Array(u),new J(e,t,n,i,h,a))}};Gn.Data=J;J.prototype.childData=Object.freeze([])});var Au=w(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.valueToString=void 0;var Ww=void 0;function Yw(r){if(r===null)return"null";if(r===Ww)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r)}Zo.valueToString=Yw});var Xp=w(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.createIsValidFunction=void 0;var Fu=Au(),Gw=ut();function $w(r){if(!r||r.length<=0)return function(i){return!0};let e="",t=r.filter(n=>n===n);return t.length>0&&(e=`
|
|
2
|
-
switch (x) {${
|
|
3
|
-
case ${
|
|
1
|
+
var duckdb=(()=>{var Fp=Object.create;var hi=Object.defineProperty,Tp=Object.defineProperties,Bp=Object.getOwnPropertyDescriptor,Dp=Object.getOwnPropertyDescriptors,Ep=Object.getOwnPropertyNames,Wl=Object.getOwnPropertySymbols,Op=Object.getPrototypeOf,Yl=Object.prototype.hasOwnProperty,Mp=Object.prototype.propertyIsEnumerable;var $l=(r,t,e)=>t in r?hi(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vr=(r,t)=>{for(var e in t||(t={}))Yl.call(t,e)&&$l(r,e,t[e]);if(Wl)for(var e of Wl(t))Mp.call(t,e)&&$l(r,e,t[e]);return r},pi=(r,t)=>Tp(r,Dp(t));var Rp=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var un=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),dn=(r,t)=>{for(var e in t)hi(r,e,{get:t[e],enumerable:!0})},Xl=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ep(t))!Yl.call(r,i)&&i!==e&&hi(r,i,{get:()=>t[i],enumerable:!(n=Bp(t,i))||n.enumerable});return r};var Gl=(r,t,e)=>(e=r!=null?Fp(Op(r)):{},Xl(t||!r||!r.__esModule?hi(e,"default",{value:r,enumerable:!0}):e,r)),Up=r=>Xl(hi({},"__esModule",{value:!0}),r);var mu=un((Oy,vs)=>{var Kl,Jl,ql,Zl,Ql,tu,eu,ru,nu,gs,_a,iu,su,ou,Dn,au,cu,lu,uu,du,fu,hu,pu,ws;(function(r){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(e(t,e(n)))}):typeof vs=="object"&&typeof vs.exports=="object"?r(e(t,e(vs.exports))):r(e(t));function e(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}})(function(r){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};Kl=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function s(){this.constructor=n}n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},Jl=Object.assign||function(n){for(var i,s=1,o=arguments.length;s<o;s++){i=arguments[s];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])}return n},ql=function(n,i){var s={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.indexOf(o)<0&&(s[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,o=Object.getOwnPropertySymbols(n);c<o.length;c++)i.indexOf(o[c])<0&&Object.prototype.propertyIsEnumerable.call(n,o[c])&&(s[o[c]]=n[o[c]]);return s},Zl=function(n,i,s,o){var c=arguments.length,a=c<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,i,s,o);else for(var m=n.length-1;m>=0;m--)(f=n[m])&&(a=(c<3?f(a):c>3?f(i,s,a):f(i,s))||a);return c>3&&a&&Object.defineProperty(i,s,a),a},Ql=function(n,i){return function(s,o){i(s,o,n)}},tu=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},eu=function(n,i,s,o){function c(a){return a instanceof s?a:new s(function(f){f(a)})}return new(s||(s=Promise))(function(a,f){function m(I){try{b(o.next(I))}catch(J){f(J)}}function y(I){try{b(o.throw(I))}catch(J){f(J)}}function b(I){I.done?a(I.value):c(I.value).then(m,y)}b((o=o.apply(n,i||[])).next())})},ru=function(n,i){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,c,a,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(b){return function(I){return y([b,I])}}function y(b){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,c&&(a=b[0]&2?c.return:b[0]?c.throw||((a=c.return)&&a.call(c),0):c.next)&&!(a=a.call(c,b[1])).done)return a;switch(c=0,a&&(b=[b[0]&2,a.value]),b[0]){case 0:case 1:a=b;break;case 4:return s.label++,{value:b[1],done:!1};case 5:s.label++,c=b[1],b=[0];continue;case 7:b=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(b[0]===6||b[0]===2)){s=0;continue}if(b[0]===3&&(!a||b[1]>a[0]&&b[1]<a[3])){s.label=b[1];break}if(b[0]===6&&s.label<a[1]){s.label=a[1],a=b;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(b);break}a[2]&&s.ops.pop(),s.trys.pop();continue}b=i.call(n,s)}catch(I){b=[6,I],c=0}finally{o=a=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}},nu=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&ws(i,n,s)},ws=Object.create?function(n,i,s,o){o===void 0&&(o=s),Object.defineProperty(n,o,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},gs=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],o=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},_a=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),c,a=[],f;try{for(;(i===void 0||i-- >0)&&!(c=o.next()).done;)a.push(c.value)}catch(m){f={error:m}}finally{try{c&&!c.done&&(s=o.return)&&s.call(o)}finally{if(f)throw f.error}}return a},iu=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(_a(arguments[i]));return n},su=function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var o=Array(n),c=0,i=0;i<s;i++)for(var a=arguments[i],f=0,m=a.length;f<m;f++,c++)o[c]=a[f];return o},ou=function(n,i,s){if(s||arguments.length===2)for(var o=0,c=i.length,a;o<c;o++)(a||!(o in i))&&(a||(a=Array.prototype.slice.call(i,0,o)),a[o]=i[o]);return n.concat(a||Array.prototype.slice.call(i))},Dn=function(n){return this instanceof Dn?(this.v=n,this):new Dn(n)},au=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),c,a=[];return c={},f("next"),f("throw"),f("return"),c[Symbol.asyncIterator]=function(){return this},c;function f(Z){o[Z]&&(c[Z]=function(at){return new Promise(function(st,x){a.push([Z,at,st,x])>1||m(Z,at)})})}function m(Z,at){try{y(o[Z](at))}catch(st){J(a[0][3],st)}}function y(Z){Z.value instanceof Dn?Promise.resolve(Z.value.v).then(b,I):J(a[0][2],Z)}function b(Z){m("next",Z)}function I(Z){m("throw",Z)}function J(Z,at){Z(at),a.shift(),a.length&&m(a[0][0],a[0][1])}},cu=function(n){var i,s;return i={},o("next"),o("throw",function(c){throw c}),o("return"),i[Symbol.iterator]=function(){return this},i;function o(c,a){i[c]=n[c]?function(f){return(s=!s)?{value:Dn(n[c](f)),done:c==="return"}:a?a(f):f}:a}},lu=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof gs=="function"?gs(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(a){s[a]=n[a]&&function(f){return new Promise(function(m,y){f=n[a](f),c(m,y,f.done,f.value)})}}function c(a,f,m,y){Promise.resolve(y).then(function(b){a({value:b,done:m})},f)}},uu=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var e=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};du=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&ws(i,n,s);return e(i,n),i},fu=function(n){return n&&n.__esModule?n:{default:n}},hu=function(n,i,s,o){if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!o:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?o:s==="a"?o.call(n):o?o.value:i.get(n)},pu=function(n,i,s,o,c){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!c:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?c.call(n,s):c?c.value=s:i.set(n,s),s},r("__extends",Kl),r("__assign",Jl),r("__rest",ql),r("__decorate",Zl),r("__param",Ql),r("__metadata",tu),r("__awaiter",eu),r("__generator",ru),r("__exportStar",nu),r("__createBinding",ws),r("__values",gs),r("__read",_a),r("__spread",iu),r("__spreadArrays",su),r("__spreadArray",ou),r("__await",Dn),r("__asyncGenerator",au),r("__asyncDelegator",cu),r("__asyncValues",lu),r("__makeTemplateObject",uu),r("__importStar",du),r("__importDefault",fu),r("__classPrivateFieldGet",hu),r("__classPrivateFieldSet",pu)})});var pc=un(()=>{});var ef=un(()=>{});var rf=un(()=>{});var nf=un(()=>{});var sf=un(()=>{});var df=un((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(e){return new Sha256(t,!0).update(e)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(i){return t.create().update(i)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(e,n){return new HmacSha256(e,t,!0).update(n)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(i){return new HmacSha256(i,r)},t.update=function(i,s){return t.create(i).update(s)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createHmacOutputMethod(n,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,e=typeof r;if(e!=="string"){if(e==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,s,o=r.length,c=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)for(s=this.start;i<o&&s<64;++i)c[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?c[s>>2]|=n<<SHIFT[s++&3]:n<2048?(c[s>>2]|=(192|n>>6)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(c[s>>2]|=(224|n>>12)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),c[s>>2]|=(240|n>>18)<<SHIFT[s++&3],c[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,c=this.h7,a=this.blocks,f,m,y,b,I,J,Z,at,st,x,St;for(f=16;f<64;++f)I=a[f-15],m=(I>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,I=a[f-2],y=(I>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,a[f]=a[f-16]+m+a[f-7]+y<<0;for(St=t&e,f=0;f<64;f+=4)this.first?(this.is224?(at=300032,I=a[0]-1413257819,c=I-150054599<<0,n=I+24177077<<0):(at=704751109,I=a[0]-210244248,c=I-1521486534<<0,n=I+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),y=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),at=r&t,b=at^r&e^St,Z=i&s^~i&o,I=c+y+Z+K[f]+a[f],J=m+b,c=n+I<<0,n=I+J<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),y=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),st=n&r,b=st^n&t^at,Z=c&i^~c&s,I=o+y+Z+K[f+1]+a[f+1],J=m+b,o=e+I<<0,e=I+J<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),y=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),x=e&n,b=x^e&r^st,Z=o&c^~o&i,I=s+y+Z+K[f+2]+a[f+2],J=m+b,s=t+I<<0,t=I+J<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),y=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),St=t&e,b=St^t&n^x,Z=s&o^~s&c,I=i+y+Z+K[f+3]+a[f+3],J=m+b,i=r+I<<0,r=I+J<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+c<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,c=this.h7,a=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(a+=HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]),a},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,c=this.h7,a=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||a.push(c>>24&255,c>>16&255,c>>8&255,c&255),a},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,e){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,c=0,a;for(n=0;n<o;++n)a=r.charCodeAt(n),a<128?s[c++]=a:a<2048?(s[c++]=192|a>>6,s[c++]=128|a&63):a<55296||a>=57344?(s[c++]=224|a>>12,s[c++]=128|a>>6&63,s[c++]=128|a&63):(a=65536+((a&1023)<<10|r.charCodeAt(++n)&1023),s[c++]=240|a>>18,s[c++]=128|a>>12&63,s[c++]=128|a>>6&63,s[c++]=128|a&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var f=[],m=[];for(n=0;n<64;++n){var y=r[n]||0;f[n]=92^y,m[n]=54^y}Sha256.call(this,t,e),this.update(m),this.oKeyPad=f,this.inner=!0,this.sharedMemory=e}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var xy={};dn(xy,{registerWorker:()=>pf});var _u=Gl(mu(),1),{__extends:My,__assign:Ry,__rest:yu,__decorate:Uy,__param:ky,__metadata:Ny,__awaiter:A,__generator:Ly,__exportStar:Cy,__createBinding:Py,__values:Vy,__read:Hy,__spread:zy,__spreadArrays:jy,__spreadArray:Wy,__await:$,__asyncGenerator:le,__asyncDelegator:En,__asyncValues:Oe,__makeTemplateObject:$y,__importStar:Yy,__importDefault:Xy,__classPrivateFieldGet:Gy,__classPrivateFieldSet:Ky}=_u.default;var Sa={};dn(Sa,{compareArrayLike:()=>va,joinUint8Arrays:()=>Ie,memcpy:()=>Mn,rebaseValueOffsets:()=>bi,toArrayBufferView:()=>Y,toArrayBufferViewAsyncIterator:()=>ze,toArrayBufferViewIterator:()=>ir,toBigInt64Array:()=>Hp,toBigUint64Array:()=>Wp,toFloat32Array:()=>$p,toFloat32ArrayAsyncIterator:()=>am,toFloat32ArrayIterator:()=>Qp,toFloat64Array:()=>Yp,toFloat64ArrayAsyncIterator:()=>cm,toFloat64ArrayIterator:()=>tm,toInt16Array:()=>Vp,toInt16ArrayAsyncIterator:()=>nm,toInt16ArrayIterator:()=>Kp,toInt32Array:()=>fn,toInt32ArrayAsyncIterator:()=>im,toInt32ArrayIterator:()=>Jp,toInt8Array:()=>Pp,toInt8ArrayAsyncIterator:()=>rm,toInt8ArrayIterator:()=>Gp,toUint16Array:()=>zp,toUint16ArrayAsyncIterator:()=>sm,toUint16ArrayIterator:()=>qp,toUint32Array:()=>jp,toUint32ArrayAsyncIterator:()=>om,toUint32ArrayIterator:()=>Zp,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>wa,toUint8ArrayIterator:()=>ga,toUint8ClampedArray:()=>Xp,toUint8ClampedArrayAsyncIterator:()=>lm,toUint8ClampedArrayIterator:()=>em});var kp=new TextDecoder("utf-8"),mi=r=>kp.decode(r),Np=new TextEncoder,Hr=r=>Np.encode(r);var[Zy,Ss]=(()=>{let r=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw r()}return t.asIntN=()=>{throw r()},t.asUintN=()=>{throw r()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[_i,Qy]=(()=>{let r=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[On,tb]=(()=>{let r=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})();var Lp=r=>typeof r=="number",bu=r=>typeof r=="boolean",Ct=r=>typeof r=="function",se=r=>r!=null&&Object(r)===r,Ve=r=>se(r)&&Ct(r.then);var He=r=>se(r)&&Ct(r[Symbol.iterator]),Me=r=>se(r)&&Ct(r[Symbol.asyncIterator]),Is=r=>se(r)&&se(r.schema);var As=r=>se(r)&&"done"in r&&"value"in r;var xs=r=>se(r)&&Ct(r.stat)&&Lp(r.fd);var Fs=r=>se(r)&&yi(r.body),Ts=r=>"_getDOMStream"in r&&"_getNodeStream"in r,gu=r=>se(r)&&Ct(r.abort)&&Ct(r.getWriter)&&!Ts(r),yi=r=>se(r)&&Ct(r.cancel)&&Ct(r.getReader)&&!Ts(r),wu=r=>se(r)&&Ct(r.end)&&Ct(r.write)&&bu(r.writable)&&!Ts(r),Bs=r=>se(r)&&Ct(r.read)&&Ct(r.pipe)&&bu(r.readable)&&!Ts(r),vu=r=>se(r)&&Ct(r.clear)&&Ct(r.bytes)&&Ct(r.position)&&Ct(r.setPosition)&&Ct(r.capacity)&&Ct(r.getBufferIdentifier)&&Ct(r.createLong);var ba=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Cp(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,c,a=0,f=0,m=r.length;++a<m;){if(o=t[f],c=r[a],!o||!c||o.buffer!==c.buffer||c.byteOffset<o.byteOffset){c&&(t[++f]=c);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=c,e+i<n||n+s<e){c&&(t[++f]=c);continue}t[f]=new Uint8Array(o.buffer,e,n-e+s)}return t}function Mn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function Ie(r,t){let e=Cp(r),n=e.reduce((m,y)=>m+y.byteLength,0),i,s,o,c=0,a=-1,f=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++a<m;){if(i=e[a],s=i.subarray(0,Math.min(i.length,f-c)),f<=c+s.length){s.length<i.length?e[a]=i.subarray(s.length):s.length===i.length&&a++,o?Mn(o,s,c):o=s;break}Mn(o||(o=new Uint8Array(f)),s,c),c+=s.length}return[o||new Uint8Array(0),e.slice(a),n-(o?o.byteLength:0)]}function Y(r,t){let e=As(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Hr(e)),e instanceof ArrayBuffer?new r(e):e instanceof ba?new r(e):vu(e)?Y(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Pp=r=>Y(Int8Array,r),Vp=r=>Y(Int16Array,r),fn=r=>Y(Int32Array,r),Hp=r=>Y(_i,r),N=r=>Y(Uint8Array,r),zp=r=>Y(Uint16Array,r),jp=r=>Y(Uint32Array,r),Wp=r=>Y(On,r),$p=r=>Y(Float32Array,r),Yp=r=>Y(Float64Array,r),Xp=r=>Y(Uint8ClampedArray,r),ya=r=>(r.next(),r);function*ir(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ba?e(t):He(t)?t:e(t);return yield*ya(function*(i){let s=null;do s=i.next(yield Y(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var Gp=r=>ir(Int8Array,r),Kp=r=>ir(Int16Array,r),Jp=r=>ir(Int32Array,r),ga=r=>ir(Uint8Array,r),qp=r=>ir(Uint16Array,r),Zp=r=>ir(Uint32Array,r),Qp=r=>ir(Float32Array,r),tm=r=>ir(Float64Array,r),em=r=>ir(Uint8ClampedArray,r);function ze(r,t){return le(this,arguments,function*(){if(Ve(t))return yield $(yield $(yield*En(Oe(ze(r,yield $(t))))));let n=function(o){return le(this,arguments,function*(){yield yield $(yield $(o))})},i=function(o){return le(this,arguments,function*(){yield $(yield*En(Oe(ya(function*(c){let a=null;do a=c.next(yield a==null?void 0:a.value);while(!a.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ba?n(t):He(t)?i(t):Me(t)?t:n(t);return yield $(yield*En(Oe(ya(function(o){return le(this,arguments,function*(){let c=null;do c=yield $(o.next(yield yield $(Y(r,c))));while(!c.done)})}(s[Symbol.asyncIterator]()))))),yield $(new r)})}var rm=r=>ze(Int8Array,r),nm=r=>ze(Int16Array,r),im=r=>ze(Int32Array,r),wa=r=>ze(Uint8Array,r),sm=r=>ze(Uint16Array,r),om=r=>ze(Uint32Array,r),am=r=>ze(Float32Array,r),cm=r=>ze(Float64Array,r),lm=r=>ze(Uint8ClampedArray,r);function bi(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function va(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var Jt={fromIterable(r){return Ds(um(r))},fromAsyncIterable(r){return Ds(dm(r))},fromDOMStream(r){return Ds(fm(r))},fromNodeStream(r){return Ds(hm(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Ds=r=>(r.next(),r);function*um(r){let t,e=!1,n=[],i,s,o,c=0;function a(){return s==="peek"?Ie(n,o)[0]:([i,n,c]=Ie(n,o),i)}({cmd:s,size:o}=yield null);let f=ga(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-c)?f.next():f.next(o-c),!t&&i.byteLength>0&&(n.push(i),c+=i.byteLength),t||o<=c)do({cmd:s,size:o}=yield a());while(o<c);while(!t)}catch(m){(e=!0)&&typeof f.throw=="function"&&f.throw(m)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function dm(r){return le(this,arguments,function*(){let e,n=!1,i=[],s,o,c,a=0;function f(){return o==="peek"?Ie(i,c)[0]:([s,i,a]=Ie(i,c),s)}({cmd:o,size:c}=yield yield $(null));let m=wa(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(c-a)?yield $(m.next()):yield $(m.next(c-a)),!e&&s.byteLength>0&&(i.push(s),a+=s.byteLength),e||c<=a)do({cmd:o,size:c}=yield yield $(f()));while(c<a);while(!e)}catch(y){(n=!0)&&typeof m.throw=="function"&&(yield $(m.throw(y)))}finally{n===!1&&typeof m.return=="function"&&(yield $(m.return(new Uint8Array(0))))}return yield $(null)})}function fm(r){return le(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,c,a=0;function f(){return o==="peek"?Ie(i,c)[0]:([s,i,a]=Ie(i,c),s)}({cmd:o,size:c}=yield yield $(null));let m=new Aa(r);try{do if({done:e,value:s}=Number.isNaN(c-a)?yield $(m.read()):yield $(m.read(c-a)),!e&&s.byteLength>0&&(i.push(N(s)),a+=s.byteLength),e||c<=a)do({cmd:o,size:c}=yield yield $(f()));while(c<a);while(!e)}catch(y){(n=!0)&&(yield $(m.cancel(y)))}finally{n===!1?yield $(m.cancel()):r.locked&&m.releaseLock()}return yield $(null)})}var Aa=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return A(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return A(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=N(e)),e})}},Ia=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function hm(r){return le(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,c,a=0,f=[],m;function y(){return o==="peek"?Ie(f,c)[0]:([m,f,a]=Ie(f,c),m)}if({cmd:o,size:c}=yield yield $(null),r.isTTY)return yield yield $(new Uint8Array(0)),yield $(null);try{e[0]=Ia(r,"end"),e[1]=Ia(r,"error");do{if(e[2]=Ia(r,"readable"),[n,s]=yield $(Promise.race(e.map(I=>I[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(c-a)?(m=N(r.read(c-a)),m.byteLength<c-a&&(m=N(r.read()))):m=N(r.read()),m.byteLength>0&&(f.push(m),a+=m.byteLength)),i||c<=a)do({cmd:o,size:c}=yield yield $(y()));while(c<a)}while(!i)}finally{yield $(b(e,n==="error"?s:null))}return yield $(null);function b(I,J){return m=f=null,new Promise((Z,at)=>{for(let[st,x]of I)r.off(st,x);try{let st=r.destroy;st&&st.call(r,J),J=void 0}catch(st){J=st||J}finally{J!=null?at(J):Z()}})}})}var Vt;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Vt||(Vt={}));var xt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(xt||(xt={}));var bt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(bt||(bt={}));var qt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(qt||(qt={}));var G;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(G||(G={}));var oe;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(oe||(oe={}));var rt;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(rt||(rt={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth"})(h||(h={}));var Re;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Re||(Re={}));var Ha={};dn(Ha,{clampIndex:()=>n_,clampRange:()=>vi,createElementComparator:()=>$r});function je(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>je(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Fa={};dn(Fa,{BN:()=>hn,bignumToBigInt:()=>Es,bignumToString:()=>zr,isArrowBigNumSymbol:()=>Su});var Su=Symbol.for("isArrowBigNum");function We(r,...t){return t.length===0?Object.setPrototypeOf(Y(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}We.prototype[Su]=!0;We.prototype.toJSON=function(){return`"${zr(this)}"`};We.prototype.valueOf=function(){return Iu(this)};We.prototype.toString=function(){return zr(this)};We.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Iu(this);case"string":return zr(this);case"default":return Es(this)}return zr(this)};function Rn(...r){return We.apply(this,r)}function Un(...r){return We.apply(this,r)}function gi(...r){return We.apply(this,r)}Object.setPrototypeOf(Rn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Un.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(gi.prototype,Object.create(Uint32Array.prototype));Object.assign(Rn.prototype,We.prototype,{constructor:Rn,signed:!0,TypedArray:Int32Array,BigIntArray:_i});Object.assign(Un.prototype,We.prototype,{constructor:Un,signed:!1,TypedArray:Uint32Array,BigIntArray:On});Object.assign(gi.prototype,We.prototype,{constructor:gi,signed:!0,TypedArray:Uint32Array,BigIntArray:On});function Iu(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new On(t,e,n),o=i&&s[s.length-1]&BigInt(1)<<BigInt(63),c=BigInt(o?1:0),a=BigInt(0);if(o){for(let f of s)c+=~f*(BigInt(1)<<BigInt(32)*a++);c*=BigInt(-1)}else for(let f of s)c+=f*(BigInt(1)<<BigInt(32)*a++);return c}var zr,Es;Ss?(Es=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:xa(r),zr=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:xa(r)):(zr=xa,Es=zr);function xa(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t||"0"}var hn=class{static new(t,e){switch(e){case!0:return new Rn(t);case!1:return new Un(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case _i:return new Rn(t)}return t.byteLength===16?new gi(t):new Un(t)}static signed(t){return new Rn(t)}static unsigned(t){return new Un(t)}static decimal(t){return new gi(t)}constructor(t,e){return hn.new(t,e)}};var Au,xu,Fu,Tu,Bu,Du,Eu,Ou,Mu,Ru,Uu,ku,Nu,Lu,Cu,Pu,Vu,Hu,zu,T=class{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return T.isUnion(t)&&t.mode===xt.Dense}static isSparseUnion(t){return T.isUnion(t)&&t.mode===xt.Sparse}get typeId(){return h.NONE}};Au=Symbol.toStringTag;T[Au]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(T.prototype);var ae=class extends T{toString(){return"Null"}get typeId(){return h.Null}};xu=Symbol.toStringTag;ae[xu]=(r=>r[Symbol.toStringTag]="Null")(ae.prototype);var Dt=class extends T{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.Int}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 new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Fu=Symbol.toStringTag;Dt[Fu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Dt.prototype);var Os=class extends Dt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ms=class extends Dt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},sr=class extends Dt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Rs=class extends Dt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Us=class extends Dt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ks=class extends Dt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ns=class extends Dt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ls=class extends Dt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Os.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ms.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(sr.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Rs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Us.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ks.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ns.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ls.prototype,"ArrayType",{value:BigUint64Array});var ue=class extends T{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case bt.HALF:return Uint16Array;case bt.SINGLE:return Float32Array;case bt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Tu=Symbol.toStringTag;ue[Tu]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ue.prototype);var Cs=class extends ue{constructor(){super(bt.HALF)}},Ps=class extends ue{constructor(){super(bt.SINGLE)}},Vs=class extends ue{constructor(){super(bt.DOUBLE)}};Object.defineProperty(Cs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ps.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Vs.prototype,"ArrayType",{value:Float64Array});var Ir=class extends T{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};Bu=Symbol.toStringTag;Ir[Bu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ir.prototype);var Ar=class extends T{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Du=Symbol.toStringTag;Ar[Du]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Ar.prototype);var xr=class extends T{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};Eu=Symbol.toStringTag;xr[Eu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(xr.prototype);var Fr=class extends T{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return h.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Ou=Symbol.toStringTag;Fr[Ou]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Fr.prototype);var Tr=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return`Date${(this.unit+1)*32}<${qt[this.unit]}>`}};Mu=Symbol.toStringTag;Tr[Mu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Tr.prototype);var $e=class extends T{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return`Time${this.bitWidth}<${G[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Ru=Symbol.toStringTag;$e[Ru]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))($e.prototype);var Br=class extends T{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return`Timestamp<${G[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Uu=Symbol.toStringTag;Br[Uu]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Br.prototype);var Dr=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return`Interval<${oe[this.unit]}>`}};ku=Symbol.toStringTag;Dr[ku]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Dr.prototype);var Ye=class extends T{constructor(t){super(),this.children=[t]}get typeId(){return h.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Nu=Symbol.toStringTag;Ye[Nu]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Ye.prototype);var pt=class extends T{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Lu=Symbol.toStringTag;pt[Lu]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(pt.prototype);var Xe=class extends T{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return h.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Cu=Symbol.toStringTag;Xe[Cu]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Xe.prototype);var Er=class extends T{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Pu=Symbol.toStringTag;Er[Pu]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Er.prototype);var Ge=class extends T{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.FixedSizeList}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}>`}};Vu=Symbol.toStringTag;Ge[Vu]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ge.prototype);var Ke=class extends T{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.Map}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(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Hu=Symbol.toStringTag;Ke[Hu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ke.prototype);var pm=(r=>()=>++r)(-1),Ae=class extends T{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?pm():typeof n=="number"?n:n.low}get typeId(){return h.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};zu=Symbol.toStringTag;Ae[zu]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ae.prototype);function xe(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.FixedSizeBinary:return t.byteWidth;default:return 1}}var D=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return mm(this,t,e)}getVisitFnByTypeId(t,e=!0){return kn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function mm(r,t,e=!0){return typeof t=="number"?kn(r,t,e):typeof t=="string"&&t in h?kn(r,h[t],e):t&&t instanceof T?kn(r,ju(t),e):(t==null?void 0:t.type)&&t.type instanceof T?kn(r,ju(t.type),e):kn(r,h.NONE,e)}function kn(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.Binary:n=r.visitBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${h[t]}'`)}function ju(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case bt.HALF:return h.Float16;case bt.SINGLE:return h.Float32;case bt.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case G.SECOND:return h.TimeSecond;case G.MILLISECOND:return h.TimeMillisecond;case G.MICROSECOND:return h.TimeMicrosecond;case G.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case G.SECOND:return h.TimestampSecond;case G.MILLISECOND:return h.TimestampMillisecond;case G.MICROSECOND:return h.TimestampMicrosecond;case G.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case qt.DAY:return h.DateDay;case qt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case oe.DAY_TIME:return h.IntervalDayTime;case oe.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case xt.Dense:return h.DenseUnion;case xt.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error(`Unrecognized type '${h[r.typeId]}'`)}D.prototype.visitInt8=null;D.prototype.visitInt16=null;D.prototype.visitInt32=null;D.prototype.visitInt64=null;D.prototype.visitUint8=null;D.prototype.visitUint16=null;D.prototype.visitUint32=null;D.prototype.visitUint64=null;D.prototype.visitFloat16=null;D.prototype.visitFloat32=null;D.prototype.visitFloat64=null;D.prototype.visitDateDay=null;D.prototype.visitDateMillisecond=null;D.prototype.visitTimestampSecond=null;D.prototype.visitTimestampMillisecond=null;D.prototype.visitTimestampMicrosecond=null;D.prototype.visitTimestampNanosecond=null;D.prototype.visitTimeSecond=null;D.prototype.visitTimeMillisecond=null;D.prototype.visitTimeMicrosecond=null;D.prototype.visitTimeNanosecond=null;D.prototype.visitDenseUnion=null;D.prototype.visitSparseUnion=null;D.prototype.visitIntervalDayTime=null;D.prototype.visitIntervalYearMonth=null;var Ta={};dn(Ta,{float64ToUint16:()=>wi,uint16ToFloat64:()=>Hs});var Wu=new Float64Array(1),Nn=new Uint32Array(Wu.buffer);function Hs(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function wi(r){if(r!==r)return 32256;Wu[0]=r;let t=(Nn[1]&2147483648)>>16&65535,e=Nn[1]&2146435072,n=0;return e>=1089470464?Nn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Nn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Nn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Nn[1]&1048575)+512>>10),t|e|n&65535}var L=class extends D{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var _m=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},Ba=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},ym=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},bm=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},$u=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},gm=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Or=({values:r},t,e)=>{r[t]=e},Da=({values:r},t,e)=>{r[t]=e},Yu=({values:r},t,e)=>{r[t]=wi(e)},wm=(r,t,e)=>{switch(r.type.precision){case bt.HALF:return Yu(r,t,e);case bt.SINGLE:case bt.DOUBLE:return Da(r,t,e)}},zs=({values:r},t,e)=>{_m(r,t,e.valueOf())},js=({values:r},t,e)=>{Ba(r,t*2,e.valueOf())},Ea=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},vm=({values:r,valueOffsets:t},e,n)=>$u(r,t,e,n),Sm=({values:r,valueOffsets:t},e,n)=>{$u(r,t,e,Hr(n))},Oa=(r,t,e)=>{r.type.unit===qt.DAY?zs(r,t,e):js(r,t,e)},Ws=({values:r},t,e)=>Ba(r,t*2,e/1e3),$s=({values:r},t,e)=>Ba(r,t*2,e),Ys=({values:r},t,e)=>ym(r,t*2,e),Xs=({values:r},t,e)=>bm(r,t*2,e),Ma=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Ws(r,t,e);case G.MILLISECOND:return $s(r,t,e);case G.MICROSECOND:return Ys(r,t,e);case G.NANOSECOND:return Xs(r,t,e)}},Gs=({values:r},t,e)=>{r[t]=e},Ks=({values:r},t,e)=>{r[t]=e},Js=({values:r},t,e)=>{r[t]=e},qs=({values:r},t,e)=>{r[t]=e},Ra=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Gs(r,t,e);case G.MILLISECOND:return Ks(r,t,e);case G.MICROSECOND:return Js(r,t,e);case G.NANOSECOND:return qs(r,t,e)}},Ua=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Im=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Zt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,c=i[t],a=i[t+1];c<a;)s(n,c++,e[++o]);else for(let o=-1,c=i[t],a=i[t+1];c<a;)s(n,c++,e.get(++o))},Am=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Zt.getVisitFn(n),{[t]:o,[t+1]:c}=i,a=e instanceof Map?e.entries():Object.entries(e);for(let f of a)if(s(n,o,f),++o>=c)break},xm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),Fm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Tm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Bm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Dm=(r,t,e)=>{let n=r.type.children.map(s=>Zt.getVisitFn(s.type)),i=e instanceof Map?Tm(t,e):e instanceof C?Fm(t,e):Array.isArray(e)?xm(t,e):Bm(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Em=(r,t,e)=>{r.type.mode===xt.Dense?Xu(r,t,e):Gu(r,t,e)},Xu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Zt.visit(i,r.valueOffsets[t],e)},Gu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Zt.visit(i,t,e)},Om=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ka=(r,t,e)=>{r.type.unit===oe.DAY_TIME?Zs(r,t,e):Qs(r,t,e)},Zs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Qs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Mm=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Zt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,c=t*n;++o<n;)s(i,c+o,e[o]);else for(let o=-1,c=t*n;++o<n;)s(i,c+o,e.get(o))};L.prototype.visitBool=j(gm);L.prototype.visitInt=j(Or);L.prototype.visitInt8=j(Or);L.prototype.visitInt16=j(Or);L.prototype.visitInt32=j(Or);L.prototype.visitInt64=j(Or);L.prototype.visitUint8=j(Or);L.prototype.visitUint16=j(Or);L.prototype.visitUint32=j(Or);L.prototype.visitUint64=j(Or);L.prototype.visitFloat=j(wm);L.prototype.visitFloat16=j(Yu);L.prototype.visitFloat32=j(Da);L.prototype.visitFloat64=j(Da);L.prototype.visitUtf8=j(Sm);L.prototype.visitBinary=j(vm);L.prototype.visitFixedSizeBinary=j(Ea);L.prototype.visitDate=j(Oa);L.prototype.visitDateDay=j(zs);L.prototype.visitDateMillisecond=j(js);L.prototype.visitTimestamp=j(Ma);L.prototype.visitTimestampSecond=j(Ws);L.prototype.visitTimestampMillisecond=j($s);L.prototype.visitTimestampMicrosecond=j(Ys);L.prototype.visitTimestampNanosecond=j(Xs);L.prototype.visitTime=j(Ra);L.prototype.visitTimeSecond=j(Gs);L.prototype.visitTimeMillisecond=j(Ks);L.prototype.visitTimeMicrosecond=j(Js);L.prototype.visitTimeNanosecond=j(qs);L.prototype.visitDecimal=j(Ua);L.prototype.visitList=j(Im);L.prototype.visitStruct=j(Dm);L.prototype.visitUnion=j(Em);L.prototype.visitDenseUnion=j(Xu);L.prototype.visitSparseUnion=j(Gu);L.prototype.visitDictionary=j(Om);L.prototype.visitInterval=j(ka);L.prototype.visitIntervalDayTime=j(Zs);L.prototype.visitIntervalYearMonth=j(Qs);L.prototype.visitFixedSizeList=j(Mm);L.prototype.visitMap=j(Am);var Zt=new L;var Je=Symbol.for("parent"),Ln=Symbol.for("rowIndex"),jr=class{constructor(t,e){return this[Je]=t,this[Ln]=e,new Proxy(this,new La)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ln],e=this[Je],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Mt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${je(t)}: ${je(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Na(this[Je],this[Ln])}},Na=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(jr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Je]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ln]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var La=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Je].type.children.map(e=>e.name)}has(t,e){return t[Je].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Je].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Je].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Mt.visit(t[Je].children[n],t[Ln]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Je].type.children.findIndex(s=>s.name===e);return i!==-1?(Zt.visit(t[Je].children[i],t[Ln],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var M=class extends D{};function V(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Rm=(r,t)=>864e5*r[t],Ca=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Um=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,km=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,Ku=r=>new Date(r),Nm=(r,t)=>Ku(Rm(r,t)),Lm=(r,t)=>Ku(Ca(r,t)),Cm=(r,t)=>null,Ju=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Pm=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},qu=({values:r},t)=>Nm(r,t),Zu=({values:r},t)=>Lm(r,t*2),Wr=({stride:r,values:t},e)=>t[r*e],Vm=({stride:r,values:t},e)=>Hs(t[r*e]),Qu=({values:r},t)=>r[t],Hm=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),zm=({values:r,valueOffsets:t},e)=>Ju(r,t,e),jm=({values:r,valueOffsets:t},e)=>{let n=Ju(r,t,e);return n!==null?mi(n):null},Wm=({values:r},t)=>r[t],$m=({type:r,values:t},e)=>r.precision!==bt.HALF?t[e]:Hs(t[e]),Ym=(r,t)=>r.type.unit===qt.DAY?qu(r,t):Zu(r,t),td=({values:r},t)=>1e3*Ca(r,t*2),ed=({values:r},t)=>Ca(r,t*2),rd=({values:r},t)=>Um(r,t*2),nd=({values:r},t)=>km(r,t*2),Xm=(r,t)=>{switch(r.type.unit){case G.SECOND:return td(r,t);case G.MILLISECOND:return ed(r,t);case G.MICROSECOND:return rd(r,t);case G.NANOSECOND:return nd(r,t)}},id=({values:r},t)=>r[t],sd=({values:r},t)=>r[t],od=({values:r},t)=>r[t],ad=({values:r},t)=>r[t],Gm=(r,t)=>{switch(r.type.unit){case G.SECOND:return id(r,t);case G.MILLISECOND:return sd(r,t);case G.MICROSECOND:return od(r,t);case G.NANOSECOND:return ad(r,t)}},Km=({values:r,stride:t},e)=>hn.decimal(r.subarray(t*e,t*(e+1))),Jm=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,a=i[0].slice(s,o-s);return new C([a])},qm=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new or(o.slice(i,s-i))},Zm=(r,t)=>new jr(r,t),Qm=(r,t)=>r.type.mode===xt.Dense?cd(r,t):ld(r,t),cd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Mt.visit(n,r.valueOffsets[t])},ld=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Mt.visit(n,t)},t_=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},e_=(r,t)=>r.type.unit===oe.DAY_TIME?ud(r,t):dd(r,t),ud=({values:r},t)=>r.subarray(2*t,2*(t+1)),dd=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},r_=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new C([s])};M.prototype.visitNull=V(Cm);M.prototype.visitBool=V(Pm);M.prototype.visitInt=V(Wm);M.prototype.visitInt8=V(Wr);M.prototype.visitInt16=V(Wr);M.prototype.visitInt32=V(Wr);M.prototype.visitInt64=V(Qu);M.prototype.visitUint8=V(Wr);M.prototype.visitUint16=V(Wr);M.prototype.visitUint32=V(Wr);M.prototype.visitUint64=V(Qu);M.prototype.visitFloat=V($m);M.prototype.visitFloat16=V(Vm);M.prototype.visitFloat32=V(Wr);M.prototype.visitFloat64=V(Wr);M.prototype.visitUtf8=V(jm);M.prototype.visitBinary=V(zm);M.prototype.visitFixedSizeBinary=V(Hm);M.prototype.visitDate=V(Ym);M.prototype.visitDateDay=V(qu);M.prototype.visitDateMillisecond=V(Zu);M.prototype.visitTimestamp=V(Xm);M.prototype.visitTimestampSecond=V(td);M.prototype.visitTimestampMillisecond=V(ed);M.prototype.visitTimestampMicrosecond=V(rd);M.prototype.visitTimestampNanosecond=V(nd);M.prototype.visitTime=V(Gm);M.prototype.visitTimeSecond=V(id);M.prototype.visitTimeMillisecond=V(sd);M.prototype.visitTimeMicrosecond=V(od);M.prototype.visitTimeNanosecond=V(ad);M.prototype.visitDecimal=V(Km);M.prototype.visitList=V(Jm);M.prototype.visitStruct=V(Zm);M.prototype.visitUnion=V(Qm);M.prototype.visitDenseUnion=V(cd);M.prototype.visitSparseUnion=V(ld);M.prototype.visitDictionary=V(t_);M.prototype.visitInterval=V(e_);M.prototype.visitIntervalDayTime=V(ud);M.prototype.visitIntervalYearMonth=V(dd);M.prototype.visitFixedSizeList=V(r_);M.prototype.visitMap=V(qm);var Mt=new M;var Ue=Symbol.for("keys"),Cn=Symbol.for("vals"),or=class{constructor(t){return this[Ue]=new C([t.children[0]]).memoize(),this[Cn]=t.children[1],new Proxy(this,new Va)}[Symbol.iterator](){return new Pa(this[Ue],this[Cn])}get size(){return this[Ue].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ue],e=this[Cn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Mt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${je(t)}: ${je(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Pa=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Mt.visit(this.vals,t)]})}},Va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ue].toArray().map(String)}has(t,e){return t[Ue].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Ue].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Ue].indexOf(e);if(n!==-1){let i=Mt.visit(Reflect.get(t,Cn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ue].indexOf(e);return i!==-1?(Zt.visit(Reflect.get(t,Cn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(or.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ue]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function n_(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var fd;function vi(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(fd=s,s=o,o=fd),o>i&&(o=i),n?n(r,s,o):[s,o]}var hd=r=>r!==r;function $r(r){if(typeof r!=="object"||r===null)return hd(r)?hd:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?va(r,e):!1:r instanceof Map?s_(r):Array.isArray(r)?i_(r):r instanceof C?o_(r):a_(r,!0)}function i_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=$r(r[e]);return to(t)}function s_(r){let t=-1,e=[];for(let n of r.values())e[++t]=$r(n);return to(e)}function o_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=$r(r.get(e));return to(t)}function a_(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=$r(r[e[i]]);return to(n,e)}function to(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return c_(r,e);case Map:return pd(r,e,e.keys());case or:case jr:case Object:case void 0:return pd(r,e,t||Object.keys(e))}return e instanceof C?l_(r,e):!1}}function c_(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function l_(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function pd(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,c=r.length,a=s.next(),f=n.next(),m=i.next();for(;o<c&&!f.done&&!m.done&&!a.done&&!(f.value!==m.value||!r[o](a.value));++o,f=n.next(),m=i.next(),a=s.next());return o===c&&f.done&&m.done&&a.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var za={};dn(za,{BitIterator:()=>pn,getBit:()=>md,getBool:()=>ro,packBools:()=>mn,popcnt_array:()=>_d,popcnt_bit_range:()=>Si,popcnt_uint32:()=>eo,setBool:()=>u_,truncateBitmap:()=>Pn});function ro(r,t,e,n){return(e&1<<n)!==0}function md(r,t,e,n){return(e&1<<n)>>n}function u_(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Pn(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):mn(new pn(e,r,t,null,ro)).subarray(0,n)),i}return e}function mn(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var pn=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[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 Si(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new pn(r,t,e-t,r,md))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Si(r,t,i)+Si(r,n,e)+_d(r,i>>3,n-i>>3)}function _d(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=eo(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=eo(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=eo(s.getUint8(i)),i+=1;return n}function eo(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var d_=-1,nt=class{constructor(t,e,n,i,s,o=[],c){this.type=t,this.children=o,this.dictionary=c,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let a;s instanceof nt?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=xe(t),s&&((a=s[0])&&(this.valueOffsets=a),(a=s[1])&&(this.values=a),(a=s[2])&&(this.nullBitmap=a),(a=s[3])&&(this.typeIds=a))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>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 byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,c)=>o+c.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=d_&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Si(e,this.offset,this.offset+this.length)),t}getValid(t){if(this.nullable&&this.nullCount>0){let e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:a}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:a,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,c=n[s]>>o&1;return e?c===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):c===1&&(n[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new nt(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,c=i===16?n:1,a=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,a,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Pn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Re.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[Re.TYPE])&&(o[Re.TYPE]=s.subarray(t,t+e)),(s=o[Re.OFFSET])&&(o[Re.OFFSET]=s.subarray(t,t+e+1))||(s=o[Re.DATA])&&(o[Re.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};nt.prototype.children=Object.freeze([]);var _n=class extends D{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new nt(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new nt(e,n,c,a,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new nt(e,n,c,a,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=N(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new nt(e,n,c,a,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),{length:o=i.reduce((a,{length:f})=>Math.max(a,f),0),nullCount:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),o=Y(e.ArrayType,t.typeIds),{["length"]:c=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;if(T.isSparseUnion(e))return new nt(e,n,c,a,[void 0,void 0,s,o],i);let f=fn(t.valueOffsets);return new nt(e,n,c,a,[f,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.indices.ArrayType,t.data),{["dictionary"]:o=new C([new _n().visit({type:e.dictionary})])}=t,{["length"]:c=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new nt(e,n,c,a,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.valueType})}=t,s=N(t.nullBitmap),{["length"]:o=i.length/xe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new nt(e,n,o,c,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.childType})}=t,s=N(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new nt(e,n,c,a,[o,void 0,s],[i])}};function P(r){return new _n().visit(r)}var Ii=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function no(r){return r.reduce((t,e)=>t+e.nullCount,0)}function io(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function so(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let c=r[s],a=t[s],{length:f}=c;if(a>=n)break;if(e>=a+f)continue;if(a>=e&&a+f<=n){i.push(c);continue}let m=Math.max(0,e-a),y=Math.min(n-a,f);i.push(c.slice(m,y-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function ja(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function Ai(r,t){return r.getValid(t)}function Yr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return ja(n,this._offsets,e,t)}}function oo(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=ja(s,this._offsets,n,e);return t=void 0,o}}function ao(r){let t;function e(n,i,s){let o=s,c=0,a=0;for(let f=i-1,m=n.length;++f<m;){let y=n[f];if(~(c=r(y,t,o)))return a+c;o=0,a+=y.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):ja(s,this._offsets,i,e);return t=void 0,o}}var R=class extends D{};function f_(r,t){return t===null&&r.length>0?0:-1}function h_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new pn(e,r.offset+(t||0),r.length,e,ro)){if(!i)return n;++n}return-1}function X(r,t,e){if(t===void 0)return-1;if(t===null)return h_(r,e);let n=Mt.getVisitFn(r),i=$r(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function yd(r,t,e){let n=Mt.getVisitFn(r),i=$r(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}R.prototype.visitNull=f_;R.prototype.visitBool=X;R.prototype.visitInt=X;R.prototype.visitInt8=X;R.prototype.visitInt16=X;R.prototype.visitInt32=X;R.prototype.visitInt64=X;R.prototype.visitUint8=X;R.prototype.visitUint16=X;R.prototype.visitUint32=X;R.prototype.visitUint64=X;R.prototype.visitFloat=X;R.prototype.visitFloat16=X;R.prototype.visitFloat32=X;R.prototype.visitFloat64=X;R.prototype.visitUtf8=X;R.prototype.visitBinary=X;R.prototype.visitFixedSizeBinary=X;R.prototype.visitDate=X;R.prototype.visitDateDay=X;R.prototype.visitDateMillisecond=X;R.prototype.visitTimestamp=X;R.prototype.visitTimestampSecond=X;R.prototype.visitTimestampMillisecond=X;R.prototype.visitTimestampMicrosecond=X;R.prototype.visitTimestampNanosecond=X;R.prototype.visitTime=X;R.prototype.visitTimeSecond=X;R.prototype.visitTimeMillisecond=X;R.prototype.visitTimeMicrosecond=X;R.prototype.visitTimeNanosecond=X;R.prototype.visitDecimal=X;R.prototype.visitList=X;R.prototype.visitStruct=X;R.prototype.visitUnion=X;R.prototype.visitDenseUnion=yd;R.prototype.visitSparseUnion=yd;R.prototype.visitDictionary=X;R.prototype.visitInterval=X;R.prototype.visitIntervalDayTime=X;R.prototype.visitIntervalYearMonth=X;R.prototype.visitFixedSizeList=X;R.prototype.visitMap=X;var yn=new R;var U=class extends D{};function H(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===h.Timestamp||t instanceof Dt&&t.bitWidth!==64||t instanceof $e&&t.bitWidth!==64||t instanceof ue&&t.precision!==bt.HALF))return new Ii(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Ii(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Wa(o)})}var Wa=class{constructor(t){this.vector=t,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=H;U.prototype.visitBool=H;U.prototype.visitInt=H;U.prototype.visitInt8=H;U.prototype.visitInt16=H;U.prototype.visitInt32=H;U.prototype.visitInt64=H;U.prototype.visitUint8=H;U.prototype.visitUint16=H;U.prototype.visitUint32=H;U.prototype.visitUint64=H;U.prototype.visitFloat=H;U.prototype.visitFloat16=H;U.prototype.visitFloat32=H;U.prototype.visitFloat64=H;U.prototype.visitUtf8=H;U.prototype.visitBinary=H;U.prototype.visitFixedSizeBinary=H;U.prototype.visitDate=H;U.prototype.visitDateDay=H;U.prototype.visitDateMillisecond=H;U.prototype.visitTimestamp=H;U.prototype.visitTimestampSecond=H;U.prototype.visitTimestampMillisecond=H;U.prototype.visitTimestampMicrosecond=H;U.prototype.visitTimestampNanosecond=H;U.prototype.visitTime=H;U.prototype.visitTimeSecond=H;U.prototype.visitTimeMillisecond=H;U.prototype.visitTimeMicrosecond=H;U.prototype.visitTimeNanosecond=H;U.prototype.visitDecimal=H;U.prototype.visitList=H;U.prototype.visitStruct=H;U.prototype.visitUnion=H;U.prototype.visitDenseUnion=H;U.prototype.visitSparseUnion=H;U.prototype.visitDictionary=H;U.prototype.visitInterval=H;U.prototype.visitIntervalDayTime=H;U.prototype.visitIntervalYearMonth=H;U.prototype.visitFixedSizeList=H;U.prototype.visitMap=H;var Vn=new U;var p_=(r,t)=>r+t,ar=class extends D{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===G.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+Fe.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+Fe.visit(i,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}},m_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),__=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),y_=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,c=Fe.getVisitFn(i.type),a=i.slice(s,o-s),f=8;for(let m=-1,y=o-s;++m<y;)f+=c(a,m);return f},b_=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=Fe.getVisitFn(n.type),o=0;for(let c=-1,a=i.length;++c<a;)o+=s(i,c);return o},g_=(r,t)=>r.type.mode===xt.Dense?bd(r,t):gd(r,t),bd=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+Fe.visit(t[s],n[i])},gd=({children:r},t)=>4+Fe.visitMany(r,r.map(()=>t)).reduce(p_,0);ar.prototype.visitUtf8=m_;ar.prototype.visitBinary=__;ar.prototype.visitList=y_;ar.prototype.visitFixedSizeList=b_;ar.prototype.visitUnion=g_;ar.prototype.visitDenseUnion=bd;ar.prototype.visitSparseUnion=gd;var Fe=new ar;var wd,vd={},Sd={},C=class{constructor(t){var e,n,i;let s=t[0]instanceof C?t.flatMap(c=>c.data):t;if(s.some(c=>!(c instanceof nt)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:c,set:a,indexOf:f,byteLength:m}=vd[o.typeId],y=s[0];this.isValid=b=>Ai(y,b),this.get=b=>c(y,b),this.set=(b,I)=>a(y,b,I),this.indexOf=b=>f(y,b),this.getByteLength=b=>m(y,b),this._offsets=[0,y.length];break}default:Object.setPrototypeOf(this,Sd[o.typeId]),this._offsets=io(s);break}this.data=s,this.type=o,this.stride=xe(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=no(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${h[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return Vn.visit(this)}concat(...t){return new C(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new C(vi(this,t,e,({data:n,_offsets:i},s,o)=>so(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:c})=>(o.array.set(c,o.offset),o.offset+=c.length,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new C(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return T.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(T.isDictionary(this.type)){let t=new Hn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new C(e)}return new Hn(this)}unmemoize(){if(T.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new C(e)}return this}};wd=Symbol.toStringTag;C[wd]=(r=>{r.type=T.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._nullCount=-1,r._byteLength=-1,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=Mt.getVisitFnByTypeId(e),i=Zt.getVisitFnByTypeId(e),s=yn.getVisitFnByTypeId(e),o=Fe.getVisitFnByTypeId(e);vd[e]={get:n,set:i,indexOf:s,byteLength:o},Sd[e]=Object.create(r,{isValid:{value:Yr(Ai)},get:{value:Yr(Mt.getVisitFnByTypeId(e))},set:{value:oo(Zt.getVisitFnByTypeId(e))},indexOf:{value:ao(yn.getVisitFnByTypeId(e))},getByteLength:{value:Yr(Fe.getVisitFnByTypeId(e))}})}return"Vector"})(C.prototype);var Hn=class extends C{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let c=s[o];if(c!==void 0)return c;let a=e.call(this,o);return s[o]=a,a}}),Object.defineProperty(this,"set",{value(o,c){n.call(this,o,c),s[o]=c}}),Object.defineProperty(this,"slice",{value:(o,c)=>new Hn(i.call(this,o,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new C(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Id(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
|
|
2
|
+
switch (x) {${e.map(n=>`
|
|
3
|
+
case ${w_(n)}:`).join("")}
|
|
4
4
|
return false;
|
|
5
|
-
}`),r.length!==
|
|
6
|
-
${
|
|
7
|
-
return true;`)}Qo.createIsValidFunction=$w;function Jw(r){return typeof r!="bigint"?Fu.valueToString(r):Gw.BigIntAvailable?`${Fu.valueToString(r)}n`:`"${Fu.valueToString(r)}"`}});var tn=w(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.WideBufferBuilder=Dt.OffsetsBufferBuilder=Dt.BitmapBufferBuilder=Dt.DataBufferBuilder=Dt.BufferBuilder=void 0;var Zp=Je(),Du=ut(),Ou=(r,e)=>(r*e+63&~63||64)/e,Kw=(r,e=0)=>r.length>=e?r.subarray(0,e):Zp.memcpy(new r.constructor(e),r,0),Bs=class{constructor(e,t=1){this.buffer=e,this.stride=t,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e.constructor,this._resize(this.length=e.length/t|0)}get byteLength(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(e,t){return this}append(e){return this.set(this.length,e)}reserve(e){if(e>0){this.length+=e;let t=this.stride,n=this.length*t,i=this.buffer.length;n>=i&&this._resize(i===0?Ou(n*1,this.BYTES_PER_ELEMENT):Ou(n*2,this.BYTES_PER_ELEMENT))}return this}flush(e=this.length){e=Ou(e*this.stride,this.BYTES_PER_ELEMENT);let t=Kw(this.buffer,e);return this.clear(),t}clear(){return this.length=0,this._resize(0),this}_resize(e){return this.buffer=Zp.memcpy(new this.ArrayType(e),this.buffer)}};Dt.BufferBuilder=Bs;Bs.prototype.offset=0;var ea=class extends Bs{last(){return this.get(this.length-1)}get(e){return this.buffer[e]}set(e,t){return this.reserve(e-this.length+1),this.buffer[e*this.stride]=t,this}};Dt.DataBufferBuilder=ea;var Qp=class extends ea{constructor(e=new Uint8Array(0)){super(e,1/8);this.numValid=0}get numInvalid(){return this.length-this.numValid}get(e){return this.buffer[e>>3]>>e%8&1}set(e,t){let{buffer:n}=this.reserve(e-this.length+1),i=e>>3,s=e%8,o=n[i]>>s&1;return t?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}};Dt.BitmapBufferBuilder=Qp;var ey=class extends ea{constructor(e=new Int32Array(1)){super(e,1)}append(e){return this.set(this.length-1,e)}set(e,t){let n=this.length-1,i=this.reserve(e-n+1).buffer;return n<e++&&i.fill(i[n],n,e),i[e]=i[e-1]+t,this}flush(e=this.length-1){return e>this.length&&this.set(e-1,0),super.flush(e+1)}};Dt.OffsetsBufferBuilder=ey;var ty=class extends Bs{get ArrayType64(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?Du.BigInt64Array:Du.BigUint64Array)}set(e,t){switch(this.reserve(e-this.length+1),typeof t){case"bigint":this.buffer64[e]=t;break;case"number":this.buffer[e*this.stride]=t;break;default:this.buffer.set(t,e*this.stride)}return this}_resize(e){let t=super._resize(e),n=t.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return Du.BigIntAvailable&&(this.buffer64=new this.ArrayType64(t.buffer,t.byteOffset,n)),t}};Dt.WideBufferBuilder=ty});var xe=w(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.VariableWidthBuilder=rn.FixedWidthBuilder=rn.Builder=void 0;var hi=ct(),Xw=je(),pi=we(),Zw=Jt(),Qw=Xp(),Mu=tn(),eB=he(),Ot=class{constructor({type:e,nullValues:t}){this.length=0,this.finished=!1,this.type=e,this.children=[],this.nullValues=t,this.stride=eB.strideForType(e),this._nulls=new Mu.BitmapBufferBuilder,t&&t.length>0&&(this._isValid=Qw.createIsValidFunction(t))}static new(e){}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e){throw new Error('"throughDOM" not available in this environment')}static throughIterable(e){return tB(e)}static throughAsyncIterable(e){return rB(e)}toVector(){return Xw.Vector.new(this.flush())}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let e=0;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),this._typeIds&&(e+=this._typeIds.byteLength),this.children.reduce((t,n)=>t+n.byteLength,e)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let e=0;return this._offsets&&(e+=this._offsets.reservedByteLength),this._values&&(e+=this._values.reservedByteLength),this._nulls&&(e+=this._nulls.reservedByteLength),this._typeIds&&(e+=this._typeIds.reservedByteLength),this.children.reduce((t,n)=>t+n.reservedByteLength,e)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(e){return this.set(this.length,e)}isValid(e){return this._isValid(e)}set(e,t){return this.setValid(e,this.isValid(t))&&this.setValue(e,t),this}setValue(e,t){this._setValue(this,e,t)}setValid(e,t){return this.length=this._nulls.set(e,+t).length,t}addChild(e,t=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(e){return this.children[e]||null}flush(){let e=[],t=this._values,n=this._offsets,i=this._typeIds,{length:s,nullCount:o}=this;i?(e[pi.BufferType.TYPE]=i.flush(s),n&&(e[pi.BufferType.OFFSET]=n.flush(s))):n?(t&&(e[pi.BufferType.DATA]=t.flush(n.last())),e[pi.BufferType.OFFSET]=n.flush(s)):t&&(e[pi.BufferType.DATA]=t.flush(s)),o>0&&(e[pi.BufferType.VALIDITY]=this._nulls.flush(s));let u=Zw.Data.new(this.type,0,s,o,e,this.children.map(a=>a.flush()));return this.clear(),u}finish(){return this.finished=!0,this.children.forEach(e=>e.finish()),this}clear(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach(e=>e.clear()),this}};rn.Builder=Ot;Ot.prototype.length=1;Ot.prototype.stride=1;Ot.prototype.children=null;Ot.prototype.finished=!1;Ot.prototype.nullValues=null;Ot.prototype._isValid=()=>!0;var ry=class extends Ot{constructor(e){super(e);this._values=new Mu.DataBufferBuilder(new this.ArrayType(0),this.stride)}setValue(e,t){let n=this._values;return n.reserve(e-n.length+1),super.setValue(e,t)}};rn.FixedWidthBuilder=ry;var ny=class extends Ot{constructor(e){super(e);this._pendingLength=0,this._offsets=new Mu.OffsetsBufferBuilder}setValue(e,t){let n=this._pending||(this._pending=new Map),i=n.get(e);i&&(this._pendingLength-=i.length),this._pendingLength+=t.length,n.set(e,t)}setValid(e,t){return super.setValid(e,t)?!0:((this._pending||(this._pending=new Map)).set(e,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let e=this._pending,t=this._pendingLength;return this._pendingLength=0,this._pending=void 0,e&&e.size>0&&this._flushPending(e,t),this}};rn.VariableWidthBuilder=ny;function tB(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?1e3:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function*(i){let s=0,o=Ot.new(r);for(let u of i)o.append(u)[n]>=t&&++s&&(yield o.toVector());(o.finish().length>0||s===0)&&(yield o.toVector())}}function rB(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?1e3:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function(i){return hi.__asyncGenerator(this,arguments,function*(){var s,o;let u=0,a=Ot.new(r);try{for(var h=hi.__asyncValues(i),_;_=yield hi.__await(h.next()),!_.done;){let T=_.value;a.append(T)[n]>=t&&++u&&(yield yield hi.__await(a.toVector()))}}catch(T){s={error:T}}finally{try{_&&!_.done&&(o=h.return)&&(yield hi.__await(o.call(h)))}finally{if(s)throw s.error}}(a.finish().length>0||u===0)&&(yield yield hi.__await(a.toVector()))})}}});var Eu=w(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.BoolBuilder=void 0;var nB=tn(),iB=xe(),iy=class extends iB.Builder{constructor(e){super(e);this._values=new nB.BitmapBufferBuilder}setValue(e,t){this._values.set(e,+t)}};ta.BoolBuilder=iy});var Uu=w(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.NullBuilder=void 0;var sB=xe(),sy=class extends sB.Builder{setValue(e,t){}setValid(e,t){return this.length=Math.max(e+1,this.length),t}};ra.NullBuilder=sy});var Ru=w(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.DateMillisecondBuilder=nn.DateDayBuilder=nn.DateBuilder=void 0;var oB=xe(),na=class extends oB.FixedWidthBuilder{};nn.DateBuilder=na;var oy=class extends na{};nn.DateDayBuilder=oy;var ay=class extends na{};nn.DateMillisecondBuilder=ay});var xu=w(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.DecimalBuilder=void 0;var aB=xe(),cy=class extends aB.FixedWidthBuilder{};ia.DecimalBuilder=cy});var Pu=w(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.DictionaryBuilder=void 0;var cB=he(),Vu=xe(),uy=class extends Vu.Builder{constructor({type:e,nullValues:t,dictionaryHashFunction:n}){super({type:new cB.Dictionary(e.dictionary,e.indices,e.id,e.isOrdered)});this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Vu.Builder.new({type:this.type.indices,nullValues:t}),this.dictionary=Vu.Builder.new({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(e){return this.indices.isValid(e)}setValid(e,t){let n=this.indices;return t=n.setValid(e,t),this.length=n.length,t}setValue(e,t){let n=this._keysToIndices,i=this.valueToKey(t),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(t).length-1),this.indices.setValue(e,s)}flush(){let e=this.type,t=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(e);return i.dictionary=t?t.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(e){return typeof e=="string"?e:`${e}`}};sa.DictionaryBuilder=uy});var Lu=w(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.FixedSizeBinaryBuilder=void 0;var uB=xe(),ly=class extends uB.FixedWidthBuilder{};oa.FixedSizeBinaryBuilder=ly});var Is=w(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.float64ToUint16=_i.uint16ToFloat64=void 0;var dy=new Float64Array(1),yi=new Uint32Array(dy.buffer);function lB(r){let e=(r&31744)>>10,t=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return n*(t?NaN:1/0);case 0:return n*(t?6103515625e-14*t:0)}return n*Math.pow(2,e-15)*(1+t)}_i.uint16ToFloat64=lB;function dB(r){if(r!==r)return 32256;dy[0]=r;let e=(yi[1]&2147483648)>>16&65535,t=yi[1]&2146435072,n=0;return t>=1089470464?yi[0]>0?t=31744:(t=(t&2080374784)>>16,n=(yi[1]&1048575)>>10):t<=1056964608?(n=1048576+(yi[1]&1048575),n=1048576+(n<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,n=(yi[1]&1048575)+512>>10),e|t|n&65535}_i.float64ToUint16=dB});var Nu=w(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.Float64Builder=lr.Float32Builder=lr.Float16Builder=lr.FloatBuilder=void 0;var fB=Is(),hB=xe(),Ts=class extends hB.FixedWidthBuilder{};lr.FloatBuilder=Ts;var fy=class extends Ts{setValue(e,t){this._values.set(e,fB.float64ToUint16(t))}};lr.Float16Builder=fy;var hy=class extends Ts{setValue(e,t){this._values.set(e,t)}};lr.Float32Builder=hy;var py=class extends Ts{setValue(e,t){this._values.set(e,t)}};lr.Float64Builder=py});var Fs=w(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.BN=Ke.bignumToBigInt=Ke.bignumToString=Ke.isArrowBigNumSymbol=void 0;var pB=Je(),Ss=ut();Ke.isArrowBigNumSymbol=Symbol.for("isArrowBigNum");function Kt(r,...e){return e.length===0?Object.setPrototypeOf(pB.toArrayBufferView(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}Kt.prototype[Ke.isArrowBigNumSymbol]=!0;Kt.prototype.toJSON=function(){return`"${Ke.bignumToString(this)}"`};Kt.prototype.valueOf=function(){return yy(this)};Kt.prototype.toString=function(){return Ke.bignumToString(this)};Kt.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return yy(this);case"string":return Ke.bignumToString(this);case"default":return Ke.bignumToBigInt(this)}return Ke.bignumToString(this)};function mi(...r){return Kt.apply(this,r)}function bi(...r){return Kt.apply(this,r)}function As(...r){return Kt.apply(this,r)}Object.setPrototypeOf(mi.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(bi.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(As.prototype,Object.create(Uint32Array.prototype));Object.assign(mi.prototype,Kt.prototype,{constructor:mi,signed:!0,TypedArray:Int32Array,BigIntArray:Ss.BigInt64Array});Object.assign(bi.prototype,Kt.prototype,{constructor:bi,signed:!1,TypedArray:Uint32Array,BigIntArray:Ss.BigUint64Array});Object.assign(As.prototype,Kt.prototype,{constructor:As,signed:!0,TypedArray:Uint32Array,BigIntArray:Ss.BigUint64Array});function yy(r){let{buffer:e,byteOffset:t,length:n,signed:i}=r,s=new Int32Array(e,t,n),o=0,u=0,a=s.length,h,_;for(;u<a;)_=s[u++],h=s[u++],i||(h=h>>>0),o+=(_>>>0)+h*Math.pow(u,32);return o}Ss.BigIntAvailable?(Ke.bignumToBigInt=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:ku(r),Ke.bignumToString=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:ku(r)):(Ke.bignumToString=ku,Ke.bignumToBigInt=Ke.bignumToString);function ku(r){let e="",t=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(t[0]=n[s=0];s<o;)n[s++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+n[s];n[s]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(i[0]||i[1]||i[2]||i[3]);return e||"0"}var aa=class{static new(e,t){switch(t){case!0:return new mi(e);case!1:return new bi(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case Ss.BigInt64Array:return new mi(e)}return e.byteLength===16?new As(e):new bi(e)}static signed(e){return new mi(e)}static unsigned(e){return new bi(e)}static decimal(e){return new As(e)}constructor(e,t){return aa.new(e,t)}};Ke.BN=aa});var Cu=w(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.Uint64Builder=Ye.Uint32Builder=Ye.Uint16Builder=Ye.Uint8Builder=Ye.Int64Builder=Ye.Int32Builder=Ye.Int16Builder=Ye.Int8Builder=Ye.IntBuilder=void 0;var yB=Fs(),_y=tn(),_B=ut(),mB=xe(),dr=class extends mB.FixedWidthBuilder{setValue(e,t){this._values.set(e,t)}};Ye.IntBuilder=dr;var my=class extends dr{};Ye.Int8Builder=my;var by=class extends dr{};Ye.Int16Builder=by;var gy=class extends dr{};Ye.Int32Builder=gy;var vy=class extends dr{constructor(e){e.nullValues&&(e.nullValues=e.nullValues.map(ca));super(e);this._values=new _y.WideBufferBuilder(new Int32Array(0),2)}get values64(){return this._values.buffer64}isValid(e){return super.isValid(ca(e))}};Ye.Int64Builder=vy;var wy=class extends dr{};Ye.Uint8Builder=wy;var By=class extends dr{};Ye.Uint16Builder=By;var Iy=class extends dr{};Ye.Uint32Builder=Iy;var Ty=class extends dr{constructor(e){e.nullValues&&(e.nullValues=e.nullValues.map(ca));super(e);this._values=new _y.WideBufferBuilder(new Uint32Array(0),2)}get values64(){return this._values.buffer64}isValid(e){return super.isValid(ca(e))}};Ye.Uint64Builder=Ty;var ca=(r=>e=>(ArrayBuffer.isView(e)&&(r.buffer=e.buffer,r.byteOffset=e.byteOffset,r.byteLength=e.byteLength,e=yB.bignumToBigInt(r),r.buffer=null),e))({BigIntArray:_B.BigInt64Array})});var ju=w(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.TimeNanosecondBuilder=Mt.TimeMicrosecondBuilder=Mt.TimeMillisecondBuilder=Mt.TimeSecondBuilder=Mt.TimeBuilder=void 0;var bB=xe(),gi=class extends bB.FixedWidthBuilder{};Mt.TimeBuilder=gi;var Sy=class extends gi{};Mt.TimeSecondBuilder=Sy;var Ay=class extends gi{};Mt.TimeMillisecondBuilder=Ay;var Fy=class extends gi{};Mt.TimeMicrosecondBuilder=Fy;var Dy=class extends gi{};Mt.TimeNanosecondBuilder=Dy});var qu=w(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.TimestampNanosecondBuilder=Et.TimestampMicrosecondBuilder=Et.TimestampMillisecondBuilder=Et.TimestampSecondBuilder=Et.TimestampBuilder=void 0;var gB=xe(),vi=class extends gB.FixedWidthBuilder{};Et.TimestampBuilder=vi;var Oy=class extends vi{};Et.TimestampSecondBuilder=Oy;var My=class extends vi{};Et.TimestampMillisecondBuilder=My;var Ey=class extends vi{};Et.TimestampMicrosecondBuilder=Ey;var Uy=class extends vi{};Et.TimestampNanosecondBuilder=Uy});var Hu=w(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.IntervalYearMonthBuilder=sn.IntervalDayTimeBuilder=sn.IntervalBuilder=void 0;var vB=xe(),ua=class extends vB.FixedWidthBuilder{};sn.IntervalBuilder=ua;var Ry=class extends ua{};sn.IntervalDayTimeBuilder=Ry;var xy=class extends ua{};sn.IntervalYearMonthBuilder=xy});var da=w(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.BinaryBuilder=void 0;var wB=Je(),BB=tn(),IB=xe(),Vy=class extends IB.VariableWidthBuilder{constructor(e){super(e);this._values=new BB.BufferBuilder(new Uint8Array(0))}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,wB.toUint8Array(t))}_flushPending(e,t){let n=this._offsets,i=this._values.reserve(t).buffer,s=0,o=0,u=0,a;for([s,a]of e)a===void 0?n.set(s,0):(o=a.length,i.set(a,u),n.set(s,o),u+=o)}};la.BinaryBuilder=Vy});var ha=w(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.Utf8Builder=void 0;var TB=xn(),SB=da(),AB=tn(),FB=xe(),zu=class extends FB.VariableWidthBuilder{constructor(e){super(e);this._values=new AB.BufferBuilder(new Uint8Array(0))}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,TB.encodeUtf8(t))}_flushPending(e,t){}};fa.Utf8Builder=zu;zu.prototype._flushPending=SB.BinaryBuilder.prototype._flushPending});var Wu=w(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.Run=void 0;var DB=je(),Py=class{get length(){return this._values.length}get(e){return this._values[e]}clear(){return this._values=null,this}bind(e){return e instanceof DB.Vector?e:(this._values=e,this)}};pa.Run=Py});var et=w(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.Field=wi.Schema=void 0;var OB=he(),Ut=class{constructor(e=[],t,n){this.fields=e||[],this.metadata=t||new Map,n||(n=Yu(e)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}select(...e){let t=e.reduce((n,i)=>(n[i]=!0)&&n,Object.create(null));return new Ut(this.fields.filter(n=>t[n.name]),this.metadata)}selectAt(...e){return new Ut(e.map(t=>this.fields[t]).filter(Boolean),this.metadata)}assign(...e){let t=e[0]instanceof Ut?e[0]:Array.isArray(e[0])?new Ut(e[0]):new Ut(e),n=[...this.fields],i=ya(ya(new Map,this.metadata),t.metadata),s=t.fields.filter(u=>{let a=n.findIndex(h=>h.name===u.name);return~a?(n[a]=u.clone({metadata:ya(ya(new Map,n[a].metadata),u.metadata)}))&&!1:!0}),o=Yu(s,new Map);return new Ut([...n,...s],i,new Map([...this.dictionaries,...o]))}};wi.Schema=Ut;var Mr=class{constructor(e,t,n=!1,i){this.name=e,this.type=t,this.nullable=n,this.metadata=i||new Map}static new(...e){let[t,n,i,s]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],n===void 0&&(n=e[0].type),i===void 0&&(i=e[0].nullable),s===void 0&&(s=e[0].metadata)),new Mr(`${t}`,n,i,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[t,n,i,s]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,n=this.type,i=this.nullable,s=this.metadata]=e:{name:t=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=e[0],Mr.new(t,n,i,s)}};wi.Field=Mr;function ya(r,e){return new Map([...r||new Map,...e||new Map])}function Yu(r,e=new Map){for(let t=-1,n=r.length;++t<n;){let s=r[t].type;if(OB.DataType.isDictionary(s)){if(!e.has(s.id))e.set(s.id,s.dictionary);else if(e.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Yu(s.children,e)}return e}Ut.prototype.fields=null;Ut.prototype.metadata=null;Ut.prototype.dictionaries=null;Mr.prototype.type=null;Mr.prototype.name=null;Mr.prototype.nullable=null;Mr.prototype.metadata=null});var Gu=w(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.ListBuilder=void 0;var MB=Wu(),EB=et(),UB=he(),RB=tn(),xB=xe(),Ly=class extends xB.VariableWidthBuilder{constructor(e){super(e);this._run=new MB.Run,this._offsets=new RB.OffsetsBufferBuilder}addChild(e,t="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new UB.List(new EB.Field(t,e.type,!0)),this.numChildren-1}clear(){return this._run.clear(),super.clear()}_flushPending(e){let t=this._run,n=this._offsets,i=this._setValue,s=0,o;for([s,o]of e)o===void 0?n.set(s,0):(n.set(s,o.length),i(this,s,t.bind(o)))}};_a.ListBuilder=Ly});var $u=w(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.FixedSizeListBuilder=void 0;var VB=Wu(),PB=et(),LB=xe(),NB=he(),Ny=class extends LB.Builder{constructor(){super(...arguments);this._run=new VB.Run}setValue(e,t){super.setValue(e,this._run.bind(t))}addChild(e,t="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(e);return this.type=new NB.FixedSizeList(this.type.listSize,new PB.Field(t,e.type,!0)),n}clear(){return this._run.clear(),super.clear()}};ma.FixedSizeListBuilder=Ny});var Ju=w(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.MapBuilder=void 0;var kB=et(),CB=he(),jB=xe(),ky=class extends jB.VariableWidthBuilder{set(e,t){return super.set(e,t)}setValue(e,t){t=t instanceof Map?t:new Map(Object.entries(t));let n=this._pending||(this._pending=new Map),i=n.get(e);i&&(this._pendingLength-=i.size),this._pendingLength+=t.size,n.set(e,t)}addChild(e,t=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new CB.Map_(new kB.Field(t,e.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(e){let t=this._offsets,n=this._setValue;e.forEach((i,s)=>{i===void 0?t.set(s,0):(t.set(s,i.size),n(this,s,i))})}};ba.MapBuilder=ky});var Ku=w(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.StructBuilder=void 0;var qB=et(),HB=xe(),zB=he(),Cy=class extends HB.Builder{addChild(e,t=`${this.numChildren}`){let n=this.children.push(e);return this.type=new zB.Struct([...this.type.children,new qB.Field(t,e.type,!0)]),n}};ga.StructBuilder=Cy});var Xu=w(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.DenseUnionBuilder=on.SparseUnionBuilder=on.UnionBuilder=void 0;var WB=et(),jy=tn(),YB=xe(),GB=he(),va=class extends YB.Builder{constructor(e){super(e);this._typeIds=new jy.DataBufferBuilder(new Int8Array(0),1),typeof e.valueToChildTypeId=="function"&&(this._valueToChildTypeId=e.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(e,t){return this.set(this.length,e,t)}set(e,t,n){return n===void 0&&(n=this._valueToChildTypeId(this,t,e)),this.setValid(e,this.isValid(t))&&this.setValue(e,t,n),this}setValue(e,t,n){this._typeIds.set(e,n),super.setValue(e,t)}addChild(e,t=`${this.children.length}`){let n=this.children.push(e),{type:{children:i,mode:s,typeIds:o}}=this,u=[...i,new WB.Field(t,e.type)];return this.type=new GB.Union(s,[...o,n],u),n}_valueToChildTypeId(e,t,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}};on.UnionBuilder=va;var qy=class extends va{};on.SparseUnionBuilder=qy;var Hy=class extends va{constructor(e){super(e);this._offsets=new jy.DataBufferBuilder(new Int32Array(0))}setValue(e,t,n){let i=this.type.typeIdToChildIndex[n];return this._offsets.set(e,this.getChildAt(i).length),super.setValue(e,t,n)}};on.DenseUnionBuilder=Hy});var it=w(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.Visitor=void 0;var $B=Jt(),JB=je(),g=we(),KB=he(),ve=class{visitMany(e,...t){return e.map((n,i)=>this.visit(n,...t.map(s=>s[i])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return XB(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}visitBinary(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}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};wa.Visitor=ve;function XB(r,e,t=!0){let n=null,i=g.Type.NONE;switch(e instanceof $B.Data||e instanceof JB.Vector?i=Zu(e.type):e instanceof KB.DataType?i=Zu(e):typeof(i=e)!="number"&&(i=g.Type[e]),i){case g.Type.Null:n=r.visitNull;break;case g.Type.Bool:n=r.visitBool;break;case g.Type.Int:n=r.visitInt;break;case g.Type.Int8:n=r.visitInt8||r.visitInt;break;case g.Type.Int16:n=r.visitInt16||r.visitInt;break;case g.Type.Int32:n=r.visitInt32||r.visitInt;break;case g.Type.Int64:n=r.visitInt64||r.visitInt;break;case g.Type.Uint8:n=r.visitUint8||r.visitInt;break;case g.Type.Uint16:n=r.visitUint16||r.visitInt;break;case g.Type.Uint32:n=r.visitUint32||r.visitInt;break;case g.Type.Uint64:n=r.visitUint64||r.visitInt;break;case g.Type.Float:n=r.visitFloat;break;case g.Type.Float16:n=r.visitFloat16||r.visitFloat;break;case g.Type.Float32:n=r.visitFloat32||r.visitFloat;break;case g.Type.Float64:n=r.visitFloat64||r.visitFloat;break;case g.Type.Utf8:n=r.visitUtf8;break;case g.Type.Binary:n=r.visitBinary;break;case g.Type.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case g.Type.Date:n=r.visitDate;break;case g.Type.DateDay:n=r.visitDateDay||r.visitDate;break;case g.Type.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case g.Type.Timestamp:n=r.visitTimestamp;break;case g.Type.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case g.Type.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case g.Type.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case g.Type.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case g.Type.Time:n=r.visitTime;break;case g.Type.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case g.Type.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case g.Type.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case g.Type.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case g.Type.Decimal:n=r.visitDecimal;break;case g.Type.List:n=r.visitList;break;case g.Type.Struct:n=r.visitStruct;break;case g.Type.Union:n=r.visitUnion;break;case g.Type.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case g.Type.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case g.Type.Dictionary:n=r.visitDictionary;break;case g.Type.Interval:n=r.visitInterval;break;case g.Type.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case g.Type.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case g.Type.FixedSizeList:n=r.visitFixedSizeList;break;case g.Type.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!t)return()=>null;throw new Error(`Unrecognized type '${g.Type[i]}'`)}function Zu(r){switch(r.typeId){case g.Type.Null:return g.Type.Null;case g.Type.Int:{let{bitWidth:e,isSigned:t}=r;switch(e){case 8:return t?g.Type.Int8:g.Type.Uint8;case 16:return t?g.Type.Int16:g.Type.Uint16;case 32:return t?g.Type.Int32:g.Type.Uint32;case 64:return t?g.Type.Int64:g.Type.Uint64}return g.Type.Int}case g.Type.Float:switch(r.precision){case g.Precision.HALF:return g.Type.Float16;case g.Precision.SINGLE:return g.Type.Float32;case g.Precision.DOUBLE:return g.Type.Float64}return g.Type.Float;case g.Type.Binary:return g.Type.Binary;case g.Type.Utf8:return g.Type.Utf8;case g.Type.Bool:return g.Type.Bool;case g.Type.Decimal:return g.Type.Decimal;case g.Type.Time:switch(r.unit){case g.TimeUnit.SECOND:return g.Type.TimeSecond;case g.TimeUnit.MILLISECOND:return g.Type.TimeMillisecond;case g.TimeUnit.MICROSECOND:return g.Type.TimeMicrosecond;case g.TimeUnit.NANOSECOND:return g.Type.TimeNanosecond}return g.Type.Time;case g.Type.Timestamp:switch(r.unit){case g.TimeUnit.SECOND:return g.Type.TimestampSecond;case g.TimeUnit.MILLISECOND:return g.Type.TimestampMillisecond;case g.TimeUnit.MICROSECOND:return g.Type.TimestampMicrosecond;case g.TimeUnit.NANOSECOND:return g.Type.TimestampNanosecond}return g.Type.Timestamp;case g.Type.Date:switch(r.unit){case g.DateUnit.DAY:return g.Type.DateDay;case g.DateUnit.MILLISECOND:return g.Type.DateMillisecond}return g.Type.Date;case g.Type.Interval:switch(r.unit){case g.IntervalUnit.DAY_TIME:return g.Type.IntervalDayTime;case g.IntervalUnit.YEAR_MONTH:return g.Type.IntervalYearMonth}return g.Type.Interval;case g.Type.Map:return g.Type.Map;case g.Type.List:return g.Type.List;case g.Type.Struct:return g.Type.Struct;case g.Type.Union:switch(r.mode){case g.UnionMode.Dense:return g.Type.DenseUnion;case g.UnionMode.Sparse:return g.Type.SparseUnion}return g.Type.Union;case g.Type.FixedSizeBinary:return g.Type.FixedSizeBinary;case g.Type.FixedSizeList:return g.Type.FixedSizeList;case g.Type.Dictionary:return g.Type.Dictionary}throw new Error(`Unrecognized type '${g.Type[r.typeId]}'`)}ve.prototype.visitInt8=null;ve.prototype.visitInt16=null;ve.prototype.visitInt32=null;ve.prototype.visitInt64=null;ve.prototype.visitUint8=null;ve.prototype.visitUint16=null;ve.prototype.visitUint32=null;ve.prototype.visitUint64=null;ve.prototype.visitFloat16=null;ve.prototype.visitFloat32=null;ve.prototype.visitFloat64=null;ve.prototype.visitDateDay=null;ve.prototype.visitDateMillisecond=null;ve.prototype.visitTimestampSecond=null;ve.prototype.visitTimestampMillisecond=null;ve.prototype.visitTimestampMicrosecond=null;ve.prototype.visitTimestampNanosecond=null;ve.prototype.visitTimeSecond=null;ve.prototype.visitTimeMillisecond=null;ve.prototype.visitTimeMicrosecond=null;ve.prototype.visitTimeNanosecond=null;ve.prototype.visitDenseUnion=null;ve.prototype.visitSparseUnion=null;ve.prototype.visitIntervalDayTime=null;ve.prototype.visitIntervalYearMonth=null});var tl=w(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.instance=Bi.SetVisitor=void 0;var ZB=je(),QB=it(),eI=xn(),tI=Is(),rI=Je(),Rt=we(),X=class extends QB.Visitor{};Bi.SetVisitor=X;var nI=(r,e,t)=>{r[e]=t/864e5|0},Qu=(r,e,t)=>{r[e]=t%4294967296|0,r[e+1]=t/4294967296|0},iI=(r,e,t)=>{r[e]=t*1e3%4294967296|0,r[e+1]=t*1e3/4294967296|0},sI=(r,e,t)=>{r[e]=t*1e6%4294967296|0,r[e+1]=t*1e6/4294967296|0},zy=(r,e,t,n)=>{let{[t]:i,[t+1]:s}=e;i!=null&&s!=null&&r.set(n.subarray(0,s-i),i)},oI=({offset:r,values:e},t,n)=>{let i=r+t;n?e[i>>3]|=1<<i%8:e[i>>3]&=~(1<<i%8)},Wy=({values:r},e,t)=>{nI(r,e,t.valueOf())},Yy=({values:r},e,t)=>{Qu(r,e*2,t.valueOf())},fr=({stride:r,values:e},t,n)=>{e[r*t]=n},Gy=({stride:r,values:e},t,n)=>{e[r*t]=tI.float64ToUint16(n)},el=(r,e,t)=>{switch(typeof t){case"bigint":r.values64[e]=t;break;case"number":r.values[e*r.stride]=t;break;default:{let n=t,{stride:i,ArrayType:s}=r,o=rI.toArrayBufferView(s,n);r.values.set(o.subarray(0,i),i*e)}}},aI=({stride:r,values:e},t,n)=>{e.set(n.subarray(0,r),r*t)},cI=({values:r,valueOffsets:e},t,n)=>zy(r,e,t,n),uI=({values:r,valueOffsets:e},t,n)=>{zy(r,e,t,eI.encodeUtf8(n))},lI=(r,e,t)=>{r.type.bitWidth<64?fr(r,e,t):el(r,e,t)},dI=(r,e,t)=>{r.type.precision!==Rt.Precision.HALF?fr(r,e,t):Gy(r,e,t)},fI=(r,e,t)=>{r.type.unit===Rt.DateUnit.DAY?Wy(r,e,t):Yy(r,e,t)},$y=({values:r},e,t)=>Qu(r,e*2,t/1e3),Jy=({values:r},e,t)=>Qu(r,e*2,t),Ky=({values:r},e,t)=>iI(r,e*2,t),Xy=({values:r},e,t)=>sI(r,e*2,t),hI=(r,e,t)=>{switch(r.type.unit){case Rt.TimeUnit.SECOND:return $y(r,e,t);case Rt.TimeUnit.MILLISECOND:return Jy(r,e,t);case Rt.TimeUnit.MICROSECOND:return Ky(r,e,t);case Rt.TimeUnit.NANOSECOND:return Xy(r,e,t)}},Zy=({values:r,stride:e},t,n)=>{r[e*t]=n},Qy=({values:r,stride:e},t,n)=>{r[e*t]=n},e_=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},t_=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},pI=(r,e,t)=>{switch(r.type.unit){case Rt.TimeUnit.SECOND:return Zy(r,e,t);case Rt.TimeUnit.MILLISECOND:return Qy(r,e,t);case Rt.TimeUnit.MICROSECOND:return e_(r,e,t);case Rt.TimeUnit.NANOSECOND:return t_(r,e,t)}},yI=({values:r},e,t)=>{r.set(t.subarray(0,4),4*e)},_I=(r,e,t)=>{let n=r.getChildAt(0),i=r.valueOffsets;for(let s=-1,o=i[e],u=i[e+1];o<u;)n.set(o++,t.get(++s))},mI=(r,e,t)=>{let n=r.getChildAt(0),i=r.valueOffsets,s=t instanceof Map?[...t]:Object.entries(t);for(let o=-1,u=i[e],a=i[e+1];u<a;)n.set(u++,s[++o])},bI=(r,e)=>(t,n,i)=>t==null?void 0:t.set(r,e[i]),gI=(r,e)=>(t,n,i)=>t==null?void 0:t.set(r,e.get(i)),vI=(r,e)=>(t,n,i)=>t==null?void 0:t.set(r,e.get(n.name)),wI=(r,e)=>(t,n,i)=>t==null?void 0:t.set(r,e[n.name]),BI=(r,e,t)=>{let n=t instanceof Map?vI(e,t):t instanceof ZB.Vector?gI(e,t):Array.isArray(t)?bI(e,t):wI(e,t);r.type.children.forEach((i,s)=>n(r.getChildAt(s),i,s))},II=(r,e,t)=>{r.type.mode===Rt.UnionMode.Dense?r_(r,e,t):n_(r,e,t)},r_=(r,e,t)=>{let n=r.typeIdToChildIndex[r.typeIds[e]],i=r.getChildAt(n);i&&i.set(r.valueOffsets[e],t)},n_=(r,e,t)=>{let n=r.typeIdToChildIndex[r.typeIds[e]],i=r.getChildAt(n);i&&i.set(e,t)},TI=(r,e,t)=>{let n=r.getKey(e);n!==null&&r.setValue(n,t)},SI=(r,e,t)=>{r.type.unit===Rt.IntervalUnit.DAY_TIME?i_(r,e,t):s_(r,e,t)},i_=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},s_=({values:r},e,t)=>{r[e]=t[0]*12+t[1]%12},AI=(r,e,t)=>{let n=r.getChildAt(0),{stride:i}=r;for(let s=-1,o=e*i;++s<i;)n.set(o+s,t.get(s))};X.prototype.visitBool=oI;X.prototype.visitInt=lI;X.prototype.visitInt8=fr;X.prototype.visitInt16=fr;X.prototype.visitInt32=fr;X.prototype.visitInt64=el;X.prototype.visitUint8=fr;X.prototype.visitUint16=fr;X.prototype.visitUint32=fr;X.prototype.visitUint64=el;X.prototype.visitFloat=dI;X.prototype.visitFloat16=Gy;X.prototype.visitFloat32=fr;X.prototype.visitFloat64=fr;X.prototype.visitUtf8=uI;X.prototype.visitBinary=cI;X.prototype.visitFixedSizeBinary=aI;X.prototype.visitDate=fI;X.prototype.visitDateDay=Wy;X.prototype.visitDateMillisecond=Yy;X.prototype.visitTimestamp=hI;X.prototype.visitTimestampSecond=$y;X.prototype.visitTimestampMillisecond=Jy;X.prototype.visitTimestampMicrosecond=Ky;X.prototype.visitTimestampNanosecond=Xy;X.prototype.visitTime=pI;X.prototype.visitTimeSecond=Zy;X.prototype.visitTimeMillisecond=Qy;X.prototype.visitTimeMicrosecond=e_;X.prototype.visitTimeNanosecond=t_;X.prototype.visitDecimal=yI;X.prototype.visitList=_I;X.prototype.visitStruct=BI;X.prototype.visitUnion=II;X.prototype.visitDenseUnion=r_;X.prototype.visitSparseUnion=n_;X.prototype.visitDictionary=TI;X.prototype.visitInterval=SI;X.prototype.visitIntervalDayTime=i_;X.prototype.visitIntervalYearMonth=s_;X.prototype.visitFixedSizeList=AI;X.prototype.visitMap=mI;Bi.instance=new X});var o_=w(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.instance=Ii.GetBuilderCtor=void 0;var FI=it(),DI=da(),OI=Eu(),rl=Ru(),MI=xu(),EI=Pu(),UI=Lu(),RI=$u(),Ba=Nu(),nl=Hu(),Er=Cu(),xI=Gu(),VI=Ju(),PI=Uu(),LI=Ku(),Ds=qu(),Os=ju(),il=Xu(),NI=ha(),sl=class extends FI.Visitor{visitNull(){return PI.NullBuilder}visitBool(){return OI.BoolBuilder}visitInt(){return Er.IntBuilder}visitInt8(){return Er.Int8Builder}visitInt16(){return Er.Int16Builder}visitInt32(){return Er.Int32Builder}visitInt64(){return Er.Int64Builder}visitUint8(){return Er.Uint8Builder}visitUint16(){return Er.Uint16Builder}visitUint32(){return Er.Uint32Builder}visitUint64(){return Er.Uint64Builder}visitFloat(){return Ba.FloatBuilder}visitFloat16(){return Ba.Float16Builder}visitFloat32(){return Ba.Float32Builder}visitFloat64(){return Ba.Float64Builder}visitUtf8(){return NI.Utf8Builder}visitBinary(){return DI.BinaryBuilder}visitFixedSizeBinary(){return UI.FixedSizeBinaryBuilder}visitDate(){return rl.DateBuilder}visitDateDay(){return rl.DateDayBuilder}visitDateMillisecond(){return rl.DateMillisecondBuilder}visitTimestamp(){return Ds.TimestampBuilder}visitTimestampSecond(){return Ds.TimestampSecondBuilder}visitTimestampMillisecond(){return Ds.TimestampMillisecondBuilder}visitTimestampMicrosecond(){return Ds.TimestampMicrosecondBuilder}visitTimestampNanosecond(){return Ds.TimestampNanosecondBuilder}visitTime(){return Os.TimeBuilder}visitTimeSecond(){return Os.TimeSecondBuilder}visitTimeMillisecond(){return Os.TimeMillisecondBuilder}visitTimeMicrosecond(){return Os.TimeMicrosecondBuilder}visitTimeNanosecond(){return Os.TimeNanosecondBuilder}visitDecimal(){return MI.DecimalBuilder}visitList(){return xI.ListBuilder}visitStruct(){return LI.StructBuilder}visitUnion(){return il.UnionBuilder}visitDenseUnion(){return il.DenseUnionBuilder}visitSparseUnion(){return il.SparseUnionBuilder}visitDictionary(){return EI.DictionaryBuilder}visitInterval(){return nl.IntervalBuilder}visitIntervalDayTime(){return nl.IntervalDayTimeBuilder}visitIntervalYearMonth(){return nl.IntervalYearMonthBuilder}visitFixedSizeList(){return RI.FixedSizeListBuilder}visitMap(){return VI.MapBuilder}};Ii.GetBuilderCtor=sl;Ii.instance=new sl});var Ta=w(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.DenseUnionBuilder=D.SparseUnionBuilder=D.UnionBuilder=D.StructBuilder=D.MapBuilder=D.FixedSizeListBuilder=D.ListBuilder=D.BinaryBuilder=D.Utf8Builder=D.IntervalYearMonthBuilder=D.IntervalDayTimeBuilder=D.IntervalBuilder=D.TimestampNanosecondBuilder=D.TimestampMicrosecondBuilder=D.TimestampMillisecondBuilder=D.TimestampSecondBuilder=D.TimestampBuilder=D.TimeNanosecondBuilder=D.TimeMicrosecondBuilder=D.TimeMillisecondBuilder=D.TimeSecondBuilder=D.TimeBuilder=D.Uint64Builder=D.Uint32Builder=D.Uint16Builder=D.Uint8Builder=D.Int64Builder=D.Int32Builder=D.Int16Builder=D.Int8Builder=D.IntBuilder=D.Float64Builder=D.Float32Builder=D.Float16Builder=D.FloatBuilder=D.FixedSizeBinaryBuilder=D.DictionaryBuilder=D.DecimalBuilder=D.DateMillisecondBuilder=D.DateDayBuilder=D.DateBuilder=D.NullBuilder=D.BoolBuilder=D.Builder=void 0;var kI=xe();Object.defineProperty(D,"Builder",{enumerable:!0,get:function(){return kI.Builder}});var CI=Eu();Object.defineProperty(D,"BoolBuilder",{enumerable:!0,get:function(){return CI.BoolBuilder}});var jI=Uu();Object.defineProperty(D,"NullBuilder",{enumerable:!0,get:function(){return jI.NullBuilder}});var ol=Ru();Object.defineProperty(D,"DateBuilder",{enumerable:!0,get:function(){return ol.DateBuilder}});Object.defineProperty(D,"DateDayBuilder",{enumerable:!0,get:function(){return ol.DateDayBuilder}});Object.defineProperty(D,"DateMillisecondBuilder",{enumerable:!0,get:function(){return ol.DateMillisecondBuilder}});var qI=xu();Object.defineProperty(D,"DecimalBuilder",{enumerable:!0,get:function(){return qI.DecimalBuilder}});var HI=Pu();Object.defineProperty(D,"DictionaryBuilder",{enumerable:!0,get:function(){return HI.DictionaryBuilder}});var zI=Lu();Object.defineProperty(D,"FixedSizeBinaryBuilder",{enumerable:!0,get:function(){return zI.FixedSizeBinaryBuilder}});var Ia=Nu();Object.defineProperty(D,"FloatBuilder",{enumerable:!0,get:function(){return Ia.FloatBuilder}});Object.defineProperty(D,"Float16Builder",{enumerable:!0,get:function(){return Ia.Float16Builder}});Object.defineProperty(D,"Float32Builder",{enumerable:!0,get:function(){return Ia.Float32Builder}});Object.defineProperty(D,"Float64Builder",{enumerable:!0,get:function(){return Ia.Float64Builder}});var Ur=Cu();Object.defineProperty(D,"IntBuilder",{enumerable:!0,get:function(){return Ur.IntBuilder}});Object.defineProperty(D,"Int8Builder",{enumerable:!0,get:function(){return Ur.Int8Builder}});Object.defineProperty(D,"Int16Builder",{enumerable:!0,get:function(){return Ur.Int16Builder}});Object.defineProperty(D,"Int32Builder",{enumerable:!0,get:function(){return Ur.Int32Builder}});Object.defineProperty(D,"Int64Builder",{enumerable:!0,get:function(){return Ur.Int64Builder}});Object.defineProperty(D,"Uint8Builder",{enumerable:!0,get:function(){return Ur.Uint8Builder}});Object.defineProperty(D,"Uint16Builder",{enumerable:!0,get:function(){return Ur.Uint16Builder}});Object.defineProperty(D,"Uint32Builder",{enumerable:!0,get:function(){return Ur.Uint32Builder}});Object.defineProperty(D,"Uint64Builder",{enumerable:!0,get:function(){return Ur.Uint64Builder}});var Ms=ju();Object.defineProperty(D,"TimeBuilder",{enumerable:!0,get:function(){return Ms.TimeBuilder}});Object.defineProperty(D,"TimeSecondBuilder",{enumerable:!0,get:function(){return Ms.TimeSecondBuilder}});Object.defineProperty(D,"TimeMillisecondBuilder",{enumerable:!0,get:function(){return Ms.TimeMillisecondBuilder}});Object.defineProperty(D,"TimeMicrosecondBuilder",{enumerable:!0,get:function(){return Ms.TimeMicrosecondBuilder}});Object.defineProperty(D,"TimeNanosecondBuilder",{enumerable:!0,get:function(){return Ms.TimeNanosecondBuilder}});var Es=qu();Object.defineProperty(D,"TimestampBuilder",{enumerable:!0,get:function(){return Es.TimestampBuilder}});Object.defineProperty(D,"TimestampSecondBuilder",{enumerable:!0,get:function(){return Es.TimestampSecondBuilder}});Object.defineProperty(D,"TimestampMillisecondBuilder",{enumerable:!0,get:function(){return Es.TimestampMillisecondBuilder}});Object.defineProperty(D,"TimestampMicrosecondBuilder",{enumerable:!0,get:function(){return Es.TimestampMicrosecondBuilder}});Object.defineProperty(D,"TimestampNanosecondBuilder",{enumerable:!0,get:function(){return Es.TimestampNanosecondBuilder}});var al=Hu();Object.defineProperty(D,"IntervalBuilder",{enumerable:!0,get:function(){return al.IntervalBuilder}});Object.defineProperty(D,"IntervalDayTimeBuilder",{enumerable:!0,get:function(){return al.IntervalDayTimeBuilder}});Object.defineProperty(D,"IntervalYearMonthBuilder",{enumerable:!0,get:function(){return al.IntervalYearMonthBuilder}});var WI=ha();Object.defineProperty(D,"Utf8Builder",{enumerable:!0,get:function(){return WI.Utf8Builder}});var YI=da();Object.defineProperty(D,"BinaryBuilder",{enumerable:!0,get:function(){return YI.BinaryBuilder}});var GI=Gu();Object.defineProperty(D,"ListBuilder",{enumerable:!0,get:function(){return GI.ListBuilder}});var $I=$u();Object.defineProperty(D,"FixedSizeListBuilder",{enumerable:!0,get:function(){return $I.FixedSizeListBuilder}});var JI=Ju();Object.defineProperty(D,"MapBuilder",{enumerable:!0,get:function(){return JI.MapBuilder}});var KI=Ku();Object.defineProperty(D,"StructBuilder",{enumerable:!0,get:function(){return KI.StructBuilder}});var cl=Xu();Object.defineProperty(D,"UnionBuilder",{enumerable:!0,get:function(){return cl.UnionBuilder}});Object.defineProperty(D,"SparseUnionBuilder",{enumerable:!0,get:function(){return cl.SparseUnionBuilder}});Object.defineProperty(D,"DenseUnionBuilder",{enumerable:!0,get:function(){return cl.DenseUnionBuilder}});var ul=we(),XI=ha(),ZI=xe(),a_=tl(),c_=o_();ZI.Builder.new=u_;function u_(r){let e=r.type,t=new(c_.instance.getVisitFn(e)())(r);if(e.children&&e.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,u)=>n[u]||i:({name:o})=>n[o]||i;e.children.forEach((o,u)=>{let{type:a}=o,h=s(o,u);t.children.push(u_(Object.assign(Object.assign({},h),{type:a})))})}return t}Object.keys(ul.Type).map(r=>ul.Type[r]).filter(r=>typeof r=="number"&&r!==ul.Type.NONE).forEach(r=>{let e=c_.instance.visit(r);e.prototype._setValue=a_.instance.getVisitFn(r)});XI.Utf8Builder.prototype._setValue=a_.instance.visitBinary});var l_=w(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.Block=Ti.Footer=void 0;var QI=Ar(),Sa=Zr(),xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(e,t){return(t||new xt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,t){return e.setPosition(e.position()+QI.flatbuffers.SIZE_PREFIX_LENGTH),(t||new xt).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Sa.MetadataVersion.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Sa.Schema).__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 Aa).__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 Aa).__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 Sa.KeyValue).__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,Sa.MetadataVersion.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)}static createFooter(e,t,n,i,s,o){return xt.startFooter(e),xt.addVersion(e,t),xt.addSchema(e,n),xt.addDictionaries(e,i),xt.addRecordBatches(e,s),xt.addCustomMetadata(e,o),xt.endFooter(e)}};Ti.Footer=xt;var Aa=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 createBlock(e,t,n,i){return e.prep(8,24),e.writeInt64(i),e.pad(4),e.writeInt32(n),e.writeInt64(t),e.offset()}};Ti.Block=Aa});var fl=w(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.FileBlock=Si.Footer=void 0;var Xt=l_(),ll=Ar(),d_=ll.flatbuffers.Long,eT=ll.flatbuffers.Builder,tT=ll.flatbuffers.ByteBuffer,f_=et(),h_=we(),rT=Je(),dl=class{constructor(e,t=h_.MetadataVersion.V4,n,i){this.schema=e,this.version=t,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(e){e=new tT(rT.toUint8Array(e));let t=Xt.Footer.getRootAsFooter(e),n=f_.Schema.decode(t.schema());return new p_(n,t)}static encode(e){let t=new eT,n=f_.Schema.encode(t,e.schema);Xt.Footer.startRecordBatchesVector(t,e.numRecordBatches),[...e.recordBatches()].slice().reverse().forEach(o=>an.encode(t,o));let i=t.endVector();Xt.Footer.startDictionariesVector(t,e.numDictionaries),[...e.dictionaryBatches()].slice().reverse().forEach(o=>an.encode(t,o));let s=t.endVector();return Xt.Footer.startFooter(t),Xt.Footer.addSchema(t,n),Xt.Footer.addVersion(t,h_.MetadataVersion.V4),Xt.Footer.addRecordBatches(t,i),Xt.Footer.addDictionaries(t,s),Xt.Footer.finishFooterBuffer(t,Xt.Footer.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*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}};Si.Footer=dl;var p_=class extends dl{constructor(e,t){super(e,t.version());this._footer=t}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return an.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return an.decode(t)}return null}},an=class{constructor(e,t,n){this.metaDataLength=e,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof t=="number"?t:t.low}static decode(e){return new an(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){let{metaDataLength:n}=t,i=new d_(t.offset,0),s=new d_(t.bodyLength,0);return Xt.Block.createBlock(e,i,n,s)}};Si.FileBlock=an});var fn=w(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.AsyncByteStream=dn.ByteStream=dn.AsyncByteQueue=void 0;var cn=ct(),un=ws(),y_=xn(),Us=ai(),hl=Je(),Ai=ut(),pl=class extends Us.AsyncQueue{write(e){if((e=hl.toUint8Array(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?y_.decodeUtf8(this.toUint8Array(!0)):this.toUint8Array(!1).then(y_.decodeUtf8)}toUint8Array(e=!1){return e?hl.joinUint8Arrays(this._values)[0]:(()=>cn.__awaiter(this,void 0,void 0,function*(){var t,n;let i=[],s=0;try{for(var o=cn.__asyncValues(this),u;u=yield o.next(),!u.done;){let a=u.value;i.push(a),s+=a.byteLength}}catch(a){t={error:a}}finally{try{u&&!u.done&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return hl.joinUint8Arrays(i,s)[0]}))()}};dn.AsyncByteQueue=pl;var __=class{constructor(e){e&&(this.source=new m_(un.default.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)}};dn.ByteStream=__;var Fa=class{constructor(e){e instanceof Fa?this.source=e.source:e instanceof pl?this.source=new ln(un.default.fromAsyncIterable(e)):Ai.isReadableNodeStream(e)?this.source=new ln(un.default.fromNodeStream(e)):Ai.isReadableDOMStream(e)?this.source=new ln(un.default.fromDOMStream(e)):Ai.isFetchResponse(e)?this.source=new ln(un.default.fromDOMStream(e.body)):Ai.isIterable(e)?this.source=new ln(un.default.fromIterable(e)):Ai.isPromise(e)?this.source=new ln(un.default.fromAsyncIterable(e)):Ai.isAsyncIterable(e)&&(this.source=new ln(un.default.fromAsyncIterable(e)))}[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)}};dn.AsyncByteStream=Fa;var m_=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)||Us.ITERATOR_DONE)}return(e){return Object.create(this.source.return&&this.source.return(e)||Us.ITERATOR_DONE)}},ln=class{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(e){return cn.__awaiter(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return cn.__awaiter(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return cn.__awaiter(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e,t="read"){return cn.__awaiter(this,void 0,void 0,function*(){return yield this.source.next({cmd:t,size:e})})}throw(e){return cn.__awaiter(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||Us.ITERATOR_DONE;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return cn.__awaiter(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||Us.ITERATOR_DONE;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}}});var yl=w(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.AsyncRandomAccessFile=Fi.RandomAccessFile=void 0;var hn=ct(),b_=fn(),nT=Je(),g_=class extends b_.ByteStream{constructor(e,t){super();this.position=0,this.buffer=nT.toUint8Array(e),this.size=typeof t=="undefined"?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:i}=this;return t&&i<n?(typeof e!="number"&&(e=1/0),this.position=Math.min(n,i+Math.min(n-i,e)),t.subarray(i,this.position)):null}readAt(e,t){let n=this.buffer,i=Math.min(this.size,e+t);return n?n.subarray(e,i):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}};Fi.RandomAccessFile=g_;var v_=class extends b_.AsyncByteStream{constructor(e,t){super();this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=(()=>hn.__awaiter(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending}))()}readInt32(e){return hn.__awaiter(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 hn.__awaiter(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 hn.__awaiter(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:i}=this;if(t&&i<n){typeof e!="number"&&(e=1/0);let s=i,o=0,u=0,a=Math.min(n,s+Math.min(n-s,e)),h=new Uint8Array(Math.max(0,(this.position=a)-s));for(;(s+=u)<a&&(o+=u)<h.byteLength;)({bytesRead:u}=yield t.read(h,o,h.byteLength-o,s));return h}return null})}readAt(e,t){return hn.__awaiter(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&e+t<i){let s=Math.min(i,e+t),o=new Uint8Array(s-e);return(yield n.read(o,0,t,e)).buffer}return new Uint8Array(t)})}close(){return hn.__awaiter(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return hn.__awaiter(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return hn.__awaiter(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}};Fi.AsyncRandomAccessFile=v_});var ml=w(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.Int128=hr.Int64=hr.Uint64=hr.BaseInt64=void 0;var iT=1<<16;function Di(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Oi=8,_l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Da=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]),i=t[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=t[2]*n[3],s+=i,i=t[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?iT:0,this.buffer[1]+=s>>>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`${Di(this.buffer[1])} ${Di(this.buffer[0])}`}};hr.BaseInt64=Da;var pe=class extends Da{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return pe.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return pe.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.length,i=new pe(t);for(let s=0;s<n;){let o=Oi<n-s?Oi:n-s,u=new pe(new Uint32Array([parseInt(e.substr(s,o),10),0])),a=new pe(new Uint32Array([_l[o],0]));i.times(a),i.plus(u),s+=o}return i}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,i=e.length;++n<i;)pe.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new pe(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new pe(new Uint32Array(e.buffer)).plus(t)}};hr.Uint64=pe;var _t=class extends Da{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(e,t=new Uint32Array(2)){return _t.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return _t.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.startsWith("-"),i=e.length,s=new _t(t);for(let o=n?1:0;o<i;){let u=Oi<i-o?Oi:i-o,a=new _t(new Uint32Array([parseInt(e.substr(o,u),10),0])),h=new _t(new Uint32Array([_l[u],0]));s.times(h),s.plus(a),o+=u}return n?s.negate():s}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,i=e.length;++n<i;)_t.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new _t(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new _t(new Uint32Array(e.buffer)).plus(t)}};hr.Int64=_t;var Zt=class{constructor(e){this.buffer=e}high(){return new _t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new _t(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 pe(new Uint32Array([this.buffer[3],0])),n=new pe(new Uint32Array([this.buffer[2],0])),i=new pe(new Uint32Array([this.buffer[1],0])),s=new pe(new Uint32Array([this.buffer[0],0])),o=new pe(new Uint32Array([e.buffer[3],0])),u=new pe(new Uint32Array([e.buffer[2],0])),a=new pe(new Uint32Array([e.buffer[1],0])),h=new pe(new Uint32Array([e.buffer[0],0])),_=pe.multiply(s,h);this.buffer[0]=_.low();let T=new pe(new Uint32Array([_.high(),0]));return _=pe.multiply(i,h),T.plus(_),_=pe.multiply(s,a),T.plus(_),this.buffer[1]=T.low(),this.buffer[3]=T.lessThan(_)?1:0,this.buffer[2]=T.high(),new pe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(pe.multiply(n,h)).plus(pe.multiply(i,a)).plus(pe.multiply(s,u)),this.buffer[3]+=pe.multiply(t,h).plus(pe.multiply(n,a)).plus(pe.multiply(i,u)).plus(pe.multiply(s,o)).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`${Di(this.buffer[3])} ${Di(this.buffer[2])} ${Di(this.buffer[1])} ${Di(this.buffer[0])}`}static multiply(e,t){return new Zt(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Zt(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return Zt.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return Zt.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){let n=e.startsWith("-"),i=e.length,s=new Zt(t);for(let o=n?1:0;o<i;){let u=Oi<i-o?Oi:i-o,a=new Zt(new Uint32Array([parseInt(e.substr(o,u),10),0,0,0])),h=new Zt(new Uint32Array([_l[u],0,0,0]));s.times(h),s.plus(a),o+=u}return n?s.negate():s}static convertArray(e){let t=new Uint32Array(e.length*4);for(let n=-1,i=e.length;++n<i;)Zt.from(e[n],new Uint32Array(t.buffer,t.byteOffset+4*4*n,4));return t}};hr.Int128=Zt});var T_=w(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.JSONVectorLoader=Mi.VectorLoader=void 0;var Xe=Jt(),sT=et(),Rr=he(),oT=it(),w_=ur(),aT=xn(),Oa=ml(),B_=we(),pr=Je(),bl=class extends oT.Visitor{constructor(e,t,n,i){super();this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=i}visit(e){return super.visit(e instanceof sT.Field?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return Xe.Data.Null(e,0,t)}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Bool(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Int(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Float(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Utf8(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.readData(e))}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Binary(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.readData(e))}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.FixedSizeBinary(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Date(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Timestamp(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Time(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Decimal(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.List(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),this.visit(e.children[0]))}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Struct(e,0,t,n,this.readNullBitmap(e,n),this.visitMany(e.children))}visitUnion(e){return e.mode===B_.UnionMode.Sparse?this.visitSparseUnion(e):this.visitDenseUnion(e)}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Union(e,0,t,n,this.readNullBitmap(e,n),this.readTypeIds(e),this.readOffsets(e),this.visitMany(e.children))}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Union(e,0,t,n,this.readNullBitmap(e,n),this.readTypeIds(e),this.visitMany(e.children))}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Dictionary(e,0,t,n,this.readNullBitmap(e,n),this.readData(e.indices),this.readDictionary(e))}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Interval(e,0,t,n,this.readNullBitmap(e,n),this.readData(e))}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.FixedSizeList(e,0,t,n,this.readNullBitmap(e,n),this.visit(e.children[0]))}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return Xe.Data.Map(e,0,t,n,this.readNullBitmap(e,n),this.readOffsets(e),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(0)}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)}readDictionary(e){return this.dictionaries.get(e.id)}};Mi.VectorLoader=bl;var I_=class extends bl{constructor(e,t,n,i){super(new Uint8Array(0),t,n,i);this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array(0):w_.packBools(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return pr.toArrayBufferView(Uint8Array,pr.toArrayBufferView(Int32Array,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return pr.toArrayBufferView(Uint8Array,pr.toArrayBufferView(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;return Rr.DataType.isTimestamp(e)||(Rr.DataType.isInt(e)||Rr.DataType.isTime(e))&&e.bitWidth===64||Rr.DataType.isDate(e)&&e.unit===B_.DateUnit.MILLISECOND?pr.toArrayBufferView(Uint8Array,Oa.Int64.convertArray(n[t])):Rr.DataType.isDecimal(e)?pr.toArrayBufferView(Uint8Array,Oa.Int128.convertArray(n[t])):Rr.DataType.isBinary(e)||Rr.DataType.isFixedSizeBinary(e)?cT(n[t]):Rr.DataType.isBool(e)?w_.packBools(n[t]):Rr.DataType.isUtf8(e)?aT.encodeUtf8(n[t].join("")):pr.toArrayBufferView(Uint8Array,pr.toArrayBufferView(e.ArrayType,n[t].map(i=>+i)))}};Mi.JSONVectorLoader=I_;function cT(r){let e=r.join(""),t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=parseInt(e.substr(n,2),16);return t}});var Rs=w(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.StructRow=Ui.MapRow=void 0;var S_=Au(),st=Symbol.for("parent"),Ei=Symbol.for("rowIndex"),mt=Symbol.for("keyToIdx"),bt=Symbol.for("idxToVal"),gl=Symbol.for("nodejs.util.inspect.custom"),yr=class{constructor(e,t){this[st]=e,this.size=t}entries(){return this[Symbol.iterator]()}has(e){return this.get(e)!==void 0}get(e){let t;if(e!=null){let n=this[mt]||(this[mt]=new Map),i=n.get(e);if(i!==void 0){let s=this[bt]||(this[bt]=new Array(this.size));(t=s[i])!==void 0||(s[i]=t=this.getValue(i))}else if((i=this.getIndex(e))>-1){n.set(e,i);let s=this[bt]||(this[bt]=new Array(this.size));(t=s[i])!==void 0||(s[i]=t=this.getValue(i))}}return t}set(e,t){if(e!=null){let n=this[mt]||(this[mt]=new Map),i=n.get(e);if(i===void 0&&n.set(e,i=this.getIndex(e)),i>-1){let s=this[bt]||(this[bt]=new Array(this.size));s[i]=this.setValue(i,t)}}return this}clear(){throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`)}delete(e){throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`)}*[Symbol.iterator](){let e=this.keys(),t=this.values(),n=this[mt]||(this[mt]=new Map),i=this[bt]||(this[bt]=new Array(this.size));for(let s,o,u=0,a,h;!((a=e.next()).done||(h=t.next()).done);++u)s=a.value,o=h.value,i[u]=o,n.has(s)||n.set(s,u),yield[s,o]}forEach(e,t){let n=this.keys(),i=this.values(),s=t===void 0?e:(a,h,_)=>e.call(t,a,h,_),o=this[mt]||(this[mt]=new Map),u=this[bt]||(this[bt]=new Array(this.size));for(let a,h,_=0,T,M;!((T=n.next()).done||(M=i.next()).done);++_)a=T.value,h=M.value,u[_]=h,o.has(a)||o.set(a,_),s(h,a,this)}toArray(){return[...this.values()]}toJSON(){let e={};return this.forEach((t,n)=>e[n]=t),e}inspect(){return this.toString()}[gl](){return this.toString()}toString(){let e=[];return this.forEach((t,n)=>{n=S_.valueToString(n),t=S_.valueToString(t),e.push(`${n}: ${t}`)}),`{ ${e.join(", ")} }`}};yr[Symbol.toStringTag]=(r=>(Object.defineProperties(r,{size:{writable:!0,enumerable:!1,configurable:!1,value:0},[st]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ei]:{writable:!0,enumerable:!1,configurable:!1,value:-1}}),r[Symbol.toStringTag]="Row"))(yr.prototype);var A_=class extends yr{constructor(e){super(e,e.length);return uT(this)}keys(){return this[st].getChildAt(0)[Symbol.iterator]()}values(){return this[st].getChildAt(1)[Symbol.iterator]()}getKey(e){return this[st].getChildAt(0).get(e)}getIndex(e){return this[st].getChildAt(0).indexOf(e)}getValue(e){return this[st].getChildAt(1).get(e)}setValue(e,t){this[st].getChildAt(1).set(e,t)}};Ui.MapRow=A_;var F_=class extends yr{constructor(e){super(e,e.type.children.length);return D_(this)}*keys(){for(let e of this[st].type.children)yield e.name}*values(){for(let e of this[st].type.children)yield this[e.name]}getKey(e){return this[st].type.children[e].name}getIndex(e){return this[st].type.children.findIndex(t=>t.name===e)}getValue(e){return this[st].getChildAt(e).get(this[Ei])}setValue(e,t){return this[st].getChildAt(e).set(this[Ei],t)}};Ui.StructRow=F_;Object.setPrototypeOf(yr.prototype,Map.prototype);var D_=(()=>{let r={enumerable:!0,configurable:!1,get:null,set:null};return e=>{let t=-1,n=e[mt]||(e[mt]=new Map),i=o=>function(){return this.get(o)},s=o=>function(u){return this.set(o,u)};for(let o of e.keys())n.set(o,++t),r.get=i(o),r.set=s(o),Object.prototype.hasOwnProperty.call(e,o)||(r.enumerable=!0,Object.defineProperty(e,o,r)),Object.prototype.hasOwnProperty.call(e,t)||(r.enumerable=!1,Object.defineProperty(e,t,r));return r.get=r.set=null,e}})(),uT=(()=>{if(typeof Proxy=="undefined")return D_;let r=yr.prototype.has,e=yr.prototype.get,t=yr.prototype.set,n=yr.prototype.getKey,i={isExtensible(){return!1},deleteProperty(){return!1},preventExtensions(){return!0},ownKeys(s){return[...s.keys()].map(o=>`${o}`)},has(s,o){switch(o){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case st:case Ei:case bt:case mt:case gl:return!0}return typeof o=="number"&&!s.has(o)&&(o=s.getKey(o)),s.has(o)},get(s,o,u){switch(o){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case st:case Ei:case bt:case mt:case gl:return Reflect.get(s,o,u)}return typeof o=="number"&&!r.call(u,o)&&(o=n.call(u,o)),e.call(u,o)},set(s,o,u,a){switch(o){case st:case Ei:case bt:case mt:return Reflect.set(s,o,u,a);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return typeof o=="number"&&!r.call(a,o)&&(o=n.call(a,o)),r.call(a,o)?!!t.call(a,o,u):!1}};return s=>new Proxy(s,i)})()});var Vs=w(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.createElementComparator=pn.clampRange=pn.clampIndex=void 0;var O_=je(),M_=Rs(),lT=Je(),E_=ut();function dT(r,e,t){let n=r.length,i=e>-1?e:n+e%n;return t?t(r,i):i}pn.clampIndex=dT;var U_;function fT(r,e,t,n){let{length:i=0}=r,s=typeof e!="number"?0:e,o=typeof t!="number"?i:t;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(U_=s,s=o,o=U_),o>i&&(o=i),n?n(r,s,o):[s,o]}pn.clampRange=fT;var hT=E_.BigIntAvailable?E_.BigInt(0):0,R_=r=>r!==r;function xs(r){let e=typeof r;if(e!=="object"||r===null)return R_(r)?R_:e!=="bigint"?t=>t===r:t=>hT+t===r;if(r instanceof Date){let t=r.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(r)?t=>t?lT.compareArrayLike(r,t):!1:r instanceof Map?yT(r):Array.isArray(r)?pT(r):r instanceof O_.Vector?_T(r):mT(r)}pn.createElementComparator=xs;function pT(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=xs(r[t]);return Ma(e)}function yT(r){let e=-1,t=[];return r.forEach(n=>t[++e]=xs(n)),Ma(t)}function _T(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=xs(r.get(t));return Ma(e)}function mT(r){let e=Object.keys(r);if(e.length===0)return()=>!1;let t=[];for(let n=-1,i=e.length;++n<i;)t[n]=xs(r[e[n]]);return Ma(t,e)}function Ma(r,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return bT(r,t);case Map:case M_.MapRow:case M_.StructRow:return x_(r,t,t.keys());case Object:case void 0:return x_(r,t,e||Object.keys(t))}return t instanceof O_.Vector?gT(r,t):!1}}function bT(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e[n]))return!1;return!0}function gT(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e.get(n)))return!1;return!0}function x_(r,e,t){let n=t[Symbol.iterator](),i=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),s=e instanceof Map?e.values():Object.values(e)[Symbol.iterator](),o=0,u=r.length,a=s.next(),h=n.next(),_=i.next();for(;o<u&&!h.done&&!_.done&&!a.done&&!(h.value!==_.value||!r[o](a.value));++o,h=n.next(),_=i.next(),a=s.next());return o===u&&h.done&&_.done&&a.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}});var $n=w(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.selectColumnChildrenArgs=tt.selectVectorChildrenArgs=tt.selectChunkArgs=tt.selectFieldArgs=tt.selectColumnArgs=tt.selectArgs=tt.arrayTypeToDataType=tt.isTypedArray=void 0;var vl=Jt(),V_=et(),xr=xi(),Ri=je(),Vt=he(),vT=_n(),yn=Array.isArray;function wl(r){return ArrayBuffer.isView(r)&&"BYTES_PER_ELEMENT"in r}tt.isTypedArray=wl;function P_(r){switch(r){case Int8Array:return Vt.Int8;case Int16Array:return Vt.Int16;case Int32Array:return Vt.Int32;case BigInt64Array:return Vt.Int64;case Uint8Array:return Vt.Uint8;case Uint16Array:return Vt.Uint16;case Uint32Array:return Vt.Uint32;case BigUint64Array:return Vt.Uint64;case Float32Array:return Vt.Float32;case Float64Array:return Vt.Float64;default:return null}}tt.arrayTypeToDataType=P_;function wT(r){let e=P_(r.constructor);if(!e)throw new TypeError("Unrecognized Array input");let t=new e,n=vl.Data.new(t,0,r.length,0,[void 0,r]);return Ri.Vector.new(n)}tt.selectArgs=(r,e)=>Ea(r,e,[],0);tt.selectColumnArgs=r=>{let[e,t]=Il(r,[[],[]]);return t.map((n,i)=>n instanceof xr.Column?xr.Column.new(n.field.clone(e[i]),n):n instanceof Ri.Vector?xr.Column.new(e[i],n):wl(n)?xr.Column.new(e[i],wT(n)):xr.Column.new(e[i],[]))};tt.selectFieldArgs=r=>Il(r,[[],[]]);tt.selectChunkArgs=(r,e)=>Bl(r,e,[],0);tt.selectVectorChildrenArgs=(r,e)=>L_(r,e,[],0);tt.selectColumnChildrenArgs=(r,e)=>N_(r,e,[],0);function Ea(r,e,t,n){let i,s=n,o=-1,u=e.length;for(;++o<u;)yn(i=e[o])?s=Ea(r,i,t,s).length:i instanceof r&&(t[s++]=i);return t}function Bl(r,e,t,n){let i,s=n,o=-1,u=e.length;for(;++o<u;)yn(i=e[o])?s=Bl(r,i,t,s).length:i instanceof vT.Chunked?s=Bl(r,i.chunks,t,s).length:i instanceof r&&(t[s++]=i);return t}function L_(r,e,t,n){let i,s=n,o=-1,u=e.length;for(;++o<u;)yn(i=e[o])?s=L_(r,i,t,s).length:i instanceof r?s=Ea(Ri.Vector,i.schema.fields.map((a,h)=>i.getChildAt(h)),t,s).length:i instanceof Ri.Vector&&(t[s++]=i);return t}function N_(r,e,t,n){let i,s=n,o=-1,u=e.length;for(;++o<u;)yn(i=e[o])?s=N_(r,i,t,s).length:i instanceof r?s=Ea(xr.Column,i.schema.fields.map((a,h)=>xr.Column.new(a,i.getChildAt(h))),t,s).length:i instanceof xr.Column&&(t[s++]=i);return t}var BT=(r,[e,t],n)=>(r[0][n]=e,r[1][n]=t,r);function Il(r,e){let t,n;switch(n=r.length){case 0:return e;case 1:if(t=e[0],!r[0])return e;if(yn(r[0]))return Il(r[0],e);r[0]instanceof vl.Data||r[0]instanceof Ri.Vector||wl(r[0])||r[0]instanceof Vt.DataType||([t,r]=Object.entries(r[0]).reduce(BT,e));break;default:yn(t=r[n-1])?r=yn(r[0])?r[0]:r.slice(0,n-1):(r=yn(r[0])?r[0]:r,t=[])}let i=-1,s=-1,o=-1,u=r.length,a,h,[_,T]=e;for(;++o<u;)h=r[o],h instanceof xr.Column&&(T[++s]=h)?_[++i]=h.field.clone(t[o],h.type,!0):({[o]:a=o}=t,h instanceof Vt.DataType&&(T[++s]=h)?_[++i]=V_.Field.new(a,h,!0):(h==null?void 0:h.type)&&(T[++s]=h)&&(h instanceof vl.Data&&(T[s]=h=Ri.Vector.new(h)),_[++i]=V_.Field.new(a,h.type,!0)));return e}});var _n=w(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.Chunked=void 0;var IT=Vs(),k_=he(),TT=$n(),C_=je(),j_=class{constructor(e){this.chunks=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator()}next(){for(;this.chunkIndex<this.chunks.length;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.chunks.length&&(this.chunkIterator=this.getChunkIterator())}return{done:!0,value:null}}getChunkIterator(){return this.chunks[this.chunkIndex][Symbol.iterator]()}[Symbol.iterator](){return this}},Vr=class extends C_.AbstractVector{constructor(e,t=[],n=ST(t)){super();this._nullCount=-1,this._type=e,this._chunks=t,this._chunkOffsets=n,this._length=n[n.length-1],this._numChildren=(this._type.children||[]).length}static flatten(...e){return TT.selectChunkArgs(C_.Vector,e)}static concat(...e){let t=Vr.flatten(...e);return new Vr(t[0].type,t)}get type(){return this._type}get length(){return this._length}get chunks(){return this._chunks}get typeId(){return this._type.typeId}get VectorName(){return`Chunked<${this._type}>`}get data(){return this._chunks[0]?this._chunks[0].data:null}get ArrayType(){return this._type.ArrayType}get numChildren(){return this._numChildren}get stride(){return this._chunks[0]?this._chunks[0].stride:1}get byteLength(){return this._chunks.reduce((e,t)=>e+t.byteLength,0)}get nullCount(){let e=this._nullCount;return e<0&&(this._nullCount=e=this._chunks.reduce((t,{nullCount:n})=>t+n,0)),e}get indices(){if(k_.DataType.isDictionary(this._type)){if(!this._indices){let e=this._chunks;this._indices=e.length===1?e[0].indices:Vr.concat(...e.map(t=>t.indices))}return this._indices}return null}get dictionary(){return k_.DataType.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}[Symbol.iterator](){return new j_(this._chunks)}clone(e=this._chunks){return new Vr(this._type,e)}concat(...e){return this.clone(Vr.flatten(this,...e))}slice(e,t){return IT.clampRange(this,e,t,this._sliceInternal)}getChildAt(e){if(e<0||e>=this._numChildren)return null;let t=this._children||(this._children=[]),n,i,s;return(n=t[e])?n:(i=(this._type.children||[])[e])&&(s=this._chunks.map(o=>o.getChildAt(e)).filter(o=>o!=null),s.length>0)?t[e]=new Vr(i.type,s):null}search(e,t){let n=e,i=this._chunkOffsets,s=i.length-1;if(n<0||n>=i[s])return null;if(s<=1)return t?t(this,0,n):[0,n];let o=0,u=0,a=0;do{if(o+1===s)return t?t(this,o,n-u):[o,n-u];a=o+(s-o)/2|0,n>=i[a]?o=a:s=a}while(n<i[s]&&n>=(u=i[o]));return null}isValid(e){return!!this.search(e,this.isValidInternal)}get(e){return this.search(e,this.getInternal)}set(e,t){this.search(e,({chunks:n},i,s)=>n[i].set(s,t))}indexOf(e,t){return t&&typeof t=="number"?this.search(t,(n,i,s)=>this.indexOfInternal(n,i,s,e)):this.indexOfInternal(this,0,Math.max(0,t||0),e)}toArray(){let{chunks:e}=this,t=e.length,n=this._type.ArrayType;if(t<=0)return new n(0);if(t<=1)return e[0].toArray();let i=0,s=new Array(t);for(let a=-1;++a<t;)i+=(s[a]=e[a].toArray()).length;n!==s[0].constructor&&(n=s[0].constructor);let o=new n(i),u=n===Array?FT:AT;for(let a=-1,h=0;++a<t;)h=u(s[a],o,h);return o}getInternal({_chunks:e},t,n){return e[t].get(n)}isValidInternal({_chunks:e},t,n){return e[t].isValid(n)}indexOfInternal({_chunks:e},t,n,i){let s=t-1,o=e.length,u=n,a=0,h=-1;for(;++s<o;){if(~(h=e[s].indexOf(i,u)))return a+h;u=0,a+=e[s].length}return-1}_sliceInternal(e,t,n){let i=[],{chunks:s,_chunkOffsets:o}=e;for(let u=-1,a=s.length;++u<a;){let h=s[u],_=h.length,T=o[u];if(T>=n)break;if(t>=T+_)continue;if(T>=t&&T+_<=n){i.push(h);continue}let M=Math.max(0,t-T),E=Math.min(n-T,_);i.push(h.slice(M,E))}return e.clone(i)}};Ua.Chunked=Vr;function ST(r){let e=new Uint32Array((r||[]).length+1),t=e[0]=0,n=e.length;for(let i=0;++i<n;)e[i]=t+=r[i-1].length;return e}var AT=(r,e,t)=>(e.set(r,t),t+r.length),FT=(r,e,t)=>{let n=t;for(let i=-1,s=r.length;++i<s;)e[n++]=r[i];return n}});var xi=w(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Column=void 0;var q_=et(),H_=je(),Tl=_n(),Jn=class extends Tl.Chunked{constructor(e,t=[],n){t=Tl.Chunked.flatten(...t);super(e.type,t,n);if(this._field=e,t.length===1&&!(this instanceof Sl))return new Sl(e,t[0],this._chunkOffsets)}static new(...e){let[t,n,...i]=e;typeof t!="string"&&!(t instanceof q_.Field)&&(n=t,t="");let s=Tl.Chunked.flatten(Array.isArray(n)?[...n,...i]:n instanceof H_.Vector?[n,...i]:[H_.Vector.new(n,...i)]);if(typeof t=="string"){let o=s[0].data.type;t=new q_.Field(t,o,!0)}else!t.nullable&&s.some(({nullCount:o})=>o>0)&&(t=t.clone({nullable:!0}));return new Jn(t,s)}get field(){return this._field}get name(){return this._field.name}get nullable(){return this._field.nullable}get metadata(){return this._field.metadata}clone(e=this._chunks){return new Jn(this._field,e)}getChildAt(e){if(e<0||e>=this.numChildren)return null;let t=this._children||(this._children=[]),n,i,s;return(n=t[e])?n:(i=(this.type.children||[])[e])&&(s=this._chunks.map(o=>o.getChildAt(e)).filter(o=>o!=null),s.length>0)?t[e]=new Jn(i,s):null}};Ra.Column=Jn;var Sl=class extends Jn{constructor(e,t,n){super(e,[t],n);this._chunk=t}search(e,t){return t?t(this,0,e):[0,e]}isValid(e){return this._chunk.isValid(e)}get(e){return this._chunk.get(e)}set(e,t){this._chunk.set(e,t)}indexOf(e,t){return this._chunk.indexOf(e,t)}}});var z_=w(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.instance=Vi.TypeAssembler=void 0;var DT=Ar(),OT=DT.flatbuffers.Long,MT=it(),N=Zr(),Al=class extends MT.Visitor{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return N.Null.startNull(t),N.Null.endNull(t)}visitInt(e,t){return N.Int.startInt(t),N.Int.addBitWidth(t,e.bitWidth),N.Int.addIsSigned(t,e.isSigned),N.Int.endInt(t)}visitFloat(e,t){return N.FloatingPoint.startFloatingPoint(t),N.FloatingPoint.addPrecision(t,e.precision),N.FloatingPoint.endFloatingPoint(t)}visitBinary(e,t){return N.Binary.startBinary(t),N.Binary.endBinary(t)}visitBool(e,t){return N.Bool.startBool(t),N.Bool.endBool(t)}visitUtf8(e,t){return N.Utf8.startUtf8(t),N.Utf8.endUtf8(t)}visitDecimal(e,t){return N.Decimal.startDecimal(t),N.Decimal.addScale(t,e.scale),N.Decimal.addPrecision(t,e.precision),N.Decimal.endDecimal(t)}visitDate(e,t){return N.Date.startDate(t),N.Date.addUnit(t,e.unit),N.Date.endDate(t)}visitTime(e,t){return N.Time.startTime(t),N.Time.addUnit(t,e.unit),N.Time.addBitWidth(t,e.bitWidth),N.Time.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return N.Timestamp.startTimestamp(t),N.Timestamp.addUnit(t,e.unit),n!==void 0&&N.Timestamp.addTimezone(t,n),N.Timestamp.endTimestamp(t)}visitInterval(e,t){return N.Interval.startInterval(t),N.Interval.addUnit(t,e.unit),N.Interval.endInterval(t)}visitList(e,t){return N.List.startList(t),N.List.endList(t)}visitStruct(e,t){return N.Struct_.startStruct_(t),N.Struct_.endStruct_(t)}visitUnion(e,t){N.Union.startTypeIdsVector(t,e.typeIds.length);let n=N.Union.createTypeIdsVector(t,e.typeIds);return N.Union.startUnion(t),N.Union.addMode(t,e.mode),N.Union.addTypeIds(t,n),N.Union.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return N.DictionaryEncoding.startDictionaryEncoding(t),N.DictionaryEncoding.addId(t,new OT(e.id,0)),N.DictionaryEncoding.addIsOrdered(t,e.isOrdered),n!==void 0&&N.DictionaryEncoding.addIndexType(t,n),N.DictionaryEncoding.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return N.FixedSizeBinary.startFixedSizeBinary(t),N.FixedSizeBinary.addByteWidth(t,e.byteWidth),N.FixedSizeBinary.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return N.FixedSizeList.startFixedSizeList(t),N.FixedSizeList.addListSize(t,e.listSize),N.FixedSizeList.endFixedSizeList(t)}visitMap(e,t){return N.Map.startMap(t),N.Map.addKeysSorted(t,e.keysSorted),N.Map.endMap(t)}};Vi.TypeAssembler=Al;Vi.instance=new Al});var X_=w(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.fieldFromJSON=_r.dictionaryBatchFromJSON=_r.recordBatchFromJSON=_r.schemaFromJSON=void 0;var Pi=et(),Ae=he(),Kn=Xn(),Li=we();function ET(r,e=new Map){return new Pi.Schema(RT(r,e),xa(r.customMetadata),e)}_r.schemaFromJSON=ET;function W_(r){return new Kn.RecordBatch(r.count,G_(r.columns),$_(r.columns))}_r.recordBatchFromJSON=W_;function UT(r){return new Kn.DictionaryBatch(W_(r.data),r.id,r.isDelta)}_r.dictionaryBatchFromJSON=UT;function RT(r,e){return(r.fields||[]).filter(Boolean).map(t=>Pi.Field.fromJSON(t,e))}function Y_(r,e){return(r.children||[]).filter(Boolean).map(t=>Pi.Field.fromJSON(t,e))}function G_(r){return(r||[]).reduce((e,t)=>[...e,new Kn.FieldNode(t.count,xT(t.VALIDITY)),...G_(t.children)],[])}function $_(r,e=[]){for(let t=-1,n=(r||[]).length;++t<n;){let i=r[t];i.VALIDITY&&e.push(new Kn.BufferRegion(e.length,i.VALIDITY.length)),i.TYPE&&e.push(new Kn.BufferRegion(e.length,i.TYPE.length)),i.OFFSET&&e.push(new Kn.BufferRegion(e.length,i.OFFSET.length)),i.DATA&&e.push(new Kn.BufferRegion(e.length,i.DATA.length)),e=$_(i.children,e)}return e}function xT(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function VT(r,e){let t,n,i,s,o,u;return!e||!(s=r.dictionary)?(o=K_(r,Y_(r,e)),i=new Pi.Field(r.name,o,r.nullable,xa(r.customMetadata))):e.has(t=s.id)?(n=(n=s.indexType)?J_(n):new Ae.Int32,u=new Ae.Dictionary(e.get(t),n,t,s.isOrdered),i=new Pi.Field(r.name,u,r.nullable,xa(r.customMetadata))):(n=(n=s.indexType)?J_(n):new Ae.Int32,e.set(t,o=K_(r,Y_(r,e))),u=new Ae.Dictionary(o,n,t,s.isOrdered),i=new Pi.Field(r.name,u,r.nullable,xa(r.customMetadata))),i||null}_r.fieldFromJSON=VT;function xa(r){return new Map(Object.entries(r||{}))}function J_(r){return new Ae.Int(r.isSigned,r.bitWidth)}function K_(r,e){let t=r.type.name;switch(t){case"NONE":return new Ae.Null;case"null":return new Ae.Null;case"binary":return new Ae.Binary;case"utf8":return new Ae.Utf8;case"bool":return new Ae.Bool;case"list":return new Ae.List((e||[])[0]);case"struct":return new Ae.Struct(e||[]);case"struct_":return new Ae.Struct(e||[])}switch(t){case"int":{let n=r.type;return new Ae.Int(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Ae.Float(Li.Precision[n.precision])}case"decimal":{let n=r.type;return new Ae.Decimal(n.scale,n.precision)}case"date":{let n=r.type;return new Ae.Date_(Li.DateUnit[n.unit])}case"time":{let n=r.type;return new Ae.Time(Li.TimeUnit[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Ae.Timestamp(Li.TimeUnit[n.unit],n.timezone)}case"interval":{let n=r.type;return new Ae.Interval(Li.IntervalUnit[n.unit])}case"union":{let n=r.type;return new Ae.Union(Li.UnionMode[n.mode],n.typeIds||[],e||[])}case"fixedsizebinary":{let n=r.type;return new Ae.FixedSizeBinary(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ae.FixedSizeList(n.listSize,(e||[])[0])}case"map":{let n=r.type;return new Ae.Map_((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}});var Xn=w(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.FieldNode=Lt.BufferRegion=Lt.DictionaryBatch=Lt.RecordBatch=Lt.Message=void 0;var Fl=Ar(),P=Zr(),Oe=No(),rt=et(),PT=Je(),Ve=we(),Dl=z_(),Va=X_(),Zn=Fl.flatbuffers.Long,LT=Fl.flatbuffers.Builder,NT=Fl.flatbuffers.ByteBuffer,Fe=he(),mn=class{constructor(e,t,n,i){this._version=t,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=typeof e=="number"?e:e.low}static fromJSON(e,t){let n=new mn(0,Ve.MetadataVersion.V4,t);return n._createHeader=kT(e,t),n}static decode(e){e=new NT(PT.toUint8Array(e));let t=Oe.Message.getRootAsMessage(e),n=t.bodyLength(),i=t.version(),s=t.headerType(),o=new mn(n,i,s);return o._createHeader=CT(t,s),o}static encode(e){let t=new LT,n=-1;return e.isSchema()?n=rt.Schema.encode(t,e.header()):e.isRecordBatch()?n=Pt.encode(t,e.header()):e.isDictionaryBatch()&&(n=mr.encode(t,e.header())),Oe.Message.startMessage(t),Oe.Message.addVersion(t,Ve.MetadataVersion.V4),Oe.Message.addHeader(t,n),Oe.Message.addHeaderType(t,e.headerType),Oe.Message.addBodyLength(t,new Zn(e.bodyLength,0)),Oe.Message.finishMessageBuffer(t,Oe.Message.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof rt.Schema)return new mn(0,Ve.MetadataVersion.V4,Ve.MessageHeader.Schema,e);if(e instanceof Pt)return new mn(t,Ve.MetadataVersion.V4,Ve.MessageHeader.RecordBatch,e);if(e instanceof mr)return new mn(t,Ve.MetadataVersion.V4,Ve.MessageHeader.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Ve.MessageHeader.Schema}isRecordBatch(){return this.headerType===Ve.MessageHeader.RecordBatch}isDictionaryBatch(){return this.headerType===Ve.MessageHeader.DictionaryBatch}};Lt.Message=mn;var Pt=class{constructor(e,t,n){this._nodes=t,this._buffers=n,this._length=typeof e=="number"?e:e.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}};Lt.RecordBatch=Pt;var mr=class{constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=typeof t=="number"?t:t.low}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}};Lt.DictionaryBatch=mr;var Qn=class{constructor(e,t){this.offset=typeof e=="number"?e:e.low,this.length=typeof t=="number"?t:t.low}};Lt.BufferRegion=Qn;var ei=class{constructor(e,t){this.length=typeof e=="number"?e:e.low,this.nullCount=typeof t=="number"?t:t.low}};Lt.FieldNode=ei;function kT(r,e){return()=>{switch(e){case Ve.MessageHeader.Schema:return rt.Schema.fromJSON(r);case Ve.MessageHeader.RecordBatch:return Pt.fromJSON(r);case Ve.MessageHeader.DictionaryBatch:return mr.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Ve.MessageHeader[e]}, type: ${e} }`)}}function CT(r,e){return()=>{switch(e){case Ve.MessageHeader.Schema:return rt.Schema.decode(r.header(new P.Schema));case Ve.MessageHeader.RecordBatch:return Pt.decode(r.header(new Oe.RecordBatch),r.version());case Ve.MessageHeader.DictionaryBatch:return mr.decode(r.header(new Oe.DictionaryBatch),r.version())}throw new Error(`Unrecognized Message type: { name: ${Ve.MessageHeader[e]}, type: ${e} }`)}}rt.Field.encode=XT;rt.Field.decode=JT;rt.Field.fromJSON=Va.fieldFromJSON;rt.Schema.encode=KT;rt.Schema.decode=jT;rt.Schema.fromJSON=Va.schemaFromJSON;Pt.encode=ZT;Pt.decode=qT;Pt.fromJSON=Va.recordBatchFromJSON;mr.encode=QT;mr.decode=HT;mr.fromJSON=Va.dictionaryBatchFromJSON;ei.encode=eS;ei.decode=WT;Qn.encode=tS;Qn.decode=zT;function jT(r,e=new Map){let t=$T(r,e);return new rt.Schema(t,Pa(r),e)}function qT(r,e=Ve.MetadataVersion.V4){return new Pt(r.length(),YT(r),GT(r,e))}function HT(r,e=Ve.MetadataVersion.V4){return new mr(Pt.decode(r.data(),e),r.id(),r.isDelta())}function zT(r){return new Qn(r.offset(),r.length())}function WT(r){return new ei(r.length(),r.nullCount())}function YT(r){let e=[];for(let t,n=-1,i=-1,s=r.nodesLength();++n<s;)(t=r.nodes(n))&&(e[++i]=ei.decode(t));return e}function GT(r,e){let t=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(e<Ve.MetadataVersion.V4&&(n.bb_pos+=8*(i+1)),t[++s]=Qn.decode(n));return t}function $T(r,e){let t=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(t[++s]=rt.Field.decode(n,e));return t}function Z_(r,e){let t=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(t[++s]=rt.Field.decode(n,e));return t}function JT(r,e){let t,n,i,s,o,u;return!e||!(u=r.dictionary())?(i=em(r,Z_(r,e)),n=new rt.Field(r.name(),i,r.nullable(),Pa(r))):e.has(t=u.id().low)?(s=(s=u.indexType())?Q_(s):new Fe.Int32,o=new Fe.Dictionary(e.get(t),s,t,u.isOrdered()),n=new rt.Field(r.name(),o,r.nullable(),Pa(r))):(s=(s=u.indexType())?Q_(s):new Fe.Int32,e.set(t,i=em(r,Z_(r,e))),o=new Fe.Dictionary(i,s,t,u.isOrdered()),n=new rt.Field(r.name(),o,r.nullable(),Pa(r))),n||null}function Pa(r){let e=new Map;if(r)for(let t,n,i=-1,s=r.customMetadataLength()|0;++i<s;)(t=r.customMetadata(i))&&(n=t.key())!=null&&e.set(n,t.value());return e}function Q_(r){return new Fe.Int(r.isSigned(),r.bitWidth())}function em(r,e){let t=r.typeType();switch(t){case P.Type.NONE:return new Fe.Null;case P.Type.Null:return new Fe.Null;case P.Type.Binary:return new Fe.Binary;case P.Type.Utf8:return new Fe.Utf8;case P.Type.Bool:return new Fe.Bool;case P.Type.List:return new Fe.List((e||[])[0]);case P.Type.Struct_:return new Fe.Struct(e||[])}switch(t){case P.Type.Int:{let n=r.type(new P.Int);return new Fe.Int(n.isSigned(),n.bitWidth())}case P.Type.FloatingPoint:{let n=r.type(new P.FloatingPoint);return new Fe.Float(n.precision())}case P.Type.Decimal:{let n=r.type(new P.Decimal);return new Fe.Decimal(n.scale(),n.precision())}case P.Type.Date:{let n=r.type(new P.Date);return new Fe.Date_(n.unit())}case P.Type.Time:{let n=r.type(new P.Time);return new Fe.Time(n.unit(),n.bitWidth())}case P.Type.Timestamp:{let n=r.type(new P.Timestamp);return new Fe.Timestamp(n.unit(),n.timezone())}case P.Type.Interval:{let n=r.type(new P.Interval);return new Fe.Interval(n.unit())}case P.Type.Union:{let n=r.type(new P.Union);return new Fe.Union(n.mode(),n.typeIdsArray()||[],e||[])}case P.Type.FixedSizeBinary:{let n=r.type(new P.FixedSizeBinary);return new Fe.FixedSizeBinary(n.byteWidth())}case P.Type.FixedSizeList:{let n=r.type(new P.FixedSizeList);return new Fe.FixedSizeList(n.listSize(),(e||[])[0])}case P.Type.Map:{let n=r.type(new P.Map);return new Fe.Map_((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${P.Type[t]}" (${t})`)}function KT(r,e){let t=e.fields.map(s=>rt.Field.encode(r,s));P.Schema.startFieldsVector(r,t.length);let n=P.Schema.createFieldsVector(r,t),i=e.metadata&&e.metadata.size>0?P.Schema.createCustomMetadataVector(r,[...e.metadata].map(([s,o])=>{let u=r.createString(`${s}`),a=r.createString(`${o}`);return P.KeyValue.startKeyValue(r),P.KeyValue.addKey(r,u),P.KeyValue.addValue(r,a),P.KeyValue.endKeyValue(r)})):-1;return P.Schema.startSchema(r),P.Schema.addFields(r,n),P.Schema.addEndianness(r,rS?P.Endianness.Little:P.Endianness.Big),i!==-1&&P.Schema.addCustomMetadata(r,i),P.Schema.endSchema(r)}function XT(r,e){let t=-1,n=-1,i=-1,s=e.type,o=e.typeId;Fe.DataType.isDictionary(s)?(o=s.dictionary.typeId,i=Dl.instance.visit(s,r),n=Dl.instance.visit(s.dictionary,r)):n=Dl.instance.visit(s,r);let u=(s.children||[]).map(_=>rt.Field.encode(r,_)),a=P.Field.createChildrenVector(r,u),h=e.metadata&&e.metadata.size>0?P.Field.createCustomMetadataVector(r,[...e.metadata].map(([_,T])=>{let M=r.createString(`${_}`),E=r.createString(`${T}`);return P.KeyValue.startKeyValue(r),P.KeyValue.addKey(r,M),P.KeyValue.addValue(r,E),P.KeyValue.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),P.Field.startField(r),P.Field.addType(r,n),P.Field.addTypeType(r,o),P.Field.addChildren(r,a),P.Field.addNullable(r,!!e.nullable),t!==-1&&P.Field.addName(r,t),i!==-1&&P.Field.addDictionary(r,i),h!==-1&&P.Field.addCustomMetadata(r,h),P.Field.endField(r)}function ZT(r,e){let t=e.nodes||[],n=e.buffers||[];Oe.RecordBatch.startNodesVector(r,t.length),t.slice().reverse().forEach(o=>ei.encode(r,o));let i=r.endVector();Oe.RecordBatch.startBuffersVector(r,n.length),n.slice().reverse().forEach(o=>Qn.encode(r,o));let s=r.endVector();return Oe.RecordBatch.startRecordBatch(r),Oe.RecordBatch.addLength(r,new Zn(e.length,0)),Oe.RecordBatch.addNodes(r,i),Oe.RecordBatch.addBuffers(r,s),Oe.RecordBatch.endRecordBatch(r)}function QT(r,e){let t=Pt.encode(r,e.data);return Oe.DictionaryBatch.startDictionaryBatch(r),Oe.DictionaryBatch.addId(r,new Zn(e.id,0)),Oe.DictionaryBatch.addIsDelta(r,e.isDelta),Oe.DictionaryBatch.addData(r,t),Oe.DictionaryBatch.endDictionaryBatch(r)}function eS(r,e){return Oe.FieldNode.createFieldNode(r,new Zn(e.length,0),new Zn(e.nullCount,0))}function tS(r,e){return P.Buffer.createBuffer(r,new Zn(e.offset,0),new Zn(e.length,0))}var rS=function(){let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256}()});var Na=w(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.magicX2AndPadding=ce.magicAndPadding=ce.magicLength=ce.checkForMagicArrowString=ce.MAGIC=ce.MAGIC_STR=ce.PADDING=ce.JSONMessageReader=ce.AsyncMessageReader=ce.MessageReader=void 0;var bn=ct(),gn=we(),nS=Ar(),tm=nS.flatbuffers.ByteBuffer,Ps=Xn(),iS=ut(),sS=yl(),rm=Je(),La=fn(),Qt=ai(),Ol=r=>`Expected ${gn.MessageHeader[r]} Message in stream, but was null or length 0.`,Ml=r=>`Header pointer of flatbuffer-encoded ${gn.MessageHeader[r]} Message is null or length 0.`,nm=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,im=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`,El=class{constructor(e){this.source=e instanceof La.ByteStream?e:new La.ByteStream(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?Qt.ITERATOR_DONE: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 new Error(Ol(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);let t=rm.toUint8Array(this.source.read(e));if(t.byteLength<e)throw new Error(im(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=gn.MessageHeader.Schema,n=this.readMessage(t),i=n==null?void 0:n.header();if(e&&!i)throw new Error(Ml(t));return i}readMetadataLength(){let e=this.source.read(ce.PADDING),t=e&&new tm(e),n=(t==null?void 0:t.readInt32(0))||0;return{done:n===0,value:n}}readMetadata(e){let t=this.source.read(e);if(!t)return Qt.ITERATOR_DONE;if(t.byteLength<e)throw new Error(nm(e,t.byteLength));return{done:!1,value:Ps.Message.decode(t)}}};ce.MessageReader=El;var sm=class{constructor(e,t){this.source=e instanceof La.AsyncByteStream?e:iS.isFileHandle(e)?new sS.AsyncRandomAccessFile(e,t):new La.AsyncByteStream(e)}[Symbol.asyncIterator](){return this}next(){return bn.__awaiter(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?Qt.ITERATOR_DONE:e})}throw(e){return bn.__awaiter(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return bn.__awaiter(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return bn.__awaiter(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Ol(e));return t.value})}readMessageBody(e){return bn.__awaiter(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);let t=rm.toUint8Array(yield this.source.read(e));if(t.byteLength<e)throw new Error(im(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(e=!1){return bn.__awaiter(this,void 0,void 0,function*(){let t=gn.MessageHeader.Schema,n=yield this.readMessage(t),i=n==null?void 0:n.header();if(e&&!i)throw new Error(Ml(t));return i})}readMetadataLength(){return bn.__awaiter(this,void 0,void 0,function*(){let e=yield this.source.read(ce.PADDING),t=e&&new tm(e),n=(t==null?void 0:t.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(e){return bn.__awaiter(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return Qt.ITERATOR_DONE;if(t.byteLength<e)throw new Error(nm(e,t.byteLength));return{done:!1,value:Ps.Message.decode(t)}})}};ce.AsyncMessageReader=sm;var om=class extends El{constructor(e){super(new Uint8Array(0));this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Qt.ArrowJSON?e:new Qt.ArrowJSON(e)}next(){let{_json:e}=this;if(!this._schema){this._schema=!0;let t=Ps.Message.fromJSON(e.schema,gn.MessageHeader.Schema);return{done:!1,value:t}}if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];this._body=t.data.columns;let n=Ps.Message.fromJSON(t,gn.MessageHeader.DictionaryBatch);return{done:!1,value:n}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];this._body=t.columns;let n=Ps.Message.fromJSON(t,gn.MessageHeader.RecordBatch);return{done:!1,value:n}}return this._body=[],Qt.ITERATOR_DONE}readMessageBody(e){return t(this._body);function t(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...t(s.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Ol(e));return t.value}readSchema(){let e=gn.MessageHeader.Schema,t=this.readMessage(e),n=t==null?void 0:t.header();if(!t||!n)throw new Error(Ml(e));return n}};ce.JSONMessageReader=om;ce.PADDING=4;ce.MAGIC_STR="ARROW1";ce.MAGIC=new Uint8Array(ce.MAGIC_STR.length);for(let r=0;r<ce.MAGIC_STR.length;r+=1|0)ce.MAGIC[r]=ce.MAGIC_STR.charCodeAt(r);function oS(r,e=0){for(let t=-1,n=ce.MAGIC.length;++t<n;)if(ce.MAGIC[t]!==r[e+t])return!1;return!0}ce.checkForMagicArrowString=oS;ce.magicLength=ce.MAGIC.length;ce.magicAndPadding=ce.magicLength+ce.PADDING;ce.magicX2AndPadding=ce.magicLength*2+ce.PADDING});var Vl=w(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.compareTypes=Pe.compareFields=Pe.compareSchemas=Pe.instance=Pe.TypeComparator=void 0;var aS=it(),H=class extends aS.Visitor{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((n,i)=>this.compareFields(n,t[i]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};Pe.TypeComparator=H;function pt(r,e){return e instanceof r.constructor}function Ls(r,e){return r===e||pt(r,e)}function Pr(r,e){return r===e||pt(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function ka(r,e){return r===e||pt(r,e)&&r.precision===e.precision}function cS(r,e){return r===e||pt(r,e)&&r.byteWidth===e.byteWidth}function Ul(r,e){return r===e||pt(r,e)&&r.unit===e.unit}function Ns(r,e){return r===e||pt(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function ks(r,e){return r===e||pt(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function uS(r,e){return r===e||pt(r,e)&&r.children.length===e.children.length&&Pe.instance.compareManyFields(r.children,e.children)}function lS(r,e){return r===e||pt(r,e)&&r.children.length===e.children.length&&Pe.instance.compareManyFields(r.children,e.children)}function Rl(r,e){return r===e||pt(r,e)&&r.mode===e.mode&&r.typeIds.every((t,n)=>t===e.typeIds[n])&&Pe.instance.compareManyFields(r.children,e.children)}function dS(r,e){return r===e||pt(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&Pe.instance.visit(r.indices,e.indices)&&Pe.instance.visit(r.dictionary,e.dictionary)}function xl(r,e){return r===e||pt(r,e)&&r.unit===e.unit}function fS(r,e){return r===e||pt(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&Pe.instance.compareManyFields(r.children,e.children)}function hS(r,e){return r===e||pt(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&Pe.instance.compareManyFields(r.children,e.children)}H.prototype.visitNull=Ls;H.prototype.visitBool=Ls;H.prototype.visitInt=Pr;H.prototype.visitInt8=Pr;H.prototype.visitInt16=Pr;H.prototype.visitInt32=Pr;H.prototype.visitInt64=Pr;H.prototype.visitUint8=Pr;H.prototype.visitUint16=Pr;H.prototype.visitUint32=Pr;H.prototype.visitUint64=Pr;H.prototype.visitFloat=ka;H.prototype.visitFloat16=ka;H.prototype.visitFloat32=ka;H.prototype.visitFloat64=ka;H.prototype.visitUtf8=Ls;H.prototype.visitBinary=Ls;H.prototype.visitFixedSizeBinary=cS;H.prototype.visitDate=Ul;H.prototype.visitDateDay=Ul;H.prototype.visitDateMillisecond=Ul;H.prototype.visitTimestamp=Ns;H.prototype.visitTimestampSecond=Ns;H.prototype.visitTimestampMillisecond=Ns;H.prototype.visitTimestampMicrosecond=Ns;H.prototype.visitTimestampNanosecond=Ns;H.prototype.visitTime=ks;H.prototype.visitTimeSecond=ks;H.prototype.visitTimeMillisecond=ks;H.prototype.visitTimeMicrosecond=ks;H.prototype.visitTimeNanosecond=ks;H.prototype.visitDecimal=Ls;H.prototype.visitList=uS;H.prototype.visitStruct=lS;H.prototype.visitUnion=Rl;H.prototype.visitDenseUnion=Rl;H.prototype.visitSparseUnion=Rl;H.prototype.visitDictionary=dS;H.prototype.visitInterval=xl;H.prototype.visitIntervalDayTime=xl;H.prototype.visitIntervalYearMonth=xl;H.prototype.visitFixedSizeList=fS;H.prototype.visitMap=hS;Pe.instance=new H;function pS(r,e){return Pe.instance.compareSchemas(r,e)}Pe.compareSchemas=pS;function yS(r,e){return Pe.instance.compareFields(r,e)}Pe.compareFields=yS;function _S(r,e){return Pe.instance.visit(r,e)}Pe.compareTypes=_S});var dm=w(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.VectorAssembler=void 0;var mS=it(),am=we(),bS=Lr(),Pl=Je(),Ll=ur(),gS=$n(),cm=Xn(),um=he(),Ge=class extends mS.Visitor{constructor(){super();this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...e){let t=new Ge,n=gS.selectVectorChildrenArgs(bS.RecordBatch,e),[i=t]=t.visitMany(n);return i}visit(e){if(!um.DataType.isDictionary(e.type)){let{data:t,length:n,nullCount:i}=e;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");um.DataType.isNull(e.type)||er.call(this,i<=0?new Uint8Array(0):Ll.truncateBitmap(t.offset,n,t.nullBitmap)),this.nodes.push(new cm.FieldNode(n,i))}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.indices)}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};Ca.VectorAssembler=Ge;function er(r){let e=r.byteLength+7&~7;return this.buffers.push(r),this.bufferRegions.push(new cm.BufferRegion(this._byteLength,e)),this._byteLength+=e,this}function vS(r){let{type:e,length:t,typeIds:n,valueOffsets:i}=r;if(er.call(this,n),e.mode===am.UnionMode.Sparse)return kl.call(this,r);if(e.mode===am.UnionMode.Dense){if(r.offset<=0)return er.call(this,i),kl.call(this,r);{let s=n.reduce((_,T)=>Math.max(_,T),n[0]),o=new Int32Array(s+1),u=new Int32Array(s+1).fill(-1),a=new Int32Array(t),h=Pl.rebaseValueOffsets(-i[0],t,i);for(let _,T,M=-1;++M<t;)(T=u[_=n[M]])===-1&&(T=u[_]=h[_]),a[M]=h[M]-T,++o[_];er.call(this,a);for(let _,T=-1,M=e.children.length;++T<M;)if(_=r.getChildAt(T)){let E=e.typeIds[T],q=Math.min(t,o[E]);this.visit(_.slice(u[E],q))}}}return this}function wS(r){let e;return r.nullCount>=r.length?er.call(this,new Uint8Array(0)):(e=r.values)instanceof Uint8Array?er.call(this,Ll.truncateBitmap(r.offset,r.length,e)):er.call(this,Ll.packBools(r))}function vn(r){return er.call(this,r.values.subarray(0,r.length*r.stride))}function lm(r){let{length:e,values:t,valueOffsets:n}=r,i=n[0],s=n[e],o=Math.min(s-i,t.byteLength-i);return er.call(this,Pl.rebaseValueOffsets(-n[0],e,n)),er.call(this,t.subarray(i,i+o)),this}function Nl(r){let{length:e,valueOffsets:t}=r;return t&&er.call(this,Pl.rebaseValueOffsets(t[0],e,t)),this.visit(r.getChildAt(0))}function kl(r){return this.visitMany(r.type.children.map((e,t)=>r.getChildAt(t)).filter(Boolean))[0]}Ge.prototype.visitBool=wS;Ge.prototype.visitInt=vn;Ge.prototype.visitFloat=vn;Ge.prototype.visitUtf8=lm;Ge.prototype.visitBinary=lm;Ge.prototype.visitFixedSizeBinary=vn;Ge.prototype.visitDate=vn;Ge.prototype.visitTimestamp=vn;Ge.prototype.visitTime=vn;Ge.prototype.visitDecimal=vn;Ge.prototype.visitList=Nl;Ge.prototype.visitStruct=kl;Ge.prototype.visitUnion=vS;Ge.prototype.visitInterval=vn;Ge.prototype.visitFixedSizeList=Nl;Ge.prototype.visitMap=Nl});var hm=w(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.JSONTypeAssembler=void 0;var BS=it(),ot=Zr(),Ni=we(),fm=class extends BS.Visitor{visit(e){return e==null?void 0:super.visit(e)}visitNull({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitInt({typeId:e,bitWidth:t,isSigned:n}){return{name:ot.Type[e].toLowerCase(),bitWidth:t,isSigned:n}}visitFloat({typeId:e,precision:t}){return{name:ot.Type[e].toLowerCase(),precision:Ni.Precision[t]}}visitBinary({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitBool({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitUtf8({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitDecimal({typeId:e,scale:t,precision:n}){return{name:ot.Type[e].toLowerCase(),scale:t,precision:n}}visitDate({typeId:e,unit:t}){return{name:ot.Type[e].toLowerCase(),unit:Ni.DateUnit[t]}}visitTime({typeId:e,unit:t,bitWidth:n}){return{name:ot.Type[e].toLowerCase(),unit:Ni.TimeUnit[t],bitWidth:n}}visitTimestamp({typeId:e,timezone:t,unit:n}){return{name:ot.Type[e].toLowerCase(),unit:Ni.TimeUnit[n],timezone:t}}visitInterval({typeId:e,unit:t}){return{name:ot.Type[e].toLowerCase(),unit:Ni.IntervalUnit[t]}}visitList({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitStruct({typeId:e}){return{name:ot.Type[e].toLowerCase()}}visitUnion({typeId:e,mode:t,typeIds:n}){return{name:ot.Type[e].toLowerCase(),mode:Ni.UnionMode[t],typeIds:[...n]}}visitDictionary(e){return this.visit(e.dictionary)}visitFixedSizeBinary({typeId:e,byteWidth:t}){return{name:ot.Type[e].toLowerCase(),byteWidth:t}}visitFixedSizeList({typeId:e,listSize:t}){return{name:ot.Type[e].toLowerCase(),listSize:t}}visitMap({typeId:e,keysSorted:t}){return{name:ot.Type[e].toLowerCase(),keysSorted:t}}};ja.JSONTypeAssembler=fm});var _m=w(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.JSONVectorAssembler=void 0;var IS=Fs(),Cs=xi(),TS=je(),SS=it(),AS=we(),FS=Lr(),Cl=we(),qa=ur(),DS=$n(),pm=he(),Ha=class extends SS.Visitor{static assemble(...e){return new Ha().visitMany(DS.selectColumnChildrenArgs(FS.RecordBatch,e))}visit(e){let{data:t,name:n,length:i}=e,{offset:s,nullCount:o,nullBitmap:u}=t,a=pm.DataType.isDictionary(e.type)?e.type.indices:e.type,h=Object.assign([],t.buffers,{[AS.BufferType.VALIDITY]:void 0});return Object.assign({name:n,count:i,VALIDITY:pm.DataType.isNull(a)?void 0:o<=0?Array.from({length:i},()=>1):[...new qa.BitIterator(u,s,i,null,qa.getBit)]},super.visit(TS.Vector.new(t.clone(a,s,i,0,h))))}visitNull(){return{}}visitBool({values:e,offset:t,length:n}){return{DATA:[...new qa.BitIterator(e,t,n,null,qa.getBool)]}}visitInt(e){return{DATA:e.type.bitWidth<64?[...e.values]:[...js(e.values,2)]}}visitFloat(e){return{DATA:[...e.values]}}visitUtf8(e){return{DATA:[...e],OFFSET:[...e.valueOffsets]}}visitBinary(e){return{DATA:[...ym(e)],OFFSET:[...e.valueOffsets]}}visitFixedSizeBinary(e){return{DATA:[...ym(e)]}}visitDate(e){return{DATA:e.type.unit===Cl.DateUnit.DAY?[...e.values]:[...js(e.values,2)]}}visitTimestamp(e){return{DATA:[...js(e.values,2)]}}visitTime(e){return{DATA:e.type.unit<Cl.TimeUnit.MICROSECOND?[...e.values]:[...js(e.values,2)]}}visitDecimal(e){return{DATA:[...js(e.values,4)]}}visitList(e){return{OFFSET:[...e.valueOffsets],children:e.type.children.map((t,n)=>this.visit(new Cs.Column(t,[e.getChildAt(n)])))}}visitStruct(e){return{children:e.type.children.map((t,n)=>this.visit(new Cs.Column(t,[e.getChildAt(n)])))}}visitUnion(e){return{TYPE:[...e.typeIds],OFFSET:e.type.mode===Cl.UnionMode.Dense?[...e.valueOffsets]:void 0,children:e.type.children.map((t,n)=>this.visit(new Cs.Column(t,[e.getChildAt(n)])))}}visitInterval(e){return{DATA:[...e.values]}}visitFixedSizeList(e){return{children:e.type.children.map((t,n)=>this.visit(new Cs.Column(t,[e.getChildAt(n)])))}}visitMap(e){return{OFFSET:[...e.valueOffsets],children:e.type.children.map((t,n)=>this.visit(new Cs.Column(t,[e.getChildAt(n)])))}}};za.JSONVectorAssembler=Ha;function*ym(r){for(let e of r)yield e.reduce((t,n)=>`${t}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*js(r,e){for(let t=-1,n=r.length/e;++t<n;)yield`${IS.BN.new(r.subarray((t+0)*e,(t+1)*e),!1)}`}});var Ja=w(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.RecordBatchJSONWriter=gr.RecordBatchFileWriter=gr.RecordBatchStreamWriter=gr.RecordBatchWriter=void 0;var mm=ct(),jl=Hs(),OS=Na(),MS=xi(),ES=he(),US=et(),Wa=Xn(),ql=Xn(),ki=fl(),Hl=we(),bm=Vl(),zl=fn(),gm=dm(),RS=hm(),vm=_m(),xS=Je(),Wl=Lr(),VS=ai(),br=ut(),qs=class extends VS.ReadableInterop{constructor(e){super();this._position=0,this._started=!1,this._sink=new zl.AsyncByteQueue,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,br.isObject(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return br.isPromise(e)?e.then(t=>this.writeAll(t)):br.isAsyncIterable(e)?Gl(this,e):Yl(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof zl.AsyncByteQueue?this._sink=e:(this._sink=new zl.AsyncByteQueue,e&&br.isWritableDOMStream(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&br.isWritableNodeStream(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!t||!bm.compareSchemas(t,this._schema))&&(t===null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof jl.Table&&!(t=e.schema))return this.finish()&&void 0;if(e instanceof Wl.RecordBatch&&!(t=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(t&&!bm.compareSchemas(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof Wl.RecordBatch?e instanceof Wl._InternalEmptyPlaceholderRecordBatch||this._writeRecordBatch(e):e instanceof jl.Table?this.writeAll(e.chunks):br.isIterable(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,i=Wa.Message.encode(e),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,u=s+o+n&~n,a=u-s-o;return e.headerType===Hl.MessageHeader.RecordBatch?this._recordBatchBlocks.push(new ki.FileBlock(u,e.bodyLength,this._position)):e.headerType===Hl.MessageHeader.DictionaryBatch&&this._dictionaryBlocks.push(new ki.FileBlock(u,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(u-o)),s>0&&this._write(i),this._writePadding(a)}_write(e){if(this._started){let t=xS.toUint8Array(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(Wa.Message.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(OS.MAGIC)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:i,buffers:s}=gm.VectorAssembler.assemble(e),o=new ql.RecordBatch(e.length,n,i),u=Wa.Message.from(o,t);return this._writeDictionaries(e)._writeMessage(u)._writeBodyBuffers(s)}_writeDictionaryBatch(e,t,n=!1){this._dictionaryDeltaOffsets.set(t,e.length+(this._dictionaryDeltaOffsets.get(t)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:u}=gm.VectorAssembler.assemble(e),a=new ql.RecordBatch(e.length,s,o),h=new ql.DictionaryBatch(a,t,n),_=Wa.Message.from(h,i);return this._writeMessage(_)._writeBodyBuffers(u)}_writeBodyBuffers(e){let t,n,i;for(let s=-1,o=e.length;++s<o;)(t=e[s])&&(n=t.byteLength)>0&&(this._write(t),(i=(n+7&~7)-n)>0&&this._writePadding(i));return this}_writeDictionaries(e){for(let[t,n]of e.dictionaries){let i=this._dictionaryDeltaOffsets.get(t)||0;if(i===0||(n=n.slice(i)).length>0){let s="chunks"in n?n.chunks:[n];for(let o of s)this._writeDictionaryBatch(o,t,i>0),i+=o.length}}return this}};gr.RecordBatchWriter=qs;var Ya=class extends qs{static writeAll(e,t){let n=new Ya(t);return br.isPromise(e)?e.then(i=>n.writeAll(i)):br.isAsyncIterable(e)?Gl(n,e):Yl(n,e)}};gr.RecordBatchStreamWriter=Ya;var Ga=class extends qs{static writeAll(e){let t=new Ga;return br.isPromise(e)?e.then(n=>t.writeAll(n)):br.isAsyncIterable(e)?Gl(t,e):Yl(t,e)}constructor(){super();this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeFooter(e){let t=ki.Footer.encode(new ki.Footer(e,Hl.MetadataVersion.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}};gr.RecordBatchFileWriter=Ga;var $a=class extends qs{constructor(){super();this._autoDestroy=!0,this._recordBatches=[],this._dictionaries=[]}static writeAll(e){return new $a().writeAll(e)}_writeMessage(){return this}_writeFooter(e){return this}_writeSchema(e){return this._write(`{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"dictionaries": [
|
|
11
|
-
`)
|
|
12
|
-
]`)}if(this._recordBatches.length>0){for(let e=-1,t=this._recordBatches.length;++e<t;)this._write(e===0?`,
|
|
13
|
-
"batches": [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}`),this._dictionaries=[],this._recordBatches=[],super.close()}};gr.RecordBatchJSONWriter=$a;function Yl(r,e){let t=e;e instanceof jl.Table&&(t=e.chunks,r.reset(void 0,e.schema));for(let n of t)r.write(n);return r.finish()}function Gl(r,e){var t,n,i,s;return mm.__awaiter(this,void 0,void 0,function*(){try{for(t=mm.__asyncValues(e);n=yield t.next(),!n.done;){let o=n.value;r.write(o)}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=t.return)&&(yield s.call(t))}finally{if(i)throw i.error}}return r.finish()})}function wm({name:r,type:e,nullable:t}){let n=new RS.JSONTypeAssembler;return{name:r,nullable:t,type:n.visit(e),children:(e.children||[]).map(wm),dictionary:ES.DataType.isDictionary(e)?{id:e.id,isOrdered:e.isOrdered,indexType:n.visit(e.indices)}:void 0}}function PS(r,e,t=!1){let n=new US.Field(`${e}`,r.type,r.nullCount>0),i=vm.JSONVectorAssembler.assemble(new MS.Column(n,[r]));return JSON.stringify({id:e,isDelta:t,data:{count:r.length,columns:i}},null,2)}function LS(r){return JSON.stringify({count:r.length,columns:vm.JSONVectorAssembler.assemble(r)},null,2)}});var Kl=w(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.distributeVectorsIntoRecordBatches=wn.distributeColumnsIntoRecordBatches=wn.ensureSameLengthData=void 0;var Bm=Jt(),$l=et(),NS=_n(),kS=Lr(),Jl=new Uint8Array(0),Im=r=>[Jl,Jl,new Uint8Array(r),Jl];function CS(r,e,t=e.reduce((n,i)=>Math.max(n,i.length),0)){let n,i,s=-1,o=e.length,u=[...r.fields],a=[],h=(t+63&~63)>>3;for(;++s<o;)(n=e[s])&&n.length===t?a[s]=n:((i=u[s]).nullable||(u[s]=u[s].clone({nullable:!0})),a[s]=n?n._changeLengthAndBackfillNullBitmap(t):Bm.Data.new(i.type,0,t,t,Im(h)));return[new $l.Schema(u),t,a]}wn.ensureSameLengthData=CS;function jS(r){return Tm(new $l.Schema(r.map(({field:e})=>e)),r)}wn.distributeColumnsIntoRecordBatches=jS;function Tm(r,e){return qS(r,e.map(t=>t instanceof NS.Chunked?t.chunks.map(n=>n.data):[t.data]))}wn.distributeVectorsIntoRecordBatches=Tm;function qS(r,e){let t=[...r.fields],n=[],i={numBatches:e.reduce((T,M)=>Math.max(T,M.length),0)},s=0,o=0,u=-1,a=e.length,h,_=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,u=-1;++u<a;)_[u]=h=e[u].shift(),o=Math.min(o,h?h.length:o);isFinite(o)&&(_=HS(t,o,_,e,i),o>0&&(n[s++]=[o,_.slice()]))}return[r=new $l.Schema(t,r.metadata),n.map(T=>new kS.RecordBatch(r,...T))]}function HS(r,e,t,n,i){let s,o,u=0,a=-1,h=n.length,_=(e+63&~63)>>3;for(;++a<h;)(s=t[a])&&(u=s.length)>=e?u===e?t[a]=s:(t[a]=s.slice(0,e),s=s.slice(e,u-e),i.numBatches=Math.max(i.numBatches,n[a].unshift(s))):((o=r[a]).nullable||(r[a]=o.clone({nullable:!0})),t[a]=s?s._changeLengthAndBackfillNullBitmap(e):Bm.Data.new(o.type,0,e,e,Im(_)));return t}});var He=w(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.BaseVector=void 0;var zS=we(),WS=_n(),YS=Vs(),Xl=je(),Zl=class extends Xl.AbstractVector{constructor(e,t){super();this._children=t,this.numChildren=e.childData.length,this._bindDataAccessors(this.data=e)}get type(){return this.data.type}get typeId(){return this.data.typeId}get length(){return this.data.length}get offset(){return this.data.offset}get stride(){return this.data.stride}get nullCount(){return this.data.nullCount}get byteLength(){return this.data.byteLength}get VectorName(){return`${zS.Type[this.typeId]}Vector`}get ArrayType(){return this.type.ArrayType}get values(){return this.data.values}get typeIds(){return this.data.typeIds}get nullBitmap(){return this.data.nullBitmap}get valueOffsets(){return this.data.valueOffsets}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}clone(e,t=this._children){return Xl.Vector.new(e,t)}concat(...e){return WS.Chunked.concat(this,...e)}slice(e,t){return YS.clampRange(this,e,t,this._sliceInternal)}isValid(e){if(this.nullCount>0){let t=this.offset+e;return(this.nullBitmap[t>>3]&1<<t%8)!==0}return!0}getChildAt(e){return e<0||e>=this.numChildren?null:(this._children||(this._children=[]))[e]||(this._children[e]=Xl.Vector.new(this.data.childData[e]))}toJSON(){return[...this]}_sliceInternal(e,t,n){return e.clone(e.data.slice(t,n-t),null)}_bindDataAccessors(e){}};Ka.BaseVector=Zl;Zl.prototype[Symbol.isConcatSpreadable]=!0});var Ql=w(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.BinaryVector=void 0;var GS=je(),$S=He(),JS=he(),Sm=class extends $S.BaseVector{asUtf8(){return GS.Vector.new(this.data.clone(new JS.Utf8))}};Xa.BinaryVector=Sm});var ed=w(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.BoolVector=void 0;var KS=he(),XS=He(),ZS=vr(),Am=class extends XS.BaseVector{static from(e){return ZS.vectorFromValuesWithType(()=>new KS.Bool,e)}};Za.BoolVector=Am});var rd=w(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.DateMillisecondVector=Bn.DateDayVector=Bn.DateVector=void 0;var QS=we(),e1=He(),Fm=vr(),td=he(),Qa=class extends e1.BaseVector{static from(...e){return e.length===2?Fm.vectorFromValuesWithType(()=>e[1]===QS.DateUnit.DAY?new td.DateDay:new td.DateMillisecond,e[0]):Fm.vectorFromValuesWithType(()=>new td.DateMillisecond,e[0])}};Bn.DateVector=Qa;var Dm=class extends Qa{};Bn.DateDayVector=Dm;var Om=class extends Qa{};Bn.DateMillisecondVector=Om});var nd=w(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.DecimalVector=void 0;var t1=He(),Mm=class extends t1.BaseVector{};ec.DecimalVector=Mm});var rc=w(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.DictionaryVector=void 0;var r1=Jt(),Em=je(),n1=He(),i1=vr(),s1=he(),id=class extends n1.BaseVector{constructor(e){super(e);this.indices=Em.Vector.new(e.clone(this.type.indices))}static from(...e){if(e.length===3){let[t,n,i]=e,s=new s1.Dictionary(t.type,n,null,null);return Em.Vector.new(r1.Data.Dictionary(s,0,i.length,0,null,i,t))}return i1.vectorFromValuesWithType(()=>e[0].type,e[0])}get dictionary(){return this.data.dictionary}reverseLookup(e){return this.dictionary.indexOf(e)}getKey(e){return this.indices.get(e)}getValue(e){return this.dictionary.get(e)}setKey(e,t){return this.indices.set(e,t)}setValue(e,t){return this.dictionary.set(e,t)}};tc.DictionaryVector=id;id.prototype.indices=null});var sd=w(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.FixedSizeBinaryVector=void 0;var o1=He(),Um=class extends o1.BaseVector{};nc.FixedSizeBinaryVector=Um});var od=w(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.FixedSizeListVector=void 0;var a1=He(),Rm=class extends a1.BaseVector{};ic.FixedSizeListVector=Rm});var ld=w(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.Float64Vector=wr.Float32Vector=wr.Float16Vector=wr.FloatVector=void 0;var c1=Jt(),u1=je(),l1=He(),d1=vr(),ti=he(),zs=class extends l1.BaseVector{static from(e){let t=p1(this);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let n=h1(e.constructor)||t;if(t===null&&(t=n),t&&t===n){let i=new t,s=e.byteLength/i.ArrayType.BYTES_PER_ELEMENT;if(!f1(t,e.constructor))return u1.Vector.new(c1.Data.Float(i,0,s,0,null,e))}}if(t)return d1.vectorFromValuesWithType(()=>new t,e);throw e instanceof DataView||e instanceof ArrayBuffer?new TypeError(`Cannot infer float type from instance of ${e.constructor.name}`):new TypeError("Unrecognized FloatVector input")}};wr.FloatVector=zs;var ad=class extends zs{toFloat32Array(){return new Float32Array(this)}toFloat64Array(){return new Float64Array(this)}};wr.Float16Vector=ad;var cd=class extends zs{};wr.Float32Vector=cd;var ud=class extends zs{};wr.Float64Vector=ud;var f1=(r,e)=>r===ti.Float16&&e!==Uint16Array,h1=r=>{switch(r){case Uint16Array:return ti.Float16;case Float32Array:return ti.Float32;case Float64Array:return ti.Float64;default:return null}},p1=r=>{switch(r){case ad:return ti.Float16;case cd:return ti.Float32;case ud:return ti.Float64;default:return null}}});var dd=w(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.IntervalYearMonthVector=In.IntervalDayTimeVector=In.IntervalVector=void 0;var y1=He(),sc=class extends y1.BaseVector{};In.IntervalVector=sc;var xm=class extends sc{};In.IntervalDayTimeVector=xm;var Vm=class extends sc{};In.IntervalYearMonthVector=Vm});var oc=w($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.Uint64Vector=$e.Uint32Vector=$e.Uint16Vector=$e.Uint8Vector=$e.Int64Vector=$e.Int32Vector=$e.Int16Vector=$e.Int8Vector=$e.IntVector=void 0;var _1=Jt(),m1=je(),b1=He(),g1=vr(),Pm=ut(),Lm=Je(),Le=he(),Br=class extends b1.BaseVector{static from(...e){let[t,n=!1]=e,i=B1(this,n);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let s=w1(t.constructor,n)||i;if(i===null&&(i=s),i&&i===s){let o=new i,u=t.byteLength/o.ArrayType.BYTES_PER_ELEMENT;return v1(i,t.constructor)&&(u*=.5),m1.Vector.new(_1.Data.Int(o,0,u,0,null,t))}}if(i)return g1.vectorFromValuesWithType(()=>new i,t);throw t instanceof DataView||t instanceof ArrayBuffer?new TypeError(`Cannot infer integer type from instance of ${t.constructor.name}`):new TypeError("Unrecognized IntVector input")}};$e.IntVector=Br;var fd=class extends Br{};$e.Int8Vector=fd;var hd=class extends Br{};$e.Int16Vector=hd;var pd=class extends Br{};$e.Int32Vector=pd;var yd=class extends Br{toBigInt64Array(){return Lm.toBigInt64Array(this.values)}get values64(){return this._values64||(this._values64=this.toBigInt64Array())}};$e.Int64Vector=yd;var _d=class extends Br{};$e.Uint8Vector=_d;var md=class extends Br{};$e.Uint16Vector=md;var bd=class extends Br{};$e.Uint32Vector=bd;var gd=class extends Br{toBigUint64Array(){return Lm.toBigUint64Array(this.values)}get values64(){return this._values64||(this._values64=this.toBigUint64Array())}};$e.Uint64Vector=gd;var v1=(r,e)=>(r===Le.Int64||r===Le.Uint64)&&(e===Int32Array||e===Uint32Array),w1=(r,e)=>{switch(r){case Int8Array:return Le.Int8;case Int16Array:return Le.Int16;case Int32Array:return e?Le.Int64:Le.Int32;case Pm.BigInt64Array:return Le.Int64;case Uint8Array:return Le.Uint8;case Uint16Array:return Le.Uint16;case Uint32Array:return e?Le.Uint64:Le.Uint32;case Pm.BigUint64Array:return Le.Uint64;default:return null}},B1=(r,e)=>{switch(r){case fd:return Le.Int8;case hd:return Le.Int16;case pd:return e?Le.Int64:Le.Int32;case yd:return Le.Int64;case _d:return Le.Uint8;case md:return Le.Uint16;case bd:return e?Le.Uint64:Le.Uint32;case gd:return Le.Uint64;default:return null}}});var vd=w(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.ListVector=void 0;var I1=He(),Nm=class extends I1.BaseVector{};ac.ListVector=Nm});var wd=w(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.MapVector=void 0;var T1=Rs(),S1=je(),A1=He(),F1=he(),km=class extends A1.BaseVector{asList(){let e=this.type.children[0];return S1.Vector.new(this.data.clone(new F1.List(e)))}bind(e){let t=this.getChildAt(0),{[e]:n,[e+1]:i}=this.valueOffsets;return new T1.MapRow(t.slice(n,i))}};cc.MapVector=km});var Bd=w(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.NullVector=void 0;var D1=He(),Cm=class extends D1.BaseVector{};uc.NullVector=Cm});var Id=w(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.StructVector=void 0;var O1=Rs(),M1=He(),E1=Symbol.for("rowIndex"),jm=class extends M1.BaseVector{bind(e){let t=this._row||(this._row=new O1.StructRow(this)),n=Object.create(t);return n[E1]=e,n}};lc.StructVector=jm});var Td=w(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.TimestampNanosecondVector=Nt.TimestampMicrosecondVector=Nt.TimestampMillisecondVector=Nt.TimestampSecondVector=Nt.TimestampVector=void 0;var U1=He(),Ci=class extends U1.BaseVector{};Nt.TimestampVector=Ci;var qm=class extends Ci{};Nt.TimestampSecondVector=qm;var Hm=class extends Ci{};Nt.TimestampMillisecondVector=Hm;var zm=class extends Ci{};Nt.TimestampMicrosecondVector=zm;var Wm=class extends Ci{};Nt.TimestampNanosecondVector=Wm});var Sd=w(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.TimeNanosecondVector=kt.TimeMicrosecondVector=kt.TimeMillisecondVector=kt.TimeSecondVector=kt.TimeVector=void 0;var R1=He(),ji=class extends R1.BaseVector{};kt.TimeVector=ji;var Ym=class extends ji{};kt.TimeSecondVector=Ym;var Gm=class extends ji{};kt.TimeMillisecondVector=Gm;var $m=class extends ji{};kt.TimeMicrosecondVector=$m;var Jm=class extends ji{};kt.TimeNanosecondVector=Jm});var Ad=w(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.SparseUnionVector=Tn.DenseUnionVector=Tn.UnionVector=void 0;var x1=He(),dc=class extends x1.BaseVector{get typeIdToChildIndex(){return this.data.type.typeIdToChildIndex}};Tn.UnionVector=dc;var Km=class extends dc{get valueOffsets(){return this.data.valueOffsets}};Tn.DenseUnionVector=Km;var Xm=class extends dc{};Tn.SparseUnionVector=Xm});var Fd=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.Utf8Vector=void 0;var V1=je(),P1=He(),Zm=he(),L1=vr(),Qm=class extends P1.BaseVector{static from(e){return L1.vectorFromValuesWithType(()=>new Zm.Utf8,e)}asBinary(){return V1.Vector.new(this.data.clone(new Zm.Binary))}};fc.Utf8Vector=Qm});var eb=w(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.partial2=Sn.partial1=Sn.partial0=void 0;function N1(r){return function(){return r(this)}}Sn.partial0=N1;function k1(r){return function(e){return r(this,e)}}Sn.partial1=k1;function C1(r){return function(e,t){return r(this,e,t)}}Sn.partial2=C1});var Md=w(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.instance=qi.GetVisitor=void 0;var hc=Fs(),j1=it(),q1=xn(),H1=Is(),Ct=we(),z=class extends j1.Visitor{};qi.GetVisitor=z;var z1=(r,e)=>864e5*r[e],Dd=(r,e)=>4294967296*r[e+1]+(r[e]>>>0),W1=(r,e)=>4294967296*(r[e+1]/1e3)+(r[e]>>>0)/1e3,Y1=(r,e)=>4294967296*(r[e+1]/1e6)+(r[e]>>>0)/1e6,tb=r=>new Date(r),G1=(r,e)=>tb(z1(r,e)),$1=(r,e)=>tb(Dd(r,e)),J1=(r,e)=>null,rb=(r,e,t)=>{let{[t]:n,[t+1]:i}=e;return n!=null&&i!=null?r.subarray(n,i):null},K1=({offset:r,values:e},t)=>{let n=r+t;return(e[n>>3]&1<<n%8)!==0},nb=({values:r},e)=>G1(r,e),ib=({values:r},e)=>$1(r,e*2),Ir=({stride:r,values:e},t)=>e[r*t],sb=({stride:r,values:e},t)=>H1.uint16ToFloat64(e[r*t]),Od=({stride:r,values:e,type:t},n)=>hc.BN.new(e.subarray(r*n,r*(n+1)),t.isSigned),X1=({stride:r,values:e},t)=>e.subarray(r*t,r*(t+1)),Z1=({values:r,valueOffsets:e},t)=>rb(r,e,t),Q1=({values:r,valueOffsets:e},t)=>{let n=rb(r,e,t);return n!==null?q1.decodeUtf8(n):null},eA=(r,e)=>r.type.bitWidth<64?Ir(r,e):Od(r,e),tA=(r,e)=>r.type.precision!==Ct.Precision.HALF?Ir(r,e):sb(r,e),rA=(r,e)=>r.type.unit===Ct.DateUnit.DAY?nb(r,e):ib(r,e),ob=({values:r},e)=>1e3*Dd(r,e*2),ab=({values:r},e)=>Dd(r,e*2),cb=({values:r},e)=>W1(r,e*2),ub=({values:r},e)=>Y1(r,e*2),nA=(r,e)=>{switch(r.type.unit){case Ct.TimeUnit.SECOND:return ob(r,e);case Ct.TimeUnit.MILLISECOND:return ab(r,e);case Ct.TimeUnit.MICROSECOND:return cb(r,e);case Ct.TimeUnit.NANOSECOND:return ub(r,e)}},lb=({values:r,stride:e},t)=>r[e*t],db=({values:r,stride:e},t)=>r[e*t],fb=({values:r},e)=>hc.BN.signed(r.subarray(2*e,2*(e+1))),hb=({values:r},e)=>hc.BN.signed(r.subarray(2*e,2*(e+1))),iA=(r,e)=>{switch(r.type.unit){case Ct.TimeUnit.SECOND:return lb(r,e);case Ct.TimeUnit.MILLISECOND:return db(r,e);case Ct.TimeUnit.MICROSECOND:return fb(r,e);case Ct.TimeUnit.NANOSECOND:return hb(r,e)}},sA=({values:r},e)=>hc.BN.decimal(r.subarray(4*e,4*(e+1))),oA=(r,e)=>{let t=r.getChildAt(0),{valueOffsets:n,stride:i}=r;return t.slice(n[e*i],n[e*i+1])},aA=(r,e)=>r.bind(e),cA=(r,e)=>r.bind(e),uA=(r,e)=>r.type.mode===Ct.UnionMode.Dense?pb(r,e):yb(r,e),pb=(r,e)=>{let t=r.typeIdToChildIndex[r.typeIds[e]],n=r.getChildAt(t);return n?n.get(r.valueOffsets[e]):null},yb=(r,e)=>{let t=r.typeIdToChildIndex[r.typeIds[e]],n=r.getChildAt(t);return n?n.get(e):null},lA=(r,e)=>r.getValue(r.getKey(e)),dA=(r,e)=>r.type.unit===Ct.IntervalUnit.DAY_TIME?_b(r,e):mb(r,e),_b=({values:r},e)=>r.subarray(2*e,2*(e+1)),mb=({values:r},e)=>{let t=r[e],n=new Int32Array(2);return n[0]=t/12|0,n[1]=t%12|0,n},fA=(r,e)=>{let t=r.getChildAt(0),{stride:n}=r;return t.slice(e*n,(e+1)*n)};z.prototype.visitNull=J1;z.prototype.visitBool=K1;z.prototype.visitInt=eA;z.prototype.visitInt8=Ir;z.prototype.visitInt16=Ir;z.prototype.visitInt32=Ir;z.prototype.visitInt64=Od;z.prototype.visitUint8=Ir;z.prototype.visitUint16=Ir;z.prototype.visitUint32=Ir;z.prototype.visitUint64=Od;z.prototype.visitFloat=tA;z.prototype.visitFloat16=sb;z.prototype.visitFloat32=Ir;z.prototype.visitFloat64=Ir;z.prototype.visitUtf8=Q1;z.prototype.visitBinary=Z1;z.prototype.visitFixedSizeBinary=X1;z.prototype.visitDate=rA;z.prototype.visitDateDay=nb;z.prototype.visitDateMillisecond=ib;z.prototype.visitTimestamp=nA;z.prototype.visitTimestampSecond=ob;z.prototype.visitTimestampMillisecond=ab;z.prototype.visitTimestampMicrosecond=cb;z.prototype.visitTimestampNanosecond=ub;z.prototype.visitTime=iA;z.prototype.visitTimeSecond=lb;z.prototype.visitTimeMillisecond=db;z.prototype.visitTimeMicrosecond=fb;z.prototype.visitTimeNanosecond=hb;z.prototype.visitDecimal=sA;z.prototype.visitList=oA;z.prototype.visitStruct=cA;z.prototype.visitUnion=uA;z.prototype.visitDenseUnion=pb;z.prototype.visitSparseUnion=yb;z.prototype.visitDictionary=lA;z.prototype.visitInterval=dA;z.prototype.visitIntervalDayTime=_b;z.prototype.visitIntervalYearMonth=mb;z.prototype.visitFixedSizeList=fA;z.prototype.visitMap=aA;qi.instance=new z});var wb=w(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.instance=Hi.IndexOfVisitor=void 0;var hA=it(),bb=ur(),gb=Vs(),W=class extends hA.Visitor{};Hi.IndexOfVisitor=W;function pA(r,e){return e===null&&r.length>0?0:-1}function yA(r,e){let{nullBitmap:t}=r.data;if(!t||r.nullCount<=0)return-1;let n=0;for(let i of new bb.BitIterator(t,r.data.offset+(e||0),r.length,t,bb.getBool)){if(!i)return n;++n}return-1}function ne(r,e,t){if(e===void 0)return-1;if(e===null)return yA(r,t);let n=gb.createElementComparator(e);for(let i=(t||0)-1,s=r.length;++i<s;)if(n(r.get(i)))return i;return-1}function vb(r,e,t){let n=gb.createElementComparator(e);for(let i=(t||0)-1,s=r.length;++i<s;)if(n(r.get(i)))return i;return-1}W.prototype.visitNull=pA;W.prototype.visitBool=ne;W.prototype.visitInt=ne;W.prototype.visitInt8=ne;W.prototype.visitInt16=ne;W.prototype.visitInt32=ne;W.prototype.visitInt64=ne;W.prototype.visitUint8=ne;W.prototype.visitUint16=ne;W.prototype.visitUint32=ne;W.prototype.visitUint64=ne;W.prototype.visitFloat=ne;W.prototype.visitFloat16=ne;W.prototype.visitFloat32=ne;W.prototype.visitFloat64=ne;W.prototype.visitUtf8=ne;W.prototype.visitBinary=ne;W.prototype.visitFixedSizeBinary=ne;W.prototype.visitDate=ne;W.prototype.visitDateDay=ne;W.prototype.visitDateMillisecond=ne;W.prototype.visitTimestamp=ne;W.prototype.visitTimestampSecond=ne;W.prototype.visitTimestampMillisecond=ne;W.prototype.visitTimestampMicrosecond=ne;W.prototype.visitTimestampNanosecond=ne;W.prototype.visitTime=ne;W.prototype.visitTimeSecond=ne;W.prototype.visitTimeMillisecond=ne;W.prototype.visitTimeMicrosecond=ne;W.prototype.visitTimeNanosecond=ne;W.prototype.visitDecimal=ne;W.prototype.visitList=ne;W.prototype.visitStruct=ne;W.prototype.visitUnion=ne;W.prototype.visitDenseUnion=vb;W.prototype.visitSparseUnion=vb;W.prototype.visitDictionary=ne;W.prototype.visitInterval=ne;W.prototype.visitIntervalDayTime=ne;W.prototype.visitIntervalYearMonth=ne;W.prototype.visitFixedSizeList=ne;W.prototype.visitMap=ne;Hi.instance=new W});var Ed=w(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.instance=zi.IteratorVisitor=void 0;var pc=we(),_A=it(),mA=ur(),Bb=Md(),Y=class extends _A.Visitor{};zi.IteratorVisitor=Y;function bA(r){let e=Bb.instance.getVisitFn(r);return new mA.BitIterator(r.data.nullBitmap,r.data.offset,r.length,r,(t,n,i,s)=>(i&1<<s)!==0?e(t,n):null)}var Ib=class{constructor(e,t){this.vector=e,this.getFn=t,this.index=0}next(){return this.index<this.vector.length?{value:this.getFn(this.vector,this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};function ee(r){if(r.nullCount>0)return bA(r);let{type:e,typeId:t,length:n}=r;return r.stride===1&&(t===pc.Type.Timestamp||t===pc.Type.Int&&e.bitWidth!==64||t===pc.Type.Time&&e.bitWidth!==64||t===pc.Type.Float&&e.precision>0)?r.data.values.subarray(0,n)[Symbol.iterator]():new Ib(r,Bb.instance.getVisitFn(r))}Y.prototype.visitNull=ee;Y.prototype.visitBool=ee;Y.prototype.visitInt=ee;Y.prototype.visitInt8=ee;Y.prototype.visitInt16=ee;Y.prototype.visitInt32=ee;Y.prototype.visitInt64=ee;Y.prototype.visitUint8=ee;Y.prototype.visitUint16=ee;Y.prototype.visitUint32=ee;Y.prototype.visitUint64=ee;Y.prototype.visitFloat=ee;Y.prototype.visitFloat16=ee;Y.prototype.visitFloat32=ee;Y.prototype.visitFloat64=ee;Y.prototype.visitUtf8=ee;Y.prototype.visitBinary=ee;Y.prototype.visitFixedSizeBinary=ee;Y.prototype.visitDate=ee;Y.prototype.visitDateDay=ee;Y.prototype.visitDateMillisecond=ee;Y.prototype.visitTimestamp=ee;Y.prototype.visitTimestampSecond=ee;Y.prototype.visitTimestampMillisecond=ee;Y.prototype.visitTimestampMicrosecond=ee;Y.prototype.visitTimestampNanosecond=ee;Y.prototype.visitTime=ee;Y.prototype.visitTimeSecond=ee;Y.prototype.visitTimeMillisecond=ee;Y.prototype.visitTimeMicrosecond=ee;Y.prototype.visitTimeNanosecond=ee;Y.prototype.visitDecimal=ee;Y.prototype.visitList=ee;Y.prototype.visitStruct=ee;Y.prototype.visitUnion=ee;Y.prototype.visitDenseUnion=ee;Y.prototype.visitSparseUnion=ee;Y.prototype.visitDictionary=ee;Y.prototype.visitInterval=ee;Y.prototype.visitIntervalDayTime=ee;Y.prototype.visitIntervalYearMonth=ee;Y.prototype.visitFixedSizeList=ee;Y.prototype.visitMap=ee;zi.instance=new Y});var Tb=w(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.instance=Wi.ToArrayVisitor=void 0;var Ws=we(),gA=it(),vA=Ed(),G=class extends gA.Visitor{};Wi.ToArrayVisitor=G;function te(r){let{type:e,length:t,stride:n}=r;switch(e.typeId){case Ws.Type.Int:case Ws.Type.Float:case Ws.Type.Decimal:case Ws.Type.Time:case Ws.Type.Timestamp:return r.data.values.subarray(0,t*n)}return[...vA.instance.visit(r)]}G.prototype.visitNull=te;G.prototype.visitBool=te;G.prototype.visitInt=te;G.prototype.visitInt8=te;G.prototype.visitInt16=te;G.prototype.visitInt32=te;G.prototype.visitInt64=te;G.prototype.visitUint8=te;G.prototype.visitUint16=te;G.prototype.visitUint32=te;G.prototype.visitUint64=te;G.prototype.visitFloat=te;G.prototype.visitFloat16=te;G.prototype.visitFloat32=te;G.prototype.visitFloat64=te;G.prototype.visitUtf8=te;G.prototype.visitBinary=te;G.prototype.visitFixedSizeBinary=te;G.prototype.visitDate=te;G.prototype.visitDateDay=te;G.prototype.visitDateMillisecond=te;G.prototype.visitTimestamp=te;G.prototype.visitTimestampSecond=te;G.prototype.visitTimestampMillisecond=te;G.prototype.visitTimestampMicrosecond=te;G.prototype.visitTimestampNanosecond=te;G.prototype.visitTime=te;G.prototype.visitTimeSecond=te;G.prototype.visitTimeMillisecond=te;G.prototype.visitTimeMicrosecond=te;G.prototype.visitTimeNanosecond=te;G.prototype.visitDecimal=te;G.prototype.visitList=te;G.prototype.visitStruct=te;G.prototype.visitUnion=te;G.prototype.visitDenseUnion=te;G.prototype.visitSparseUnion=te;G.prototype.visitDictionary=te;G.prototype.visitInterval=te;G.prototype.visitIntervalDayTime=te;G.prototype.visitIntervalYearMonth=te;G.prototype.visitFixedSizeList=te;G.prototype.visitMap=te;Wi.instance=new G});var Sb=w(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.instance=Yi.ByteWidthVisitor=void 0;var wA=it(),BA=we(),Ys=(r,e)=>r+e,Ud=r=>`Cannot compute the byte width of variable-width column ${r}`,Rd=class extends wA.Visitor{visitNull(e){return 0}visitInt(e){return e.bitWidth/8}visitFloat(e){return e.ArrayType.BYTES_PER_ELEMENT}visitBinary(e){throw new Error(Ud(e))}visitUtf8(e){throw new Error(Ud(e))}visitBool(e){return 1/8}visitDecimal(e){return 16}visitDate(e){return(e.unit+1)*4}visitTime(e){return e.bitWidth/8}visitTimestamp(e){return e.unit===BA.TimeUnit.SECOND?4:8}visitInterval(e){return(e.unit+1)*4}visitList(e){throw new Error(Ud(e))}visitStruct(e){return this.visitFields(e.children).reduce(Ys,0)}visitUnion(e){return this.visitFields(e.children).reduce(Ys,0)}visitFixedSizeBinary(e){return e.byteWidth}visitFixedSizeList(e){return e.listSize*this.visitFields(e.children).reduce(Ys,0)}visitMap(e){return this.visitFields(e.children).reduce(Ys,0)}visitDictionary(e){return this.visit(e.indices)}visitFields(e){return(e||[]).map(t=>this.visit(t.type))}visitSchema(e){return this.visitFields(e.fields).reduce(Ys,0)}};Yi.ByteWidthVisitor=Rd;Yi.instance=new Rd});var Ab=w(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.instance=Gi.GetVectorConstructor=void 0;var IA=it(),TA=Ql(),SA=ed(),xd=rd(),AA=nd(),FA=rc(),DA=sd(),OA=od(),yc=ld(),Vd=dd(),Nr=oc(),MA=vd(),EA=wd(),UA=Bd(),RA=Id(),Gs=Td(),$s=Sd(),Pd=Ad(),xA=Fd(),Ld=class extends IA.Visitor{visitNull(){return UA.NullVector}visitBool(){return SA.BoolVector}visitInt(){return Nr.IntVector}visitInt8(){return Nr.Int8Vector}visitInt16(){return Nr.Int16Vector}visitInt32(){return Nr.Int32Vector}visitInt64(){return Nr.Int64Vector}visitUint8(){return Nr.Uint8Vector}visitUint16(){return Nr.Uint16Vector}visitUint32(){return Nr.Uint32Vector}visitUint64(){return Nr.Uint64Vector}visitFloat(){return yc.FloatVector}visitFloat16(){return yc.Float16Vector}visitFloat32(){return yc.Float32Vector}visitFloat64(){return yc.Float64Vector}visitUtf8(){return xA.Utf8Vector}visitBinary(){return TA.BinaryVector}visitFixedSizeBinary(){return DA.FixedSizeBinaryVector}visitDate(){return xd.DateVector}visitDateDay(){return xd.DateDayVector}visitDateMillisecond(){return xd.DateMillisecondVector}visitTimestamp(){return Gs.TimestampVector}visitTimestampSecond(){return Gs.TimestampSecondVector}visitTimestampMillisecond(){return Gs.TimestampMillisecondVector}visitTimestampMicrosecond(){return Gs.TimestampMicrosecondVector}visitTimestampNanosecond(){return Gs.TimestampNanosecondVector}visitTime(){return $s.TimeVector}visitTimeSecond(){return $s.TimeSecondVector}visitTimeMillisecond(){return $s.TimeMillisecondVector}visitTimeMicrosecond(){return $s.TimeMicrosecondVector}visitTimeNanosecond(){return $s.TimeNanosecondVector}visitDecimal(){return AA.DecimalVector}visitList(){return MA.ListVector}visitStruct(){return RA.StructVector}visitUnion(){return Pd.UnionVector}visitDenseUnion(){return Pd.DenseUnionVector}visitSparseUnion(){return Pd.SparseUnionVector}visitDictionary(){return FA.DictionaryVector}visitInterval(){return Vd.IntervalVector}visitIntervalDayTime(){return Vd.IntervalDayTimeVector}visitIntervalYearMonth(){return Vd.IntervalYearMonthVector}visitFixedSizeList(){return OA.FixedSizeListVector}visitMap(){return EA.MapVector}};Gi.GetVectorConstructor=Ld;Gi.instance=new Ld});var vr=w(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.vectorFromValuesWithType=I.StructRow=I.MapRow=I.Utf8Vector=I.SparseUnionVector=I.DenseUnionVector=I.UnionVector=I.TimeNanosecondVector=I.TimeMicrosecondVector=I.TimeMillisecondVector=I.TimeSecondVector=I.TimeVector=I.TimestampNanosecondVector=I.TimestampMicrosecondVector=I.TimestampMillisecondVector=I.TimestampSecondVector=I.TimestampVector=I.StructVector=I.NullVector=I.MapVector=I.ListVector=I.Uint64Vector=I.Uint32Vector=I.Uint16Vector=I.Uint8Vector=I.Int64Vector=I.Int32Vector=I.Int16Vector=I.Int8Vector=I.IntVector=I.IntervalYearMonthVector=I.IntervalDayTimeVector=I.IntervalVector=I.Float64Vector=I.Float32Vector=I.Float16Vector=I.FloatVector=I.FixedSizeListVector=I.FixedSizeBinaryVector=I.DictionaryVector=I.DecimalVector=I.DateMillisecondVector=I.DateDayVector=I.DateVector=I.Chunked=I.BoolVector=I.BinaryVector=I.BaseVector=I.Vector=void 0;var Nd=ct(),VA=je();Object.defineProperty(I,"Vector",{enumerable:!0,get:function(){return VA.Vector}});var PA=He();Object.defineProperty(I,"BaseVector",{enumerable:!0,get:function(){return PA.BaseVector}});var LA=Ql();Object.defineProperty(I,"BinaryVector",{enumerable:!0,get:function(){return LA.BinaryVector}});var NA=ed();Object.defineProperty(I,"BoolVector",{enumerable:!0,get:function(){return NA.BoolVector}});var kA=_n();Object.defineProperty(I,"Chunked",{enumerable:!0,get:function(){return kA.Chunked}});var kd=rd();Object.defineProperty(I,"DateVector",{enumerable:!0,get:function(){return kd.DateVector}});Object.defineProperty(I,"DateDayVector",{enumerable:!0,get:function(){return kd.DateDayVector}});Object.defineProperty(I,"DateMillisecondVector",{enumerable:!0,get:function(){return kd.DateMillisecondVector}});var CA=nd();Object.defineProperty(I,"DecimalVector",{enumerable:!0,get:function(){return CA.DecimalVector}});var jA=rc();Object.defineProperty(I,"DictionaryVector",{enumerable:!0,get:function(){return jA.DictionaryVector}});var qA=sd();Object.defineProperty(I,"FixedSizeBinaryVector",{enumerable:!0,get:function(){return qA.FixedSizeBinaryVector}});var HA=od();Object.defineProperty(I,"FixedSizeListVector",{enumerable:!0,get:function(){return HA.FixedSizeListVector}});var _c=ld();Object.defineProperty(I,"FloatVector",{enumerable:!0,get:function(){return _c.FloatVector}});Object.defineProperty(I,"Float16Vector",{enumerable:!0,get:function(){return _c.Float16Vector}});Object.defineProperty(I,"Float32Vector",{enumerable:!0,get:function(){return _c.Float32Vector}});Object.defineProperty(I,"Float64Vector",{enumerable:!0,get:function(){return _c.Float64Vector}});var Cd=dd();Object.defineProperty(I,"IntervalVector",{enumerable:!0,get:function(){return Cd.IntervalVector}});Object.defineProperty(I,"IntervalDayTimeVector",{enumerable:!0,get:function(){return Cd.IntervalDayTimeVector}});Object.defineProperty(I,"IntervalYearMonthVector",{enumerable:!0,get:function(){return Cd.IntervalYearMonthVector}});var kr=oc();Object.defineProperty(I,"IntVector",{enumerable:!0,get:function(){return kr.IntVector}});Object.defineProperty(I,"Int8Vector",{enumerable:!0,get:function(){return kr.Int8Vector}});Object.defineProperty(I,"Int16Vector",{enumerable:!0,get:function(){return kr.Int16Vector}});Object.defineProperty(I,"Int32Vector",{enumerable:!0,get:function(){return kr.Int32Vector}});Object.defineProperty(I,"Int64Vector",{enumerable:!0,get:function(){return kr.Int64Vector}});Object.defineProperty(I,"Uint8Vector",{enumerable:!0,get:function(){return kr.Uint8Vector}});Object.defineProperty(I,"Uint16Vector",{enumerable:!0,get:function(){return kr.Uint16Vector}});Object.defineProperty(I,"Uint32Vector",{enumerable:!0,get:function(){return kr.Uint32Vector}});Object.defineProperty(I,"Uint64Vector",{enumerable:!0,get:function(){return kr.Uint64Vector}});var zA=vd();Object.defineProperty(I,"ListVector",{enumerable:!0,get:function(){return zA.ListVector}});var WA=wd();Object.defineProperty(I,"MapVector",{enumerable:!0,get:function(){return WA.MapVector}});var YA=Bd();Object.defineProperty(I,"NullVector",{enumerable:!0,get:function(){return YA.NullVector}});var GA=Id();Object.defineProperty(I,"StructVector",{enumerable:!0,get:function(){return GA.StructVector}});var Js=Td();Object.defineProperty(I,"TimestampVector",{enumerable:!0,get:function(){return Js.TimestampVector}});Object.defineProperty(I,"TimestampSecondVector",{enumerable:!0,get:function(){return Js.TimestampSecondVector}});Object.defineProperty(I,"TimestampMillisecondVector",{enumerable:!0,get:function(){return Js.TimestampMillisecondVector}});Object.defineProperty(I,"TimestampMicrosecondVector",{enumerable:!0,get:function(){return Js.TimestampMicrosecondVector}});Object.defineProperty(I,"TimestampNanosecondVector",{enumerable:!0,get:function(){return Js.TimestampNanosecondVector}});var Ks=Sd();Object.defineProperty(I,"TimeVector",{enumerable:!0,get:function(){return Ks.TimeVector}});Object.defineProperty(I,"TimeSecondVector",{enumerable:!0,get:function(){return Ks.TimeSecondVector}});Object.defineProperty(I,"TimeMillisecondVector",{enumerable:!0,get:function(){return Ks.TimeMillisecondVector}});Object.defineProperty(I,"TimeMicrosecondVector",{enumerable:!0,get:function(){return Ks.TimeMicrosecondVector}});Object.defineProperty(I,"TimeNanosecondVector",{enumerable:!0,get:function(){return Ks.TimeNanosecondVector}});var jd=Ad();Object.defineProperty(I,"UnionVector",{enumerable:!0,get:function(){return jd.UnionVector}});Object.defineProperty(I,"DenseUnionVector",{enumerable:!0,get:function(){return jd.DenseUnionVector}});Object.defineProperty(I,"SparseUnionVector",{enumerable:!0,get:function(){return jd.SparseUnionVector}});var $A=Fd();Object.defineProperty(I,"Utf8Vector",{enumerable:!0,get:function(){return $A.Utf8Vector}});var Fb=Rs();Object.defineProperty(I,"MapRow",{enumerable:!0,get:function(){return Fb.MapRow}});Object.defineProperty(I,"StructRow",{enumerable:!0,get:function(){return Fb.StructRow}});var Xs=eb(),qd=we(),$i=je(),Db=_n(),ri=He(),JA=ur(),mc=ut(),Ob=xe(),Mb=Md(),Eb=tl(),Ub=wb(),Rb=Tb(),xb=Ed(),Vb=Sb(),Pb=Ab();$i.Vector.new=KA;$i.Vector.from=ZA;function KA(r,...e){return new(Pb.instance.getVisitFn(r)())(r,...e)}function XA(r,e){if(mc.isIterable(e))return $i.Vector.from({nullValues:[null,void 0],type:r(),values:e});if(mc.isAsyncIterable(e))return $i.Vector.from({nullValues:[null,void 0],type:r(),values:e});let{values:t=[],type:n=r(),nullValues:i=[null,void 0]}=Object.assign({},e);return mc.isIterable(t)?$i.Vector.from(Object.assign(Object.assign({nullValues:i},e),{type:n})):$i.Vector.from(Object.assign(Object.assign({nullValues:i},e),{type:n}))}I.vectorFromValuesWithType=XA;function ZA(r){let e=Object.assign({nullValues:[null,void 0]},r),{values:t=[]}=e,n=Nd.__rest(e,["values"]);if(mc.isIterable(t)){let i=[...Ob.Builder.throughIterable(n)(t)];return i.length===1?i[0]:Db.Chunked.concat(i)}return(i=>Nd.__awaiter(this,void 0,void 0,function*(){var s,o;let u=Ob.Builder.throughAsyncIterable(n);try{for(var a=Nd.__asyncValues(u(t)),h;h=yield a.next(),!h.done;){let _=h.value;i.push(_)}}catch(_){s={error:_}}finally{try{h&&!h.done&&(o=a.return)&&(yield o.call(a))}finally{if(s)throw s.error}}return i.length===1?i[0]:Db.Chunked.concat(i)}))([])}ri.BaseVector.prototype.get=function(e){return Mb.instance.visit(this,e)};ri.BaseVector.prototype.set=function(e,t){return Eb.instance.visit(this,e,t)};ri.BaseVector.prototype.indexOf=function(e,t){return Ub.instance.visit(this,e,t)};ri.BaseVector.prototype.toArray=function(){return Rb.instance.visit(this)};ri.BaseVector.prototype.getByteWidth=function(){return Vb.instance.visit(this.type)};ri.BaseVector.prototype[Symbol.iterator]=function(){return xb.instance.visit(this)};ri.BaseVector.prototype._bindDataAccessors=rF;Object.keys(qd.Type).map(r=>qd.Type[r]).filter(r=>typeof r=="number").filter(r=>r!==qd.Type.NONE).forEach(r=>{let e=Pb.instance.visit(r);e.prototype.get=Xs.partial1(Mb.instance.getVisitFn(r)),e.prototype.set=Xs.partial2(Eb.instance.getVisitFn(r)),e.prototype.indexOf=Xs.partial2(Ub.instance.getVisitFn(r)),e.prototype.toArray=Xs.partial0(Rb.instance.getVisitFn(r)),e.prototype.getByteWidth=QA(Vb.instance.getVisitFn(r)),e.prototype[Symbol.iterator]=Xs.partial0(xb.instance.getVisitFn(r))});function QA(r){return function(){return r(this.type)}}function eF(r){return function(e){return this.isValid(e)?r.call(this,e):null}}function tF(r){return function(e,t){JA.setBool(this.nullBitmap,this.offset+e,t!=null)&&r.call(this,e,t)}}function rF(){let r=this.nullBitmap;r&&r.byteLength>0&&(this.get=eF(this.get),this.set=tF(this.set))}});var Hs=w(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.Table=void 0;var bc=ct(),nF=xi(),iF=Zs(),Lb=Ja(),Hd=Lr(),Nb=et(),zd=he(),kb=$n(),Wd=ut(),Cb=Kl(),Yd=vr(),Ze=class extends Yd.Chunked{constructor(...e){var t;let n=null;e[0]instanceof Nb.Schema&&(n=e[0]);let i=e[0]instanceof Ze?e[0].chunks:kb.selectArgs(Hd.RecordBatch,e);if(!n&&!(n=(t=i[0])===null||t===void 0?void 0:t.schema))throw new TypeError("Table must be initialized with a Schema or at least one RecordBatch");i[0]||(i[0]=new Hd._InternalEmptyPlaceholderRecordBatch(n));super(new zd.Struct(n.fields),i);this._schema=n,this._chunks=i}static empty(e=new Nb.Schema([])){return new Ze(e,[])}static from(e){if(!e)return Ze.empty();if(typeof e=="object"){let n=Wd.isIterable(e.values)?sF(e):Wd.isAsyncIterable(e.values)?oF(e):null;if(n!==null)return n}let t=iF.RecordBatchReader.from(e);return Wd.isPromise(t)?(()=>bc.__awaiter(this,void 0,void 0,function*(){return yield Ze.from(yield t)}))():t.isSync()&&(t=t.open())?t.schema?new Ze(t.schema,[...t]):Ze.empty():(n=>bc.__awaiter(this,void 0,void 0,function*(){var i,s;let o=yield n,u=o.schema,a=[];if(u){try{for(var h=bc.__asyncValues(o),_;_=yield h.next(),!_.done;){let T=_.value;a.push(T)}}catch(T){i={error:T}}finally{try{_&&!_.done&&(s=h.return)&&(yield s.call(h))}finally{if(i)throw i.error}}return new Ze(u,a)}return Ze.empty()}))(t.open())}static fromAsync(e){return bc.__awaiter(this,void 0,void 0,function*(){return yield Ze.from(e)})}static fromStruct(e){return Ze.new(e.data.childData,e.type.children)}static new(...e){return new Ze(...Cb.distributeColumnsIntoRecordBatches(kb.selectColumnArgs(e)))}get schema(){return this._schema}get length(){return this._length}get chunks(){return this._chunks}get numCols(){return this._numChildren}clone(e=this._chunks){return new Ze(this._schema,e)}getColumn(e){return this.getColumnAt(this.getColumnIndex(e))}getColumnAt(e){return this.getChildAt(e)}getColumnIndex(e){return this._schema.fields.findIndex(t=>t.name===e)}getChildAt(e){if(e<0||e>=this.numChildren)return null;let t,n,i=this._schema.fields,s=this._children||(this._children=[]);if(n=s[e])return n;if(t=i[e]){let o=this._chunks.map(u=>u.getChildAt(e)).filter(u=>u!=null);if(o.length>0)return s[e]=new nF.Column(t,o)}return null}serialize(e="binary",t=!0){return(t?Lb.RecordBatchStreamWriter:Lb.RecordBatchFileWriter).writeAll(this).toUint8Array(!0)}count(){return this._length}select(...e){let t=this._schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(...e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(...e){let t=this._schema.selectAt(...e);return new Ze(t,this._chunks.map(({length:n,data:{childData:i}})=>new Hd.RecordBatch(t,n,e.map(s=>i[s]).filter(Boolean))))}assign(e){let t=this._schema.fields,[n,i]=e.schema.fields.reduce((u,a,h)=>{let[_,T]=u,M=t.findIndex(E=>E.name===a.name);return~M?T[M]=h:_.push(h),u},[[],[]]),s=this._schema.assign(e.schema),o=[...t.map((u,a,h,_=i[a])=>_===void 0?this.getColumnAt(a):e.getColumnAt(_)),...n.map(u=>e.getColumnAt(u))].filter(Boolean);return new Ze(...Cb.distributeVectorsIntoRecordBatches(s,o))}};gc.Table=Ze;function sF(r){let{type:e}=r;return e instanceof zd.Struct?Ze.fromStruct(Yd.StructVector.from(r)):null}function oF(r){let{type:e}=r;return e instanceof zd.Struct?Yd.StructVector.from(r).then(t=>Ze.fromStruct(t)):null}});var Lr=w(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji._InternalEmptyPlaceholderRecordBatch=Ji.RecordBatch=void 0;var Gd=Jt(),$d=Hs(),aF=je(),cF=it(),uF=et(),lF=ut(),dF=_n(),fF=$n(),Jd=he(),hF=Kl(),pF=vr(),An=class extends pF.StructVector{constructor(...e){let t,n=e[0],i;if(e[1]instanceof Gd.Data)[,t,i]=e;else{let s=n.fields,[,o,u]=e;t=Gd.Data.Struct(new Jd.Struct(s),0,o,0,null,u)}super(t,i);this._schema=n}static from(e){return lF.isIterable(e.values),$d.Table.from(e)}static new(...e){let[t,n]=fF.selectFieldArgs(e),i=n.filter(s=>s instanceof aF.Vector);return new An(...hF.ensureSameLengthData(new uF.Schema(t),i.map(s=>s.data)))}clone(e,t=this._children){return new An(this._schema,e,t)}concat(...e){let t=this._schema,n=dF.Chunked.flatten(this,...e);return new $d.Table(t,n.map(({data:i})=>new An(t,i)))}get schema(){return this._schema}get numCols(){return this._schema.fields.length}get dictionaries(){return this._dictionaries||(this._dictionaries=vc.collect(this))}select(...e){let t=this._schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(...e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(...e){let t=this._schema.selectAt(...e),n=e.map(i=>this.data.childData[i]).filter(Boolean);return new An(t,this.length,n)}};Ji.RecordBatch=An;var jb=class extends An{constructor(e){super(e,0,e.fields.map(t=>Gd.Data.new(t.type,0,0,0)))}};Ji._InternalEmptyPlaceholderRecordBatch=jb;var vc=class extends cF.Visitor{constructor(){super(...arguments);this.dictionaries=new Map}static collect(e){return new vc().visit(e.data,new Jd.Struct(e.schema.fields)).dictionaries}visit(e,t){return Jd.DataType.isDictionary(t)?this.visitDictionary(e,t):(e.childData.forEach((n,i)=>this.visit(n,t.children[i].type)),this)}visitDictionary(e,t){let n=e.dictionary;return n&&n.length>0&&this.dictionaries.set(t.id,n),this}}});var Zs=w(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.AsyncRecordBatchFileReader=Ht.RecordBatchFileReader=Ht.AsyncRecordBatchStreamReader=Ht.RecordBatchStreamReader=Ht.RecordBatchReader=void 0;var Te=ct(),qb=je(),wc=we(),Hb=fl(),zb=ws(),Wb=fn(),Qs=yl(),Yb=T_(),Kd=Lr(),ni=ai(),jt=Na(),qt=ut(),Tr=class extends ni.ReadableInterop{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 qt.isPromise(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 zb.default.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return zb.default.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Tr?e:qt.isArrowJSON(e)?yF(e):qt.isFileHandle(e)?bF(e):qt.isPromise(e)?(()=>Te.__awaiter(this,void 0,void 0,function*(){return yield Tr.from(yield e)}))():qt.isFetchResponse(e)||qt.isReadableDOMStream(e)||qt.isReadableNodeStream(e)||qt.isAsyncIterable(e)?mF(new Wb.AsyncByteStream(e)):_F(new Wb.ByteStream(e))}static readAll(e){return e instanceof Tr?e.isSync()?Kb(e):Xb(e):qt.isArrowJSON(e)||ArrayBuffer.isView(e)||qt.isIterable(e)||qt.isIteratorResult(e)?Kb(e):Xb(e)}};Ht.RecordBatchReader=Tr;var Ki=class extends Tr{constructor(e){super(e);this._impl=e}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Te.__asyncGenerator(this,arguments,function*(){yield Te.__await(yield*Te.__asyncDelegator(Te.__asyncValues(this[Symbol.iterator]())))})}};Ht.RecordBatchStreamReader=Ki;var Xi=class extends Tr{constructor(e){super(e);this._impl=e}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}};Ht.AsyncRecordBatchStreamReader=Xi;var Bc=class extends Ki{constructor(e){super(e);this._impl=e}};Ht.RecordBatchFileReader=Bc;var Xd=class extends Xi{constructor(e){super(e);this._impl=e}};Ht.AsyncRecordBatchFileReader=Xd;var Zd=class{constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}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){return new Kd.RecordBatch(this.schema,e.length,this._loadVectors(e,t,this.schema.fields))}_loadDictionaryBatch(e,t){let{id:n,isDelta:i,data:s}=e,{dictionaries:o,schema:u}=this,a=o.get(n);if(i||!a){let h=u.dictionaries.get(n);return a&&i?a.concat(qb.Vector.new(this._loadVectors(s,t,[h])[0])):qb.Vector.new(this._loadVectors(s,t,[h])[0])}return a}_loadVectors(e,t,n){return new Yb.VectorLoader(t,e.nodes,e.buffers,this.dictionaries).visitMany(n)}},eo=class extends Zd{constructor(e,t){super(t);this._reader=qt.isArrowJSON(e)?new jt.JSONMessageReader(this._handle=e):new jt.MessageReader(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=Jb(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):ni.ITERATOR_DONE}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):ni.ITERATOR_DONE}next(){if(this.closed)return ni.ITERATOR_DONE;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(),i=t.readMessageBody(e.bodyLength),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),i=t.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Kd._InternalEmptyPlaceholderRecordBatch(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},to=class extends Zd{constructor(e,t){super(t);this._reader=new jt.AsyncMessageReader(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Te.__awaiter(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 Te.__awaiter(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Jb(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return Te.__awaiter(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):ni.ITERATOR_DONE})}return(e){return Te.__awaiter(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):ni.ITERATOR_DONE})}next(){return Te.__awaiter(this,void 0,void 0,function*(){if(this.closed)return ni.ITERATOR_DONE;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(),i=yield t.readMessageBody(e.bodyLength),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),i=yield t.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Kd._InternalEmptyPlaceholderRecordBatch(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return Te.__awaiter(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},Qd=class extends eo{constructor(e,t){super(e instanceof Qs.RandomAccessFile?e:new Qs.RandomAccessFile(e),t)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer&&this._footer.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let n=this._reader.readMessage(wc.MessageHeader.RecordBatch);if(n==null?void 0:n.isRecordBatch()){let i=n.header(),s=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(i,s)}}return null}_readDictionaryBatch(e){let t=this._footer&&this._footer.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let n=this._reader.readMessage(wc.MessageHeader.DictionaryBatch);if(n==null?void 0:n.isDictionaryBatch()){let i=n.header(),s=this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,o)}}}_readFooter(){let{_handle:e}=this,t=e.size-jt.magicAndPadding,n=e.readInt32(t),i=e.readAt(t-n,n);return Hb.Footer.decode(i)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer&&this._footer.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},Gb=class extends to{constructor(e,...t){let n=typeof t[0]!="number"?t.shift():void 0,i=t[0]instanceof Map?t.shift():void 0;super(e instanceof Qs.AsyncRandomAccessFile?e:new Qs.AsyncRandomAccessFile(e,n),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return Te.__awaiter(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return Te.__awaiter(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer&&this._footer.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let n=yield this._reader.readMessage(wc.MessageHeader.RecordBatch);if(n==null?void 0:n.isRecordBatch()){let i=n.header(),s=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(i,s)}}return null})}_readDictionaryBatch(e){return Te.__awaiter(this,void 0,void 0,function*(){let t=this._footer&&this._footer.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let n=yield this._reader.readMessage(wc.MessageHeader.DictionaryBatch);if(n==null?void 0:n.isDictionaryBatch()){let i=n.header(),s=yield this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,o)}}})}_readFooter(){return Te.__awaiter(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-jt.magicAndPadding,n=yield e.readInt32(t),i=yield e.readAt(t-n,n);return Hb.Footer.decode(i)})}_readNextMessageAndValidate(e){return Te.__awaiter(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})}},$b=class extends eo{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new Yb.JSONVectorLoader(t,e.nodes,e.buffers,this.dictionaries).visitMany(n)}};function Jb(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*Kb(r){let e=Tr.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function Xb(r){return Te.__asyncGenerator(this,arguments,function*(){let t=yield Te.__await(Tr.from(r));try{if(!(yield Te.__await(t.open({autoDestroy:!1}))).closed)do yield yield Te.__await(t);while(!(yield Te.__await(t.reset().open())).closed)}finally{yield Te.__await(t.cancel())}})}function yF(r){return new Ki(new $b(r))}function _F(r){let e=r.peek(jt.magicLength+7&~7);return e&&e.byteLength>=4?jt.checkForMagicArrowString(e)?new Bc(new Qd(r.read())):new Ki(new eo(r)):new Ki(new eo(function*(){}()))}function mF(r){return Te.__awaiter(this,void 0,void 0,function*(){let e=yield r.peek(jt.magicLength+7&~7);return e&&e.byteLength>=4?jt.checkForMagicArrowString(e)?new Bc(new Qd(yield r.read())):new Xi(new to(r)):new Xi(new to(function(){return Te.__asyncGenerator(this,arguments,function*(){})}()))})}function bF(r){return Te.__awaiter(this,void 0,void 0,function*(){let{size:e}=yield r.stat(),t=new Qs.AsyncRandomAccessFile(r,e);return e>=jt.magicX2AndPadding&&jt.checkForMagicArrowString(yield t.readAt(0,jt.magicLength+7&~7))?new Xd(new Gb(t)):new Xi(new to(t))})}});var eg=w(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.toDOMStream=void 0;var Ic=ct(),Zb=Je(),Qb=ut();function gF(r,e){if(Qb.isAsyncIterable(r))return wF(r,e);if(Qb.isIterable(r))return vF(r,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}Tc.toDOMStream=gF;function vF(r,e){let t=null,n=(e==null?void 0:e.type)==="bytes"||!1,i=(e==null?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){s(o,t||(t=r[Symbol.iterator]()))},pull(o){t?s(o,t):o.close()},cancel(){((t==null?void 0:t.return)&&t.return()||!0)&&(t=null)}}),Object.assign({highWaterMark:n?i:void 0},e));function s(o,u){let a,h=null,_=o.desiredSize||null;for(;!(h=u.next(n?_:null)).done;)if(ArrayBuffer.isView(h.value)&&(a=Zb.toUint8Array(h.value))&&(_!=null&&n&&(_=_-a.byteLength+1),h.value=a),o.enqueue(h.value),_!=null&&--_<=0)return;o.close()}}function wF(r,e){let t=null,n=(e==null?void 0:e.type)==="bytes"||!1,i=(e==null?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){return Ic.__awaiter(this,void 0,void 0,function*(){yield s(o,t||(t=r[Symbol.asyncIterator]()))})},pull(o){return Ic.__awaiter(this,void 0,void 0,function*(){t?yield s(o,t):o.close()})},cancel(){return Ic.__awaiter(this,void 0,void 0,function*(){((t==null?void 0:t.return)&&(yield t.return())||!0)&&(t=null)})}}),Object.assign({highWaterMark:n?i:void 0},e));function s(o,u){return Ic.__awaiter(this,void 0,void 0,function*(){let a,h=null,_=o.desiredSize||null;for(;!(h=yield u.next(n?_:null)).done;)if(ArrayBuffer.isView(h.value)&&(a=Zb.toUint8Array(h.value))&&(_!=null&&n&&(_=_-a.byteLength+1),h.value=a),o.enqueue(h.value),_!=null&&--_<=0)return;o.close()})}}});var ng=w(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.BuilderTransform=Zi.builderThroughDOMStream=void 0;var BF=ct(),IF=Ta();function TF(r){return new ef(r)}Zi.builderThroughDOMStream=TF;var ef=class{constructor(e){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:t,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=e,s=BF.__rest(e,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=IF.Builder.new(s),this._getSize=i!=="bytes"?tg:rg;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},t),{["highWaterMark"]:u=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:a=>{this._maybeFlush(this._builder,this._controller=a)},start:a=>{this._maybeFlush(this._builder,this._controller=a)}},{highWaterMark:o,size:i!=="bytes"?tg:rg}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:u,size:a=>this._writeValueAndReturnChunkSize(a)})}_writeValueAndReturnChunkSize(e){let t=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(e)),this._bufferedSize-t}_maybeFlush(e,t){t!==null&&(this._bufferedSize>=t.desiredSize&&++this._numChunks&&this._enqueue(t,e.toVector()),e.finished&&((e.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(t,e.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(t,null)))}_enqueue(e,t){this._bufferedSize=0,this._controller=null,t===null?e.close():e.enqueue(t)}};Zi.BuilderTransform=ef;var tg=r=>r.length,rg=r=>r.byteLength});var ig=w(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.recordBatchReaderThroughDOMStream=void 0;var ro=ct(),SF=fn(),AF=Zs();function FF(r,e){let t=new SF.AsyncByteQueue,n=null,i=new ReadableStream({cancel(){return ro.__awaiter(this,void 0,void 0,function*(){yield t.close()})},start(u){return ro.__awaiter(this,void 0,void 0,function*(){yield o(u,n||(n=yield s()))})},pull(u){return ro.__awaiter(this,void 0,void 0,function*(){n?yield o(u,n):u.close()})}});return{writable:new WritableStream(t,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return ro.__awaiter(this,void 0,void 0,function*(){return yield(yield AF.RecordBatchReader.from(t)).open(e)})}function o(u,a){return ro.__awaiter(this,void 0,void 0,function*(){let h=u.desiredSize,_=null;for(;!(_=yield a.next()).done;)if(u.enqueue(_.value),h!=null&&--h<=0)return;u.close()})}}Sc.recordBatchReaderThroughDOMStream=FF});var sg=w(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.recordBatchWriterThroughDOMStream=void 0;var Ac=ct(),DF=fn();function OF(r,e){let t=new this(r),n=new DF.AsyncByteStream(t),i=new ReadableStream({type:"bytes",cancel(){return Ac.__awaiter(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return Ac.__awaiter(this,void 0,void 0,function*(){yield s(o)})},start(o){return Ac.__awaiter(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(t,r),readable:i};function s(o){return Ac.__awaiter(this,void 0,void 0,function*(){let u=null,a=o.desiredSize;for(;u=yield n.read(a||null);)if(o.enqueue(u),a!=null&&(a-=u.byteLength)<=0)return;o.close()})}}Fc.recordBatchWriterThroughDOMStream=OF});var af=w(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.custom=oe.or=oe.and=oe.col=oe.lit=oe.CustomPredicate=oe.Not=oe.GTeq=oe.LTeq=oe.Equals=oe.Or=oe.And=oe.CombinationPredicate=oe.ComparisonPredicate=oe.Predicate=oe.Col=oe.Literal=oe.Value=void 0;var MF=rc(),Fn=class{eq(e){return e instanceof Fn||(e=new Cr(e)),new rf(this,e)}le(e){return e instanceof Fn||(e=new Cr(e)),new nf(this,e)}ge(e){return e instanceof Fn||(e=new Cr(e)),new sf(this,e)}lt(e){return new rs(this.ge(e))}gt(e){return new rs(this.le(e))}ne(e){return new rs(this.eq(e))}};oe.Value=Fn;var Cr=class extends Fn{constructor(e){super();this.v=e}};oe.Literal=Cr;var tf=class extends Fn{constructor(e){super();this.name=e}bind(e){if(!this.colidx){this.colidx=-1;let n=e.schema.fields;for(let i=-1;++i<n.length;)if(n[i].name===this.name){this.colidx=i;break}if(this.colidx<0)throw new Error(`Failed to bind Col "${this.name}"`)}let t=this.vector=e.getChildAt(this.colidx);return n=>t.get(n)}};oe.Col=tf;var Qi=class{and(...e){return new es(this,...e)}or(...e){return new ts(this,...e)}not(){return new rs(this)}};oe.Predicate=Qi;var no=class extends Qi{constructor(e,t){super();this.left=e,this.right=t}bind(e){return this.left instanceof Cr?this.right instanceof Cr?this._bindLitLit(e,this.left,this.right):this._bindLitCol(e,this.left,this.right):this.right instanceof Cr?this._bindColLit(e,this.left,this.right):this._bindColCol(e,this.left,this.right)}};oe.ComparisonPredicate=no;var io=class extends Qi{constructor(...e){super();this.children=e}};oe.CombinationPredicate=io;io.prototype.children=Object.freeze([]);var es=class extends io{constructor(...e){e=e.reduce((t,n)=>t.concat(n instanceof es?n.children:n),[]);super(...e)}bind(e){let t=this.children.map(n=>n.bind(e));return(n,i)=>t.every(s=>s(n,i))}};oe.And=es;var ts=class extends io{constructor(...e){e=e.reduce((t,n)=>t.concat(n instanceof ts?n.children:n),[]);super(...e)}bind(e){let t=this.children.map(n=>n.bind(e));return(n,i)=>t.some(s=>s(n,i))}};oe.Or=ts;var rf=class extends no{_bindLitLit(e,t,n){let i=t.v==n.v;return()=>i}_bindColCol(e,t,n){let i=t.bind(e),s=n.bind(e);return(o,u)=>i(o,u)==s(o,u)}_bindColLit(e,t,n){let i=t.bind(e);if(t.vector instanceof MF.DictionaryVector){let s,o=t.vector;return o.dictionary!==this.lastDictionary?(s=o.reverseLookup(n.v),this.lastDictionary=o.dictionary,this.lastKey=s):s=this.lastKey,s===-1?()=>!1:u=>o.getKey(u)===s}else return(s,o)=>i(s,o)==n.v}_bindLitCol(e,t,n){return this._bindColLit(e,n,t)}};oe.Equals=rf;var nf=class extends no{_bindLitLit(e,t,n){let i=t.v<=n.v;return()=>i}_bindColCol(e,t,n){let i=t.bind(e),s=n.bind(e);return(o,u)=>i(o,u)<=s(o,u)}_bindColLit(e,t,n){let i=t.bind(e);return(s,o)=>i(s,o)<=n.v}_bindLitCol(e,t,n){let i=n.bind(e);return(s,o)=>t.v<=i(s,o)}};oe.LTeq=nf;var sf=class extends no{_bindLitLit(e,t,n){let i=t.v>=n.v;return()=>i}_bindColCol(e,t,n){let i=t.bind(e),s=n.bind(e);return(o,u)=>i(o,u)>=s(o,u)}_bindColLit(e,t,n){let i=t.bind(e);return(s,o)=>i(s,o)>=n.v}_bindLitCol(e,t,n){let i=n.bind(e);return(s,o)=>t.v>=i(s,o)}};oe.GTeq=sf;var rs=class extends Qi{constructor(e){super();this.child=e}bind(e){let t=this.child.bind(e);return(n,i)=>!t(n,i)}};oe.Not=rs;var of=class extends Qi{constructor(e,t){super();this.next=e,this.bind_=t}bind(e){return this.bind_(e),this.next}};oe.CustomPredicate=of;function EF(r){return new Cr(r)}oe.lit=EF;function UF(r){return new tf(r)}oe.col=UF;function RF(...r){return new es(...r)}oe.and=RF;function xF(...r){return new ts(...r)}oe.or=xF;function VF(r,e){return new of(r,e)}oe.custom=VF});var dg=w(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.FilteredDataFrame=Dn.CountByResult=Dn.DataFrame=void 0;var og=Hs(),ag=oc(),cf=et(),cg=af(),PF=Lr(),ug=he(),uf=class extends og.Table{filter(e){return new so(this.chunks,e)}scan(e,t){let n=this.chunks,i=n.length;for(let s=-1;++s<i;){let o=n[s];t&&t(o);for(let u=-1,a=o.length;++u<a;)e(u,o)}}scanReverse(e,t){let n=this.chunks,i=n.length;for(let s=i;--s>=0;){let o=n[s];t&&t(o);for(let u=o.length;--u>=0;)e(u,o)}}countBy(e){let t=this.chunks,n=t.length,i=typeof e=="string"?new cg.Col(e):e;i.bind(t[n-1]);let s=i.vector;if(!ug.DataType.isDictionary(s.type))throw new Error("countBy currently only supports dictionary-encoded columns");let o=Math.ceil(Math.log(s.length)/Math.log(256)),u=o==4?Uint32Array:o>=2?Uint16Array:Uint8Array,a=new u(s.dictionary.length);for(let h=-1;++h<n;){let _=t[h];i.bind(_);let T=i.vector.indices;for(let M=-1,E=_.length;++M<E;){let q=T.get(M);q!==null&&a[q]++}}return new Dc(s.dictionary,ag.IntVector.from(a))}};Dn.DataFrame=uf;var Dc=class extends og.Table{constructor(e,t){let n=new cf.Schema([new cf.Field("values",e.type),new cf.Field("counts",t.type)]);super(new PF.RecordBatch(n,t.length,[e,t]))}toJSON(){let e=this.getColumnAt(0),t=this.getColumnAt(1),n={};for(let i=-1;++i<this.length;)n[e.get(i)]=t.get(i);return n}};Dn.CountByResult=Dc;var lg=class{constructor(e,t){this.batches=e,this.predicate=t,this.batchIndex=0,this.index=0,this.batch=this.batches[this.batchIndex],this.predicateFunc=this.predicate.bind(this.batch)}next(){for(;this.batchIndex<this.batches.length;){for(;this.index<this.batch.length;){if(this.predicateFunc(this.index,this.batch))return{value:this.batch.get(this.index++)};this.index++}++this.batchIndex<this.batches.length&&(this.index=0,this.batch=this.batches[this.batchIndex],this.predicateFunc=this.predicate.bind(this.batch))}return{done:!0,value:null}}[Symbol.iterator](){return this}},so=class extends uf{constructor(e,t){super(e);this._predicate=t}scan(e,t){let n=this._chunks,i=n.length;for(let s=-1;++s<i;){let o=n[s],u=this._predicate.bind(o),a=!1;for(let h=-1,_=o.length;++h<_;)u(h,o)&&(t&&!a&&(t(o),a=!0),e(h,o))}}scanReverse(e,t){let n=this._chunks,i=n.length;for(let s=i;--s>=0;){let o=n[s],u=this._predicate.bind(o),a=!1;for(let h=o.length;--h>=0;)u(h,o)&&(t&&!a&&(t(o),a=!0),e(h,o))}}count(){let e=0,t=this._chunks,n=t.length;for(let i=-1;++i<n;){let s=t[i],o=this._predicate.bind(s);for(let u=-1,a=s.length;++u<a;)o(u,s)&&++e}return e}[Symbol.iterator](){return new lg(this._chunks,this._predicate)}filter(e){return new so(this._chunks,this._predicate.and(e))}countBy(e){let t=this._chunks,n=t.length,i=typeof e=="string"?new cg.Col(e):e;i.bind(t[n-1]);let s=i.vector;if(!ug.DataType.isDictionary(s.type))throw new Error("countBy currently only supports dictionary-encoded columns");let o=Math.ceil(Math.log(s.length)/Math.log(256)),u=o==4?Uint32Array:o>=2?Uint16Array:Uint8Array,a=new u(s.dictionary.length);for(let h=-1;++h<n;){let _=t[h],T=this._predicate.bind(_);i.bind(_);let M=i.vector.indices;for(let E=-1,q=_.length;++E<q;){let re=M.get(E);re!==null&&T(E,_)&&a[re]++}}return new Dc(s.dictionary,ag.IntVector.from(a))}};Dn.FilteredDataFrame=so});var pg=w(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.isTypedArray=f.util=f.predicate=f.CountByResult=f.FilteredDataFrame=f.DataFrame=f.RecordBatch=f.Message=f.JSONMessageReader=f.AsyncMessageReader=f.MessageReader=f.RecordBatchJSONWriter=f.RecordBatchStreamWriter=f.RecordBatchFileWriter=f.RecordBatchWriter=f.AsyncRecordBatchStreamReader=f.AsyncRecordBatchFileReader=f.RecordBatchStreamReader=f.RecordBatchFileReader=f.RecordBatchReader=f.AsyncByteQueue=f.AsyncByteStream=f.ByteStream=f.Utf8Builder=f.SparseUnionBuilder=f.DenseUnionBuilder=f.UnionBuilder=f.TimeNanosecondBuilder=f.TimeMicrosecondBuilder=f.TimeMillisecondBuilder=f.TimeSecondBuilder=f.TimeBuilder=f.TimestampNanosecondBuilder=f.TimestampMicrosecondBuilder=f.TimestampMillisecondBuilder=f.TimestampSecondBuilder=f.TimestampBuilder=f.StructBuilder=f.NullBuilder=f.MapBuilder=f.ListBuilder=f.Uint64Builder=f.Uint32Builder=f.Uint16Builder=f.Uint8Builder=f.Int64Builder=f.Int32Builder=f.Int16Builder=f.Int8Builder=f.IntBuilder=f.IntervalYearMonthBuilder=f.IntervalDayTimeBuilder=f.IntervalBuilder=f.Float64Builder=f.Float32Builder=f.Float16Builder=f.FloatBuilder=f.FixedSizeListBuilder=f.FixedSizeBinaryBuilder=f.DictionaryBuilder=f.DecimalBuilder=f.DateMillisecondBuilder=f.DateDayBuilder=f.DateBuilder=f.BoolBuilder=f.BinaryBuilder=f.Builder=f.Utf8Vector=f.SparseUnionVector=f.DenseUnionVector=f.UnionVector=f.TimeNanosecondVector=f.TimeMicrosecondVector=f.TimeMillisecondVector=f.TimeSecondVector=f.TimeVector=f.TimestampNanosecondVector=f.TimestampMicrosecondVector=f.TimestampMillisecondVector=f.TimestampSecondVector=f.TimestampVector=f.StructVector=f.NullVector=f.MapVector=f.ListVector=f.Uint64Vector=f.Uint32Vector=f.Uint16Vector=f.Uint8Vector=f.Int64Vector=f.Int32Vector=f.Int16Vector=f.Int8Vector=f.IntVector=f.IntervalYearMonthVector=f.IntervalDayTimeVector=f.IntervalVector=f.Float64Vector=f.Float32Vector=f.Float16Vector=f.FloatVector=f.FixedSizeListVector=f.FixedSizeBinaryVector=f.DictionaryVector=f.DecimalVector=f.DateMillisecondVector=f.DateDayVector=f.DateVector=f.Chunked=f.BoolVector=f.BinaryVector=f.BaseVector=f.Vector=f.Field=f.Schema=f.Visitor=f.Column=f.Table=f.Map_=f.FixedSizeList=f.IntervalYearMonth=f.IntervalDayTime=f.Interval=f.Dictionary=f.SparseUnion=f.DenseUnion=f.Union=f.Struct=f.List=f.Decimal=f.TimeNanosecond=f.TimeMicrosecond=f.TimeMillisecond=f.TimeSecond=f.Time=f.TimestampNanosecond=f.TimestampMicrosecond=f.TimestampMillisecond=f.TimestampSecond=f.Timestamp=f.DateMillisecond=f.DateDay=f.Date_=f.FixedSizeBinary=f.Binary=f.Utf8=f.Float64=f.Float32=f.Float16=f.Float=f.Uint64=f.Uint32=f.Uint16=f.Uint8=f.Int64=f.Int32=f.Int16=f.Int8=f.Int=f.Bool=f.Null=f.DataType=f.Data=f.BufferType=f.Type=f.MessageHeader=f.MetadataVersion=f.IntervalUnit=f.UnionMode=f.Precision=f.TimeUnit=f.DateUnit=void 0;var ns=Zr();Object.defineProperty(f,"DateUnit",{enumerable:!0,get:function(){return ns.DateUnit}});Object.defineProperty(f,"TimeUnit",{enumerable:!0,get:function(){return ns.TimeUnit}});Object.defineProperty(f,"Precision",{enumerable:!0,get:function(){return ns.Precision}});Object.defineProperty(f,"UnionMode",{enumerable:!0,get:function(){return ns.UnionMode}});Object.defineProperty(f,"IntervalUnit",{enumerable:!0,get:function(){return ns.IntervalUnit}});Object.defineProperty(f,"MetadataVersion",{enumerable:!0,get:function(){return ns.MetadataVersion}});var LF=No();Object.defineProperty(f,"MessageHeader",{enumerable:!0,get:function(){return LF.MessageHeader}});var fg=we();Object.defineProperty(f,"Type",{enumerable:!0,get:function(){return fg.Type}});Object.defineProperty(f,"BufferType",{enumerable:!0,get:function(){return fg.BufferType}});var NF=Jt();Object.defineProperty(f,"Data",{enumerable:!0,get:function(){return NF.Data}});var Z=he();Object.defineProperty(f,"DataType",{enumerable:!0,get:function(){return Z.DataType}});Object.defineProperty(f,"Null",{enumerable:!0,get:function(){return Z.Null}});Object.defineProperty(f,"Bool",{enumerable:!0,get:function(){return Z.Bool}});Object.defineProperty(f,"Int",{enumerable:!0,get:function(){return Z.Int}});Object.defineProperty(f,"Int8",{enumerable:!0,get:function(){return Z.Int8}});Object.defineProperty(f,"Int16",{enumerable:!0,get:function(){return Z.Int16}});Object.defineProperty(f,"Int32",{enumerable:!0,get:function(){return Z.Int32}});Object.defineProperty(f,"Int64",{enumerable:!0,get:function(){return Z.Int64}});Object.defineProperty(f,"Uint8",{enumerable:!0,get:function(){return Z.Uint8}});Object.defineProperty(f,"Uint16",{enumerable:!0,get:function(){return Z.Uint16}});Object.defineProperty(f,"Uint32",{enumerable:!0,get:function(){return Z.Uint32}});Object.defineProperty(f,"Uint64",{enumerable:!0,get:function(){return Z.Uint64}});Object.defineProperty(f,"Float",{enumerable:!0,get:function(){return Z.Float}});Object.defineProperty(f,"Float16",{enumerable:!0,get:function(){return Z.Float16}});Object.defineProperty(f,"Float32",{enumerable:!0,get:function(){return Z.Float32}});Object.defineProperty(f,"Float64",{enumerable:!0,get:function(){return Z.Float64}});Object.defineProperty(f,"Utf8",{enumerable:!0,get:function(){return Z.Utf8}});Object.defineProperty(f,"Binary",{enumerable:!0,get:function(){return Z.Binary}});Object.defineProperty(f,"FixedSizeBinary",{enumerable:!0,get:function(){return Z.FixedSizeBinary}});Object.defineProperty(f,"Date_",{enumerable:!0,get:function(){return Z.Date_}});Object.defineProperty(f,"DateDay",{enumerable:!0,get:function(){return Z.DateDay}});Object.defineProperty(f,"DateMillisecond",{enumerable:!0,get:function(){return Z.DateMillisecond}});Object.defineProperty(f,"Timestamp",{enumerable:!0,get:function(){return Z.Timestamp}});Object.defineProperty(f,"TimestampSecond",{enumerable:!0,get:function(){return Z.TimestampSecond}});Object.defineProperty(f,"TimestampMillisecond",{enumerable:!0,get:function(){return Z.TimestampMillisecond}});Object.defineProperty(f,"TimestampMicrosecond",{enumerable:!0,get:function(){return Z.TimestampMicrosecond}});Object.defineProperty(f,"TimestampNanosecond",{enumerable:!0,get:function(){return Z.TimestampNanosecond}});Object.defineProperty(f,"Time",{enumerable:!0,get:function(){return Z.Time}});Object.defineProperty(f,"TimeSecond",{enumerable:!0,get:function(){return Z.TimeSecond}});Object.defineProperty(f,"TimeMillisecond",{enumerable:!0,get:function(){return Z.TimeMillisecond}});Object.defineProperty(f,"TimeMicrosecond",{enumerable:!0,get:function(){return Z.TimeMicrosecond}});Object.defineProperty(f,"TimeNanosecond",{enumerable:!0,get:function(){return Z.TimeNanosecond}});Object.defineProperty(f,"Decimal",{enumerable:!0,get:function(){return Z.Decimal}});Object.defineProperty(f,"List",{enumerable:!0,get:function(){return Z.List}});Object.defineProperty(f,"Struct",{enumerable:!0,get:function(){return Z.Struct}});Object.defineProperty(f,"Union",{enumerable:!0,get:function(){return Z.Union}});Object.defineProperty(f,"DenseUnion",{enumerable:!0,get:function(){return Z.DenseUnion}});Object.defineProperty(f,"SparseUnion",{enumerable:!0,get:function(){return Z.SparseUnion}});Object.defineProperty(f,"Dictionary",{enumerable:!0,get:function(){return Z.Dictionary}});Object.defineProperty(f,"Interval",{enumerable:!0,get:function(){return Z.Interval}});Object.defineProperty(f,"IntervalDayTime",{enumerable:!0,get:function(){return Z.IntervalDayTime}});Object.defineProperty(f,"IntervalYearMonth",{enumerable:!0,get:function(){return Z.IntervalYearMonth}});Object.defineProperty(f,"FixedSizeList",{enumerable:!0,get:function(){return Z.FixedSizeList}});Object.defineProperty(f,"Map_",{enumerable:!0,get:function(){return Z.Map_}});var kF=Hs();Object.defineProperty(f,"Table",{enumerable:!0,get:function(){return kF.Table}});var CF=xi();Object.defineProperty(f,"Column",{enumerable:!0,get:function(){return CF.Column}});var jF=it();Object.defineProperty(f,"Visitor",{enumerable:!0,get:function(){return jF.Visitor}});var hg=et();Object.defineProperty(f,"Schema",{enumerable:!0,get:function(){return hg.Schema}});Object.defineProperty(f,"Field",{enumerable:!0,get:function(){return hg.Field}});var $=vr();Object.defineProperty(f,"Vector",{enumerable:!0,get:function(){return $.Vector}});Object.defineProperty(f,"BaseVector",{enumerable:!0,get:function(){return $.BaseVector}});Object.defineProperty(f,"BinaryVector",{enumerable:!0,get:function(){return $.BinaryVector}});Object.defineProperty(f,"BoolVector",{enumerable:!0,get:function(){return $.BoolVector}});Object.defineProperty(f,"Chunked",{enumerable:!0,get:function(){return $.Chunked}});Object.defineProperty(f,"DateVector",{enumerable:!0,get:function(){return $.DateVector}});Object.defineProperty(f,"DateDayVector",{enumerable:!0,get:function(){return $.DateDayVector}});Object.defineProperty(f,"DateMillisecondVector",{enumerable:!0,get:function(){return $.DateMillisecondVector}});Object.defineProperty(f,"DecimalVector",{enumerable:!0,get:function(){return $.DecimalVector}});Object.defineProperty(f,"DictionaryVector",{enumerable:!0,get:function(){return $.DictionaryVector}});Object.defineProperty(f,"FixedSizeBinaryVector",{enumerable:!0,get:function(){return $.FixedSizeBinaryVector}});Object.defineProperty(f,"FixedSizeListVector",{enumerable:!0,get:function(){return $.FixedSizeListVector}});Object.defineProperty(f,"FloatVector",{enumerable:!0,get:function(){return $.FloatVector}});Object.defineProperty(f,"Float16Vector",{enumerable:!0,get:function(){return $.Float16Vector}});Object.defineProperty(f,"Float32Vector",{enumerable:!0,get:function(){return $.Float32Vector}});Object.defineProperty(f,"Float64Vector",{enumerable:!0,get:function(){return $.Float64Vector}});Object.defineProperty(f,"IntervalVector",{enumerable:!0,get:function(){return $.IntervalVector}});Object.defineProperty(f,"IntervalDayTimeVector",{enumerable:!0,get:function(){return $.IntervalDayTimeVector}});Object.defineProperty(f,"IntervalYearMonthVector",{enumerable:!0,get:function(){return $.IntervalYearMonthVector}});Object.defineProperty(f,"IntVector",{enumerable:!0,get:function(){return $.IntVector}});Object.defineProperty(f,"Int8Vector",{enumerable:!0,get:function(){return $.Int8Vector}});Object.defineProperty(f,"Int16Vector",{enumerable:!0,get:function(){return $.Int16Vector}});Object.defineProperty(f,"Int32Vector",{enumerable:!0,get:function(){return $.Int32Vector}});Object.defineProperty(f,"Int64Vector",{enumerable:!0,get:function(){return $.Int64Vector}});Object.defineProperty(f,"Uint8Vector",{enumerable:!0,get:function(){return $.Uint8Vector}});Object.defineProperty(f,"Uint16Vector",{enumerable:!0,get:function(){return $.Uint16Vector}});Object.defineProperty(f,"Uint32Vector",{enumerable:!0,get:function(){return $.Uint32Vector}});Object.defineProperty(f,"Uint64Vector",{enumerable:!0,get:function(){return $.Uint64Vector}});Object.defineProperty(f,"ListVector",{enumerable:!0,get:function(){return $.ListVector}});Object.defineProperty(f,"MapVector",{enumerable:!0,get:function(){return $.MapVector}});Object.defineProperty(f,"NullVector",{enumerable:!0,get:function(){return $.NullVector}});Object.defineProperty(f,"StructVector",{enumerable:!0,get:function(){return $.StructVector}});Object.defineProperty(f,"TimestampVector",{enumerable:!0,get:function(){return $.TimestampVector}});Object.defineProperty(f,"TimestampSecondVector",{enumerable:!0,get:function(){return $.TimestampSecondVector}});Object.defineProperty(f,"TimestampMillisecondVector",{enumerable:!0,get:function(){return $.TimestampMillisecondVector}});Object.defineProperty(f,"TimestampMicrosecondVector",{enumerable:!0,get:function(){return $.TimestampMicrosecondVector}});Object.defineProperty(f,"TimestampNanosecondVector",{enumerable:!0,get:function(){return $.TimestampNanosecondVector}});Object.defineProperty(f,"TimeVector",{enumerable:!0,get:function(){return $.TimeVector}});Object.defineProperty(f,"TimeSecondVector",{enumerable:!0,get:function(){return $.TimeSecondVector}});Object.defineProperty(f,"TimeMillisecondVector",{enumerable:!0,get:function(){return $.TimeMillisecondVector}});Object.defineProperty(f,"TimeMicrosecondVector",{enumerable:!0,get:function(){return $.TimeMicrosecondVector}});Object.defineProperty(f,"TimeNanosecondVector",{enumerable:!0,get:function(){return $.TimeNanosecondVector}});Object.defineProperty(f,"UnionVector",{enumerable:!0,get:function(){return $.UnionVector}});Object.defineProperty(f,"DenseUnionVector",{enumerable:!0,get:function(){return $.DenseUnionVector}});Object.defineProperty(f,"SparseUnionVector",{enumerable:!0,get:function(){return $.SparseUnionVector}});Object.defineProperty(f,"Utf8Vector",{enumerable:!0,get:function(){return $.Utf8Vector}});var Q=Ta();Object.defineProperty(f,"Builder",{enumerable:!0,get:function(){return Q.Builder}});Object.defineProperty(f,"BinaryBuilder",{enumerable:!0,get:function(){return Q.BinaryBuilder}});Object.defineProperty(f,"BoolBuilder",{enumerable:!0,get:function(){return Q.BoolBuilder}});Object.defineProperty(f,"DateBuilder",{enumerable:!0,get:function(){return Q.DateBuilder}});Object.defineProperty(f,"DateDayBuilder",{enumerable:!0,get:function(){return Q.DateDayBuilder}});Object.defineProperty(f,"DateMillisecondBuilder",{enumerable:!0,get:function(){return Q.DateMillisecondBuilder}});Object.defineProperty(f,"DecimalBuilder",{enumerable:!0,get:function(){return Q.DecimalBuilder}});Object.defineProperty(f,"DictionaryBuilder",{enumerable:!0,get:function(){return Q.DictionaryBuilder}});Object.defineProperty(f,"FixedSizeBinaryBuilder",{enumerable:!0,get:function(){return Q.FixedSizeBinaryBuilder}});Object.defineProperty(f,"FixedSizeListBuilder",{enumerable:!0,get:function(){return Q.FixedSizeListBuilder}});Object.defineProperty(f,"FloatBuilder",{enumerable:!0,get:function(){return Q.FloatBuilder}});Object.defineProperty(f,"Float16Builder",{enumerable:!0,get:function(){return Q.Float16Builder}});Object.defineProperty(f,"Float32Builder",{enumerable:!0,get:function(){return Q.Float32Builder}});Object.defineProperty(f,"Float64Builder",{enumerable:!0,get:function(){return Q.Float64Builder}});Object.defineProperty(f,"IntervalBuilder",{enumerable:!0,get:function(){return Q.IntervalBuilder}});Object.defineProperty(f,"IntervalDayTimeBuilder",{enumerable:!0,get:function(){return Q.IntervalDayTimeBuilder}});Object.defineProperty(f,"IntervalYearMonthBuilder",{enumerable:!0,get:function(){return Q.IntervalYearMonthBuilder}});Object.defineProperty(f,"IntBuilder",{enumerable:!0,get:function(){return Q.IntBuilder}});Object.defineProperty(f,"Int8Builder",{enumerable:!0,get:function(){return Q.Int8Builder}});Object.defineProperty(f,"Int16Builder",{enumerable:!0,get:function(){return Q.Int16Builder}});Object.defineProperty(f,"Int32Builder",{enumerable:!0,get:function(){return Q.Int32Builder}});Object.defineProperty(f,"Int64Builder",{enumerable:!0,get:function(){return Q.Int64Builder}});Object.defineProperty(f,"Uint8Builder",{enumerable:!0,get:function(){return Q.Uint8Builder}});Object.defineProperty(f,"Uint16Builder",{enumerable:!0,get:function(){return Q.Uint16Builder}});Object.defineProperty(f,"Uint32Builder",{enumerable:!0,get:function(){return Q.Uint32Builder}});Object.defineProperty(f,"Uint64Builder",{enumerable:!0,get:function(){return Q.Uint64Builder}});Object.defineProperty(f,"ListBuilder",{enumerable:!0,get:function(){return Q.ListBuilder}});Object.defineProperty(f,"MapBuilder",{enumerable:!0,get:function(){return Q.MapBuilder}});Object.defineProperty(f,"NullBuilder",{enumerable:!0,get:function(){return Q.NullBuilder}});Object.defineProperty(f,"StructBuilder",{enumerable:!0,get:function(){return Q.StructBuilder}});Object.defineProperty(f,"TimestampBuilder",{enumerable:!0,get:function(){return Q.TimestampBuilder}});Object.defineProperty(f,"TimestampSecondBuilder",{enumerable:!0,get:function(){return Q.TimestampSecondBuilder}});Object.defineProperty(f,"TimestampMillisecondBuilder",{enumerable:!0,get:function(){return Q.TimestampMillisecondBuilder}});Object.defineProperty(f,"TimestampMicrosecondBuilder",{enumerable:!0,get:function(){return Q.TimestampMicrosecondBuilder}});Object.defineProperty(f,"TimestampNanosecondBuilder",{enumerable:!0,get:function(){return Q.TimestampNanosecondBuilder}});Object.defineProperty(f,"TimeBuilder",{enumerable:!0,get:function(){return Q.TimeBuilder}});Object.defineProperty(f,"TimeSecondBuilder",{enumerable:!0,get:function(){return Q.TimeSecondBuilder}});Object.defineProperty(f,"TimeMillisecondBuilder",{enumerable:!0,get:function(){return Q.TimeMillisecondBuilder}});Object.defineProperty(f,"TimeMicrosecondBuilder",{enumerable:!0,get:function(){return Q.TimeMicrosecondBuilder}});Object.defineProperty(f,"TimeNanosecondBuilder",{enumerable:!0,get:function(){return Q.TimeNanosecondBuilder}});Object.defineProperty(f,"UnionBuilder",{enumerable:!0,get:function(){return Q.UnionBuilder}});Object.defineProperty(f,"DenseUnionBuilder",{enumerable:!0,get:function(){return Q.DenseUnionBuilder}});Object.defineProperty(f,"SparseUnionBuilder",{enumerable:!0,get:function(){return Q.SparseUnionBuilder}});Object.defineProperty(f,"Utf8Builder",{enumerable:!0,get:function(){return Q.Utf8Builder}});var lf=fn();Object.defineProperty(f,"ByteStream",{enumerable:!0,get:function(){return lf.ByteStream}});Object.defineProperty(f,"AsyncByteStream",{enumerable:!0,get:function(){return lf.AsyncByteStream}});Object.defineProperty(f,"AsyncByteQueue",{enumerable:!0,get:function(){return lf.AsyncByteQueue}});var oo=Zs();Object.defineProperty(f,"RecordBatchReader",{enumerable:!0,get:function(){return oo.RecordBatchReader}});Object.defineProperty(f,"RecordBatchFileReader",{enumerable:!0,get:function(){return oo.RecordBatchFileReader}});Object.defineProperty(f,"RecordBatchStreamReader",{enumerable:!0,get:function(){return oo.RecordBatchStreamReader}});Object.defineProperty(f,"AsyncRecordBatchFileReader",{enumerable:!0,get:function(){return oo.AsyncRecordBatchFileReader}});Object.defineProperty(f,"AsyncRecordBatchStreamReader",{enumerable:!0,get:function(){return oo.AsyncRecordBatchStreamReader}});var Oc=Ja();Object.defineProperty(f,"RecordBatchWriter",{enumerable:!0,get:function(){return Oc.RecordBatchWriter}});Object.defineProperty(f,"RecordBatchFileWriter",{enumerable:!0,get:function(){return Oc.RecordBatchFileWriter}});Object.defineProperty(f,"RecordBatchStreamWriter",{enumerable:!0,get:function(){return Oc.RecordBatchStreamWriter}});Object.defineProperty(f,"RecordBatchJSONWriter",{enumerable:!0,get:function(){return Oc.RecordBatchJSONWriter}});var df=Na();Object.defineProperty(f,"MessageReader",{enumerable:!0,get:function(){return df.MessageReader}});Object.defineProperty(f,"AsyncMessageReader",{enumerable:!0,get:function(){return df.AsyncMessageReader}});Object.defineProperty(f,"JSONMessageReader",{enumerable:!0,get:function(){return df.JSONMessageReader}});var qF=Xn();Object.defineProperty(f,"Message",{enumerable:!0,get:function(){return qF.Message}});var HF=Lr();Object.defineProperty(f,"RecordBatch",{enumerable:!0,get:function(){return HF.RecordBatch}});var ff=dg();Object.defineProperty(f,"DataFrame",{enumerable:!0,get:function(){return ff.DataFrame}});Object.defineProperty(f,"FilteredDataFrame",{enumerable:!0,get:function(){return ff.FilteredDataFrame}});Object.defineProperty(f,"CountByResult",{enumerable:!0,get:function(){return ff.CountByResult}});var zF=Fs(),WF=ml(),YF=ur(),GF=Is(),$F=Je(),JF=Vs(),KF=af();f.predicate=KF;var hf=Vl();f.util=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zF),WF),YF),GF),$F),JF),{compareSchemas:hf.compareSchemas,compareFields:hf.compareFields,compareTypes:hf.compareTypes});var XF=$n();Object.defineProperty(f,"isTypedArray",{enumerable:!0,get:function(){return XF.isTypedArray}})});var mf=w(()=>{});var gg=w(()=>{});var vg=w(()=>{});var wg=w(()=>{});var Bg=w(()=>{});var Ag=w((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,e){return function(t){return new Sha256(e,!0).update(t)[r]()}},createMethod=function(r){var e=createOutputMethod("hex",r);NODE_JS&&(e=nodeWrap(e,r)),e.create=function(){return new Sha256(r)},e.update=function(i){return e.create().update(i)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n,r)}return e},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,e){return function(t,n){return new HmacSha256(t,e,!0).update(n)[r]()}},createHmacMethod=function(r){var e=createHmacOutputMethod("hex",r);e.create=function(i){return new HmacSha256(i,r)},e.update=function(i,s){return e.create(i).update(s)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createHmacOutputMethod(n,r)}return e};function Sha256(r,e){e?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=r}Sha256.prototype.update=function(r){if(!this.finalized){var e,t=typeof r;if(t!=="string"){if(t==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,i=0,s,o=r.length,u=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,u[0]=this.block,u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),e)for(s=this.start;i<o&&s<64;++i)u[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?u[s>>2]|=n<<SHIFT[s++&3]:n<2048?(u[s>>2]|=(192|n>>6)<<SHIFT[s++&3],u[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(u[s>>2]|=(224|n>>12)<<SHIFT[s++&3],u[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],u[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),u[s>>2]|=(240|n>>18)<<SHIFT[s++&3],u[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],u[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],u[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=u[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,e=this.lastByteIndex;r[16]=this.block,r[e>>2]|=EXTRA[e&3],this.block=r[16],e>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,u=this.h7,a=this.blocks,h,_,T,M,E,q,re,le,de,Me,L;for(h=16;h<64;++h)E=a[h-15],_=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,E=a[h-2],T=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,a[h]=a[h-16]+_+a[h-7]+T<<0;for(L=e&t,h=0;h<64;h+=4)this.first?(this.is224?(le=300032,E=a[0]-1413257819,u=E-150054599<<0,n=E+24177077<<0):(le=704751109,E=a[0]-210244248,u=E-1521486534<<0,n=E+143694565<<0),this.first=!1):(_=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),T=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),le=r&e,M=le^r&t^L,re=i&s^~i&o,E=u+T+re+K[h]+a[h],q=_+M,u=n+E<<0,n=E+q<<0),_=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),T=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),de=n&r,M=de^n&e^le,re=u&i^~u&s,E=o+T+re+K[h+1]+a[h+1],q=_+M,o=t+E<<0,t=E+q<<0,_=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),T=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),Me=t&n,M=Me^t&r^de,re=o&u^~o&i,E=s+T+re+K[h+2]+a[h+2],q=_+M,s=e+E<<0,e=E+q<<0,_=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),T=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),L=e&t,M=L^e&n^Me,re=s&o^~s&u,E=i+T+re+K[h+3]+a[h+3],q=_+M,i=r+E<<0,r=E+q<<0;this.h0=this.h0+r<<0,this.h1=this.h1+e<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+u<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,u=this.h7,a=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(a+=HEX_CHARS[u>>28&15]+HEX_CHARS[u>>24&15]+HEX_CHARS[u>>20&15]+HEX_CHARS[u>>16&15]+HEX_CHARS[u>>12&15]+HEX_CHARS[u>>8&15]+HEX_CHARS[u>>4&15]+HEX_CHARS[u&15]),a},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,u=this.h7,a=[r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||a.push(u>>24&255,u>>16&255,u>>8&255,u&255),a},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),e=new DataView(r);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),r};function HmacSha256(r,e,t){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,u=0,a;for(n=0;n<o;++n)a=r.charCodeAt(n),a<128?s[u++]=a:a<2048?(s[u++]=192|a>>6,s[u++]=128|a&63):a<55296||a>=57344?(s[u++]=224|a>>12,s[u++]=128|a>>6&63,s[u++]=128|a&63):(a=65536+((a&1023)<<10|r.charCodeAt(++n)&1023),s[u++]=240|a>>18,s[u++]=128|a>>12&63,s[u++]=128|a>>6&63,s[u++]=128|a&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(e,!0).update(r).array());var h=[],_=[];for(n=0;n<64;++n){var T=r[n]||0;h[n]=92^T,_[n]=54^T}Sha256.call(this,e,t),this.update(_),this.oKeyPad=h,this.inner=!0,this.sharedMemory=t}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var cD={};fw(cD,{registerWorker:()=>Og});var yg=nr(ws(),1),_g=nr(Ta(),1),is=nr(Zs(),1),ss=nr(Ja(),1),mg=nr(eg(),1),bg=nr(ng(),1),Mc=nr(ig(),1),Ec=nr(sg(),1),y=nr(pg(),1);yg.default.toDOMStream=mg.toDOMStream;_g.Builder.throughDOM=bg.builderThroughDOMStream;is.RecordBatchReader.throughDOM=Mc.recordBatchReaderThroughDOMStream;is.RecordBatchFileReader.throughDOM=Mc.recordBatchReaderThroughDOMStream;is.RecordBatchStreamReader.throughDOM=Mc.recordBatchReaderThroughDOMStream;ss.RecordBatchWriter.throughDOM=Ec.recordBatchWriterThroughDOMStream;ss.RecordBatchFileWriter.throughDOM=Ec.recordBatchWriterThroughDOMStream;ss.RecordBatchStreamWriter.throughDOM=Ec.recordBatchWriterThroughDOMStream;function yf(r){switch(r.typeId){case y.Type.Binary:return{type:"binary"};case y.Type.Bool:return{type:"bool"};case y.Type.Date:return{type:"date"};case y.Type.DateDay:return{type:"date32[d]"};case y.Type.DateMillisecond:return{type:"date64[ms]"};case y.Type.Decimal:{let e=r;return{type:"decimal",precision:e.precision,scale:e.scale}}case y.Type.Float:return{type:"float"};case y.Type.Float16:return{type:"float16"};case y.Type.Float32:return{type:"float32"};case y.Type.Float64:return{type:"float64"};case y.Type.Int:return{type:"int32"};case y.Type.Int16:return{type:"int16"};case y.Type.Int32:return{type:"int32"};case y.Type.Int64:return{type:"int64"};case y.Type.Uint16:return{type:"uint16"};case y.Type.Uint32:return{type:"uint32"};case y.Type.Uint64:return{type:"uint64"};case y.Type.Uint8:return{type:"uint8"};case y.Type.IntervalDayTime:return{type:"interval[dt]"};case y.Type.IntervalYearMonth:return{type:"interval[m]"};case y.Type.List:{let e=r;return{type:"list",children:[ao(e.valueField.name,e.valueField.type)]}}case y.Type.FixedSizeBinary:return{type:"fixedsizebinary",byteWidth:r.byteWidth};case y.Type.Null:return{type:"null"};case y.Type.Utf8:return{type:"utf8"};case y.Type.Struct:return{type:"struct",children:r.children.map(t=>ao(t.name,t.type))};case y.Type.Time:return{type:"time[s]"};case y.Type.TimeMicrosecond:return{type:"time[us]"};case y.Type.TimeMillisecond:return{type:"time[ms]"};case y.Type.TimeNanosecond:return{type:"time[ns]"};case y.Type.TimeSecond:return{type:"time[s]"};case y.Type.Timestamp:return{type:"timestamp",timezone:r.timezone||void 0};case y.Type.TimestampSecond:return{type:"timestamp[s]",timezone:r.timezone||void 0};case y.Type.TimestampMicrosecond:return{type:"timestamp[us]",timezone:r.timezone||void 0};case y.Type.TimestampNanosecond:return{type:"timestamp[ns]",timezone:r.timezone||void 0};case y.Type.TimestampMillisecond:return{type:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function ao(r,e){let t=yf(e);return t.name=r,t}var _f=class{constructor(){this._bindings=null;this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,t){let n={name:t.name,message:t.message,stack:t.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:n},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],t=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:t},[])}),this.sendOK(e)}catch(t){this._bindings=null,this.failWith(e,t)}return;default:break}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":this._bindings.open(e.data),this.sendOK(e);break;case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let t=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:t.useUnsafe((n,i)=>i)},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let t=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:t},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let t=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"RUN_QUERY":{let t=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"SEND_PREPARED":{let t=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_START",data:t},[t.buffer]);break}case"SEND_QUERY":{let t=this._bindings.sendQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_START",data:t},[t.buffer]);break}case"FETCH_QUERY_RESULTS":{let t=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:t},[t.buffer]);break}case"GET_TABLE_NAMES":{let t=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:t},[]);break}case"GLOB_FILE_INFOS":{let t=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:t},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let t=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:t},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let t=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:t},[]);break}}}catch(t){return this.failWith(e,t)}}};var bf={},ZF=(()=>{var r=bf.url;return function(e){e=e||{};function t(){return De.buffer!=yt&&qr(De.buffer),kf}function n(){return De.buffer!=yt&&qr(De.buffer),Cf}function i(){return De.buffer!=yt&&qr(De.buffer),jf}function s(){return De.buffer!=yt&&qr(De.buffer),qf}function o(){return De.buffer!=yt&&qr(De.buffer),Hf}function u(){return De.buffer!=yt&&qr(De.buffer),zf}var a=typeof e!="undefined"?e:{},h=Object.assign,_,T;a.ready=new Promise(function(c,l){_=c,T=l});var M=h({},a),E=[],q="./this.program",re=(c,l)=>{throw l},le=typeof window=="object",de=typeof importScripts=="function",Me=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",L=a.ENVIRONMENT_IS_PTHREAD||!1,ke="";function co(c){return a.locateFile?a.locateFile(c,ke):ke+c}var jr,Af,uo,Mg;function Eg(c){if(c instanceof _s)return;at("exiting due to exception: "+c)}var as,lo,fo;if(Me){de?ke=mf().dirname(ke)+"/":ke=__dirname+"/",fo=function(){lo||(as=gg(),lo=mf())},jr=function(d,p){return fo(),d=lo.normalize(d),as.readFileSync(d,p?null:"utf8")},uo=function(d){var p=jr(d,!0);return p.buffer||(p=new Uint8Array(p)),p},Af=function(d,p,m){fo(),d=lo.normalize(d),as.readFile(d,function(v,B){v?m(v):p(B.buffer)})},process.argv.length>1&&(q=process.argv[1].replace(/\\/g,"/")),E=process.argv.slice(2),process.on("uncaughtException",function(l){if(!(l instanceof _s))throw l}),process.on("unhandledRejection",function(l){throw l}),re=(l,d)=>{if(po())throw process.exitCode=l,d;Eg(d),process.exit(l)},a.inspect=function(){return"[Emscripten Module object]"};let c;try{c=vg()}catch(l){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),l}global.Worker=c.Worker}else(le||de)&&(de?ke=self.location.href:typeof document!="undefined"&&document.currentScript&&(ke=document.currentScript.src),r&&(ke=r),ke.indexOf("blob:")!==0?ke=ke.substr(0,ke.replace(/[?#].*/,"").lastIndexOf("/")+1):ke="",Me||(jr=function(c){var l=new XMLHttpRequest;return l.open("GET",c,!1),l.send(null),l.responseText},de&&(uo=function(c){var l=new XMLHttpRequest;return l.open("GET",c,!1),l.responseType="arraybuffer",l.send(null),new Uint8Array(l.response)}),Af=function(c,l,d){var p=new XMLHttpRequest;p.open("GET",c,!0),p.responseType="arraybuffer",p.onload=function(){if(p.status==200||p.status==0&&p.response){l(p.response);return}d()},p.onerror=d,p.send(null)}),Mg=c=>document.title=c);Me&&typeof performance=="undefined"&&(global.performance=wg().performance);var Ff=console.log.bind(console),Df=console.warn.bind(console);Me&&(fo(),Ff=c=>as.writeSync(1,c+`
|
|
18
|
-
`),Df=c=>as.writeSync(2,c+`
|
|
19
|
-
`));var Of=a.print||Ff,at=a.printErr||Df;h(a,M),M=null,a.arguments&&(E=a.arguments),a.thisProgram&&(q=a.thisProgram),a.quit&&(re=a.quit);function cs(c){cs.shown||(cs.shown={}),cs.shown[c]||(cs.shown[c]=1,at(c))}var uD=Atomics.load,lD=Atomics.store,dD=Atomics.compareExchange,us;a.wasmBinary&&(us=a.wasmBinary);var Mf=a.noExitRuntime||!0;typeof WebAssembly!="object"&&zt("no native wasm support detected");var De,Ef,Uc=!1,ls;function Uf(c,l){c||zt(l)}function Ug(c){var l=a["_"+c];return l}function Rg(c,l,d,p,m){var v={string:function(Ce){var Wt=0;if(Ce!=null&&Ce!==0){var tr=(Ce.length<<2)+1;Wt=ii(tr),ho(Ce,Wt,tr)}return Wt},array:function(Ce){var Wt=ii(Ce.length);return Nf(Ce,Wt),Wt}};function B(Ce){return l==="string"?gt(Ce):l==="boolean"?Boolean(Ce):Ce}var A=Ug(c),k=[],ye=0;if(p)for(var fe=0;fe<p.length;fe++){var Bt=v[d[fe]];Bt?(ye===0&&(ye=Gc()),k[fe]=Bt(p[fe])):k[fe]=p[fe]}var Be=A.apply(null,k);function It(Ce){return ye!==0&&Fo(ye),B(Ce)}return Be=It(Be),Be}function Rf(c){var l=new TextDecoder(c);this.decode=d=>(d.buffer instanceof SharedArrayBuffer&&(d=new Uint8Array(d)),l.decode.call(l,d))}var xf=typeof TextDecoder!="undefined"?new Rf("utf8"):void 0;function Vf(c,l,d){for(var p=l+d,m=l;c[m]&&!(m>=p);)++m;if(m-l>16&&c.subarray&&xf)return xf.decode(c.subarray(l,m));for(var v="";l<m;){var B=c[l++];if(!(B&128)){v+=String.fromCharCode(B);continue}var A=c[l++]&63;if((B&224)==192){v+=String.fromCharCode((B&31)<<6|A);continue}var k=c[l++]&63;if((B&240)==224?B=(B&15)<<12|A<<6|k:B=(B&7)<<18|A<<12|k<<6|c[l++]&63,B<65536)v+=String.fromCharCode(B);else{var ye=B-65536;v+=String.fromCharCode(55296|ye>>10,56320|ye&1023)}}return v}function gt(c,l){return c?Vf(n(),c,l):""}function Pf(c,l,d,p){if(!(p>0))return 0;for(var m=d,v=d+p-1,B=0;B<c.length;++B){var A=c.charCodeAt(B);if(A>=55296&&A<=57343){var k=c.charCodeAt(++B);A=65536+((A&1023)<<10)|k&1023}if(A<=127){if(d>=v)break;l[d++]=A}else if(A<=2047){if(d+1>=v)break;l[d++]=192|A>>6,l[d++]=128|A&63}else if(A<=65535){if(d+2>=v)break;l[d++]=224|A>>12,l[d++]=128|A>>6&63,l[d++]=128|A&63}else{if(d+3>=v)break;l[d++]=240|A>>18,l[d++]=128|A>>12&63,l[d++]=128|A>>6&63,l[d++]=128|A&63}}return l[d]=0,d-m}function ho(c,l,d){return Pf(c,n(),l,d)}function Lf(c){for(var l=0,d=0;d<c.length;++d){var p=c.charCodeAt(d);p>=55296&&p<=57343&&(p=65536+((p&1023)<<10)|c.charCodeAt(++d)&1023),p<=127?++l:p<=2047?l+=2:p<=65535?l+=3:l+=4}return l}var fD=typeof TextDecoder!="undefined"?new Rf("utf-16le"):void 0;function Nf(c,l){t().set(c,l)}function xg(c,l,d){for(var p=0;p<c.length;++p)t()[l++>>0]=c.charCodeAt(p);d||(t()[l>>0]=0)}function Vg(c,l){return c%l>0&&(c+=l-c%l),c}var yt,kf,Cf,jf,qf,Hf,Pg,Lg,zf;L&&(yt=a.buffer);function qr(c){yt=c,a.HEAP8=kf=new Int8Array(c),a.HEAP16=jf=new Int16Array(c),a.HEAP32=Hf=new Int32Array(c),a.HEAPU8=Cf=new Uint8Array(c),a.HEAPU16=qf=new Uint16Array(c),a.HEAPU32=Pg=new Uint32Array(c),a.HEAPF32=Lg=new Float32Array(c),a.HEAPF64=zf=new Float64Array(c)}var Wf=a.INITIAL_MEMORY||16777216;if(L)De=a.wasmMemory,yt=a.buffer;else if(a.wasmMemory)De=a.wasmMemory;else if(De=new WebAssembly.Memory({initial:Wf/65536,maximum:2147483648/65536,shared:!0}),!(De.buffer instanceof SharedArrayBuffer))throw at("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Me&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");De&&(yt=De.buffer),Wf=yt.byteLength,qr(yt);var Yf,Gf=[],$f=[],Ng=[],kg=[],Jf=[],Cg=!1,jg=!1,qg=0;function po(){return Mf||qg>0}function Hg(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)Gg(a.preRun.shift());yo(Gf)}function Kf(){Cg=!0,!L&&yo($f)}function zg(){L||yo(Ng)}function Wg(){L||(C.terminateAllThreads(),jg=!0)}function Yg(){if(!L){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)Jg(a.postRun.shift());yo(Jf)}}function Gg(c){Gf.unshift(c)}function $g(c){$f.unshift(c)}function Jg(c){Jf.unshift(c)}var Un=0,Rc=null,ds=null;function Kg(c){Un++,a.monitorRunDependencies&&a.monitorRunDependencies(Un)}function Xg(c){if(Un--,a.monitorRunDependencies&&a.monitorRunDependencies(Un),Un==0&&(Rc!==null&&(clearInterval(Rc),Rc=null),ds)){var l=ds;ds=null,l()}}a.preloadedImages={},a.preloadedAudios={};function zt(c){L?postMessage({cmd:"onAbort",arg:c}):a.onAbort&&a.onAbort(c),c="Aborted("+c+")",at(c),Uc=!0,ls=1,c+=". Build with -s ASSERTIONS=1 for more info.";var l=new WebAssembly.RuntimeError(c);throw T(l),l}var Zg="data:application/octet-stream;base64,";function Xf(c){return c.startsWith(Zg)}var vt;a.locateFile?(vt="./duckdb-coi.wasm",Xf(vt)||(vt=co(vt))):vt=new URL("./duckdb-coi.wasm",bf.url).toString();function Zf(c){try{if(c==vt&&us)return new Uint8Array(us);if(uo)return uo(c);throw"both async and sync fetching of the wasm failed"}catch(l){zt(l)}}function Qg(){return!us&&(le||de)&&typeof fetch=="function"?fetch(vt,{credentials:"same-origin"}).then(function(c){if(!c.ok)throw"failed to load wasm binary file at '"+vt+"'";return c.arrayBuffer()}).catch(function(){return Zf(vt)}):Promise.resolve().then(function(){return Zf(vt)})}function e0(){var c={a:fv};function l(B,A){var k=B.exports;if(a.asm=k,o0(a.asm.hb),Yf=a.asm.xa,$g(a.asm.va),Ef=A,!L){var ye=C.unusedWorkers.length;C.unusedWorkers.forEach(function(fe){C.loadWasmModuleToWorker(fe,function(){--ye||Xg("wasm-instantiate")})})}}L||Kg("wasm-instantiate");function d(B){l(B.instance,B.module)}function p(B){return Qg().then(function(A){return WebAssembly.instantiate(A,c)}).then(function(A){return A}).then(B,function(A){at("failed to asynchronously prepare wasm: "+A),zt(A)})}function m(){return!us&&typeof WebAssembly.instantiateStreaming=="function"&&!Xf(vt)&&typeof fetch=="function"?fetch(vt,{credentials:"same-origin"}).then(function(B){var A=WebAssembly.instantiateStreaming(B,c);return A.then(d,function(k){return at("wasm streaming compile failed: "+k),at("falling back to ArrayBuffer instantiation"),p(d)})}):p(d)}if(a.instantiateWasm)try{var v=a.instantiateWasm(c,l);return v}catch(B){return at("Module.instantiateWasm callback failed with error: "+B),!1}return m().catch(T),{}}var t0={};function yo(c){for(;c.length>0;){var l=c.shift();if(typeof l=="function"){l(a);continue}var d=l.func;typeof d=="number"?l.arg===void 0?Vc(d)():Vc(d)(l.arg):d(l.arg===void 0?null:l.arg)}}function xc(c){var l=Gc(),d=c();return Fo(l),d}function r0(c){o()[c>>2]=0;var l=C.pthreads[c];delete C.pthreads[c],l.worker.terminate(),Yc(c),C.runningWorkers.splice(C.runningWorkers.indexOf(l.worker),1),l.worker.pthread=void 0}function n0(c){var l=C.pthreads[c];l.worker.postMessage({cmd:"cancel"})}function Qf(c){var l=C.pthreads[c];if(l){o()[c>>2]=0;var d=l.worker;C.returnWorkerToPool(d)}}function eh(c,l){n().fill(0,c,c+l)}function th(c){Zh(c)}function rh(c){if(c instanceof _s||c=="unwind")return ls;re(1,c)}var C={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],initMainThread:function(){for(var c=4,l=0;l<c;++l)C.allocateUnusedWorker()},initWorker:function(){},pthreads:{},setExitStatus:function(c){ls=c},terminateAllThreads:function(){for(var c in C.pthreads){var l=C.pthreads[c];l&&l.worker&&C.returnWorkerToPool(l.worker)}for(var d=0;d<C.unusedWorkers.length;++d){var p=C.unusedWorkers[d];p.terminate()}C.unusedWorkers=[]},returnWorkerToPool:function(c){C.runWithoutMainThreadQueuedCalls(function(){delete C.pthreads[c.pthread.threadInfoStruct],C.unusedWorkers.push(c),C.runningWorkers.splice(C.runningWorkers.indexOf(c),1),Yc(c.pthread.threadInfoStruct),c.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(c){o()[Xh>>2]=0;try{c()}finally{o()[Xh>>2]=1}},receiveObjectTransfer:function(c){},threadInit:function(){for(var c in C.tlsInitFunctions)C.tlsInitFunctions[c]()},loadWasmModuleToWorker:function(c,l){c.onmessage=function(d){var p=d.data,m=p.cmd;if(c.pthread&&(C.currentProxiedOperationCallerThread=c.pthread.threadInfoStruct),p.targetThread&&p.targetThread!=Ao()){var v=C.pthreads[p.targetThread];v?v.worker.postMessage(p,p.transferList):at('Internal error! Worker sent a message "'+m+'" to target pthread '+p.targetThread+", but that thread no longer exists!"),C.currentProxiedOperationCallerThread=void 0;return}m==="processQueuedMainThreadWork"?Hc():m==="spawnThread"?sh(p):m==="cleanupThread"?Qf(p.thread):m==="killThread"?r0(p.thread):m==="cancelThread"?n0(p.thread):m==="loaded"?(c.loaded=!0,l&&l(c),c.runPthread&&(c.runPthread(),delete c.runPthread)):m==="print"?Of("Thread "+p.threadId+": "+p.text):m==="printErr"?at("Thread "+p.threadId+": "+p.text):m==="alert"?alert("Thread "+p.threadId+": "+p.text):m==="detachedExit"?C.returnWorkerToPool(c):p.target==="setimmediate"?c.postMessage(p):m==="onAbort"?a.onAbort&&a.onAbort(p.arg):at("worker sent an unknown command "+m),C.currentProxiedOperationCallerThread=void 0},c.onerror=function(d){var p="worker sent an error!";throw at(p+" "+d.filename+":"+d.lineno+": "+d.message),d},Me&&(c.on("message",function(d){c.onmessage({data:d})}),c.on("error",function(d){c.onerror(d)}),c.on("detachedExit",function(){})),c.postMessage({cmd:"load",urlOrBlob:a.mainScriptUrlOrBlob,wasmMemory:De,wasmModule:Ef})},allocateUnusedWorker:function(){if(!a.locateFile){C.unusedWorkers.push(new Worker(new URL("duckdb_wasm.worker.js",bf.url)));return}var c=co("duckdb_wasm.worker.js");C.unusedWorkers.push(new Worker(c))},getNewWorker:function(){return C.unusedWorkers.length==0&&(C.allocateUnusedWorker(),C.loadWasmModuleToWorker(C.unusedWorkers[0])),C.unusedWorkers.pop()}};function i0(){var c=Ao(),l=o()[c+44>>2],d=o()[c+48>>2],p=l-d;Jh(l,p),Fo(l)}a.establishStackSpace=i0;function nh(c){if(L)return ue(1,0,c);try{th(c)}catch(l){rh(l)}}var _o=[];function Vc(c){var l=_o[c];return l||(c>=_o.length&&(_o.length=c+1),_o[c]=l=Yf.get(c)),l}function s0(c,l){return Vc(c)(l)}a.invokeEntryPoint=s0;function o0(c,l,d){C.tlsInitFunctions.push(c)}function a0(c,l,d,p){zt("Assertion failed: "+gt(c)+", at: "+[l?gt(l):"unknown filename",d,p?gt(p):"unknown function"])}var fs;Me?fs=()=>{var c=process.hrtime();return c[0]*1e3+c[1]/1e6}:L?fs=()=>performance.now()-a.__performance_now_clock_drift:fs=()=>performance.now();var c0=!0;function u0(c){return o()[Wh()>>2]=c,c}function ih(c,l){var d;if(c===0)d=Date.now();else if((c===1||c===4)&&c0)d=fs();else return u0(28),-1;return o()[l>>2]=d/1e3|0,o()[l+4>>2]=d%1e3*1e3*1e3|0,0}function l0(c,l){return ih(c,l)}function d0(c){Yh(c,!de,1,!le),C.threadInit()}function f0(c){L?postMessage({cmd:"cleanupThread",thread:c}):Qf(c)}function sh(c){var l=C.getNewWorker();if(!l)return 6;C.runningWorkers.push(l);var d=C.pthreads[c.pthread_ptr]={worker:l,threadInfoStruct:c.pthread_ptr};l.pthread=d;var p={cmd:"run",start_routine:c.startRoutine,arg:c.arg,threadInfoStruct:c.pthread_ptr};return l.runPthread=function(){p.time=performance.now(),l.postMessage(p,c.transferList)},l.loaded&&(l.runPthread(),delete l.runPthread),0}function h0(c,l,d,p){if(typeof SharedArrayBuffer=="undefined")return at("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var m=[],v=0;if(L&&(m.length===0||v))return Gh(687865856,c,l,d,p);if(v)return v;var B={startRoutine:d,pthread_ptr:c,arg:p,transferList:m};return L?(B.cmd="spawnThread",postMessage(B,m),0):sh(B)}function p0(){postMessage({cmd:"detachedExit"})}var Qe={mappings:{},buffers:[null,[],[]],printChar:function(c,l){var d=Qe.buffers[c];l===0||l===10?((c===1?Of:at)(Vf(d,0)),d.length=0):d.push(l)},varargs:void 0,get:function(){Qe.varargs+=4;var c=o()[Qe.varargs-4>>2];return c},getStr:function(c){var l=gt(c);return l},get64:function(c,l){return c}};function oh(c,l,d,p,m){if(L)return ue(2,1,c,l,d,p,m)}function ah(c,l){return L?ue(3,1,c,l):(c=Qe.getStr(c),Qe.doAccess(c,l))}function y0(){at("missing function: $SOCKFS"),zt(-1)}function ch(){at("missing function: $FS"),zt(-1)}function hs(c){var l=y0.getSocket(c);if(!l)throw new ch.ErrnoError(8);return l}function Pc(c){return(c&255)+"."+(c>>8&255)+"."+(c>>16&255)+"."+(c>>24&255)}function uh(c){var l="",d=0,p=0,m=0,v=0,B=0,A=0,k=[c[0]&65535,c[0]>>16,c[1]&65535,c[1]>>16,c[2]&65535,c[2]>>16,c[3]&65535,c[3]>>16],ye=!0,fe="";for(A=0;A<5;A++)if(k[A]!==0){ye=!1;break}if(ye){if(fe=Pc(k[6]|k[7]<<16),k[5]===-1)return l="::ffff:",l+=fe,l;if(k[5]===0)return l="::",fe==="0.0.0.0"&&(fe=""),fe==="0.0.0.1"&&(fe="1"),l+=fe,l}for(d=0;d<8;d++)k[d]===0&&(d-m>1&&(B=0),m=d,B++),B>p&&(p=B,v=d-p+1);for(d=0;d<8;d++){if(p>1&&k[d]===0&&d>=v&&d<v+p){d===v&&(l+=":",v===0&&(l+=":"));continue}l+=Number(Wc(k[d]&65535)).toString(16),l+=d<7?":":""}return l}function lh(c,l){var d=i()[c>>1],p=Wc(s()[c+2>>1]),m;switch(d){case 2:if(l!==16)return{errno:28};m=o()[c+4>>2],m=Pc(m);break;case 10:if(l!==28)return{errno:28};m=[o()[c+8>>2],o()[c+12>>2],o()[c+16>>2],o()[c+20>>2]],m=uh(m);break;default:return{errno:5}}return{family:d,addr:m,port:p}}function mo(c){for(var l=c.split("."),d=0;d<4;d++){var p=Number(l[d]);if(isNaN(p))return null;l[d]=p}return(l[0]|l[1]<<8|l[2]<<16|l[3]<<24)>>>0}function bo(c){return parseInt(c)}function Lc(c){var l,d,p,m,v=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,B=[];if(!v.test(c))return null;if(c==="::")return[0,0,0,0,0,0,0,0];for(c.startsWith("::")?c=c.replace("::","Z:"):c=c.replace("::",":Z:"),c.indexOf(".")>0?(c=c.replace(new RegExp("[.]","g"),":"),l=c.split(":"),l[l.length-4]=bo(l[l.length-4])+bo(l[l.length-3])*256,l[l.length-3]=bo(l[l.length-2])+bo(l[l.length-1])*256,l=l.slice(0,l.length-2)):l=c.split(":"),p=0,m=0,d=0;d<l.length;d++)if(typeof l[d]=="string")if(l[d]==="Z"){for(m=0;m<8-l.length+1;m++)B[d+m]=0;p=m-1}else B[d+p]=So(parseInt(l[d],16));else B[d+p]=l[d];return[B[1]<<16|B[0],B[3]<<16|B[2],B[5]<<16|B[4],B[7]<<16|B[6]]}var wt={address_map:{id:1,addrs:{},names:{}},lookup_name:function(c){var l=mo(c);if(l!==null||(l=Lc(c),l!==null))return c;var d;if(wt.address_map.addrs[c])d=wt.address_map.addrs[c];else{var p=wt.address_map.id++;Uf(p<65535,"exceeded max address mappings of 65535"),d="172.29."+(p&255)+"."+(p&65280),wt.address_map.names[d]=c,wt.address_map.addrs[c]=d}return d},lookup_addr:function(c){return wt.address_map.names[c]?wt.address_map.names[c]:null}};function dh(c,l,d){if(d&&c===0)return null;var p=lh(c,l);if(p.errno)throw new ch.ErrnoError(p.errno);return p.addr=wt.lookup_addr(p.addr)||p.addr,p}function fh(c,l,d){if(L)return ue(4,1,c,l,d);var p=hs(c),m=dh(l,d);return p.sock_ops.bind(p,m.addr,m.port),0}function hh(c,l,d){if(L)return ue(5,1,c,l,d);var p=hs(c),m=dh(l,d);return p.sock_ops.connect(p,m.addr,m.port),0}function ph(c,l,d){return L?ue(6,1,c,l,d):(Qe.varargs=d,0)}function yh(c,l){if(L)return ue(7,1,c,l)}function _h(c,l,d,p){if(L)return ue(8,1,c,l,d,p)}function mh(c,l,d){if(L)return ue(9,1,c,l,d)}function bh(c,l,d){if(L)return ue(10,1,c,l,d)}function Nc(c,l,d,p,m){switch(l){case 2:d=mo(d),eh(c,16),m&&(o()[m>>2]=16),i()[c>>1]=l,o()[c+4>>2]=d,i()[c+2>>1]=So(p);break;case 10:d=Lc(d),eh(c,28),m&&(o()[m>>2]=28),o()[c>>2]=l,o()[c+8>>2]=d[0],o()[c+12>>2]=d[1],o()[c+16>>2]=d[2],o()[c+20>>2]=d[3],i()[c+2>>1]=So(p);break;default:return 5}return 0}function gh(c,l,d){if(L)return ue(11,1,c,l,d);var p=hs(c);if(!p.daddr)return-53;var m=Nc(l,p.family,wt.lookup_name(p.daddr),p.dport,d);return 0}function vh(c,l,d,p,m){if(L)return ue(12,1,c,l,d,p,m);var v=hs(c);return l===1&&d===4?(o()[p>>2]=v.error,o()[m>>2]=4,v.error=null,0):-50}function wh(c,l,d){return L?ue(13,1,c,l,d):(Qe.varargs=d,0)}function Bh(c,l){if(L)return ue(14,1,c,l)}function Ih(c,l){return L?ue(15,1,c,l):(c=Qe.getStr(c),Qe.doMkdir(c,l))}function Th(c,l,d){if(L)return ue(16,1,c,l,d);Qe.varargs=d}function Sh(c,l,d,p,m,v){if(L)return ue(17,1,c,l,d,p,m,v);var B=hs(c),A=B.sock_ops.recvmsg(B,d);if(!A)return 0;if(m)var k=Nc(m,B.family,wt.lookup_name(A.addr),A.port,v);return n().set(A.buffer,l),A.buffer.byteLength}function Ah(c,l){if(L)return ue(18,1,c,l)}function Fh(c){if(L)return ue(19,1,c)}function Dh(c,l,d,p,m,v){if(L)return ue(20,1,c,l,d,p,m,v)}function Oh(c,l,d){if(L)return ue(21,1,c,l,d)}function Mh(c,l){if(L)return ue(22,1,c,l)}function Eh(c){if(L)return ue(23,1,c)}function _0(c,l){zt("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")}function m0(c,l){zt("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")}function b0(){return 2097152}function g0(c,l,d){for(var p=performance.now(),m=p+d,v=Atomics.exchange(o(),Do>>2,c);;){if(p=performance.now(),p>m)return v=Atomics.exchange(o(),Do>>2,0),-73;if(v=Atomics.exchange(o(),Do>>2,0),v==0)break;if(Hc(),Atomics.load(o(),c>>2)!=l)return-6;v=Atomics.exchange(o(),Do>>2,c)}return 0}function v0(c,l){if(c==l)postMessage({cmd:"processQueuedMainThreadWork"});else if(L)postMessage({targetThread:c,cmd:"processThreadQueue"});else{var d=C.pthreads[c],p=d&&d.worker;if(!p)return;p.postMessage({cmd:"processThreadQueue"})}return 1}function w0(){zt("")}function B0(c,l){return globalThis.DUCKDB_RUNTIME.createDirectory(a,c,l)}function I0(c,l){return globalThis.DUCKDB_RUNTIME.checkDirectory(a,c,l)}function T0(c,l){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(a,c,l)}function S0(c,l){return globalThis.DUCKDB_RUNTIME.removeDirectory(a,c,l)}function A0(c){return globalThis.DUCKDB_RUNTIME.closeFile(a,c)}function F0(c,l){return globalThis.DUCKDB_RUNTIME.checkFile(a,c,l)}function D0(c){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(a,c)}function O0(c,l,d,p){return globalThis.DUCKDB_RUNTIME.moveFile(a,c,l,d,p)}function M0(c,l){return globalThis.DUCKDB_RUNTIME.openFile(a,c,l)}function E0(c,l,d,p){return globalThis.DUCKDB_RUNTIME.readFile(a,c,l,d,p)}function U0(c,l){return globalThis.DUCKDB_RUNTIME.truncateFile(a,c,l)}function R0(c,l,d,p){return globalThis.DUCKDB_RUNTIME.writeFile(a,c,l,d,p)}function x0(c,l){return globalThis.DUCKDB_RUNTIME.glob(a,c,l)}function V0(c){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(a,c)}function P0(c,l,d,p){return globalThis.DUCKDB_RUNTIME.callScalarUDF(a,c,l,d,p)}function L0(){Me||de||cs("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function N0(){return 2147483648}function k0(c,l,d){n().copyWithin(c,l,l+d)}function C0(){return Me?Bg().cpus().length:navigator.hardwareConcurrency}function ue(c,l){var d=arguments.length-2,p=arguments;return xc(function(){for(var m=d,v=ii(m*8),B=v>>3,A=0;A<d;A++){var k=p[2+A];u()[B+A]=k}return $h(c,m,v,l)})}var kc=[];function j0(c,l,d){kc.length=l;for(var p=d>>3,m=0;m<l;m++)kc[m]=u()[p+m];var v=c<0,B=v?t0[-c-1]:lv[c];return B.apply(null,kc)}function q0(c){try{return De.grow(c-yt.byteLength+65535>>>16),qr(De.buffer),1}catch(l){}}function H0(c){var l=n().length;if(c=c>>>0,c<=l)return!1;var d=2147483648;if(c>d)return!1;for(var p=1;p<=4;p*=2){var m=l*(1+.2/p);m=Math.min(m,c+100663296);var v=Math.min(d,Vg(Math.max(c,m),65536)),B=q0(v);if(B)return!0}return!1}var se={inEventHandler:0,removeAllEventListeners:function(){for(var c=se.eventHandlers.length-1;c>=0;--c)se._removeHandler(c);se.eventHandlers=[],se.deferredCalls=[]},registerRemoveEventListeners:function(){se.removeEventListenersRegistered||(kg.push(se.removeAllEventListeners),se.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(c,l,d){function p(B,A){if(B.length!=A.length)return!1;for(var k in B)if(B[k]!=A[k])return!1;return!0}for(var m in se.deferredCalls){var v=se.deferredCalls[m];if(v.targetFunction==c&&p(v.argsList,d))return}se.deferredCalls.push({targetFunction:c,precedence:l,argsList:d}),se.deferredCalls.sort(function(B,A){return B.precedence<A.precedence})},removeDeferredCalls:function(c){for(var l=0;l<se.deferredCalls.length;++l)se.deferredCalls[l].targetFunction==c&&(se.deferredCalls.splice(l,1),--l)},canPerformEventHandlerRequests:function(){return se.inEventHandler&&se.currentEventHandler.allowsDeferredCalls},runDeferredCalls:function(){if(!!se.canPerformEventHandlerRequests())for(var c=0;c<se.deferredCalls.length;++c){var l=se.deferredCalls[c];se.deferredCalls.splice(c,1),--c,l.targetFunction.apply(null,l.argsList)}},eventHandlers:[],removeAllHandlersOnTarget:function(c,l){for(var d=0;d<se.eventHandlers.length;++d)se.eventHandlers[d].target==c&&(!l||l==se.eventHandlers[d].eventTypeString)&&se._removeHandler(d--)},_removeHandler:function(c){var l=se.eventHandlers[c];l.target.removeEventListener(l.eventTypeString,l.eventListenerFunc,l.useCapture),se.eventHandlers.splice(c,1)},registerOrRemoveHandler:function(c){var l=function(m){++se.inEventHandler,se.currentEventHandler=c,se.runDeferredCalls(),c.handlerFunc(m),se.runDeferredCalls(),--se.inEventHandler};if(c.callbackfunc)c.eventListenerFunc=l,c.target.addEventListener(c.eventTypeString,l,c.useCapture),se.eventHandlers.push(c),se.registerRemoveEventListeners();else for(var d=0;d<se.eventHandlers.length;++d)se.eventHandlers[d].target==c.target&&se.eventHandlers[d].eventTypeString==c.eventTypeString&&se._removeHandler(d--)},queueEventHandlerOnThread_iiii:function(c,l,d,p,m){xc(function(){var v=ii(12);o()[v>>2]=d,o()[v+4>>2]=p,o()[v+8>>2]=m,zc(c,637534208,l,p,v)})},getTargetThreadForEventCallback:function(c){switch(c){case 1:return 0;case 2:return C.currentProxiedOperationCallerThread;default:return c}},getNodeNameForTarget:function(c){return c?c==window?"#window":c==screen?"#screen":c&&c.nodeName?c.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function z0(c){var l=Lf(c)+1,d=ys(l);return ho(c,d,l),d}function W0(c,l,d,p){xc(function(){var m=ii(12),v=0;l&&(v=z0(l)),o()[m>>2]=v,o()[m+4>>2]=d,o()[m+8>>2]=p,zc(c,657457152,0,v,m)})}function Y0(c,l,d,p){l=l?gt(l):"",W0(c,l,d,p)}function G0(c){return c>2?gt(c):c}var $0=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function J0(c){c=G0(c);var l=$0[c]||(typeof document!="undefined"?document.querySelector(c):void 0);return l}function Cc(c){return J0(c)}function Uh(c,l,d){var p=Cc(c);if(!p)return-4;if(p.canvasSharedPtr&&(o()[p.canvasSharedPtr>>2]=l,o()[p.canvasSharedPtr+4>>2]=d),p.offscreenCanvas||!p.controlTransferredOffscreen){p.offscreenCanvas&&(p=p.offscreenCanvas);var m=!1;if(p.GLctxObject&&p.GLctxObject.GLctx){var v=p.GLctxObject.GLctx.getParameter(2978);m=v[0]===0&&v[1]===0&&v[2]===p.width&&v[3]===p.height}p.width=l,p.height=d,m&&p.GLctxObject.GLctx.viewport(0,0,l,d)}else if(p.canvasSharedPtr){var B=o()[p.canvasSharedPtr+8>>2];return Y0(B,c,l,d),1}else return-4;return 0}function Rh(c,l,d){return L?ue(24,1,c,l,d):Uh(c,l,d)}function K0(c,l,d){var p=Cc(c);return p?Uh(c,l,d):Rh(c,l,d)}function X0(){throw"unwind"}function Z0(c){var l=c.getExtension("ANGLE_instanced_arrays");if(l)return c.vertexAttribDivisor=function(d,p){l.vertexAttribDivisorANGLE(d,p)},c.drawArraysInstanced=function(d,p,m,v){l.drawArraysInstancedANGLE(d,p,m,v)},c.drawElementsInstanced=function(d,p,m,v,B){l.drawElementsInstancedANGLE(d,p,m,v,B)},1}function Q0(c){var l=c.getExtension("OES_vertex_array_object");if(l)return c.createVertexArray=function(){return l.createVertexArrayOES()},c.deleteVertexArray=function(d){l.deleteVertexArrayOES(d)},c.bindVertexArray=function(d){l.bindVertexArrayOES(d)},c.isVertexArray=function(d){return l.isVertexArrayOES(d)},1}function ev(c){var l=c.getExtension("WEBGL_draw_buffers");if(l)return c.drawBuffers=function(d,p){l.drawBuffersWEBGL(d,p)},1}function tv(c){return!!(c.multiDrawWebgl=c.getExtension("WEBGL_multi_draw"))}var Ee={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function(l){Ee.lastError||(Ee.lastError=l)},getNewId:function(c){for(var l=Ee.counter++,d=c.length;d<l;d++)c[d]=null;return l},getSource:function(c,l,d,p){for(var m="",v=0;v<l;++v){var B=p?o()[p+v*4>>2]:-1;m+=gt(o()[d+v*4>>2],B<0?void 0:B)}return m},createContext:function(c,l){c.getContextSafariWebGL2Fixed||(c.getContextSafariWebGL2Fixed=c.getContext,c.getContext=function(m,v){var B=c.getContextSafariWebGL2Fixed(m,v);return m=="webgl"==B instanceof WebGLRenderingContext?B:null});var d=c.getContext("webgl",l);if(!d)return 0;var p=Ee.registerContext(d,l);return p},registerContext:function(c,l){var d=ys(8);o()[d+4>>2]=Ao();var p={handle:d,attributes:l,version:l.majorVersion,GLctx:c};return c.canvas&&(c.canvas.GLctxObject=p),Ee.contexts[d]=p,(typeof l.enableExtensionsByDefault=="undefined"||l.enableExtensionsByDefault)&&Ee.initExtensions(p),d},makeContextCurrent:function(c){return Ee.currentContext=Ee.contexts[c],a.ctx=zh=Ee.currentContext&&Ee.currentContext.GLctx,!(c&&!zh)},getContext:function(c){return Ee.contexts[c]},deleteContext:function(c){Ee.currentContext===Ee.contexts[c]&&(Ee.currentContext=null),typeof se=="object"&&se.removeAllHandlersOnTarget(Ee.contexts[c].GLctx.canvas),Ee.contexts[c]&&Ee.contexts[c].GLctx.canvas&&(Ee.contexts[c].GLctx.canvas.GLctxObject=void 0),Kh(Ee.contexts[c].handle),Ee.contexts[c]=null},initExtensions:function(c){if(c||(c=Ee.currentContext),!c.initExtensionsDone){c.initExtensionsDone=!0;var l=c.GLctx;Z0(l),Q0(l),ev(l),l.disjointTimerQueryExt=l.getExtension("EXT_disjoint_timer_query"),tv(l);var d=l.getSupportedExtensions()||[];d.forEach(function(p){!p.includes("lose_context")&&!p.includes("debug")&&l.getExtension(p)})}}},rv=["default","low-power","high-performance"];function nv(c,l){var d=l>>2,p=o()[d+(24>>2)],m={alpha:!!o()[d+(0>>2)],depth:!!o()[d+(4>>2)],stencil:!!o()[d+(8>>2)],antialias:!!o()[d+(12>>2)],premultipliedAlpha:!!o()[d+(16>>2)],preserveDrawingBuffer:!!o()[d+(20>>2)],powerPreference:rv[p],failIfMajorPerformanceCaveat:!!o()[d+(28>>2)],majorVersion:o()[d+(32>>2)],minorVersion:o()[d+(36>>2)],enableExtensionsByDefault:o()[d+(40>>2)],explicitSwapControl:o()[d+(44>>2)],proxyContextToMainThread:o()[d+(48>>2)],renderViaOffscreenBackBuffer:o()[d+(52>>2)]},v=Cc(c);if(!v||m.explicitSwapControl)return 0;var B=Ee.createContext(v,m);return B}function iv(c,l){return nv(c,l)}var jc={};function sv(){return q||"./this.program"}function ps(){if(!ps.strings){var c=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",l={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:c,_:sv()};for(var d in jc)jc[d]===void 0?delete l[d]:l[d]=jc[d];var p=[];for(var d in l)p.push(d+"="+l[d]);ps.strings=p}return ps.strings}function xh(c,l){if(L)return ue(25,1,c,l);var d=0;return ps().forEach(function(p,m){var v=l+d;o()[c+m*4>>2]=v,xg(p,v),d+=p.length+1}),0}function Vh(c,l){if(L)return ue(26,1,c,l);var d=ps();o()[c>>2]=d.length;var p=0;return d.forEach(function(m){p+=m.length+1}),o()[l>>2]=p,0}function Ph(c){return L?ue(27,1,c):0}function Lh(c,l,d,p,m,v){if(L)return ue(28,1,c,l,d,p,m,v);var B=Qe.getStreamFromFD(c),A=Qe.doReadv(B,l,d,p);return o()[v>>2]=A,0}function Nh(c,l,d,p,m,v){if(L)return ue(29,1,c,l,d,p,m,v);var B=Qe.getStreamFromFD(c),A=Qe.doWritev(B,l,d,p);return o()[v>>2]=A,0}function kh(c,l,d,p){if(L)return ue(30,1,c,l,d,p);var m=Qe.getStreamFromFD(c),v=Qe.doReadv(m,l,d);return o()[p>>2]=v,0}function Ch(c,l,d,p,m){if(L)return ue(31,1,c,l,d,p,m)}function jh(c){if(L)return ue(32,1,c);var l=Qe.getStreamFromFD(c);return l.stream_ops&&l.stream_ops.fsync?-l.stream_ops.fsync(l):0}function qh(c,l,d,p){if(L)return ue(33,1,c,l,d,p);for(var m=0,v=0;v<d;v++){var B=o()[l>>2],A=o()[l+4>>2];l+=8;for(var k=0;k<A;k++)Qe.printChar(c,n()[B+k]);m+=A}return o()[p>>2]=m,0}function Hh(c,l,d,p){if(L)return ue(34,1,c,l,d,p);var m=0,v=0,B=0,A=0,k=0,ye=0,fe;function Bt(Be,It,Ce,Wt,tr,ms){var F,j,_e,be;return j=Be===10?28:16,tr=Be===10?uh(tr):Pc(tr),F=ys(j),be=Nc(F,Be,tr,ms),Uf(!be),_e=ys(32),o()[_e+4>>2]=Be,o()[_e+8>>2]=It,o()[_e+12>>2]=Ce,o()[_e+24>>2]=Wt,o()[_e+20>>2]=F,Be===10?o()[_e+16>>2]=28:o()[_e+16>>2]=16,o()[_e+28>>2]=0,_e}if(d&&(B=o()[d>>2],A=o()[d+4>>2],k=o()[d+8>>2],ye=o()[d+12>>2]),k&&!ye&&(ye=k===2?17:6),!k&&ye&&(k=ye===17?2:1),ye===0&&(ye=6),k===0&&(k=1),!c&&!l)return-2;if(B&~(1|2|4|1024|8|16|32)||d!==0&&o()[d>>2]&2&&!c)return-1;if(B&32)return-2;if(k!==0&&k!==1&&k!==2)return-7;if(A!==0&&A!==2&&A!==10)return-6;if(l&&(l=gt(l),v=parseInt(l,10),isNaN(v)))return B&1024?-2:-8;if(!c)return A===0&&(A=2),(B&1)===0&&(A===2?m=To(2130706433):m=[0,0,0,1]),fe=Bt(A,k,ye,null,m,v),o()[p>>2]=fe,0;if(c=gt(c),m=mo(c),m!==null)if(A===0||A===2)A=2;else if(A===10&&B&8)m=[0,0,To(65535),m],A=10;else return-2;else if(m=Lc(c),m!==null)if(A===0||A===10)A=10;else return-2;return m!=null?(fe=Bt(A,k,ye,c,m,v),o()[p>>2]=fe,0):B&4?-2:(c=wt.lookup_name(c),m=mo(c),A===0?A=2:A===10&&(m=[0,0,To(65535),m]),fe=Bt(A,k,ye,null,m,v),o()[p>>2]=fe,0)}function ov(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var c=new Uint8Array(1);return function(){return crypto.getRandomValues(c),c[0]}}else if(Me)try{var l=dw("crypto");return function(){return l.randomBytes(1)[0]}}catch(d){}return function(){zt("randomDevice")}}function go(c,l){go.randomDevice||(go.randomDevice=ov());for(var d=0;d<l;d++)t()[c+d>>0]=go.randomDevice();return 0}function av(c,l,d,p,m,v,B){var A=lh(c,l);if(A.errno)return-6;var k=A.port,ye=A.addr,fe=!1;if(d&&p){var Bt;if(B&1||!(Bt=wt.lookup_addr(ye))){if(B&8)return-2}else ye=Bt;var Be=ho(ye,d,p);Be+1>=p&&(fe=!0)}if(m&&v){k=""+k;var Be=ho(k,m,v);Be+1>=v&&(fe=!0)}return fe?-12:0}function vo(c){return c%4===0&&(c%100!==0||c%400===0)}function qc(c,l){for(var d=0,p=0;p<=l;d+=c[p++]);return d}var wo=[31,29,31,30,31,30,31,31,30,31,30,31],Bo=[31,28,31,30,31,30,31,31,30,31,30,31];function Io(c,l){for(var d=new Date(c.getTime());l>0;){var p=vo(d.getFullYear()),m=d.getMonth(),v=(p?wo:Bo)[m];if(l>v-d.getDate())l-=v-d.getDate()+1,d.setDate(1),m<11?d.setMonth(m+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else return d.setDate(d.getDate()+l),d}return d}function cv(c,l,d,p){var m=o()[p+40>>2],v={tm_sec:o()[p>>2],tm_min:o()[p+4>>2],tm_hour:o()[p+8>>2],tm_mday:o()[p+12>>2],tm_mon:o()[p+16>>2],tm_year:o()[p+20>>2],tm_wday:o()[p+24>>2],tm_yday:o()[p+28>>2],tm_isdst:o()[p+32>>2],tm_gmtoff:o()[p+36>>2],tm_zone:m?gt(m):""},B=gt(d),A={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var k in A)B=B.replace(new RegExp(k,"g"),A[k]);var ye=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],fe=["January","February","March","April","May","June","July","August","September","October","November","December"];function Bt(F,j,_e){for(var be=typeof F=="number"?F.toString():F||"";be.length<j;)be=_e[0]+be;return be}function Be(F,j){return Bt(F,j,"0")}function It(F,j){function _e(rr){return rr<0?-1:rr>0?1:0}var be;return(be=_e(F.getFullYear()-j.getFullYear()))===0&&(be=_e(F.getMonth()-j.getMonth()))===0&&(be=_e(F.getDate()-j.getDate())),be}function Ce(F){switch(F.getDay()){case 0:return new Date(F.getFullYear()-1,11,29);case 1:return F;case 2:return new Date(F.getFullYear(),0,3);case 3:return new Date(F.getFullYear(),0,2);case 4:return new Date(F.getFullYear(),0,1);case 5:return new Date(F.getFullYear()-1,11,31);case 6:return new Date(F.getFullYear()-1,11,30)}}function Wt(F){var j=Io(new Date(F.tm_year+1900,0,1),F.tm_yday),_e=new Date(j.getFullYear(),0,4),be=new Date(j.getFullYear()+1,0,4),rr=Ce(_e),Hr=Ce(be);return It(rr,j)<=0?It(Hr,j)<=0?j.getFullYear()+1:j.getFullYear():j.getFullYear()-1}var tr={"%a":function(F){return ye[F.tm_wday].substring(0,3)},"%A":function(F){return ye[F.tm_wday]},"%b":function(F){return fe[F.tm_mon].substring(0,3)},"%B":function(F){return fe[F.tm_mon]},"%C":function(F){var j=F.tm_year+1900;return Be(j/100|0,2)},"%d":function(F){return Be(F.tm_mday,2)},"%e":function(F){return Bt(F.tm_mday,2," ")},"%g":function(F){return Wt(F).toString().substring(2)},"%G":function(F){return Wt(F)},"%H":function(F){return Be(F.tm_hour,2)},"%I":function(F){var j=F.tm_hour;return j==0?j=12:j>12&&(j-=12),Be(j,2)},"%j":function(F){return Be(F.tm_mday+qc(vo(F.tm_year+1900)?wo:Bo,F.tm_mon-1),3)},"%m":function(F){return Be(F.tm_mon+1,2)},"%M":function(F){return Be(F.tm_min,2)},"%n":function(){return`
|
|
20
|
-
`},"%p":function(F){return F.tm_hour>=0&&F.tm_hour<12?"AM":"PM"},"%S":function(F){return Be(F.tm_sec,2)},"%t":function(){return" "},"%u":function(F){return F.tm_wday||7},"%U":function(F){var j=new Date(F.tm_year+1900,0,1),_e=j.getDay()===0?j:Io(j,7-j.getDay()),be=new Date(F.tm_year+1900,F.tm_mon,F.tm_mday);if(It(_e,be)<0){var rr=qc(vo(be.getFullYear())?wo:Bo,be.getMonth()-1)-31,Hr=31-_e.getDate(),Rn=Hr+rr+be.getDate();return Be(Math.ceil(Rn/7),2)}return It(_e,j)===0?"01":"00"},"%V":function(F){var j=new Date(F.tm_year+1900,0,4),_e=new Date(F.tm_year+1901,0,4),be=Ce(j),rr=Ce(_e),Hr=Io(new Date(F.tm_year+1900,0,1),F.tm_yday);if(It(Hr,be)<0)return"53";if(It(rr,Hr)<=0)return"01";var Rn;return be.getFullYear()<F.tm_year+1900?Rn=F.tm_yday+32-be.getDate():Rn=F.tm_yday+1-be.getDate(),Be(Math.ceil(Rn/7),2)},"%w":function(F){return F.tm_wday},"%W":function(F){var j=new Date(F.tm_year,0,1),_e=j.getDay()===1?j:Io(j,j.getDay()===0?1:7-j.getDay()+1),be=new Date(F.tm_year+1900,F.tm_mon,F.tm_mday);if(It(_e,be)<0){var rr=qc(vo(be.getFullYear())?wo:Bo,be.getMonth()-1)-31,Hr=31-_e.getDate(),Rn=Hr+rr+be.getDate();return Be(Math.ceil(Rn/7),2)}return It(_e,j)===0?"01":"00"},"%y":function(F){return(F.tm_year+1900).toString().substring(2)},"%Y":function(F){return F.tm_year+1900},"%z":function(F){var j=F.tm_gmtoff,_e=j>=0;return j=Math.abs(j)/60,j=j/60*100+j%60,(_e?"+":"-")+String("0000"+j).slice(-4)},"%Z":function(F){return F.tm_zone},"%%":function(){return"%"}};for(var k in tr)B.includes(k)&&(B=B.replace(new RegExp(k,"g"),tr[k](v)));var ms=dv(B,!1);return ms.length>l?0:(Nf(ms,c),ms.length-1)}function uv(c,l,d,p){return cv(c,l,d,p)}L||C.initMainThread();var zh,lv=[null,nh,oh,ah,fh,hh,ph,yh,_h,mh,bh,gh,vh,wh,Bh,Ih,Th,Sh,Ah,Fh,Dh,Oh,Mh,Eh,Rh,xh,Vh,Ph,Lh,Nh,kh,Ch,jh,qh,Hh];function dv(c,l,d){var p=d>0?d:Lf(c)+1,m=new Array(p),v=Pf(c,m,0,m.length);return l&&(m.length=v),m}var fv={b:a0,ua:l0,ra:d0,ka:f0,r:h0,_:p0,W:oh,P:ah,Y:fh,X:hh,c:ph,fa:yh,da:_h,aa:mh,ba:bh,R:gh,V:vh,ha:wh,ca:Bh,ga:Ih,s:Th,T:Sh,N:Ah,p:Fh,U:Dh,l:Oh,ea:Mh,q:Eh,n:_0,Z:m0,oa:b0,A:g0,w:v0,e:w0,o:ih,G:B0,H:I0,E:T0,F:S0,k:A0,C:F0,J:D0,D:O0,L:M0,g:E0,I:U0,h:R0,B:x0,j:V0,M:P0,u:L0,ia:N0,f:fs,pa:k0,ja:C0,sa:j0,qa:H0,ta:K0,K:X0,v:iv,ma:xh,na:Vh,S:th,d:Ph,y:Lh,x:Nh,t:kh,z:Ch,O:jh,i:qh,m:Hh,$:go,Q:av,a:De||a.wasmMemory,la:uv},hD=e0(),hv=a.___wasm_call_ctors=function(){return(hv=a.___wasm_call_ctors=a.asm.va).apply(null,arguments)},pv=a._main=function(){return(pv=a._main=a.asm.wa).apply(null,arguments)},yv=a._duckdb_web_fs_glob_add_path=function(){return(yv=a._duckdb_web_fs_glob_add_path=a.asm.ya).apply(null,arguments)},_v=a._duckdb_web_clear_response=function(){return(_v=a._duckdb_web_clear_response=a.asm.za).apply(null,arguments)},mv=a._duckdb_web_fail_with=function(){return(mv=a._duckdb_web_fail_with=a.asm.Aa).apply(null,arguments)},bv=a._duckdb_web_reset=function(){return(bv=a._duckdb_web_reset=a.asm.Ba).apply(null,arguments)},gv=a._duckdb_web_connect=function(){return(gv=a._duckdb_web_connect=a.asm.Ca).apply(null,arguments)},vv=a._duckdb_web_disconnect=function(){return(vv=a._duckdb_web_disconnect=a.asm.Da).apply(null,arguments)},wv=a._duckdb_web_flush_files=function(){return(wv=a._duckdb_web_flush_files=a.asm.Ea).apply(null,arguments)},Bv=a._duckdb_web_flush_file=function(){return(Bv=a._duckdb_web_flush_file=a.asm.Fa).apply(null,arguments)},Iv=a._duckdb_web_open=function(){return(Iv=a._duckdb_web_open=a.asm.Ga).apply(null,arguments)},Tv=a._duckdb_web_get_global_file_info=function(){return(Tv=a._duckdb_web_get_global_file_info=a.asm.Ha).apply(null,arguments)},Sv=a._duckdb_web_collect_file_stats=function(){return(Sv=a._duckdb_web_collect_file_stats=a.asm.Ia).apply(null,arguments)},Av=a._duckdb_web_export_file_stats=function(){return(Av=a._duckdb_web_export_file_stats=a.asm.Ja).apply(null,arguments)},Fv=a._duckdb_web_fs_drop_file=function(){return(Fv=a._duckdb_web_fs_drop_file=a.asm.Ka).apply(null,arguments)},Dv=a._duckdb_web_fs_drop_files=function(){return(Dv=a._duckdb_web_fs_drop_files=a.asm.La).apply(null,arguments)},Ov=a._duckdb_web_fs_glob_file_infos=function(){return(Ov=a._duckdb_web_fs_glob_file_infos=a.asm.Ma).apply(null,arguments)},Mv=a._duckdb_web_fs_get_file_info_by_id=function(){return(Mv=a._duckdb_web_fs_get_file_info_by_id=a.asm.Na).apply(null,arguments)},Ev=a._duckdb_web_fs_get_file_info_by_name=function(){return(Ev=a._duckdb_web_fs_get_file_info_by_name=a.asm.Oa).apply(null,arguments)},Uv=a._duckdb_web_fs_set_file_descriptor=function(){return(Uv=a._duckdb_web_fs_set_file_descriptor=a.asm.Pa).apply(null,arguments)},Rv=a._duckdb_web_fs_register_file_url=function(){return(Rv=a._duckdb_web_fs_register_file_url=a.asm.Qa).apply(null,arguments)},xv=a._duckdb_web_fs_register_file_buffer=function(){return(xv=a._duckdb_web_fs_register_file_buffer=a.asm.Ra).apply(null,arguments)},Vv=a._duckdb_web_copy_file_to_buffer=function(){return(Vv=a._duckdb_web_copy_file_to_buffer=a.asm.Sa).apply(null,arguments)},Pv=a._duckdb_web_copy_file_to_path=function(){return(Pv=a._duckdb_web_copy_file_to_path=a.asm.Ta).apply(null,arguments)},Lv=a._duckdb_web_get_version=function(){return(Lv=a._duckdb_web_get_version=a.asm.Ua).apply(null,arguments)},Nv=a._duckdb_web_get_feature_flags=function(){return(Nv=a._duckdb_web_get_feature_flags=a.asm.Va).apply(null,arguments)},kv=a._duckdb_web_tokenize=function(){return(kv=a._duckdb_web_tokenize=a.asm.Wa).apply(null,arguments)},Cv=a._duckdb_web_udf_scalar_create=function(){return(Cv=a._duckdb_web_udf_scalar_create=a.asm.Xa).apply(null,arguments)},jv=a._duckdb_web_prepared_create=function(){return(jv=a._duckdb_web_prepared_create=a.asm.Ya).apply(null,arguments)},qv=a._duckdb_web_prepared_close=function(){return(qv=a._duckdb_web_prepared_close=a.asm.Za).apply(null,arguments)},Hv=a._duckdb_web_prepared_run=function(){return(Hv=a._duckdb_web_prepared_run=a.asm._a).apply(null,arguments)},zv=a._duckdb_web_prepared_send=function(){return(zv=a._duckdb_web_prepared_send=a.asm.$a).apply(null,arguments)},Wv=a._duckdb_web_query_run=function(){return(Wv=a._duckdb_web_query_run=a.asm.ab).apply(null,arguments)},Yv=a._duckdb_web_query_send=function(){return(Yv=a._duckdb_web_query_send=a.asm.bb).apply(null,arguments)},Gv=a._duckdb_web_query_fetch_results=function(){return(Gv=a._duckdb_web_query_fetch_results=a.asm.cb).apply(null,arguments)},$v=a._duckdb_web_get_tablenames=function(){return($v=a._duckdb_web_get_tablenames=a.asm.db).apply(null,arguments)},Jv=a._duckdb_web_insert_arrow_from_ipc_stream=function(){return(Jv=a._duckdb_web_insert_arrow_from_ipc_stream=a.asm.eb).apply(null,arguments)},Kv=a._duckdb_web_insert_csv_from_path=function(){return(Kv=a._duckdb_web_insert_csv_from_path=a.asm.fb).apply(null,arguments)},Xv=a._duckdb_web_insert_json_from_path=function(){return(Xv=a._duckdb_web_insert_json_from_path=a.asm.gb).apply(null,arguments)},Zv=a._emscripten_tls_init=function(){return(Zv=a._emscripten_tls_init=a.asm.hb).apply(null,arguments)},Wh=a.___errno_location=function(){return(Wh=a.___errno_location=a.asm.ib).apply(null,arguments)},Yh=a.__emscripten_thread_init=function(){return(Yh=a.__emscripten_thread_init=a.asm.jb).apply(null,arguments)},To=a._htonl=function(){return(To=a._htonl=a.asm.kb).apply(null,arguments)},So=a._htons=function(){return(So=a._htons=a.asm.lb).apply(null,arguments)},Qv=a._emscripten_current_thread_process_queued_calls=function(){return(Qv=a._emscripten_current_thread_process_queued_calls=a.asm.mb).apply(null,arguments)},Gh=a._emscripten_sync_run_in_main_thread_4=function(){return(Gh=a._emscripten_sync_run_in_main_thread_4=a.asm.nb).apply(null,arguments)},Hc=a._emscripten_main_thread_process_queued_calls=function(){return(Hc=a._emscripten_main_thread_process_queued_calls=a.asm.ob).apply(null,arguments)},$h=a._emscripten_run_in_main_runtime_thread_js=function(){return($h=a._emscripten_run_in_main_runtime_thread_js=a.asm.pb).apply(null,arguments)},zc=a._emscripten_dispatch_to_thread_=function(){return(zc=a._emscripten_dispatch_to_thread_=a.asm.qb).apply(null,arguments)},Wc=a._ntohs=function(){return(Wc=a._ntohs=a.asm.rb).apply(null,arguments)},Yc=a.__emscripten_thread_free_data=function(){return(Yc=a.__emscripten_thread_free_data=a.asm.sb).apply(null,arguments)},ew=a.__emscripten_thread_exit=function(){return(ew=a.__emscripten_thread_exit=a.asm.tb).apply(null,arguments)},Ao=a._pthread_self=function(){return(Ao=a._pthread_self=a.asm.ub).apply(null,arguments)},Jh=a._emscripten_stack_set_limits=function(){return(Jh=a._emscripten_stack_set_limits=a.asm.vb).apply(null,arguments)},Gc=a.stackSave=function(){return(Gc=a.stackSave=a.asm.wb).apply(null,arguments)},Fo=a.stackRestore=function(){return(Fo=a.stackRestore=a.asm.xb).apply(null,arguments)},ii=a.stackAlloc=function(){return(ii=a.stackAlloc=a.asm.yb).apply(null,arguments)},ys=a._malloc=function(){return(ys=a._malloc=a.asm.zb).apply(null,arguments)},Kh=a._free=function(){return(Kh=a._free=a.asm.Ab).apply(null,arguments)},Do=a.__emscripten_main_thread_futex=1096768,Xh=a.__emscripten_allow_main_runtime_queued_calls=987312;a.ccall=Rg,a.keepRuntimeAlive=po,a.PThread=C,a.PThread=C,a.wasmMemory=De,a.ExitStatus=_s;var Oo;function _s(c){this.name="ExitStatus",this.message="Program terminated with exit("+c+")",this.status=c}var tw=!1;ds=function c(){Oo||$c(),Oo||(ds=c)};function rw(c){var l=a._main,d=0,p=0;try{var m=l(d,p);return Zh(m,!0),m}catch(v){return rh(v)}finally{tw=!0}}function $c(c){if(c=c||E,Un>0)return;if(L){_(a),Kf(),postMessage({cmd:"loaded"});return}if(Hg(),Un>0)return;function l(){Oo||(Oo=!0,a.calledRun=!0,!Uc&&(Kf(),zg(),_(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),Qh&&rw(c),Yg()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),l()},1)):l()}a.run=$c;function Zh(c,l){if(ls=c,!l&&L)throw nh(c),"unwind";po()||Wg(),nw(c)}function nw(c){ls=c,po()||(C.terminateAllThreads(),a.onExit&&a.onExit(c),Uc=!0),re(c,new _s(c))}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();var Qh=!0;return a.noInitialRun&&(Qh=!1),L&&(Mf=!1,C.initWorker()),$c(),e.ready}})(),Ig=ZF;var gf=class{constructor(e,t){this._bindings=e,this._conn=t}close(){this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}query(e){let t=this._bindings.runQuery(this._conn,e),n=y.RecordBatchReader.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),y.Table.from(n)}send(e){let t=this._bindings.sendQuery(this._conn,e),n=new vf(this._bindings,this._conn,t),i=y.RecordBatchReader.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}getTableNames(e){return this._bindings.getTableNames(this._conn,e)}prepare(e){let t=this._bindings.createPrepared(this._conn,e);return new Tg(this._bindings,this._conn,t)}createScalarFunction(e,t,n){this._bindings.createScalarFunction(this._conn,e,t,n)}insertArrowTable(e,t){let n=e.serialize("binary",!0);this.insertArrowFromIPCStream(n,t)}insertArrowFromIPCStream(e,t){this._bindings.insertArrowFromIPCStream(this._conn,e,t)}insertCSVFromPath(e,t){this._bindings.insertCSVFromPath(this._conn,e,t)}insertJSONFromPath(e,t){this._bindings.insertJSONFromPath(this._conn,e,t)}},vf=class{constructor(e,t,n){this.bindings=e;this.conn=t;this.header=n;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e=this.bindings.fetchQueryResults(this.conn);return this._depleted=e.length==0,{done:this._depleted,value:e}}[Symbol.iterator](){return this}},Tg=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...e){let t=this.bindings.runPrepared(this.connectionId,this.statementId,e),n=y.RecordBatchReader.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),y.Table.from(n)}send(...e){let t=this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new vf(this.bindings,this.connectionId,t),i=y.RecordBatchReader.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var QF=new TextEncoder;function wf(r,e,t){let n=QF.encode(t),i=r._malloc(n.byteLength),s=r.HEAPU8.subarray(i,i+n.byteLength);s.set(n),r.HEAPF64[(e>>3)+0]=1,r.HEAPF64[(e>>3)+1]=i,r.HEAPF64[(e>>3)+2]=s.byteLength}function Sg(r,e,t,n,i,s){try{let o=r._udfFunctions.get(n);if(!o){wf(e,t,"unknown udf with id: "+n);return}let u=e.HEAPU8.subarray(i,i+s),a=y.RecordBatchFileReader.from(u);a.open();let h=a.next();if(h.done)return;let _=h.value,T;switch(o.returnType.typeId){case y.Type.Int:case y.Type.Int32:T=new y.Int32Builder({type:new y.Int32});break;default:wf(e,t,"unsupported result type: "+o.returnType.toString());return}let M=[],E=[];for(let ke=0;ke<_.numCols;++ke)M.push(_.getChildAt(ke)),E.push(null);for(let ke=0;ke<_.length;++ke){for(let jr=0;jr<_.numCols;++jr)E[jr]=M[jr].get(ke)||null;let co=o.func(...E);T.append(co)}let q=new y.Schema([new y.Field("0",new y.Int32,!0)]),re=new y.RecordBatch(q,T.length,[T.toVector()]),le=new y.RecordBatchStreamWriter;le.write(re),le.finish();let de=le.toUint8Array(!0),Me=e._malloc(de.byteLength),L=e.HEAPU8.subarray(Me,Me+de.byteLength);L.set(de),e.HEAPF64[(t>>3)+0]=0,e.HEAPF64[(t>>3)+1]=Me,e.HEAPF64[(t>>3)+2]=L.byteLength}catch(o){wf(e,t,o.toString())}}function tD(){let r=new TextDecoder;return e=>(typeof SharedArrayBuffer!="undefined"&&e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),r.decode(e))}var rD=tD();function Sr(r,e){r.ccall("duckdb_web_fail_with",null,["string"],[e])}function os(r,e,t){let n=r.HEAPU8.subarray(e,e+t),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function ie(r,e,t){return rD(r.HEAPU8.subarray(e,e+t))}function me(r,e,t,n){let i=r.stackSave(),s=r.stackAlloc(3*8);t.unshift("number"),n.unshift(s),r.ccall(e,null,t,n);let o=r.HEAPF64[(s>>3)+0],u=r.HEAPF64[(s>>3)+1],a=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,u,a]}function Se(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Bf=class{constructor(e){let t=new Float64Array(e.buffer,e.byteOffset,e.byteLength/8),n=new Uint8Array(new ArrayBuffer(e.byteLength));n.set(e.subarray(7*8)),this.totalFileReadsCold=t[0],this.totalFileReadsAhead=t[1],this.totalFileReadsCached=t[2],this.totalFileWrites=t[3],this.totalPageAccesses=t[4],this.totalPageLoads=t[5],this.blockSize=t[6],this.blockStats=n}getBlockStats(e,t){return t=t||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},t.file_writes=this.blockStats[e*3+0]&15,t.file_reads_cold=this.blockStats[e*3+0]>>4,t.file_reads_ahead=this.blockStats[e*3+1]&15,t.file_reads_cached=this.blockStats[e*3+1]>>4,t.page_accesses=this.blockStats[e*3+1]&15,t.page_loads=this.blockStats[e*3+1]>>4,t}};var nD=new TextEncoder;var If=class{constructor(e,t){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=e,this._runtime=t,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(e=t=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(e),await this._initPromise),this._initPromise=new Promise(t=>{this._initPromiseResolver=t}),this.onInstantiationProgress=[e],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(t=>t!=e),this)}open(e){let[t,n,i]=me(this.mod,"duckdb_web_open",["string"],[JSON.stringify(e)]);if(t!==0)throw new Error(ie(this.mod,n,i));Se(this.mod)}reset(){let[e,t,n]=me(this.mod,"duckdb_web_reset",[],[]);if(e!==0)throw new Error(ie(this.mod,t,n));Se(this.mod)}getVersion(){let[e,t,n]=me(this.mod,"duckdb_web_get_version",[],[]);if(e!==0)throw new Error(ie(this.mod,t,n));let i=ie(this.mod,t,n);return Se(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(e){let[t,n,i]=me(this.mod,"duckdb_web_tokenize",["string"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));let s=ie(this.mod,n,i);return Se(this.mod),JSON.parse(s)}connect(){let e=this.mod.ccall("duckdb_web_connect","number",[],[]);return new gf(this,e)}disconnect(e){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[e]),this.pthread)for(let t of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])t.postMessage({cmd:"dropUDFFunctions",connectionId:e})}runQuery(e,t){let[n,i,s]=me(this.mod,"duckdb_web_query_run",["number","string"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));let o=os(this.mod,i,s);return Se(this.mod),o}sendQuery(e,t){let[n,i,s]=me(this.mod,"duckdb_web_query_send",["number","string"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));let o=os(this.mod,i,s);return Se(this.mod),o}fetchQueryResults(e){let[t,n,i]=me(this.mod,"duckdb_web_query_fetch_results",["number"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));let s=os(this.mod,n,i);return Se(this.mod),s}getTableNames(e,t){let[n,i,s]=me(this.mod,"duckdb_web_get_tablenames",["number","string"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));let o=ie(this.mod,i,s);return Se(this.mod),JSON.parse(o)}createScalarFunction(e,t,n,i){let s={functionId:this._nextUDFId,name:t,returnType:yf(n)},o={functionId:s.functionId,connectionId:e,name:t,returnType:n,func:i};this._nextUDFId+=1;let[u,a,h]=me(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[e,JSON.stringify(s)]);if(u!==0)throw new Error(ie(this.mod,a,h));if(Se(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let _ of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])_.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(e,t){let[n,i,s]=me(this.mod,"duckdb_web_prepared_create",["number","string"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));return Se(this.mod),i}closePrepared(e,t){let[n,i,s]=me(this.mod,"duckdb_web_prepared_close",["number","number"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));Se(this.mod)}runPrepared(e,t,n){let[i,s,o]=me(this.mod,"duckdb_web_prepared_run",["number","number","string"],[e,t,JSON.stringify(n)]);if(i!==0)throw new Error(ie(this.mod,s,o));let u=os(this.mod,s,o);return Se(this.mod),u}sendPrepared(e,t,n){let[i,s,o]=me(this.mod,"duckdb_web_prepared_send",["number","number","string"],[e,t,JSON.stringify(n)]);if(i!==0)throw new Error(ie(this.mod,s,o));let u=os(this.mod,s,o);return Se(this.mod),u}insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let i=this.mod._malloc(t.length);this.mod.HEAPU8.subarray(i,i+t.length).set(t);let o=n?JSON.stringify(n):"",[u,a,h]=me(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[e,i,t.length,o]);if(u!==0)throw new Error(ie(this.mod,a,h))}insertCSVFromPath(e,t,n){if(n.columns!==void 0){n.columnsFlat=[];for(let h in n.columns)n.columnsFlat.push(ao(h,n.columns[h]))}let i=zr({},n);i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,u,a]=me(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[e,t,s]);if(o!==0)throw new Error(ie(this.mod,u,a))}insertJSONFromPath(e,t,n){if(n.columns!==void 0){n.columnsFlat=[];for(let h in n.columns)n.columnsFlat.push(ao(h,n.columns[h]))}let i=zr({},n);i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,u,a]=me(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[e,t,s]);if(o!==0)throw new Error(ie(this.mod,u,a))}globFiles(e){let[t,n,i]=me(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));let s=ie(this.mod,n,i);Se(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(e,t){t===void 0&&(t=e);let[n,i,s]=me(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[e,t,-1]);if(n!==0)throw new Error(ie(this.mod,i,s));Se(this.mod)}registerFileText(e,t){let n=nD.encode(t);this.registerFileBuffer(e,n)}registerFileBuffer(e,t){let n=this.mod._malloc(t.length);this.mod.HEAPU8.subarray(n,n+t.length).set(t);let[s,o,u]=me(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[e,n,t.length]);if(s!==0)throw new Error(ie(this.mod,o,u));Se(this.mod)}registerFileHandle(e,t){let[n,i,s]=me(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[e,e,-1]);if(n!==0)throw new Error(ie(this.mod,i,s));if(Se(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(e,t),this.pthread){for(let o of this.pthread.runningWorkers)o.postMessage({cmd:"registerFileHandle",fileName:e,fileHandle:t});for(let o of this.pthread.unusedWorkers)o.postMessage({cmd:"dropFileHandle",fileName:e})}}dropFile(e){let[t,n,i]=me(this.mod,"duckdb_web_fs_drop_file",["string"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));Se(this.mod)}dropFiles(){let[e,t,n]=me(this.mod,"duckdb_web_fs_drop_files",[],[]);if(e!==0)throw new Error(ie(this.mod,t,n));Se(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(e,t){let[n,i,s]=me(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s));Se(this.mod)}copyFileToBuffer(e){let[t,n,i]=me(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),Se(this.mod),o}collectFileStatistics(e,t){let[n,i,s]=me(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[e,t]);if(n!==0)throw new Error(ie(this.mod,i,s))}exportFileStatistics(e){let[t,n,i]=me(this.mod,"duckdb_web_export_file_stats",["string"],[e]);if(t!==0)throw new Error(ie(this.mod,n,i));return new Bf(this.mod.HEAPU8.subarray(n,n+i))}};var Tf=class extends If{constructor(e,t,n,i){super(e,t);this.mainModuleURL=n,this.pthreadWorkerURL=i}locateFile(e,t){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error(`WASM instantiation requested unexpected file: prefix=${t} path=${e}`)}instantiateWasm(e,t){globalThis.DUCKDB_RUNTIME=this._runtime;let n=this.onInstantiationProgress,i={lastEvent:new Date};if(typeof TransformStream=="function"&&ReadableStream.prototype.pipeThrough){let o=(async()=>{var E;let u=new Request(this.mainModuleURL),a=await fetch(u),h=a.headers.get("Content-Length"),_;h?_=parseInt(h,10)||0:_=await new Promise((q,re)=>{let le=new XMLHttpRequest;le.open("HEAD",this.mainModuleURL,!0),le.onreadystatechange=()=>{if(le.readyState==le.DONE){let de=le.getResponseHeader("Content-Length");return q(de?parseInt(de):null)}},le.onerror=de=>q(null),le.send()});let T={startedAt:new Date,bytesTotal:_||0,bytesLoaded:0},M=new TransformStream({transform(q,re){T.bytesLoaded+=q.byteLength;let le=new Date;if(le.getTime()-i.lastEvent.getTime()<100){i.lastEvent=le,re.enqueue(q);return}for(let de of n)de(T);re.enqueue(q)}});return new Response((E=a.body)==null?void 0:E.pipeThrough(M),a)})();WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(o,e).then(u=>{t(u.instance,u.module)}):o.then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,e).then(a=>{t(a.instance,a.module)}).catch(a=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+a}),new Error(a)})).catch(u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+u}),new Error(u)})}else{let s=new XMLHttpRequest,o=this.mainModuleURL,u={startedAt:new Date,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=a=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+a}),new Error(a.toString())},s.onprogress=a=>{u.bytesTotal=a.total,u.bytesLoaded=a.loaded;for(let h of n)h(u)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(a=>{t(a.instance,a.module)}).catch(a=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+a}),new Error(a)})},s.send()}return[]}};var Sf=class extends Tf{constructor(e,t,n,i=null){super(e,t,n,i)}instantiateImpl(e){return Ig(gs(zr({},e),{instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)}))}};var On=nr(Ag()),iD=function(r,e,t){var i,s,o,u;let n=Fg(e);return{url:n.path,query:"",host:`${n.bucket}.s3.amazonaws.com`,region:(i=r==null?void 0:r.region)!=null?i:"",service:"s3",method:t,accessKeyId:(s=r==null?void 0:r.accessKeyId)!=null?s:"",secretAccessKey:(o=r==null?void 0:r.secretAccessKey)!=null?o:"",sessionToken:(u=r==null?void 0:r.sessionToken)!=null?u:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}};function sD(r,e=!1){let t="0123456789ABCDEF",n="";for(let i=0;i<r.length;i++){let s=r[i];s>="A"&&s<="Z"||s>="a"&&s<="z"||s>="0"&&s<="9"||s=="_"||s=="-"||s=="~"||s=="."?n+=s:s=="/"?e?n+="%2F":n+=s:(n+="%",n+=t[s.charCodeAt(0)>>4],n+=t[s.charCodeAt(0)&15])}return n}function oD(r,e=null){var q;let t=(q=e==null?void 0:e.contentHash)!=null?q:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",n=new Map;n.set("x-amz-date",r.datetimeNow),n.set("x-amz-content-sha256",t),r.sessionToken&&n.set("x-amz-security-token",r.sessionToken);let i="";(e==null?void 0:e.contentType)&&(i+="content-type;"),i+="host;x-amz-content-sha256;x-amz-date",r.sessionToken&&(i+=";x-amz-security-token");let s=r.method+`
|
|
21
|
-
`+sD(r.url)+`
|
|
22
|
-
`+r.query;(e==null?void 0:e.contentType)&&(s+=`
|
|
23
|
-
content-type:`+(e==null?void 0:e.contentType)),s+=`
|
|
5
|
+
}`),r.length!==e.length&&(t=`if (x !== x) return false;
|
|
6
|
+
${t}`),new Function("x",`${t}
|
|
7
|
+
return true;`)}function w_(r){return typeof r!="bigint"?je(r):Ss?`${je(r)}n`:`"${je(r)}"`}var $a=(r,t)=>(r*t+63&-64||64)/t,v_=(r,t=0)=>r.length>=t?r.subarray(0,t):Mn(new r.constructor(t),r,0),Xr=class{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.trunc(t.length/e))}get byteLength(){return Math.trunc(this.length*this.stride*this.BYTES_PER_ELEMENT)}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?$a(n*1,this.BYTES_PER_ELEMENT):$a(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=$a(t*this.stride,this.BYTES_PER_ELEMENT);let e=v_(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Mn(new this.ArrayType(t),this.buffer)}};Xr.prototype.offset=0;var Mr=class extends Xr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},zn=class extends Mr{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},jn=class extends Mr{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var gt=class{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=xe(t),this._nulls=new zn,e&&e.length>0&&(this._isValid=Id(e))}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}toVector(){return new C([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((c,a)=>c+a.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:s,length:o,nullCount:c,_typeIds:a,_offsets:f,_values:m,_nulls:y}=this;(e=a==null?void 0:a.flush(o))?i=f==null?void 0:f.flush(o):(i=f==null?void 0:f.flush(o))?t=m==null?void 0:m.flush(f.last()):t=m==null?void 0:m.flush(o),c>0&&(n=y==null?void 0:y.flush(o));let b=this.children.map(I=>I.flush());return this.clear(),P({type:s,length:o,nullCount:c,children:b,child:b[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};gt.prototype.length=1;gt.prototype.stride=1;gt.prototype.children=null;gt.prototype.finished=!1;gt.prototype.nullValues=null;gt.prototype._isValid=()=>!0;var Ht=class extends gt{constructor(t){super(t),this._values=new Mr(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},cr=class extends gt{constructor(t){super(t),this._pendingLength=0,this._offsets=new jn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof or?e[Ue].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var bn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(i),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}};var lr=new Int32Array(2),co=new Float32Array(lr.buffer),lo=new Float64Array(lr.buffer),Wn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Rt=class{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Rt.ZERO:new Rt(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};Rt.ZERO=new Rt(0,0);var xi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(xi||(xi={}));var ce=class{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new ce(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new Rt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new Rt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return lr[0]=this.readInt32(t),co[0]}readFloat64(t){return lr[Wn?0:1]=this.readInt32(t),lr[Wn?1:0]=this.readInt32(t+4),lo[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){co[0]=e,this.writeInt32(t,lr[0])}writeFloat64(t,e){lo[0]=e,this.writeInt32(t,lr[Wn?0:1]),this.writeInt32(t+4,lr[Wn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t),i="",s=0;if(t+=4,e===xi.UTF8_BYTES)return this.bytes_.subarray(t,t+n);for(;s<n;){let o,c=this.readUint8(t+s++);if(c<192)o=c;else{let a=this.readUint8(t+s++);if(c<224)o=(c&31)<<6|a&63;else{let f=this.readUint8(t+s++);if(c<240)o=(c&15)<<12|(a&63)<<6|f&63;else{let m=this.readUint8(t+s++);o=(c&7)<<18|(a&63)<<12|(f&63)<<6|m&63}}}o<65536?i+=String.fromCharCode(o):(o-=65536,i+=String.fromCharCode((o>>10)+55296,(o&(1<<10)-1)+56320))}return i}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createLong(t,e){return Rt.create(t,e)}createScalarList(t,e){let n=[];for(let i=0;i<e;++i)t(i)!==null&&n.push(t(i));return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var Rr=class{constructor(t){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;let e;t?e=t:e=1024,this.bb=ce.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=Rr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||!e.equals(n))&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=ce.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,c=this.space;t:for(e=0;e<this.vtables.length;e++){let a=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(a)){for(let f=2;f<s;f+=2)if(this.bb.readInt16(c+f)!=this.bb.readInt16(a+f))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(this.bb.readInt16(i+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let n=0;for(;n<t.length;){let i,s=t.charCodeAt(n++);if(s<55296||s>=56320)i=s;else{let o=t.charCodeAt(n++);i=(s<<10)+o+(65536-(55296<<10)-56320)}i<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(i&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createLong(t,e){return Rt.create(t,e)}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return mt.startKeyValue(t),mt.addKey(t,e),mt.addValue(t,n),mt.endKeyValue(t)}};var Gr;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Gr||(Gr={}));var Kr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Kr||(Kr={}));var Fi;(function(r){r[r.DenseArray=0]="DenseArray"})(Fi||(Fi={}));var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return zt.startInt(t),zt.addBitWidth(t,e),zt.addIsSigned(t,n),zt.endInt(t)}};var Te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new Te).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new zt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Fi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Fi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ur=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ur.startBinary(t),ur.endBinary(t)}};var dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return dr.startBool(t),dr.endBool(t)}};var Ti;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Ti||(Ti={}));var de=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new de).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ti.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Ti.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return de.startDate(t),de.addUnit(t,e),de.endDate(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return jt.startDecimal(t),jt.addPrecision(t,e),jt.addScale(t,n),jt.addBitWidth(t,i),jt.endDecimal(t)}};var Jr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Jr||(Jr={}));var fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new fe).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return fe.startFixedSizeBinary(t),fe.addByteWidth(t,e),fe.endFixedSizeBinary(t)}};var he=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new he).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return he.startFixedSizeList(t),he.addListSize(t,e),he.endFixedSizeList(t)}};var Bi;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Bi||(Bi={}));var pe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new pe).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Bi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Bi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return pe.startFloatingPoint(t),pe.addPrecision(t,e),pe.endFloatingPoint(t)}};var Di;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Di||(Di={}));var me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new me).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Di.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Di.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return me.startInterval(t),me.addUnit(t,e),me.endInterval(t)}};var fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return fr.startList(t),fr.endList(t)}};var _e=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new _e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return _e.startMap(t),_e.addKeysSorted(t,e),_e.endMap(t)}};var hr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return hr.startNull(t),hr.endNull(t)}};var pr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return pr.startStruct_(t),pr.endStruct_(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jr.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Jr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return ee.startTime(t),ee.addUnit(t,e),ee.addBitWidth(t,n),ee.endTime(t)}};var re=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new re).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jr.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Jr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return re.startTimestamp(t),re.addUnit(t,e),re.addTimezone(t,n),re.endTimestamp(t)}};var Ei;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Ei||(Ei={}));var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ei.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Ei.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return Wt.startUnion(t),Wt.addMode(t,e),Wt.addTypeIds(t,n),Wt.endUnion(t)}};var mr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return mr.startUtf8(t),mr.endUtf8(t)}};var wt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList"})(wt||(wt={}));var Ut=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):wt.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new Te).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new mt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,wt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var Ft=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Kr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new mt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):this.bb.createLong(0,0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Kr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return Ft.startSchema(t),Ft.addEndianness(t,e),Ft.addFields(t,n),Ft.addCustomMetadata(t,i),Ft.addFeatures(t,s),Ft.endSchema(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new ne).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ft).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new mt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Gr.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var q=class{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ya(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new q(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new q(e,this.metadata)}assign(...t){let e=t[0]instanceof q?t[0]:Array.isArray(t[0])?new q(t[0]):new q(t),n=[...this.fields],i=fo(fo(new Map,this.metadata),e.metadata),s=e.fields.filter(c=>{let a=n.findIndex(f=>f.name===c.name);return~a?(n[a]=c.clone({metadata:fo(fo(new Map,n[a].metadata),c.metadata)}))&&!1:!0}),o=Ya(s,new Map);return new q([...n,...s],i,new Map([...this.dictionaries,...o]))}};q.prototype.fields=null;q.prototype.metadata=null;q.prototype.dictionaries=null;var z=class{constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new z(`${e}`,n,i,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],z.new(e,n,i,s)}};z.prototype.type=null;z.prototype.name=null;z.prototype.nullable=null;z.prototype.metadata=null;function fo(r,t){return new Map([...r||new Map,...t||new Map])}function Ya(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(T.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Ya(s.children,t)}return t}var Ad=Rt,S_=Rr,I_=ce,Ur=class{constructor(t,e=Vt.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(t){t=new I_(N(t));let e=ne.getRootAsFooter(t),n=q.decode(e.schema());return new Xa(n,e)}static encode(t){let e=new S_,n=q.encode(e,t.schema);ne.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ze.encode(e,o);let i=e.endVector();ne.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ze.encode(e,o);let s=e.endVector();return ne.startFooter(e),ne.addSchema(e,n),ne.addVersion(e,Vt.V4),ne.addRecordBatches(e,i),ne.addDictionaries(e,s),ne.finishFooterBuffer(e,ne.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Xa=class extends Ur{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ze.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ze.decode(e)}return null}},Ze=class{constructor(t,e,n){this.metaDataLength=t,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof e=="number"?e:e.low}static decode(t){return new Ze(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=new Ad(e.offset,0),s=new Ad(e.bodyLength,0);return bn.createBlock(t,i,n,s)}};var _t=Object.freeze({done:!0,value:void 0}),Oi=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},gn=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},ho=class extends gn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return A(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(_t);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Jt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Jt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return A(this,void 0,void 0,function*(){return yield this.abort(t),_t})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),_t})}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){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,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(_t)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var _r=class extends ho{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?mi(this.toUint8Array(!0)):this.toUint8Array(!1).then(mi)}toUint8Array(t=!1){return t?Ie(this._values)[0]:(()=>A(this,void 0,void 0,function*(){var e,n;let i=[],s=0;try{for(var o=Oe(this),c;c=yield o.next(),!c.done;){let a=c.value;i.push(a),s+=a.byteLength}}catch(a){e={error:a}}finally{try{c&&!c.done&&(n=o.return)&&(yield n.call(o))}finally{if(e)throw e.error}}return Ie(i,s)[0]}))()}},yr=class{constructor(t){t&&(this.source=new Ga(Jt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ye=class{constructor(t){t instanceof ye?this.source=t.source:t instanceof _r?this.source=new kr(Jt.fromAsyncIterable(t)):Bs(t)?this.source=new kr(Jt.fromNodeStream(t)):yi(t)?this.source=new kr(Jt.fromDOMStream(t)):Fs(t)?this.source=new kr(Jt.fromDOMStream(t.body)):He(t)?this.source=new kr(Jt.fromIterable(t)):Ve(t)?this.source=new kr(Jt.fromAsyncIterable(t)):Me(t)&&(this.source=new kr(Jt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Ga=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||_t)}return(t){return Object.create(this.source.return&&this.source.return(t)||_t)}},kr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return A(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return A(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return A(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||_t;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return A(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||_t;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Mi=class extends yr{constructor(t,e){super(),this.position=0,this.buffer=N(t),this.size=typeof e>"u"?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},qr=class extends ye{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>A(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return A(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return A(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return A(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,c=0,a=Math.min(n,s+Math.min(n-s,t)),f=new Uint8Array(Math.max(0,(this.position=a)-s));for(;(s+=c)<a&&(o+=c)<f.byteLength;)({bytesRead:c}=yield e.read(f,o,f.byteLength-o,s));return f}return null})}readAt(t,e){return A(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return A(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ja={};dn(Ja,{BaseInt64:()=>Ri,Int128:()=>be,Int64:()=>$t,Uint64:()=>it});function $n(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Yn=8,Ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ri=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${$n(this.buffer[1])} ${$n(this.buffer[0])}`}},it=class extends Ri{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return it.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return it.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new it(e);for(let s=0;s<n;){let o=Yn<n-s?Yn:n-s,c=new it(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),a=new it(new Uint32Array([Ka[o],0]));i.times(a),i.plus(c),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)it.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new it(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new it(new Uint32Array(t.buffer)).plus(e)}},$t=class extends Ri{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return $t.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return $t.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new $t(e);for(let o=n?1:0;o<i;){let c=Yn<i-o?Yn:i-o,a=new $t(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0])),f=new $t(new Uint32Array([Ka[c],0]));s.times(f),s.plus(a),o+=c}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)$t.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new $t(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new $t(new Uint32Array(t.buffer)).plus(e)}},be=class{constructor(t){this.buffer=t}high(){return new $t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new $t(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(t){let e=new it(new Uint32Array([this.buffer[3],0])),n=new it(new Uint32Array([this.buffer[2],0])),i=new it(new Uint32Array([this.buffer[1],0])),s=new it(new Uint32Array([this.buffer[0],0])),o=new it(new Uint32Array([t.buffer[3],0])),c=new it(new Uint32Array([t.buffer[2],0])),a=new it(new Uint32Array([t.buffer[1],0])),f=new it(new Uint32Array([t.buffer[0],0])),m=it.multiply(s,f);this.buffer[0]=m.low();let y=new it(new Uint32Array([m.high(),0]));return m=it.multiply(i,f),y.plus(m),m=it.multiply(s,a),y.plus(m),this.buffer[1]=y.low(),this.buffer[3]=y.lessThan(m)?1:0,this.buffer[2]=y.high(),new it(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(it.multiply(n,f)).plus(it.multiply(i,a)).plus(it.multiply(s,c)),this.buffer[3]+=it.multiply(e,f).plus(it.multiply(n,a)).plus(it.multiply(i,c)).plus(it.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${$n(this.buffer[3])} ${$n(this.buffer[2])} ${$n(this.buffer[1])} ${$n(this.buffer[0])}`}static multiply(t,e){return new be(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new be(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return be.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return be.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new be(e);for(let o=n?1:0;o<i;){let c=Yn<i-o?Yn:i-o,a=new be(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0,0,0])),f=new be(new Uint32Array([Ka[c],0,0,0]));s.times(f),s.plus(a),o+=c}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)be.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var Ui=class extends D{constructor(t,e,n,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i}visit(t){return super.visit(t instanceof z?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return P({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===xt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},po=class extends Ui{constructor(t,e,n,i){super(new Uint8Array(0),e,n,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):mn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return T.isTimestamp(t)?Y(Uint8Array,$t.convertArray(n[e])):(T.isInt(t)||T.isTime(t))&&t.bitWidth===64?Y(Uint8Array,$t.convertArray(n[e])):T.isDate(t)&&t.unit===qt.MILLISECOND?Y(Uint8Array,$t.convertArray(n[e])):T.isDecimal(t)?Y(Uint8Array,be.convertArray(n[e])):T.isBinary(t)||T.isFixedSizeBinary(t)?A_(n[e]):T.isBool(t)?mn(n[e]):T.isUtf8(t)?Hr(n[e].join("")):Y(Uint8Array,Y(t.ArrayType,n[e].map(i=>+i)))}};function A_(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var Xn=class extends cr{constructor(t){super(t),this._values=new Xr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,N(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,c]of t)if(c===void 0)n.set(o,0);else{let a=c.length;i.set(c,s),n.set(o,a),s+=a}}};var mo=class extends gt{constructor(t){super(t),this._values=new zn}setValue(t,e){this._values.set(t,+e)}};var wn=class extends Ht{};wn.prototype._setValue=Oa;var ki=class extends wn{};ki.prototype._setValue=zs;var Ni=class extends wn{};Ni.prototype._setValue=js;var Li=class extends Ht{};Li.prototype._setValue=Ua;var _o=class extends gt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Ae(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vn({type:this.type.indices,nullValues:e}),this.dictionary=vn({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var Ci=class extends Ht{};Ci.prototype._setValue=Ea;var yo=class extends gt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Ge(this.type.listSize,new z(e,t.type,!0)),n}};var Sn=class extends Ht{setValue(t,e){this._values.set(t,e)}},bo=class extends Sn{setValue(t,e){super.setValue(t,wi(e))}},go=class extends Sn{},wo=class extends Sn{};var In=class extends Ht{};In.prototype._setValue=ka;var Pi=class extends In{};Pi.prototype._setValue=Zs;var Vi=class extends In{};Vi.prototype._setValue=Qs;var Ne=class extends Ht{setValue(t,e){this._values.set(t,e)}},vo=class extends Ne{},So=class extends Ne{},Io=class extends Ne{},Ao=class extends Ne{},xo=class extends Ne{},Fo=class extends Ne{},To=class extends Ne{},Bo=class extends Ne{};var Do=class extends cr{constructor(t){super(t),this._offsets=new jn}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ye(new z(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let o=s.length,c=e.set(i,o).buffer[i];for(let a=-1;++a<o;)n.set(c+a,s[a])}}};var Eo=class extends cr{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ke(new z(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:c}=e.set(i,s.size).buffer;for(let a of s.entries())if(n.set(o,a),++o>=c)break}}};var Oo=class extends gt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Mo=class extends gt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new pt([...this.type.children,new z(e,t.type,!0)]),n}};var Nr=class extends Ht{};Nr.prototype._setValue=Ma;var Hi=class extends Nr{};Hi.prototype._setValue=Ws;var zi=class extends Nr{};zi.prototype._setValue=$s;var ji=class extends Nr{};ji.prototype._setValue=Ys;var Wi=class extends Nr{};Wi.prototype._setValue=Xs;var Lr=class extends Ht{};Lr.prototype._setValue=Ra;var $i=class extends Lr{};$i.prototype._setValue=Gs;var Yi=class extends Lr{};Yi.prototype._setValue=Ks;var Xi=class extends Lr{};Xi.prototype._setValue=Js;var Gi=class extends Lr{};Gi.prototype._setValue=qs;var Gn=class extends gt{constructor(t){super(t),this._typeIds=new Mr(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s==null||s.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,c=[...i,new z(e,t.type)];return this.type=new Xe(s,[...o,n],c),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ro=class extends Gn{},Uo=class extends Gn{constructor(t){super(t),this._offsets=new Mr(new Int32Array(0))}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Ki=class extends cr{constructor(t){super(t),this._values=new Xr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Hr(e))}_flushPending(t,e){}};Ki.prototype._flushPending=Xn.prototype._flushPending;var qa=class extends D{visitNull(){return Oo}visitBool(){return mo}visitInt(){return Ne}visitInt8(){return vo}visitInt16(){return So}visitInt32(){return Io}visitInt64(){return Ao}visitUint8(){return xo}visitUint16(){return Fo}visitUint32(){return To}visitUint64(){return Bo}visitFloat(){return Sn}visitFloat16(){return bo}visitFloat32(){return go}visitFloat64(){return wo}visitUtf8(){return Ki}visitBinary(){return Xn}visitFixedSizeBinary(){return Ci}visitDate(){return wn}visitDateDay(){return ki}visitDateMillisecond(){return Ni}visitTimestamp(){return Nr}visitTimestampSecond(){return Hi}visitTimestampMillisecond(){return zi}visitTimestampMicrosecond(){return ji}visitTimestampNanosecond(){return Wi}visitTime(){return Lr}visitTimeSecond(){return $i}visitTimeMillisecond(){return Yi}visitTimeMicrosecond(){return Xi}visitTimeNanosecond(){return Gi}visitDecimal(){return Li}visitList(){return Do}visitStruct(){return Mo}visitUnion(){return Gn}visitDenseUnion(){return Uo}visitSparseUnion(){return Ro}visitDictionary(){return _o}visitInterval(){return In}visitIntervalDayTime(){return Pi}visitIntervalYearMonth(){return Vi}visitFixedSizeList(){return yo}visitMap(){return Eo}},xd=new qa;var k=class extends D{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function ge(r,t){return t instanceof r.constructor}function Ji(r,t){return r===t||ge(r,t)}function Cr(r,t){return r===t||ge(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function ko(r,t){return r===t||ge(r,t)&&r.precision===t.precision}function x_(r,t){return r===t||ge(r,t)&&r.byteWidth===t.byteWidth}function Za(r,t){return r===t||ge(r,t)&&r.unit===t.unit}function qi(r,t){return r===t||ge(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Zi(r,t){return r===t||ge(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function F_(r,t){return r===t||ge(r,t)&&r.children.length===t.children.length&&br.compareManyFields(r.children,t.children)}function T_(r,t){return r===t||ge(r,t)&&r.children.length===t.children.length&&br.compareManyFields(r.children,t.children)}function Qa(r,t){return r===t||ge(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&br.compareManyFields(r.children,t.children)}function B_(r,t){return r===t||ge(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&br.visit(r.indices,t.indices)&&br.visit(r.dictionary,t.dictionary)}function tc(r,t){return r===t||ge(r,t)&&r.unit===t.unit}function D_(r,t){return r===t||ge(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&br.compareManyFields(r.children,t.children)}function E_(r,t){return r===t||ge(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&br.compareManyFields(r.children,t.children)}k.prototype.visitNull=Ji;k.prototype.visitBool=Ji;k.prototype.visitInt=Cr;k.prototype.visitInt8=Cr;k.prototype.visitInt16=Cr;k.prototype.visitInt32=Cr;k.prototype.visitInt64=Cr;k.prototype.visitUint8=Cr;k.prototype.visitUint16=Cr;k.prototype.visitUint32=Cr;k.prototype.visitUint64=Cr;k.prototype.visitFloat=ko;k.prototype.visitFloat16=ko;k.prototype.visitFloat32=ko;k.prototype.visitFloat64=ko;k.prototype.visitUtf8=Ji;k.prototype.visitBinary=Ji;k.prototype.visitFixedSizeBinary=x_;k.prototype.visitDate=Za;k.prototype.visitDateDay=Za;k.prototype.visitDateMillisecond=Za;k.prototype.visitTimestamp=qi;k.prototype.visitTimestampSecond=qi;k.prototype.visitTimestampMillisecond=qi;k.prototype.visitTimestampMicrosecond=qi;k.prototype.visitTimestampNanosecond=qi;k.prototype.visitTime=Zi;k.prototype.visitTimeSecond=Zi;k.prototype.visitTimeMillisecond=Zi;k.prototype.visitTimeMicrosecond=Zi;k.prototype.visitTimeNanosecond=Zi;k.prototype.visitDecimal=Ji;k.prototype.visitList=F_;k.prototype.visitStruct=T_;k.prototype.visitUnion=Qa;k.prototype.visitDenseUnion=Qa;k.prototype.visitSparseUnion=Qa;k.prototype.visitDictionary=B_;k.prototype.visitInterval=tc;k.prototype.visitIntervalDayTime=tc;k.prototype.visitIntervalYearMonth=tc;k.prototype.visitFixedSizeList=D_;k.prototype.visitMap=E_;var br=new k;function An(r,t){return br.compareSchemas(r,t)}function Fd(r,t){return br.compareFields(r,t)}function Td(r,t){return br.visit(r,t)}function vn(r){let t=r.type,e=new(xd.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,c)=>n[c]||i:({name:o})=>n[o]||i;for(let[o,c]of t.children.entries()){let{type:a}=c,f=s(c,o);e.children.push(vn(Object.assign(Object.assign({},f),{type:a})))}}return e}function No(r,t){return O_(r,t.map(e=>e.data.concat()))}function O_(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((y,b)=>Math.max(y,b.length),0)},s=0,o=0,c=-1,a=t.length,f,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c<a;)m[c]=f=t[c].shift(),o=Math.min(o,f?f.length:o);Number.isFinite(o)&&(m=M_(e,o,m,t,i),o>0&&(n[s++]=P({type:new pt(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(y=>new ft(r,y))]}function M_(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let c=-1,a=n.length;++c<a;){let f=e[c],m=f==null?void 0:f.length;if(m>=t)m===t?e[c]=f:(e[c]=f.slice(0,t),i.numBatches=Math.max(i.numBatches,n[c].unshift(f.slice(t,m-t))));else{let y=r[c];r[c]=y.clone({nullable:!0}),e[c]=(s=f==null?void 0:f._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:P({type:y.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Bd,Bt=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new q([]),this._offsets=[0],this;let i,s;t[0]instanceof q&&(i=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());let o=a=>{if(a){if(a instanceof ft)return[a];if(a instanceof Bt)return a.batches;if(a instanceof nt){if(a.type instanceof pt)return[new ft(new q(a.type.children),a)]}else{if(Array.isArray(a))return a.flatMap(f=>o(f));if(typeof a[Symbol.iterator]=="function")return[...a].flatMap(f=>o(f));if(typeof a=="object"){let f=Object.keys(a),m=f.map(I=>new C([a[I]])),y=new q(f.map((I,J)=>new z(String(I),m[J].type))),[,b]=No(y,m);return b.length===0?[new ft(a)]:b}}}return[]},c=t.flatMap(a=>o(a));if(i=(n=i!=null?i:(e=c[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new q([]),!(i instanceof q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let a of c){if(!(a instanceof ft))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!An(i,a.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=c,this._offsets=s!=null?s:io(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=no(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return Vn.visit(new C(this.data))}toArray(){return[...this]}toString(){return`[
|
|
8
|
+
${this.toArray().join(`,
|
|
9
|
+
`)}
|
|
10
|
+
]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new Bt(e,n.map(i=>new ft(e,i)))}slice(t,e){let n=this.schema;[t,e]=vi({length:this.numRows},t,e);let i=so(this.data,this._offsets,t,e);return new Bt(n,i.map(s=>new ft(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=P({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new C(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new C([P({type:new ae,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),c=this.schema.fields.map((a,f)=>this.getChildAt(f));[s[t],c[t]]=[o,e],[n,i]=No(n,c)}return new Bt(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new Bt(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((c,a,f)=>{let[m,y]=c,b=e.findIndex(I=>I.name===a.name);return~b?y[b]=f:m.push(f),c},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((c,a)=>[a,i[a]]).map(([c,a])=>a===void 0?this.getChildAt(c):t.getChildAt(a)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new Bt(...No(s,o))}};Bd=Symbol.toStringTag;Bt[Bd]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Yr(Ai),r.get=Yr(Mt.getVisitFn(h.Struct)),r.set=oo(Zt.getVisitFn(h.Struct)),r.indexOf=ao(yn.getVisitFn(h.Struct)),r.getByteLength=Yr(Fe.getVisitFn(h.Struct)),"Table"))(Bt.prototype);var Ed,ft=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=P({nullCount:0,type:new pt(this.schema.fields),children:this.schema.fields.map(e=>P({type:e.type,nullCount:0}))})]=t,!(this.data instanceof nt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Dd(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((a,f,m)=>(a.children[m]=e[f],a.length=Math.max(a.length,e[f].length),a.fields[m]=z.new({name:f,type:e[f].type,nullable:!0}),a),{length:0,fields:new Array,children:new Array}),o=new q(n),c=P({type:new pt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Dd(o,c.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Od(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(t){return this.data.getValid(t)}get(t){return Mt.visit(this.data,t)}set(t,e){return Zt.visit(this.data,t,e)}indexOf(t,e){return yn.visit(this.data,t,e)}getByteLength(t){return Fe.visit(this.data,t)}[Symbol.iterator](){return Vn.visit(new C([this.data]))}toArray(){return[...this]}concat(...t){return new Bt(this.schema,[this,...t])}slice(t,e){let[n]=new C([this.data]).slice(t,e).data;return new ft(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new C([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new C([P({type:new ae,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),c=s[t].clone({type:e.type});[s[t],o[t]]=[c,e.data[0]],n=new q(s,new Map(this.schema.metadata)),i=P({type:new pt(s),children:o})}return new ft(n,i)}select(t){let e=this.schema.select(t),n=new pt(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(c=>c.name===s);~o&&(i[o]=this.data.children[o])}return new ft(e,P({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=P({type:new pt(e.fields),length:this.numRows,children:n});return new ft(e,i)}};Ed=Symbol.toStringTag;ft[Ed]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ft.prototype);function Dd(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[c,a]of r.fields.entries()){let f=t[c];(!f||f.length!==e)&&(i[c]=a.clone({nullable:!0}),s[c]=(n=f==null?void 0:f._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:P({type:a.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),P({type:new pt(i),length:e,children:s})]}function Od(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,c=t[n];if(T.isDictionary(o)){if(!e.has(o.id))c.dictionary&&e.set(o.id,c.dictionary);else if(e.get(o.id)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Od(o.children,c.children,e)}return e}var xn=class extends ft{constructor(t){let e=t.fields.map(i=>P({type:i.type})),n=P({type:new pt(t.fields),nullCount:0,children:e});super(t,n)}};var Qi;(function(r){r[r.BUFFER=0]="BUFFER"})(Qi||(Qi={}));var ts;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ts||(ts={}));var Qe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new Qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Qe).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ts.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Qi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ts.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Qi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Qe.startBodyCompression(t),Qe.addCodec(t,e),Qe.addMethod(t,n),Qe.endBodyCompression(t)}};var Kn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}};var Jn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}};var ie=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new ie).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Jn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Kn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new Qe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ie).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var qn;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(qn||(qn={}));var Et=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new Et).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):qn.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new mt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Gr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,qn.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return Et.startMessage(t),Et.addVersion(t,e),Et.addHeaderType(t,n),Et.addHeader(t,i),Et.addBodyLength(t,s),Et.addCustomMetadata(t,o),Et.endMessage(t)}};var U_=Rt,ec=class extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return hr.startNull(e),hr.endNull(e)}visitInt(t,e){return zt.startInt(e),zt.addBitWidth(e,t.bitWidth),zt.addIsSigned(e,t.isSigned),zt.endInt(e)}visitFloat(t,e){return pe.startFloatingPoint(e),pe.addPrecision(e,t.precision),pe.endFloatingPoint(e)}visitBinary(t,e){return ur.startBinary(e),ur.endBinary(e)}visitBool(t,e){return dr.startBool(e),dr.endBool(e)}visitUtf8(t,e){return mr.startUtf8(e),mr.endUtf8(e)}visitDecimal(t,e){return jt.startDecimal(e),jt.addScale(e,t.scale),jt.addPrecision(e,t.precision),jt.addBitWidth(e,t.bitWidth),jt.endDecimal(e)}visitDate(t,e){return de.startDate(e),de.addUnit(e,t.unit),de.endDate(e)}visitTime(t,e){return ee.startTime(e),ee.addUnit(e,t.unit),ee.addBitWidth(e,t.bitWidth),ee.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return re.startTimestamp(e),re.addUnit(e,t.unit),n!==void 0&&re.addTimezone(e,n),re.endTimestamp(e)}visitInterval(t,e){return me.startInterval(e),me.addUnit(e,t.unit),me.endInterval(e)}visitList(t,e){return fr.startList(e),fr.endList(e)}visitStruct(t,e){return pr.startStruct_(e),pr.endStruct_(e)}visitUnion(t,e){Wt.startTypeIdsVector(e,t.typeIds.length);let n=Wt.createTypeIdsVector(e,t.typeIds);return Wt.startUnion(e),Wt.addMode(e,t.mode),Wt.addTypeIds(e,n),Wt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Te.startDictionaryEncoding(e),Te.addId(e,new U_(t.id,0)),Te.addIsOrdered(e,t.isOrdered),n!==void 0&&Te.addIndexType(e,n),Te.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return fe.startFixedSizeBinary(e),fe.addByteWidth(e,t.byteWidth),fe.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return he.startFixedSizeList(e),he.addListSize(e,t.listSize),he.endFixedSizeList(e)}visitMap(t,e){return _e.startMap(e),_e.addKeysSorted(e,t.keysSorted),_e.endMap(e)}},Lo=new ec;function kd(r,t=new Map){return new q(k_(r,t),Co(r.customMetadata),t)}function rc(r){return new Qt(r.count,Ld(r.columns),Cd(r.columns))}function Nd(r){return new ve(rc(r.data),r.id,r.isDelta)}function k_(r,t){return(r.fields||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Md(r,t){return(r.children||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Ld(r){return(r||[]).reduce((t,e)=>[...t,new tr(e.count,N_(e.VALIDITY)),...Ld(e.children)],[])}function Cd(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new we(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new we(t.length,i.TYPE.length)),i.OFFSET&&t.push(new we(t.length,i.OFFSET.length)),i.DATA&&t.push(new we(t.length,i.DATA.length)),t=Cd(i.children,t)}return t}function N_(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Pd(r,t){let e,n,i,s,o,c;return!t||!(s=r.dictionary)?(o=Ud(r,Md(r,t)),i=new z(r.name,o,r.nullable,Co(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?Rd(n):new sr,c=new Ae(t.get(e),n,e,s.isOrdered),i=new z(r.name,c,r.nullable,Co(r.customMetadata))):(n=(n=s.indexType)?Rd(n):new sr,t.set(e,o=Ud(r,Md(r,t))),c=new Ae(o,n,e,s.isOrdered),i=new z(r.name,c,r.nullable,Co(r.customMetadata))),i||null}function Co(r){return new Map(Object.entries(r||{}))}function Rd(r){return new Dt(r.isSigned,r.bitWidth)}function Ud(r,t){let e=r.type.name;switch(e){case"NONE":return new ae;case"null":return new ae;case"binary":return new Ir;case"utf8":return new Ar;case"bool":return new xr;case"list":return new Ye((t||[])[0]);case"struct":return new pt(t||[]);case"struct_":return new pt(t||[])}switch(e){case"int":{let n=r.type;return new Dt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ue(bt[n.precision])}case"decimal":{let n=r.type;return new Fr(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Tr(qt[n.unit])}case"time":{let n=r.type;return new $e(G[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Br(G[n.unit],n.timezone)}case"interval":{let n=r.type;return new Dr(oe[n.unit])}case"union":{let n=r.type;return new Xe(xt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Er(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ge(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Ke((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Fn=Rt,L_=Rr,C_=ce,kt=class{constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,e){let n=new kt(0,Vt.V4,e);return n._createHeader=P_(t,e),n}static decode(t){t=new C_(N(t));let e=Et.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new kt(n,i,s);return o._createHeader=V_(e,s),o}static encode(t){let e=new L_,n=-1;return t.isSchema()?n=q.encode(e,t.header()):t.isRecordBatch()?n=Qt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ve.encode(e,t.header())),Et.startMessage(e),Et.addVersion(e,Vt.V4),Et.addHeader(e,n),Et.addHeaderType(e,t.headerType),Et.addBodyLength(e,new Fn(t.bodyLength,0)),Et.finishMessageBuffer(e,Et.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof q)return new kt(0,Vt.V4,rt.Schema,t);if(t instanceof Qt)return new kt(e,Vt.V4,rt.RecordBatch,t);if(t instanceof ve)return new kt(e,Vt.V4,rt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}},Qt=class{constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=typeof t=="number"?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}},ve=class{constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=typeof e=="number"?e:e.low}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}},we=class{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}},tr=class{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}};function P_(r,t){return()=>{switch(t){case rt.Schema:return q.fromJSON(r);case rt.RecordBatch:return Qt.fromJSON(r);case rt.DictionaryBatch:return ve.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}function V_(r,t){return()=>{switch(t){case rt.Schema:return q.decode(r.header(new Ft));case rt.RecordBatch:return Qt.decode(r.header(new ie),r.version());case rt.DictionaryBatch:return ve.decode(r.header(new Le),r.version())}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}z.encode=q_;z.decode=K_;z.fromJSON=Pd;q.encode=J_;q.decode=H_;q.fromJSON=kd;Qt.encode=Z_;Qt.decode=z_;Qt.fromJSON=rc;ve.encode=Q_;ve.decode=j_;ve.fromJSON=Nd;tr.encode=ty;tr.decode=$_;we.encode=ey;we.decode=W_;function H_(r,t=new Map){let e=G_(r,t);return new q(e,Po(r),t)}function z_(r,t=Vt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Qt(r.length(),Y_(r),X_(r,t))}function j_(r,t=Vt.V4){return new ve(Qt.decode(r.data(),t),r.id(),r.isDelta())}function W_(r){return new we(r.offset(),r.length())}function $_(r){return new tr(r.length(),r.nullCount())}function Y_(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=tr.decode(e));return t}function X_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Vt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=we.decode(n));return e}function G_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=z.decode(n,t));return e}function Vd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=z.decode(n,t));return e}function K_(r,t){let e,n,i,s,o,c;return!t||!(c=r.dictionary())?(i=zd(r,Vd(r,t)),n=new z(r.name(),i,r.nullable(),Po(r))):t.has(e=c.id().low)?(s=(s=c.indexType())?Hd(s):new sr,o=new Ae(t.get(e),s,e,c.isOrdered()),n=new z(r.name(),o,r.nullable(),Po(r))):(s=(s=c.indexType())?Hd(s):new sr,t.set(e,i=zd(r,Vd(r,t))),o=new Ae(i,s,e,c.isOrdered()),n=new z(r.name(),o,r.nullable(),Po(r))),n||null}function Po(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Hd(r){return new Dt(r.isSigned(),r.bitWidth())}function zd(r,t){let e=r.typeType();switch(e){case wt.NONE:return new ae;case wt.Null:return new ae;case wt.Binary:return new Ir;case wt.Utf8:return new Ar;case wt.Bool:return new xr;case wt.List:return new Ye((t||[])[0]);case wt.Struct_:return new pt(t||[])}switch(e){case wt.Int:{let n=r.type(new zt);return new Dt(n.isSigned(),n.bitWidth())}case wt.FloatingPoint:{let n=r.type(new pe);return new ue(n.precision())}case wt.Decimal:{let n=r.type(new jt);return new Fr(n.scale(),n.precision(),n.bitWidth())}case wt.Date:{let n=r.type(new de);return new Tr(n.unit())}case wt.Time:{let n=r.type(new ee);return new $e(n.unit(),n.bitWidth())}case wt.Timestamp:{let n=r.type(new re);return new Br(n.unit(),n.timezone())}case wt.Interval:{let n=r.type(new me);return new Dr(n.unit())}case wt.Union:{let n=r.type(new Wt);return new Xe(n.mode(),n.typeIdsArray()||[],t||[])}case wt.FixedSizeBinary:{let n=r.type(new fe);return new Er(n.byteWidth())}case wt.FixedSizeList:{let n=r.type(new he);return new Ge(n.listSize(),(t||[])[0])}case wt.Map:{let n=r.type(new _e);return new Ke((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${wt[e]}" (${e})`)}function J_(r,t){let e=t.fields.map(s=>z.encode(r,s));Ft.startFieldsVector(r,e.length);let n=Ft.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?Ft.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let c=r.createString(`${s}`),a=r.createString(`${o}`);return mt.startKeyValue(r),mt.addKey(r,c),mt.addValue(r,a),mt.endKeyValue(r)})):-1;return Ft.startSchema(r),Ft.addFields(r,n),Ft.addEndianness(r,ry?Kr.Little:Kr.Big),i!==-1&&Ft.addCustomMetadata(r,i),Ft.endSchema(r)}function q_(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;T.isDictionary(s)?(o=s.dictionary.typeId,i=Lo.visit(s,r),n=Lo.visit(s.dictionary,r)):n=Lo.visit(s,r);let c=(s.children||[]).map(m=>z.encode(r,m)),a=Ut.createChildrenVector(r,c),f=t.metadata&&t.metadata.size>0?Ut.createCustomMetadataVector(r,[...t.metadata].map(([m,y])=>{let b=r.createString(`${m}`),I=r.createString(`${y}`);return mt.startKeyValue(r),mt.addKey(r,b),mt.addValue(r,I),mt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Ut.startField(r),Ut.addType(r,n),Ut.addTypeType(r,o),Ut.addChildren(r,a),Ut.addNullable(r,!!t.nullable),e!==-1&&Ut.addName(r,e),i!==-1&&Ut.addDictionary(r,i),f!==-1&&Ut.addCustomMetadata(r,f),Ut.endField(r)}function Z_(r,t){let e=t.nodes||[],n=t.buffers||[];ie.startNodesVector(r,e.length);for(let o of e.slice().reverse())tr.encode(r,o);let i=r.endVector();ie.startBuffersVector(r,n.length);for(let o of n.slice().reverse())we.encode(r,o);let s=r.endVector();return ie.startRecordBatch(r),ie.addLength(r,new Fn(t.length,0)),ie.addNodes(r,i),ie.addBuffers(r,s),ie.endRecordBatch(r)}function Q_(r,t){let e=Qt.encode(r,t.data);return Le.startDictionaryBatch(r),Le.addId(r,new Fn(t.id,0)),Le.addIsDelta(r,t.isDelta),Le.addData(r,e),Le.endDictionaryBatch(r)}function ty(r,t){return Jn.createFieldNode(r,new Fn(t.length,0),new Fn(t.nullCount,0))}function ey(r,t){return Kn.createBuffer(r,new Fn(t.offset,0),new Fn(t.length,0))}var ry=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var ic=r=>`Expected ${rt[r]} Message in stream, but was null or length 0.`,sc=r=>`Header pointer of flatbuffer-encoded ${rt[r]} Message is null or length 0.`,jd=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Wd=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Zn=class{constructor(t){this.source=t instanceof yr?t:new yr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?_t:t.value===-1&&(t=this.readMetadataLength()).done?_t:(t=this.readMetadata(t.value)).done?_t:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(ic(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=N(this.source.read(t));if(e.byteLength<t)throw new Error(Wd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=rt.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(sc(e));return i}readMetadataLength(){let t=this.source.read(Vo),e=t&&new ce(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return _t;if(e.byteLength<t)throw new Error(jd(t,e.byteLength));return{done:!1,value:kt.decode(e)}}},es=class{constructor(t,e){this.source=t instanceof ye?t:xs(t)?new qr(t,e):new ye(t)}[Symbol.asyncIterator](){return this}next(){return A(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?_t:t.value===-1&&(t=yield this.readMetadataLength()).done?_t:(t=yield this.readMetadata(t.value)).done?_t:t})}throw(t){return A(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return A(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return A(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(ic(t));return e.value})}readMessageBody(t){return A(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=N(yield this.source.read(t));if(e.byteLength<t)throw new Error(Wd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return A(this,void 0,void 0,function*(){let e=rt.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(sc(e));return i})}readMetadataLength(){return A(this,void 0,void 0,function*(){let t=yield this.source.read(Vo),e=t&&new ce(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return A(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return _t;if(e.byteLength<t)throw new Error(jd(t,e.byteLength));return{done:!1,value:kt.decode(e)}})}},rs=class extends Zn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Oi?t:new Oi(t)}next(){let{_json:t}=this;if(!this._schema){this._schema=!0;let e=kt.fromJSON(t.schema,rt.Schema);return{done:!1,value:e}}if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];this._body=e.data.columns;let n=kt.fromJSON(e,rt.DictionaryBatch);return{done:!1,value:n}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];this._body=e.columns;let n=kt.fromJSON(e,rt.RecordBatch);return{done:!1,value:n}}return this._body=[],_t}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(ic(t));return e.value}readSchema(){let t=rt.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(sc(t));return n}},Vo=4,nc="ARROW1",Qn=new Uint8Array(nc.length);for(let r=0;r<nc.length;r+=1)Qn[r]=nc.codePointAt(r);function Ho(r,t=0){for(let e=-1,n=Qn.length;++e<n;)if(Qn[e]!==r[t+e])return!1;return!0}var ti=Qn.length,oc=ti+Vo,$d=ti*2+Vo;var Ot=class extends gn{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Ve(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Jt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Jt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Ot?t:Is(t)?iy(t):xs(t)?ay(t):Ve(t)?(()=>A(this,void 0,void 0,function*(){return yield Ot.from(yield t)}))():Fs(t)||yi(t)||Bs(t)||Me(t)?oy(new ye(t)):sy(new yr(t))}static readAll(t){return t instanceof Ot?t.isSync()?Yd(t):Xd(t):Is(t)||ArrayBuffer.isView(t)||He(t)||As(t)?Yd(t):Xd(t)}},gr=class extends Ot{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return le(this,arguments,function*(){yield $(yield*En(Oe(this[Symbol.iterator]())))})}},Zr=class extends Ot{constructor(t){super(t),this._impl=t}readAll(){var t,e;return A(this,void 0,void 0,function*(){let n=new Array;try{for(var i=Oe(this),s;s=yield i.next(),!s.done;){let o=s.value;n.push(o)}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=i.return)&&(yield e.call(i))}finally{if(t)throw t.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Qr=class extends gr{constructor(t){super(t),this._impl=t}},ns=class extends Zr{constructor(t){super(t),this._impl=t}},zo=class{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=P({type:new pt(this.schema.fields),length:t.length,children:n});return new ft(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,c=s.get(n);if(i||!c){let a=o.dictionaries.get(n),f=this._loadVectors(t.data,e,[a]);return(c&&i?c.concat(new C(f)):new C(f)).memoize()}return c.memoize()}_loadVectors(t,e,n){return new Ui(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},ei=class extends zo{constructor(t,e){super(e),this._reader=Is(t)?new rs(this._handle=t):new Zn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Gd(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):_t}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):_t}next(){if(this.closed)return _t;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new xn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ri=class extends zo{constructor(t,e){super(e),this._reader=new es(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return A(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return A(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Gd(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):_t})}return(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):_t})}next(){return A(this,void 0,void 0,function*(){if(this.closed)return _t;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new xn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return A(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},jo=class extends ei{constructor(t,e){super(t instanceof Mi?t:new Mi(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){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(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(rt.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(rt.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}}_readFooter(){let{_handle:t}=this,e=t.size-oc,n=t.readInt32(e),i=t.readAt(e-n,n);return Ur.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},ac=class extends ri{constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof qr?t:new qr(t,n),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return A(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return A(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(rt.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return A(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(rt.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}})}_readFooter(){return A(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-oc,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Ur.decode(i)})}_readNextMessageAndValidate(t){return A(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},cc=class extends ei{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new po(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Gd(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Yd(r){let t=Ot.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Xd(r){return le(this,arguments,function*(){let e=yield $(Ot.from(r));try{if(!(yield $(e.open({autoDestroy:!1}))).closed)do yield yield $(e);while(!(yield $(e.reset().open())).closed)}finally{yield $(e.cancel())}})}function iy(r){return new gr(new cc(r))}function sy(r){let t=r.peek(ti+7&-8);return t&&t.byteLength>=4?Ho(t)?new Qr(new jo(r.read())):new gr(new ei(r)):new gr(new ei(function*(){}()))}function oy(r){return A(this,void 0,void 0,function*(){let t=yield r.peek(ti+7&-8);return t&&t.byteLength>=4?Ho(t)?new Qr(new jo(yield r.read())):new Zr(new ri(r)):new Zr(new ri(function(){return le(this,arguments,function*(){})}()))})}function ay(r){return A(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new qr(r,t);return t>=$d&&Ho(yield e.readAt(0,ti+7&-8))?new ns(new ac(e)):new Zr(new ri(e))})}var Tt=class extends D{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof ft?s.data.children:s.data),n=new Tt;return n.visitMany(e(t)),n}visit(t){if(t instanceof C)return this.visitMany(t.data),this;let{type:e}=t;if(!T.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");T.isNull(e)||er.call(this,i<=0?new Uint8Array(0):Pn(t.offset,n,t.nullBitmap)),this.nodes.push(new tr(n,i))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function er(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new we(this._byteLength,t)),this._byteLength+=t,this}function cy(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(er.call(this,n),t.mode===xt.Sparse)return lc.call(this,r);if(t.mode===xt.Dense){if(r.offset<=0)return er.call(this,i),lc.call(this,r);{let s=n.reduce((m,y)=>Math.max(m,y),n[0]),o=new Int32Array(s+1),c=new Int32Array(s+1).fill(-1),a=new Int32Array(e),f=bi(-i[0],e,i);for(let m,y,b=-1;++b<e;)(y=c[m=n[b]])===-1&&(y=c[m]=f[m]),a[b]=f[b]-y,++o[m];er.call(this,a);for(let m,y=-1,b=t.children.length;++y<b;)if(m=r.children[y]){let I=t.typeIds[y],J=Math.min(e,o[I]);this.visit(m.slice(c[I],J))}}}return this}function ly(r){let t;return r.nullCount>=r.length?er.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?er.call(this,Pn(r.offset,r.length,t)):er.call(this,mn(r.values))}function tn(r){return er.call(this,r.values.subarray(0,r.length*r.stride))}function Kd(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return er.call(this,bi(-n[0],t,n)),er.call(this,e.subarray(i,i+o)),this}function uc(r){let{length:t,valueOffsets:e}=r;return e&&er.call(this,bi(e[0],t,e)),this.visit(r.children[0])}function lc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Tt.prototype.visitBool=ly;Tt.prototype.visitInt=tn;Tt.prototype.visitFloat=tn;Tt.prototype.visitUtf8=Kd;Tt.prototype.visitBinary=Kd;Tt.prototype.visitFixedSizeBinary=tn;Tt.prototype.visitDate=tn;Tt.prototype.visitTimestamp=tn;Tt.prototype.visitTime=tn;Tt.prototype.visitDecimal=tn;Tt.prototype.visitList=uc;Tt.prototype.visitStruct=lc;Tt.prototype.visitUnion=cy;Tt.prototype.visitInterval=tn;Tt.prototype.visitFixedSizeList=uc;Tt.prototype.visitMap=uc;var en=class extends gn{constructor(t){super(),this._position=0,this._started=!1,this._sink=new _r,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,se(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ve(t)?t.then(e=>this.writeAll(e)):Me(t)?fc(this,t):dc(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof _r?this._sink=t:(this._sink=new _r,t&&gu(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&wu(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!An(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Bt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof ft&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!An(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof ft?t instanceof xn||this._writeRecordBatch(t):t instanceof Bt?this.writeAll(t.batches):He(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=kt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,c=s+o+n&~n,a=c-s-o;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new Ze(c,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new Ze(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),s>0&&this._write(i),this._writePadding(a)}_write(t){if(this._started){let e=N(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(kt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Qn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Tt.assemble(t),o=new Qt(t.numRows,n,i),c=kt.from(o,e);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:c}=Tt.assemble(new C([t])),a=new Qt(t.length,s,o),f=new ve(a,e,n),m=kt.from(f,i);return this._writeMessage(m)._writeBodyBuffers(c)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n==null?void 0:n.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},wr=class extends en{static writeAll(t,e){let n=new wr(e);return Ve(t)?t.then(i=>n.writeAll(i)):Me(t)?fc(n,t):dc(n,t)}},rn=class extends en{static writeAll(t){let e=new rn;return Ve(t)?t.then(n=>e.writeAll(n)):Me(t)?fc(e,t):dc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=Ur.encode(new Ur(t,Vt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function dc(r,t){let e=t;t instanceof Bt&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function fc(r,t){var e,n,i,s;return A(this,void 0,void 0,function*(){try{for(e=Oe(t);n=yield e.next(),!n.done;){let o=n.value;r.write(o)}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=e.return)&&(yield s.call(e))}finally{if(i)throw i.error}}return r.finish()})}function Jd(r,t){if(Me(r))return dy(r,t);if(He(r))return uy(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function uy(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){((e==null?void 0:e.return)&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,c){let a,f=null,m=o.desiredSize||null;for(;!(f=c.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(a=N(f.value))&&(m!=null&&n&&(m=m-a.byteLength+1),f.value=a),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()}}function dy(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return A(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return A(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return A(this,void 0,void 0,function*(){((e==null?void 0:e.return)&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,c){return A(this,void 0,void 0,function*(){let a,f=null,m=o.desiredSize||null;for(;!(f=yield c.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(a=N(f.value))&&(m!=null&&n&&(m=m-a.byteLength+1),f.value=a),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()})}}function Qd(r){return new hc(r)}var hc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=yu(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vn(s),this._getSize=i!=="bytes"?qd:Zd;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:c=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:a=>{this._maybeFlush(this._builder,this._controller=a)},start:a=>{this._maybeFlush(this._builder,this._controller=a)}},{highWaterMark:o,size:i!=="bytes"?qd:Zd}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:a=>this._writeValueAndReturnChunkSize(a)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},qd=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Zd=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Wo(r,t){let e=new _r,n=null,i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield e.close()})},start(c){return A(this,void 0,void 0,function*(){yield o(c,n||(n=yield s()))})},pull(c){return A(this,void 0,void 0,function*(){n?yield o(c,n):c.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return A(this,void 0,void 0,function*(){return yield(yield Ot.from(e)).open(t)})}function o(c,a){return A(this,void 0,void 0,function*(){let f=c.desiredSize,m=null;for(;!(m=yield a.next()).done;)if(c.enqueue(m.value),f!=null&&--f<=0)return;c.close()})}}function $o(r,t){let e=new this(r),n=new ye(e),i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return A(this,void 0,void 0,function*(){yield s(o)})},start(o){return A(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return A(this,void 0,void 0,function*(){let c=null,a=o.desiredSize;for(;c=yield n.read(a||null);)if(o.enqueue(c),a!=null&&(a-=c.byteLength)<=0)return;o.close()})}}var my=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Fa),Ja),za),Ta),Sa),Ha),{compareSchemas:An,compareFields:Fd,compareTypes:Td});Jt.toDOMStream=Jd;gt.throughDOM=Qd;Ot.throughDOM=Wo;Qr.throughDOM=Wo;gr.throughDOM=Wo;en.throughDOM=$o;rn.throughDOM=$o;wr.throughDOM=$o;function ni(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:ni(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>Yo(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:ni(t.keyType),valueType:ni(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function Yo(r,t){let e=ni(t);return e.name=r,e}var Xo=class{constructor(){this._bindings=null;this._nextMessageId=0}log(t){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:t},[])}sendOK(t){this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"OK",data:null},[])}failWith(t,e){let n={name:e.name,message:e.message,stack:e.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"ERROR",data:n},[])}async onMessage(t){switch(t.type){case"PING":this.sendOK(t);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(t,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(t.data[0],t.data[1],e=>{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"INSTANTIATE_PROGRESS",data:e},[])}),this.sendOK(t)}catch(e){this._bindings=null,this.failWith(t,e)}return;default:break}if(!this._bindings)return this.failWith(t,new Error("duckdb is not initialized"));try{switch(t.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(t);break;case"OPEN":this._bindings.open(t.data),this.sendOK(t);break;case"DROP_FILE":this._bindings.dropFile(t.data),this.sendOK(t);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(t);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(t);break;case"CONNECT":{let e=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"CONNECTION_INFO",data:e.useUnsafe((n,i)=>i)},[]);break}case"DISCONNECT":this._bindings.disconnect(t.data),this.sendOK(t);break;case"CREATE_PREPARED":{let e=this._bindings.createPrepared(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"PREPARED_STATEMENT_ID",data:e},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(t.data[0],t.data[1]),this.sendOK(t);break}case"RUN_PREPARED":{let e=this._bindings.runPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"RUN_QUERY":{let e=this._bindings.runQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"SEND_PREPARED":{let e=this._bindings.sendPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_START",data:e},[e.buffer]);break}case"SEND_QUERY":{let e=this._bindings.sendQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_START",data:e},[e.buffer]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},[e.buffer]);break}case"GET_TABLE_NAMES":{let e=this._bindings.getTableNames(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"TABLE_NAMES",data:e},[]);break}case"GLOB_FILE_INFOS":{let e=this._bindings.globFiles(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_INFOS",data:e},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(t.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"TOKENIZE":{let e=this._bindings.tokenize(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SCRIPT_TOKENS",data:e},[]);break}}}catch(e){return this.failWith(t,e)}}};var mc={},_y=(()=>{var r=mc.url;return function(t){t=t||{};function e(){return It.buffer!=Se&&Pr(It.buffer),Bc}function n(){return It.buffer!=Se&&Pr(It.buffer),Dc}function i(){return It.buffer!=Se&&Pr(It.buffer),Ec}function s(){return It.buffer!=Se&&Pr(It.buffer),Oc}function o(){return It.buffer!=Se&&Pr(It.buffer),Mc}function c(){return It.buffer!=Se&&Pr(It.buffer),Rc}var a=typeof t<"u"?t:{},f,m;a.ready=new Promise(function(l,u){f=l,m=u});var y=Object.assign({},a),b=[],I="./this.program",J=(l,u)=>{throw u},Z=typeof window=="object",at=typeof importScripts=="function",st=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",x=a.ENVIRONMENT_IS_PTHREAD||!1,St="";function Tn(l){return a.locateFile?a.locateFile(l,St):St+l}var an,is,cn,si;function Q(l){if(l instanceof di)return;dt("exiting due to exception: "+l)}var Nt,te,Yt;if(st){at?St=pc().dirname(St)+"/":St=__dirname+"/",Yt=()=>{te||(Nt=ef(),te=pc())},an=function(d,p){return Yt(),d=te.normalize(d),Nt.readFileSync(d,p?void 0:"utf8")},cn=u=>{var d=an(u,!0);return d.buffer||(d=new Uint8Array(d)),d},is=(u,d,p)=>{Yt(),u=te.normalize(u),Nt.readFile(u,function(_,S){_?p(_):d(S.buffer)})},process.argv.length>1&&(I=process.argv[1].replace(/\\/g,"/")),b=process.argv.slice(2),process.on("uncaughtException",function(u){if(!(u instanceof di))throw u}),process.on("unhandledRejection",function(u){throw u}),J=(u,d)=>{if(na())throw process.exitCode=u,d;Q(d),process.exit(u)},a.inspect=function(){return"[Emscripten Module object]"};let l;try{l=rf()}catch(u){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),u}global.Worker=l.Worker}else(Z||at)&&(at?St=self.location.href:typeof document<"u"&&document.currentScript&&(St=document.currentScript.src),r&&(St=r),St.indexOf("blob:")!==0?St=St.substr(0,St.replace(/[?#].*/,"").lastIndexOf("/")+1):St="",st||(an=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.send(null),u.responseText},at&&(cn=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),is=(l,u,d)=>{var p=new XMLHttpRequest;p.open("GET",l,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){u(p.response);return}d()},p.onerror=d,p.send(null)}),si=l=>document.title=l);st&&typeof performance>"u"&&(global.performance=nf().performance);var Xt=console.log.bind(console),Pt=console.warn.bind(console);st&&(Yt(),Xt=l=>Nt.writeSync(1,l+`
|
|
11
|
+
`),Pt=l=>Nt.writeSync(2,l+`
|
|
12
|
+
`));var ut=a.print||Xt,dt=a.printErr||Pt;Object.assign(a,y),y=null,a.arguments&&(b=a.arguments),a.thisProgram&&(I=a.thisProgram),a.quit&&(J=a.quit);function rr(l){rr.shown||(rr.shown={}),rr.shown[l]||(rr.shown[l]=1,dt(l))}var Fy=Atomics.load,Ty=Atomics.store,By=Atomics.compareExchange,oi;a.wasmBinary&&(oi=a.wasmBinary);var vc=a.noExitRuntime||!0;typeof WebAssembly!="object"&&Ce("no native wasm support detected");var It,Sc,ea=!1,ai;function Ic(l,u){l||Ce(u)}function mf(l){var u=a["_"+l];return u}function _f(l,u,d,p,_){var S={string:function(Lt){var Pe=0;if(Lt!=null&&Lt!==0){var nr=(Lt.length<<2)+1;Pe=_s(nr),ra(Lt,Pe,nr)}return Pe},array:function(Lt){var Pe=_s(Lt.length);return Tc(Lt,Pe),Pe}};function g(Lt){return u==="string"?Sr(Lt):u==="boolean"?Boolean(Lt):Lt}var v=mf(l),F=[],et=0;if(p)for(var ot=0;ot<p.length;ot++){var Ee=S[d[ot]];Ee?(et===0&&(et=pa()),F[ot]=Ee(p[ot])):F[ot]=p[ot]}var yt=v.apply(null,F);function Bn(Lt){return et!==0&&ms(et),g(Lt)}return yt=Bn(yt),yt}var Ac=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function xc(l,u,d){for(var p=u+d,_=u;l[_]&&!(_>=p);)++_;if(_-u>16&&l.buffer&&Ac)return Ac.decode(l.buffer instanceof SharedArrayBuffer?l.slice(u,_):l.subarray(u,_));for(var S="";u<_;){var g=l[u++];if(!(g&128)){S+=String.fromCharCode(g);continue}var v=l[u++]&63;if((g&224)==192){S+=String.fromCharCode((g&31)<<6|v);continue}var F=l[u++]&63;if((g&240)==224?g=(g&15)<<12|v<<6|F:g=(g&7)<<18|v<<12|F<<6|l[u++]&63,g<65536)S+=String.fromCharCode(g);else{var et=g-65536;S+=String.fromCharCode(55296|et>>10,56320|et&1023)}}return S}function Sr(l,u){return l?xc(n(),l,u):""}function Fc(l,u,d,p){if(!(p>0))return 0;for(var _=d,S=d+p-1,g=0;g<l.length;++g){var v=l.charCodeAt(g);if(v>=55296&&v<=57343){var F=l.charCodeAt(++g);v=65536+((v&1023)<<10)|F&1023}if(v<=127){if(d>=S)break;u[d++]=v}else if(v<=2047){if(d+1>=S)break;u[d++]=192|v>>6,u[d++]=128|v&63}else if(v<=65535){if(d+2>=S)break;u[d++]=224|v>>12,u[d++]=128|v>>6&63,u[d++]=128|v&63}else{if(d+3>=S)break;u[d++]=240|v>>18,u[d++]=128|v>>12&63,u[d++]=128|v>>6&63,u[d++]=128|v&63}}return u[d]=0,d-_}function ra(l,u,d){return Fc(l,n(),u,d)}function yf(l){for(var u=0,d=0;d<l.length;++d){var p=l.charCodeAt(d);p>=55296&&p<=57343&&(p=65536+((p&1023)<<10)|l.charCodeAt(++d)&1023),p<=127?++u:p<=2047?u+=2:p<=65535?u+=3:u+=4}return u}function Tc(l,u){e().set(l,u)}function bf(l,u,d){for(var p=0;p<l.length;++p)e()[u++>>0]=l.charCodeAt(p);d||(e()[u>>0]=0)}var Se,Bc,Dc,Ec,Oc,Mc,gf,wf,Rc;x&&(Se=a.buffer);function Pr(l){Se=l,a.HEAP8=Bc=new Int8Array(l),a.HEAP16=Ec=new Int16Array(l),a.HEAP32=Mc=new Int32Array(l),a.HEAPU8=Dc=new Uint8Array(l),a.HEAPU16=Oc=new Uint16Array(l),a.HEAPU32=gf=new Uint32Array(l),a.HEAPF32=wf=new Float32Array(l),a.HEAPF64=Rc=new Float64Array(l)}var Uc=a.INITIAL_MEMORY||16777216;if(x)It=a.wasmMemory,Se=a.buffer;else if(a.wasmMemory)It=a.wasmMemory;else if(It=new WebAssembly.Memory({initial:Uc/65536,maximum:32768,shared:!0}),!(It.buffer instanceof SharedArrayBuffer))throw dt("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),st&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");It&&(Se=It.buffer),Uc=Se.byteLength,Pr(Se);var kc,Nc=[],Lc=[],vf=[],Cc=[],Sf=!1;function na(){return vc}function If(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)Ff(a.preRun.shift());ss(Nc)}function Pc(){Sf=!0,!x&&ss(Lc)}function Af(){x||ss(vf)}function xf(){if(!x){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)Bf(a.postRun.shift());ss(Cc)}}function Ff(l){Nc.unshift(l)}function Tf(l){Lc.unshift(l)}function Bf(l){Cc.unshift(l)}var ln=0,ia=null,ci=null;function Df(l){ln++,a.monitorRunDependencies&&a.monitorRunDependencies(ln)}function Ef(l){if(ln--,a.monitorRunDependencies&&a.monitorRunDependencies(ln),ln==0&&(ia!==null&&(clearInterval(ia),ia=null),ci)){var u=ci;ci=null,u()}}function Ce(l){x?postMessage({cmd:"onAbort",arg:l}):a.onAbort&&a.onAbort(l),l="Aborted("+l+")",dt(l),ea=!0,ai=1,l+=". Build with -sASSERTIONS for more info.";var u=new WebAssembly.RuntimeError(l);throw m(u),u}var Of="data:application/octet-stream;base64,";function Vc(l){return l.startsWith(Of)}var Be;a.locateFile?(Be="./duckdb-coi.wasm",Vc(Be)||(Be=Tn(Be))):Be=new URL("./duckdb-coi.wasm",mc.url).toString();function Hc(l){try{if(l==Be&&oi)return new Uint8Array(oi);if(cn)return cn(l);throw"both async and sync fetching of the wasm failed"}catch(u){Ce(u)}}function Mf(){return!oi&&(Z||at)&&typeof fetch=="function"?fetch(Be,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+Be+"'";return l.arrayBuffer()}).catch(function(){return Hc(Be)}):Promise.resolve().then(function(){return Hc(Be)})}function Rf(){var l={a:Mh};function u(g,v){var F=g.exports;if(a.asm=F,Vf(a.asm.eb),kc=a.asm.rb,Tf(a.asm.ta),Sc=v,!x){var et=E.unusedWorkers.length;E.unusedWorkers.forEach(function(ot){E.loadWasmModuleToWorker(ot,function(){--et||Ef("wasm-instantiate")})})}}x||Df("wasm-instantiate");function d(g){u(g.instance,g.module)}function p(g){return Mf().then(function(v){return WebAssembly.instantiate(v,l)}).then(function(v){return v}).then(g,function(v){dt("failed to asynchronously prepare wasm: "+v),Ce(v)})}function _(){return!oi&&typeof WebAssembly.instantiateStreaming=="function"&&!Vc(Be)&&typeof fetch=="function"?fetch(Be,{credentials:"same-origin"}).then(function(g){var v=WebAssembly.instantiateStreaming(g,l);return v.then(d,function(F){return dt("wasm streaming compile failed: "+F),dt("falling back to ArrayBuffer instantiation"),p(d)})}):p(d)}if(a.instantiateWasm)try{var S=a.instantiateWasm(l,u);return S}catch(g){return dt("Module.instantiateWasm callback failed with error: "+g),!1}return _().catch(m),{}}var Uf={};function ss(l){for(;l.length>0;){var u=l.shift();if(typeof u=="function"){u(a);continue}var d=u.func;typeof d=="number"?u.arg===void 0?sa(d)():sa(d)(u.arg):d(u.arg===void 0?null:u.arg)}}function kf(l){var u=pa(),d=l();return ms(u),d}function Nf(l){o()[l>>2]=0;var u=E.pthreads[l];delete E.pthreads[l],u.worker.terminate(),fa(l),E.runningWorkers.splice(E.runningWorkers.indexOf(u.worker),1),u.worker.pthread=void 0}function Lf(l){var u=E.pthreads[l];u.worker.postMessage({cmd:"cancel"})}function zc(l){var u=E.pthreads[l];if(u){o()[l>>2]=0;var d=u.worker;E.returnWorkerToPool(d)}}function jc(l,u){n().fill(0,l,l+u)}function Wc(l){var u=E.getNewWorker();if(!u)return 6;E.runningWorkers.push(u);var d=E.pthreads[l.pthread_ptr]={worker:u,threadInfoStruct:l.pthread_ptr};u.pthread=d;var p={cmd:"run",start_routine:l.startRoutine,arg:l.arg,threadInfoStruct:l.pthread_ptr};return u.runPthread=()=>{p.time=performance.now(),u.postMessage(p,l.transferList)},u.loaded&&(u.runPthread(),delete u.runPthread),0}function $c(l){zl(l)}function Yc(l){if(l instanceof di||l=="unwind")return ai;J(1,l)}var E={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],init:function(){x?E.initWorker():E.initMainThread()},initMainThread:function(){for(var l=4,u=0;u<l;++u)E.allocateUnusedWorker()},initWorker:function(){vc=!1},pthreads:{},setExitStatus:function(l){ai=l},terminateAllThreads:function(){for(var l in E.pthreads){var u=E.pthreads[l];u&&u.worker&&E.returnWorkerToPool(u.worker)}for(var d=0;d<E.unusedWorkers.length;++d){var p=E.unusedWorkers[d];p.terminate()}E.unusedWorkers=[]},returnWorkerToPool:function(l){E.runWithoutMainThreadQueuedCalls(function(){delete E.pthreads[l.pthread.threadInfoStruct],E.unusedWorkers.push(l),E.runningWorkers.splice(E.runningWorkers.indexOf(l),1),fa(l.pthread.threadInfoStruct),l.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(l){o()[Hl>>2]=0;try{l()}finally{o()[Hl>>2]=1}},receiveObjectTransfer:function(l){},threadInit:function(){for(var l in E.tlsInitFunctions)E.tlsInitFunctions.hasOwnProperty(l)&&E.tlsInitFunctions[l]()},loadWasmModuleToWorker:function(l,u){l.onmessage=d=>{var p=d.data,_=p.cmd;if(l.pthread&&(E.currentProxiedOperationCallerThread=l.pthread.threadInfoStruct),p.targetThread&&p.targetThread!=ps()){var S=E.pthreads[p.targetThread];S?S.worker.postMessage(p,p.transferList):dt('Internal error! Worker sent a message "'+_+'" to target pthread '+p.targetThread+", but that thread no longer exists!"),E.currentProxiedOperationCallerThread=void 0;return}_==="processProxyingQueue"?Il(p.queue):_==="spawnThread"?Wc(p):_==="cleanupThread"?zc(p.thread):_==="killThread"?Nf(p.thread):_==="cancelThread"?Lf(p.thread):_==="loaded"?(l.loaded=!0,u&&u(l),l.runPthread&&(l.runPthread(),delete l.runPthread)):_==="print"?ut("Thread "+p.threadId+": "+p.text):_==="printErr"?dt("Thread "+p.threadId+": "+p.text):_==="alert"?alert("Thread "+p.threadId+": "+p.text):p.target==="setimmediate"?l.postMessage(p):_==="onAbort"?a.onAbort&&a.onAbort(p.arg):_&&dt("worker sent an unknown command "+_),E.currentProxiedOperationCallerThread=void 0},l.onerror=d=>{var p="worker sent an error!";throw dt(p+" "+d.filename+":"+d.lineno+": "+d.message),d},st&&(l.on("message",function(d){l.onmessage({data:d})}),l.on("error",function(d){l.onerror(d)}),l.on("detachedExit",function(){})),l.postMessage({cmd:"load",urlOrBlob:a.mainScriptUrlOrBlob,wasmMemory:It,wasmModule:Sc})},allocateUnusedWorker:function(){if(!a.locateFile){E.unusedWorkers.push(new Worker(new URL("duckdb_wasm.worker.js",mc.url)));return}var l=Tn("duckdb_wasm.worker.js");E.unusedWorkers.push(new Worker(l))},getNewWorker:function(){return E.unusedWorkers.length==0&&(E.allocateUnusedWorker(),E.loadWasmModuleToWorker(E.unusedWorkers[0])),E.unusedWorkers.pop()}};function Cf(){var l=ps(),u=o()[l+44>>2],d=o()[l+48>>2],p=u-d;Vl(u,p),ms(u)}a.establishStackSpace=Cf;function Xc(l){if(x)return tt(1,0,l);try{$c(l)}catch(u){Yc(u)}}var os=[];function sa(l){var u=os[l];return u||(l>=os.length&&(os.length=l+1),os[l]=u=kc.get(l)),u}function Pf(l,u){return sa(l)(u)}a.invokeEntryPoint=Pf;function Vf(l){E.tlsInitFunctions.push(l)}function Hf(l,u,d,p){Ce("Assertion failed: "+Sr(l)+", at: "+[u?Sr(u):"unknown filename",d,p?Sr(p):"unknown function"])}function zf(l){Ll(l,!at,1,!Z),E.threadInit()}function jf(l){x?postMessage({cmd:"cleanupThread",thread:l}):zc(l)}function Gc(l,u,d,p){return x?tt(2,1,l,u,d,p):Kc(l,u,d,p)}function Kc(l,u,d,p){if(typeof SharedArrayBuffer>"u")return dt("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],S=0;if(x&&(_.length===0||S))return Gc(l,u,d,p);if(S)return S;var g={startRoutine:d,pthread_ptr:l,arg:p,transferList:_};return x?(g.cmd="spawnThread",postMessage(g,_),0):Wc(g)}var Gt={buffers:[null,[],[]],printChar:function(l,u){var d=Gt.buffers[l];u===0||u===10?((l===1?ut:dt)(xc(d,0)),d.length=0):d.push(u)},varargs:void 0,get:function(){Gt.varargs+=4;var l=o()[Gt.varargs-4>>2];return l},getStr:function(l){var u=Sr(l);return u}};function Jc(l,u,d,p,_){if(x)return tt(3,1,l,u,d,p,_)}function Wf(){dt("missing function: $SOCKFS"),Ce(-1)}function qc(){dt("missing function: $FS"),Ce(-1)}function li(l){var u=Wf.getSocket(l);if(!u)throw new qc.ErrnoError(8);return u}function oa(l){return(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255)}function Zc(l){var u="",d=0,p=0,_=0,S=0,g=0,v=0,F=[l[0]&65535,l[0]>>16,l[1]&65535,l[1]>>16,l[2]&65535,l[2]>>16,l[3]&65535,l[3]>>16],et=!0,ot="";for(v=0;v<5;v++)if(F[v]!==0){et=!1;break}if(et){if(ot=oa(F[6]|F[7]<<16),F[5]===-1)return u="::ffff:",u+=ot,u;if(F[5]===0)return u="::",ot==="0.0.0.0"&&(ot=""),ot==="0.0.0.1"&&(ot="1"),u+=ot,u}for(d=0;d<8;d++)F[d]===0&&(d-_>1&&(g=0),_=d,g++),g>p&&(p=g,S=d-p+1);for(d=0;d<8;d++){if(p>1&&F[d]===0&&d>=S&&d<S+p){d===S&&(u+=":",S===0&&(u+=":"));continue}u+=Number(da(F[d]&65535)).toString(16),u+=d<7?":":""}return u}function Qc(l,u){var d=i()[l>>1],p=da(s()[l+2>>1]),_;switch(d){case 2:if(u!==16)return{errno:28};_=o()[l+4>>2],_=oa(_);break;case 10:if(u!==28)return{errno:28};_=[o()[l+8>>2],o()[l+12>>2],o()[l+16>>2],o()[l+20>>2]],_=Zc(_);break;default:return{errno:5}}return{family:d,addr:_,port:p}}function as(l){for(var u=l.split("."),d=0;d<4;d++){var p=Number(u[d]);if(isNaN(p))return null;u[d]=p}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0}function cs(l){return parseInt(l)}function aa(l){var u,d,p,_,S=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,g=[];if(!S.test(l))return null;if(l==="::")return[0,0,0,0,0,0,0,0];for(l.startsWith("::")?l=l.replace("::","Z:"):l=l.replace("::",":Z:"),l.indexOf(".")>0?(l=l.replace(new RegExp("[.]","g"),":"),u=l.split(":"),u[u.length-4]=cs(u[u.length-4])+cs(u[u.length-3])*256,u[u.length-3]=cs(u[u.length-2])+cs(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=l.split(":"),p=0,_=0,d=0;d<u.length;d++)if(typeof u[d]=="string")if(u[d]==="Z"){for(_=0;_<8-u.length+1;_++)g[d+_]=0;p=_-1}else g[d+p]=hs(parseInt(u[d],16));else g[d+p]=u[d];return[g[1]<<16|g[0],g[3]<<16|g[2],g[5]<<16|g[4],g[7]<<16|g[6]]}var De={address_map:{id:1,addrs:{},names:{}},lookup_name:function(l){var u=as(l);if(u!==null||(u=aa(l),u!==null))return l;var d;if(De.address_map.addrs[l])d=De.address_map.addrs[l];else{var p=De.address_map.id++;Ic(p<65535,"exceeded max address mappings of 65535"),d="172.29."+(p&255)+"."+(p&65280),De.address_map.names[d]=l,De.address_map.addrs[l]=d}return d},lookup_addr:function(l){return De.address_map.names[l]?De.address_map.names[l]:null}};function tl(l,u,d){if(d&&l===0)return null;var p=Qc(l,u);if(p.errno)throw new qc.ErrnoError(p.errno);return p.addr=De.lookup_addr(p.addr)||p.addr,p}function el(l,u,d){if(x)return tt(4,1,l,u,d);var p=li(l),_=tl(u,d);return p.sock_ops.bind(p,_.addr,_.port),0}function rl(l,u,d){if(x)return tt(5,1,l,u,d);var p=li(l),_=tl(u,d);return p.sock_ops.connect(p,_.addr,_.port),0}function nl(l,u,d,p){return x?tt(6,1,l,u,d,p):(u=Gt.getStr(u),u=Gt.calculateAt(l,u),Gt.doAccess(u,d))}function il(l,u,d){return x?tt(7,1,l,u,d):(Gt.varargs=d,0)}function sl(l,u){if(x)return tt(8,1,l,u)}function ol(l,u,d){if(x)return tt(9,1,l,u,d)}function al(l,u,d){if(x)return tt(10,1,l,u,d)}function ca(l,u,d,p,_){switch(u){case 2:d=as(d),jc(l,16),_&&(o()[_>>2]=16),i()[l>>1]=u,o()[l+4>>2]=d,i()[l+2>>1]=hs(p);break;case 10:d=aa(d),jc(l,28),_&&(o()[_>>2]=28),o()[l>>2]=u,o()[l+8>>2]=d[0],o()[l+12>>2]=d[1],o()[l+16>>2]=d[2],o()[l+20>>2]=d[3],i()[l+2>>1]=hs(p);break;default:return 5}return 0}function cl(l,u,d){if(x)return tt(11,1,l,u,d);var p=li(l);if(!p.daddr)return-53;var _=ca(u,p.family,De.lookup_name(p.daddr),p.dport,d);return 0}function ll(l,u,d,p,_){if(x)return tt(12,1,l,u,d,p,_);var S=li(l);return u===1&&d===4?(o()[p>>2]=S.error,o()[_>>2]=4,S.error=null,0):-50}function ul(l,u,d){return x?tt(13,1,l,u,d):(Gt.varargs=d,0)}function dl(l,u){if(x)return tt(14,1,l,u)}function fl(l,u,d){if(x)return tt(15,1,l,u,d)}function hl(l,u,d,p){if(x)return tt(16,1,l,u,d,p)}function pl(l,u,d,p){if(x)return tt(17,1,l,u,d,p);Gt.varargs=p}function ml(l,u,d,p,_,S){if(x)return tt(18,1,l,u,d,p,_,S);var g=li(l),v=g.sock_ops.recvmsg(g,d);if(!v)return 0;if(_)var F=ca(_,g.family,De.lookup_name(v.addr),v.port,S);return n().set(v.buffer,u),v.buffer.byteLength}function _l(l,u,d,p){if(x)return tt(19,1,l,u,d,p)}function yl(l){if(x)return tt(20,1,l)}function bl(l,u,d,p,_,S){if(x)return tt(21,1,l,u,d,p,_,S)}function gl(l,u,d){if(x)return tt(22,1,l,u,d)}function wl(l,u){if(x)return tt(23,1,l,u)}function vl(l,u,d){if(x)return tt(24,1,l,u,d)}function $f(l){}var Sl="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function Yf(l,u){Ce(Sl)}function Xf(l,u){Ce(Sl)}function Gf(){return Date.now()}function Kf(){return 2097152}var Jf=!0;function qf(){return Jf}function Il(l){try{ps()&&Pl(l)}finally{Atomics.sub(o(),l>>2,1)}}function Zf(l,u,d,p){if(l==u)setTimeout(()=>Il(p));else if(x)postMessage({targetThread:l,cmd:"processProxyingQueue",queue:p});else{var _=E.pthreads[l],S=_&&_.worker;if(!S)return;S.postMessage({cmd:"processProxyingQueue",queue:p})}return 1}function Qf(l,u,d){return-1}function th(){Ce("")}function eh(l,u){return globalThis.DUCKDB_RUNTIME.createDirectory(a,l,u)}function rh(l,u){return globalThis.DUCKDB_RUNTIME.checkDirectory(a,l,u)}function nh(l,u){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(a,l,u)}function ih(l,u){return globalThis.DUCKDB_RUNTIME.removeDirectory(a,l,u)}function sh(l){return globalThis.DUCKDB_RUNTIME.closeFile(a,l)}function oh(l,u){return globalThis.DUCKDB_RUNTIME.checkFile(a,l,u)}function ah(l){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(a,l)}function ch(l,u,d,p){return globalThis.DUCKDB_RUNTIME.moveFile(a,l,u,d,p)}function lh(l,u){return globalThis.DUCKDB_RUNTIME.openFile(a,l,u)}function uh(l,u,d,p){return globalThis.DUCKDB_RUNTIME.readFile(a,l,u,d,p)}function dh(l,u){return globalThis.DUCKDB_RUNTIME.truncateFile(a,l,u)}function fh(l,u,d,p){return globalThis.DUCKDB_RUNTIME.writeFile(a,l,u,d,p)}function hh(l,u){return globalThis.DUCKDB_RUNTIME.glob(a,l,u)}function ph(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(a,l)}function mh(l,u,d,p,_,S){return globalThis.DUCKDB_RUNTIME.callScalarUDF(a,l,u,d,p,_,S)}function _h(){st||at||rr("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function Al(){return 2147483648}var ls;st?ls=()=>{var l=process.hrtime();return l[0]*1e3+l[1]/1e6}:x?ls=()=>performance.now()-a.__performance_now_clock_drift:ls=()=>performance.now();function yh(l,u,d){n().copyWithin(l,u,u+d)}function bh(){return st?sf().cpus().length:navigator.hardwareConcurrency}function tt(l,u){var d=arguments.length-2,p=arguments;return kf(function(){for(var _=d,S=_s(_*8),g=S>>3,v=0;v<d;v++){var F=p[2+v];c()[g+v]=F}return Cl(l,_,S,u)})}var la=[];function gh(l,u,d){la.length=u;for(var p=d>>3,_=0;_<u;_++)la[_]=c()[p+_];var S=l<0,g=S?Uf[-l-1]:Eh[l];return g.apply(null,la)}function wh(l){try{return It.grow(l-Se.byteLength+65535>>>16),Pr(It.buffer),1}catch(u){}}function vh(l){var u=n().length;if(l=l>>>0,l<=u)return!1;var d=Al();if(l>d)return!1;let p=(F,et)=>F+(et-F%et)%et;for(var _=1;_<=4;_*=2){var S=u*(1+.2/_);S=Math.min(S,l+100663296);var g=Math.min(d,p(Math.max(l,S),65536)),v=wh(g);if(v)return!0}return!1}function Sh(){throw"unwind"}var ua={};function Ih(){return I||"./this.program"}function ui(){if(!ui.strings){var l=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",u={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:l,_:Ih()};for(var d in ua)ua[d]===void 0?delete u[d]:u[d]=ua[d];var p=[];for(var d in u)p.push(d+"="+u[d]);ui.strings=p}return ui.strings}function xl(l,u){if(x)return tt(25,1,l,u);var d=0;return ui().forEach(function(p,_){var S=u+d;o()[l+_*4>>2]=S,bf(p,S),d+=p.length+1}),0}function Fl(l,u){if(x)return tt(26,1,l,u);var d=ui();o()[l>>2]=d.length;var p=0;return d.forEach(function(_){p+=_.length+1}),o()[u>>2]=p,0}function Tl(l){return x?tt(27,1,l):0}function Bl(l,u,d,p,_,S){if(x)return tt(28,1,l,u,d,p,_,S);var g=Gt.getStreamFromFD(l),v=Gt.doReadv(g,u,d,p);return o()[S>>2]=v,0}function Dl(l,u,d,p,_,S){if(x)return tt(29,1,l,u,d,p,_,S);var g=Gt.getStreamFromFD(l),v=Gt.doWritev(g,u,d,p);return o()[S>>2]=v,0}function El(l,u,d,p){if(x)return tt(30,1,l,u,d,p);var _=Gt.getStreamFromFD(l),S=Gt.doReadv(_,u,d);return o()[p>>2]=S,0}function Ol(l,u,d,p,_){if(x)return tt(31,1,l,u,d,p,_)}function Ml(l){if(x)return tt(32,1,l);var u=Gt.getStreamFromFD(l);return u.stream_ops&&u.stream_ops.fsync?-u.stream_ops.fsync(u):0}function Rl(l,u,d,p){if(x)return tt(33,1,l,u,d,p);for(var _=0,S=0;S<d;S++){var g=o()[u>>2],v=o()[u+4>>2];u+=8;for(var F=0;F<v;F++)Gt.printChar(l,n()[g+F]);_+=v}return o()[p>>2]=_,0}function Ul(l,u,d,p){if(x)return tt(34,1,l,u,d,p);var _=0,S=0,g=0,v=0,F=0,et=0,ot;function Ee(yt,Bn,Lt,Pe,nr,fi){var w,O,At,Kt;return O=yt===10?28:16,nr=yt===10?Zc(nr):oa(nr),w=ha(O),Kt=ca(w,yt,nr,fi),Ic(!Kt),At=ha(32),o()[At+4>>2]=yt,o()[At+8>>2]=Bn,o()[At+12>>2]=Lt,o()[At+24>>2]=Pe,o()[At+20>>2]=w,yt===10?o()[At+16>>2]=28:o()[At+16>>2]=16,o()[At+28>>2]=0,At}if(d&&(g=o()[d>>2],v=o()[d+4>>2],F=o()[d+8>>2],et=o()[d+12>>2]),F&&!et&&(et=F===2?17:6),!F&&et&&(F=et===17?2:1),et===0&&(et=6),F===0&&(F=1),!l&&!u)return-2;if(g&-1088||d!==0&&o()[d>>2]&2&&!l)return-1;if(g&32)return-2;if(F!==0&&F!==1&&F!==2)return-7;if(v!==0&&v!==2&&v!==10)return-6;if(u&&(u=Sr(u),S=parseInt(u,10),isNaN(S)))return g&1024?-2:-8;if(!l)return v===0&&(v=2),(g&1)===0&&(v===2?_=fs(2130706433):_=[0,0,0,1]),ot=Ee(v,F,et,null,_,S),o()[p>>2]=ot,0;if(l=Sr(l),_=as(l),_!==null)if(v===0||v===2)v=2;else if(v===10&&g&8)_=[0,0,fs(65535),_],v=10;else return-2;else if(_=aa(l),_!==null)if(v===0||v===10)v=10;else return-2;return _!=null?(ot=Ee(v,F,et,l,_,S),o()[p>>2]=ot,0):g&4?-2:(l=De.lookup_name(l),_=as(l),v===0?v=2:v===10&&(_=[0,0,fs(65535),_]),ot=Ee(v,F,et,null,_,S),o()[p>>2]=ot,0)}function Ah(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var l=new Uint8Array(1);return function(){return crypto.getRandomValues(l),l[0]}}else if(st)try{var u=Rp("crypto");return function(){return u.randomBytes(1)[0]}}catch(d){}return function(){Ce("randomDevice")}}function us(l,u){us.randomDevice||(us.randomDevice=Ah());for(var d=0;d<u;d++)e()[l+d>>0]=us.randomDevice();return 0}function xh(l,u,d,p,_,S,g){var v=Qc(l,u);if(v.errno)return-6;var F=v.port,et=v.addr,ot=!1;if(d&&p){var Ee;if(g&1||!(Ee=De.lookup_addr(et))){if(g&8)return-2}else et=Ee;var yt=ra(et,d,p);yt+1>=p&&(ot=!0)}if(_&&S){F=""+F;var yt=ra(F,_,S);yt+1>=S&&(ot=!0)}return ot?-12:0}function ds(l){return l%4===0&&(l%100!==0||l%400===0)}function Fh(l,u){for(var d=0,p=0;p<=u;d+=l[p++]);return d}var kl=[31,29,31,30,31,30,31,31,30,31,30,31],Nl=[31,28,31,30,31,30,31,31,30,31,30,31];function Th(l,u){for(var d=new Date(l.getTime());u>0;){var p=ds(d.getFullYear()),_=d.getMonth(),S=(p?kl:Nl)[_];if(u>S-d.getDate())u-=S-d.getDate()+1,d.setDate(1),_<11?d.setMonth(_+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else return d.setDate(d.getDate()+u),d}return d}function Bh(l,u,d,p){var _=o()[p+40>>2],S={tm_sec:o()[p>>2],tm_min:o()[p+4>>2],tm_hour:o()[p+8>>2],tm_mday:o()[p+12>>2],tm_mon:o()[p+16>>2],tm_year:o()[p+20>>2],tm_wday:o()[p+24>>2],tm_yday:o()[p+28>>2],tm_isdst:o()[p+32>>2],tm_gmtoff:o()[p+36>>2],tm_zone:_?Sr(_):""},g=Sr(d),v={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var F in v)g=g.replace(new RegExp(F,"g"),v[F]);var et=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ot=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ee(w,O,At){for(var Kt=typeof w=="number"?w.toString():w||"";Kt.length<O;)Kt=At[0]+Kt;return Kt}function yt(w,O){return Ee(w,O,"0")}function Bn(w,O){function At(bs){return bs<0?-1:bs>0?1:0}var Kt;return(Kt=At(w.getFullYear()-O.getFullYear()))===0&&(Kt=At(w.getMonth()-O.getMonth()))===0&&(Kt=At(w.getDate()-O.getDate())),Kt}function Lt(w){switch(w.getDay()){case 0:return new Date(w.getFullYear()-1,11,29);case 1:return w;case 2:return new Date(w.getFullYear(),0,3);case 3:return new Date(w.getFullYear(),0,2);case 4:return new Date(w.getFullYear(),0,1);case 5:return new Date(w.getFullYear()-1,11,31);case 6:return new Date(w.getFullYear()-1,11,30)}}function Pe(w){var O=Th(new Date(w.tm_year+1900,0,1),w.tm_yday),At=new Date(O.getFullYear(),0,4),Kt=new Date(O.getFullYear()+1,0,4),bs=Lt(At),xp=Lt(Kt);return Bn(bs,O)<=0?Bn(xp,O)<=0?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}var nr={"%a":function(w){return et[w.tm_wday].substring(0,3)},"%A":function(w){return et[w.tm_wday]},"%b":function(w){return ot[w.tm_mon].substring(0,3)},"%B":function(w){return ot[w.tm_mon]},"%C":function(w){var O=w.tm_year+1900;return yt(O/100|0,2)},"%d":function(w){return yt(w.tm_mday,2)},"%e":function(w){return Ee(w.tm_mday,2," ")},"%g":function(w){return Pe(w).toString().substring(2)},"%G":function(w){return Pe(w)},"%H":function(w){return yt(w.tm_hour,2)},"%I":function(w){var O=w.tm_hour;return O==0?O=12:O>12&&(O-=12),yt(O,2)},"%j":function(w){return yt(w.tm_mday+Fh(ds(w.tm_year+1900)?kl:Nl,w.tm_mon-1),3)},"%m":function(w){return yt(w.tm_mon+1,2)},"%M":function(w){return yt(w.tm_min,2)},"%n":function(){return`
|
|
13
|
+
`},"%p":function(w){return w.tm_hour>=0&&w.tm_hour<12?"AM":"PM"},"%S":function(w){return yt(w.tm_sec,2)},"%t":function(){return" "},"%u":function(w){return w.tm_wday||7},"%U":function(w){var O=w.tm_yday+7-w.tm_wday;return yt(Math.floor(O/7),2)},"%V":function(w){var O=Math.floor((w.tm_yday+7-(w.tm_wday+6)%7)/7);if((w.tm_wday+371-w.tm_yday-2)%7<=2&&O++,O){if(O==53){var Kt=(w.tm_wday+371-w.tm_yday)%7;Kt!=4&&(Kt!=3||!ds(w.tm_year))&&(O=1)}}else{O=52;var At=(w.tm_wday+7-w.tm_yday-1)%7;(At==4||At==5&&ds(w.tm_year%400-1))&&O++}return yt(O,2)},"%w":function(w){return w.tm_wday},"%W":function(w){var O=w.tm_yday+7-(w.tm_wday+6)%7;return yt(Math.floor(O/7),2)},"%y":function(w){return(w.tm_year+1900).toString().substring(2)},"%Y":function(w){return w.tm_year+1900},"%z":function(w){var O=w.tm_gmtoff,At=O>=0;return O=Math.abs(O)/60,O=O/60*100+O%60,(At?"+":"-")+String("0000"+O).slice(-4)},"%Z":function(w){return w.tm_zone},"%%":function(){return"%"}};g=g.replace(/%%/g,"\0\0");for(var F in nr)g.includes(F)&&(g=g.replace(new RegExp(F,"g"),nr[F](S)));g=g.replace(/\0\0/g,"%");var fi=Oh(g,!1);return fi.length>u?0:(Tc(fi,l),fi.length-1)}function Dh(l,u,d,p){return Bh(l,u,d,p)}E.init();var Eh=[null,Xc,Gc,Jc,el,rl,nl,il,sl,ol,al,cl,ll,ul,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,xl,Fl,Tl,Bl,Dl,El,Ol,Ml,Rl,Ul];function Oh(l,u,d){var p=d>0?d:yf(l)+1,_=new Array(p),S=Fc(l,_,0,_.length);return u&&(_.length=S),_}var Mh={b:Hf,v:zf,s:jf,aa:Kc,W:Jc,Y:el,X:rl,Q:nl,c:il,ia:sl,y:ol,ea:al,S:cl,V:ll,ka:ul,fa:dl,ja:fl,ga:hl,r:pl,T:ml,N:_l,p:yl,U:bl,l:gl,ha:wl,q:vl,Z:$f,o:Yf,_:Xf,sa:Gf,ba:Kf,ra:qf,da:Zf,I:Qf,f:th,G:eh,H:rh,E:nh,F:ih,k:sh,C:oh,K:ah,D:ch,L:lh,g:uh,J:dh,h:fh,B:hh,j:ph,M:mh,m:_h,la:Al,d:ls,P:yh,ma:bh,z:gh,qa:vh,u:Sh,oa:xl,pa:Fl,$:$c,e:Tl,x:Bl,w:Dl,t:El,A:Ol,O:Ml,i:Rl,n:Ul,ca:us,R:xh,a:It||a.wasmMemory,na:Dh},Dy=Rf(),Rh=a.___wasm_call_ctors=function(){return(Rh=a.___wasm_call_ctors=a.asm.ta).apply(null,arguments)},Uh=a._main=function(){return(Uh=a._main=a.asm.ua).apply(null,arguments)},kh=a._duckdb_web_fs_glob_add_path=function(){return(kh=a._duckdb_web_fs_glob_add_path=a.asm.va).apply(null,arguments)},Nh=a._duckdb_web_clear_response=function(){return(Nh=a._duckdb_web_clear_response=a.asm.wa).apply(null,arguments)},Lh=a._duckdb_web_fail_with=function(){return(Lh=a._duckdb_web_fail_with=a.asm.xa).apply(null,arguments)},Ch=a._duckdb_web_reset=function(){return(Ch=a._duckdb_web_reset=a.asm.ya).apply(null,arguments)},Ph=a._duckdb_web_connect=function(){return(Ph=a._duckdb_web_connect=a.asm.za).apply(null,arguments)},Vh=a._duckdb_web_disconnect=function(){return(Vh=a._duckdb_web_disconnect=a.asm.Aa).apply(null,arguments)},Hh=a._duckdb_web_flush_files=function(){return(Hh=a._duckdb_web_flush_files=a.asm.Ba).apply(null,arguments)},zh=a._duckdb_web_flush_file=function(){return(zh=a._duckdb_web_flush_file=a.asm.Ca).apply(null,arguments)},jh=a._duckdb_web_open=function(){return(jh=a._duckdb_web_open=a.asm.Da).apply(null,arguments)},Wh=a._duckdb_web_get_global_file_info=function(){return(Wh=a._duckdb_web_get_global_file_info=a.asm.Ea).apply(null,arguments)},$h=a._duckdb_web_collect_file_stats=function(){return($h=a._duckdb_web_collect_file_stats=a.asm.Fa).apply(null,arguments)},Yh=a._duckdb_web_export_file_stats=function(){return(Yh=a._duckdb_web_export_file_stats=a.asm.Ga).apply(null,arguments)},Xh=a._duckdb_web_fs_drop_file=function(){return(Xh=a._duckdb_web_fs_drop_file=a.asm.Ha).apply(null,arguments)},Gh=a._duckdb_web_fs_drop_files=function(){return(Gh=a._duckdb_web_fs_drop_files=a.asm.Ia).apply(null,arguments)},Kh=a._duckdb_web_fs_glob_file_infos=function(){return(Kh=a._duckdb_web_fs_glob_file_infos=a.asm.Ja).apply(null,arguments)},Jh=a._duckdb_web_fs_get_file_info_by_id=function(){return(Jh=a._duckdb_web_fs_get_file_info_by_id=a.asm.Ka).apply(null,arguments)},qh=a._duckdb_web_fs_get_file_info_by_name=function(){return(qh=a._duckdb_web_fs_get_file_info_by_name=a.asm.La).apply(null,arguments)},Zh=a._duckdb_web_fs_set_file_descriptor=function(){return(Zh=a._duckdb_web_fs_set_file_descriptor=a.asm.Ma).apply(null,arguments)},Qh=a._duckdb_web_fs_register_file_url=function(){return(Qh=a._duckdb_web_fs_register_file_url=a.asm.Na).apply(null,arguments)},tp=a._duckdb_web_fs_register_file_buffer=function(){return(tp=a._duckdb_web_fs_register_file_buffer=a.asm.Oa).apply(null,arguments)},ep=a._duckdb_web_copy_file_to_buffer=function(){return(ep=a._duckdb_web_copy_file_to_buffer=a.asm.Pa).apply(null,arguments)},rp=a._duckdb_web_copy_file_to_path=function(){return(rp=a._duckdb_web_copy_file_to_path=a.asm.Qa).apply(null,arguments)},np=a._duckdb_web_get_version=function(){return(np=a._duckdb_web_get_version=a.asm.Ra).apply(null,arguments)},ip=a._duckdb_web_get_feature_flags=function(){return(ip=a._duckdb_web_get_feature_flags=a.asm.Sa).apply(null,arguments)},sp=a._duckdb_web_tokenize=function(){return(sp=a._duckdb_web_tokenize=a.asm.Ta).apply(null,arguments)},op=a._duckdb_web_udf_scalar_create=function(){return(op=a._duckdb_web_udf_scalar_create=a.asm.Ua).apply(null,arguments)},ap=a._duckdb_web_prepared_create=function(){return(ap=a._duckdb_web_prepared_create=a.asm.Va).apply(null,arguments)},cp=a._duckdb_web_prepared_close=function(){return(cp=a._duckdb_web_prepared_close=a.asm.Wa).apply(null,arguments)},lp=a._duckdb_web_prepared_run=function(){return(lp=a._duckdb_web_prepared_run=a.asm.Xa).apply(null,arguments)},up=a._duckdb_web_prepared_send=function(){return(up=a._duckdb_web_prepared_send=a.asm.Ya).apply(null,arguments)},dp=a._duckdb_web_query_run=function(){return(dp=a._duckdb_web_query_run=a.asm.Za).apply(null,arguments)},fp=a._duckdb_web_query_send=function(){return(fp=a._duckdb_web_query_send=a.asm._a).apply(null,arguments)},hp=a._duckdb_web_query_fetch_results=function(){return(hp=a._duckdb_web_query_fetch_results=a.asm.$a).apply(null,arguments)},pp=a._duckdb_web_get_tablenames=function(){return(pp=a._duckdb_web_get_tablenames=a.asm.ab).apply(null,arguments)},mp=a._duckdb_web_insert_arrow_from_ipc_stream=function(){return(mp=a._duckdb_web_insert_arrow_from_ipc_stream=a.asm.bb).apply(null,arguments)},_p=a._duckdb_web_insert_csv_from_path=function(){return(_p=a._duckdb_web_insert_csv_from_path=a.asm.cb).apply(null,arguments)},yp=a._duckdb_web_insert_json_from_path=function(){return(yp=a._duckdb_web_insert_json_from_path=a.asm.db).apply(null,arguments)},bp=a._emscripten_tls_init=function(){return(bp=a._emscripten_tls_init=a.asm.eb).apply(null,arguments)},Ll=a.__emscripten_thread_init=function(){return(Ll=a.__emscripten_thread_init=a.asm.fb).apply(null,arguments)},gp=a.__emscripten_thread_crashed=function(){return(gp=a.__emscripten_thread_crashed=a.asm.gb).apply(null,arguments)},fs=a._htonl=function(){return(fs=a._htonl=a.asm.hb).apply(null,arguments)},hs=a._htons=function(){return(hs=a._htons=a.asm.ib).apply(null,arguments)},Cl=a._emscripten_run_in_main_runtime_thread_js=function(){return(Cl=a._emscripten_run_in_main_runtime_thread_js=a.asm.jb).apply(null,arguments)},da=a._ntohs=function(){return(da=a._ntohs=a.asm.kb).apply(null,arguments)},Pl=a._emscripten_proxy_execute_queue=function(){return(Pl=a._emscripten_proxy_execute_queue=a.asm.lb).apply(null,arguments)},fa=a.__emscripten_thread_free_data=function(){return(fa=a.__emscripten_thread_free_data=a.asm.mb).apply(null,arguments)},wp=a.__emscripten_thread_exit=function(){return(wp=a.__emscripten_thread_exit=a.asm.nb).apply(null,arguments)},ps=a._pthread_self=function(){return(ps=a._pthread_self=a.asm.ob).apply(null,arguments)},ha=a._malloc=function(){return(ha=a._malloc=a.asm.pb).apply(null,arguments)},vp=a._free=function(){return(vp=a._free=a.asm.qb).apply(null,arguments)},Vl=a._emscripten_stack_set_limits=function(){return(Vl=a._emscripten_stack_set_limits=a.asm.sb).apply(null,arguments)},pa=a.stackSave=function(){return(pa=a.stackSave=a.asm.tb).apply(null,arguments)},ms=a.stackRestore=function(){return(ms=a.stackRestore=a.asm.ub).apply(null,arguments)},_s=a.stackAlloc=function(){return(_s=a.stackAlloc=a.asm.vb).apply(null,arguments)},Hl=a.__emscripten_allow_main_runtime_queued_calls=1062736;a.ccall=_f,a.keepRuntimeAlive=na,a.PThread=E,a.PThread=E,a.wasmMemory=It,a.ExitStatus=di;var ys;function di(l){this.name="ExitStatus",this.message="Program terminated with exit("+l+")",this.status=l}var Sp=!1;ci=function l(){ys||ma(),ys||(ci=l)};function Ip(l){var u=a._main,d=0,p=0;try{var _=u(d,p);return zl(_,!0),_}catch(S){return Yc(S)}finally{Sp=!0}}function ma(l){if(l=l||b,ln>0)return;if(x){f(a),Pc(),postMessage({cmd:"loaded"});return}if(If(),ln>0)return;function u(){ys||(ys=!0,a.calledRun=!0,!ea&&(Pc(),Af(),f(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),jl&&Ip(l),xf()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),u()},1)):u()}a.run=ma;function zl(l,u){if(ai=l,!u&&x)throw Xc(l),"unwind";Ap(l)}function Ap(l){ai=l,na()||(E.terminateAllThreads(),a.onExit&&a.onExit(l),ea=!0),J(l,new di(l))}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();var jl=!0;return a.noInitialRun&&(jl=!1),ma(),t.ready}})(),of=_y;var Go=class{constructor(t,e){this._bindings=t,this._conn=e}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let e=this._bindings.runQuery(this._conn,t),n=Ot.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Bt(n)}send(t){let e=this._bindings.sendQuery(this._conn,t),n=new Ko(this._bindings,this._conn,e),i=Ot.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let e=this._bindings.createPrepared(this._conn,t);return new _c(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=new wr;n.writeAll(t);let i=n.toUint8Array(!0);this.insertArrowFromIPCStream(i,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},Ko=class{constructor(t,e,n){this.bindings=t;this.conn=e;this.header=n;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let t=this.bindings.fetchQueryResults(this.conn);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},_c=class{constructor(t,e,n){this.bindings=t,this.connectionId=e,this.statementId=n}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let e=this.bindings.runPrepared(this.connectionId,this.statementId,t),n=Ot.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Bt(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Ko(this.bindings,this.connectionId,e),i=Ot.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var lf=new TextEncoder,af=new TextDecoder("utf-8");function yc(r,t,e){let n=lf.encode(e),i=r._malloc(n.byteLength),s=r.HEAPU8.subarray(i,i+n.byteLength);s.set(n),r.HEAPF64[(t>>3)+0]=1,r.HEAPF64[(t>>3)+1]=i,r.HEAPF64[(t>>3)+2]=s.byteLength}function gc(r){switch(r){case"UINT8":case"INT8":return 1;case"INT32":case"FLOAT":return 4;case"INT64":case"UINT64":case"DOUBLE":case"VARCHAR":return 8;default:return 0}}function bc(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*gc(e));switch(e){case"UINT8":return new Uint8Array(i.buffer,i.byteOffset,n);case"INT8":return new Int8Array(i.buffer,i.byteOffset,n);case"INT32":return new Int32Array(i.buffer,i.byteOffset,n);case"FLOAT":return new Float32Array(i.buffer,i.byteOffset,n);case"DOUBLE":return new Float64Array(i.buffer,i.byteOffset,n);case"VARCHAR":return new Float64Array(i.buffer,i.byteOffset,n);default:return new Array(0)}}function cf(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Jo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function uf(r,t,e,n,i,s,o,c){try{let a=r._udfFunctions.get(n);if(!a){yc(t,e,"Unknown UDF with id: "+n);return}let f=af.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(f),y=Jo(t,o,c/8),b=Q=>{var te;let Nt=null;switch(Q.validityBuffer!==void 0&&(Nt=cf(t,y[Q.validityBuffer],m.rows)),Q.physicalType){case"VARCHAR":{if(Q.dataBuffer===null||Q.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(Q.lengthBuffer===null||Q.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Yt=bc(t,y[Q.dataBuffer],Q.physicalType,m.rows),Xt=[],Pt=Jo(t,y[Q.lengthBuffer],m.rows);for(let ut=0;ut<m.rows;++ut){if(Nt!=null&&!Nt[ut]){Xt.push(null);continue}let dt=t.HEAPU8.subarray(Yt[ut],Yt[ut]+Pt[ut]),rr=af.decode(dt);Xt.push(rr)}return ut=>Xt[ut]}case"STRUCT<?>":{let Yt={},Xt=[];for(let Pt=0;Pt<(((te=Q.children)==null?void 0:te.length)||0);++Pt){let ut=Q.children[Pt],dt=b(ut);Xt.push(rr=>{Yt[ut.name]=dt(rr)})}return Nt!=null?Pt=>{if(!Nt[Pt])return null;for(let ut of Xt)ut(Pt);return Yt}:Pt=>{for(let ut of Xt)ut(Pt);return Yt}}default:{if(Q.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+Q.physicalType);let Yt=bc(t,y[Q.dataBuffer],Q.physicalType,m.rows);return Nt!=null?Xt=>Nt[Xt]?Yt[Xt]:null:Xt=>Yt[Xt]}}},I=[];for(let Q=0;Q<m.args.length;++Q)I.push(b(m.args[Q]));let J=m.rows*gc(m.ret.physicalType),Z=t._malloc(J),at=bc(t,Z,m.ret.physicalType,m.rows),st=t._malloc(m.rows),x=cf(t,st,m.rows);if(at.length==0||x.length==0){yc(t,e,"Can't create physical arrays for result");return}let St=at;m.ret.physicalType=="VARCHAR"&&(St=new Array(m.rows));let Tn=[];for(let Q=0;Q<m.args.length;++Q)Tn.push(null);for(let Q=0;Q<m.rows;++Q){for(let te=0;te<m.args.length;++te)Tn[te]=I[te](Q);let Nt=a.func(...Tn);St[Q]=Nt,x[Q]=Nt==null?0:1}let an=0;switch(m.ret.physicalType){case"VARCHAR":{let Q=new Array(0);an=t._malloc(m.rows*gc("DOUBLE"));let Nt=Jo(t,an,m.rows),te=0;for(let ut=0;ut<m.rows;++ut){let dt=lf.encode(St[ut]||"");Q.push(dt),Nt[ut]=dt.length,te+=dt.length}let Yt=t._malloc(te),Xt=t.HEAPU8.subarray(Yt,Yt+te),Pt=0;for(let ut=0;ut<m.rows;++ut){at[ut]=Pt;let dt=Q[ut];Xt.subarray(Pt,Pt+dt.length).set(dt),Pt+=dt.length}}}let is=3*8,cn=t._malloc(is),si=Jo(t,cn,3);si[0]=Z,si[1]=st,si[2]=an,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=cn,t.HEAPF64[(e>>3)+2]=0}catch(a){yc(t,e,a.toString())}}function by(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var gy=by();function vr(r,t){r.ccall("duckdb_web_fail_with",null,["string"],[t])}function ii(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function W(r,t,e){return gy(r.HEAPU8.subarray(t,t+e))}function ct(r,t,e,n){let i=r.stackSave(),s=r.stackAlloc(3*8);e.unshift("number"),n.unshift(s),r.ccall(t,null,e,n);let o=r.HEAPF64[(s>>3)+0],c=r.HEAPF64[(s>>3)+1],a=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,c,a]}function vt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var qo=class{constructor(t){let e=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),n=new Uint8Array(new ArrayBuffer(t.byteLength));n.set(t.subarray(7*8)),this.totalFileReadsCold=e[0],this.totalFileReadsAhead=e[1],this.totalFileReadsCached=e[2],this.totalFileWrites=e[3],this.totalPageAccesses=e[4],this.totalPageLoads=e[5],this.blockSize=e[6],this.blockStats=n}getBlockStats(t,e){return e=e||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},e.file_writes=this.blockStats[t*3+0]&15,e.file_reads_cold=this.blockStats[t*3+0]>>4,e.file_reads_ahead=this.blockStats[t*3+1]&15,e.file_reads_cached=this.blockStats[t*3+1]>>4,e.page_accesses=this.blockStats[t*3+1]&15,e.page_loads=this.blockStats[t*3+1]>>4,e}};var wy=new TextEncoder;var Zo=class{constructor(t,e){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=e,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=e=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(e=>{this._initPromiseResolver=e}),this.onInstantiationProgress=[t],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(e=>e!=t),this)}open(t){let[e,n,i]=ct(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}reset(){let[t,e,n]=ct(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}getVersion(){let[t,e,n]=ct(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));let i=W(this.mod,e,n);return vt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=ct(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);return vt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Go(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let e of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])e.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=ii(this.mod,i,s);return vt(this.mod),o}sendQuery(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_query_send",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=ii(this.mod,i,s);return vt(this.mod),o}fetchQueryResults(t){let[e,n,i]=ct(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=ii(this.mod,n,i);return vt(this.mod),s}getTableNames(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=W(this.mod,i,s);return vt(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:ni(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[c,a,f]=ct(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(c!==0)throw new Error(W(this.mod,a,f));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let m of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])m.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));return vt(this.mod),i}closePrepared(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}runPrepared(t,e,n){let[i,s,o]=ct(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=ii(this.mod,s,o);return vt(this.mod),c}sendPrepared(t,e,n){let[i,s,o]=ct(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=ii(this.mod,s,o);return vt(this.mod),c}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(i,i+e.length).set(e);let o=n?JSON.stringify(n):"",[c,a,f]=ct(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(c!==0)throw new Error(W(this.mod,a,f))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(Yo(f,n.columns[f]))}let i=Vr({},n);i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,a]=ct(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,a))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(Yo(f,n.columns[f]))}let i=Vr({},n);i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,a]=ct(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,a))}globFiles(t){let[e,n,i]=ct(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);vt(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e){e===void 0&&(e=t);let[n,i,s]=ct(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,e,-1]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}registerFileText(t,e){let n=wy.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,o,c]=ct(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(W(this.mod,o,c));vt(this.mod)}registerFileHandle(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,t,-1]);if(n!==0)throw new Error(W(this.mod,i,s));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let o of this.pthread.runningWorkers)o.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let o of this.pthread.unusedWorkers)o.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=ct(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}dropFiles(){let[t,e,n]=ct(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}copyFileToBuffer(t){let[e,n,i]=ct(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),vt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=ct(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=ct(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));return new qo(this.mod.HEAPU8.subarray(n,n+i))}};var Qo=class extends Zo{constructor(e,n,i,s){super(e,n);this.mainModuleURL=i,this.pthreadWorkerURL=s}locateFile(e,n){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error(`WASM instantiation requested unexpected file: prefix=${n} path=${e}`)}instantiateWasm(e,n){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(typeof TransformStream=="function"&&ReadableStream.prototype.pipeThrough&&WebAssembly.instantiateStreaming){let o=(async()=>{var Z;let c=new Request(this.mainModuleURL),a=await fetch(c),f=a.headers.get("content-length"),m=f&&parseInt(f,10)||0,y=new Date,b={startedAt:y,updatedAt:y,bytesTotal:m||0,bytesLoaded:0},I={transform(at,st){b.bytesLoaded+=at.byteLength;let x=new Date;if(x.getTime()-b.updatedAt.getTime()<20){b.updatedAt=x,st.enqueue(at);return}for(let St of i)St(b);st.enqueue(at)}},J=new TransformStream(I);return new Response((Z=a.body)==null?void 0:Z.pipeThrough(J),a)})();WebAssembly.instantiateStreaming(o,e).then(c=>{n(c.instance,c.module)})}else{let s=new XMLHttpRequest,o=this.mainModuleURL,c=new Date,a={startedAt:c,updatedAt:c,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+f}),new Error(f.toString())},s.onprogress=f=>{a.bytesTotal=f.total,a.bytesLoaded=f.loaded;let m=new Date;if(m.getTime()-a.updatedAt.getTime()<20){a.updatedAt=m;return}for(let y of i)y(a)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(f=>{n(f.instance,f.module)}).catch(f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+f}),new Error(f)})},s.send()}return[]}};var ta=class extends Qo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return of(pi(Vr({},t),{instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)}))}};var nn=Gl(df()),ff=function(r,t,e){var n;if((n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")){let i=`${r==null?void 0:r.endpoint}`,s=i.indexOf("://")+3;return i.substring(s)}else return r!=null&&r.endpoint?`${e}.${r==null?void 0:r.endpoint}`:`${e}.s3.amazonaws.com`};function vy(r,t,e){var i,s,o,c;let n=hf(t);return{url:n.path,query:"",host:ff(r,t,n.bucket),region:(i=r==null?void 0:r.region)!=null?i:"",service:"s3",method:e,accessKeyId:(s=r==null?void 0:r.accessKeyId)!=null?s:"",secretAccessKey:(o=r==null?void 0:r.secretAccessKey)!=null?o:"",sessionToken:(c=r==null?void 0:r.sessionToken)!=null?c:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function Sy(r,t=!1){let e="0123456789ABCDEF",n="";for(let i=0;i<r.length;i++){let s=r[i];s>="A"&&s<="Z"||s>="a"&&s<="z"||s>="0"&&s<="9"||s=="_"||s=="-"||s=="~"||s=="."?n+=s:s=="/"?t?n+="%2F":n+=s:(n+="%",n+=e[s.charCodeAt(0)>>4],n+=e[s.charCodeAt(0)&15])}return n}function Iy(r,t=null){var J;let e=(J=t==null?void 0:t.contentHash)!=null?J:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",n=new Map;n.set("x-amz-date",r.datetimeNow),n.set("x-amz-content-sha256",e),r.sessionToken&&n.set("x-amz-security-token",r.sessionToken);let i="";t!=null&&t.contentType&&(i+="content-type;"),i+="host;x-amz-content-sha256;x-amz-date",r.sessionToken&&(i+=";x-amz-security-token");let s=r.method+`
|
|
14
|
+
`+Sy(r.url)+`
|
|
15
|
+
`+r.query;t!=null&&t.contentType&&(s+=`
|
|
16
|
+
content-type:`+(t==null?void 0:t.contentType)),s+=`
|
|
24
17
|
host:`+r.host+`
|
|
25
|
-
x-amz-content-sha256:`+
|
|
18
|
+
x-amz-content-sha256:`+e+`
|
|
26
19
|
x-amz-date:`+r.datetimeNow,r.sessionToken&&r.sessionToken.length>0&&(s+=`
|
|
27
20
|
x-amz-security-token:`+r.sessionToken),s+=`
|
|
28
21
|
|
|
29
22
|
`+i+`
|
|
30
|
-
`+
|
|
23
|
+
`+e;let o=(0,nn.sha256)(s),c=`AWS4-HMAC-SHA256
|
|
31
24
|
`+r.datetimeNow+`
|
|
32
25
|
`+r.dateNow+"/"+r.region+"/"+r.service+`/aws4_request
|
|
33
|
-
`+o,a="AWS4"+r.secretAccessKey,
|
|
26
|
+
`+o,a="AWS4"+r.secretAccessKey,f=nn.sha256.hmac.arrayBuffer(a,r.dateNow),m=nn.sha256.hmac.arrayBuffer(f,r.region),y=nn.sha256.hmac.arrayBuffer(m,r.service),b=nn.sha256.hmac.arrayBuffer(y,"aws4_request"),I=nn.sha256.hmac(b,c);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+I),n}var Ay=function(r,t,e,n=null,i=null){let s=vy(r,t,e),o={contentType:n,contentHash:i?nn.sha256.hex(i):null};return Iy(s,o)};function sn(r,t,e,n,i=null,s=null){((t==null?void 0:t.accessKeyId)||(t==null?void 0:t.sessionToken))&&(Ay(t,e,n,i,s).forEach((c,a)=>{r.setRequestHeader(a,c)}),i&&r.setRequestHeader("content-type",i))}function hf(r){if(r.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=r.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let e=r.substring(5,t);if(!e)throw new Error("URL needs to contain a bucket name");let n=r.substring(t);if(!n)throw new Error("URL needs to contain key");return{bucket:e,path:n}}function on(r,t){var n;let e=hf(t);return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?`${r==null?void 0:r.endpoint}/${e.bucket}`+e.path:"https://"+ff(r,t,e.bucket)+e.path}var ht={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=ht._fileInfoCache.get(t),[n,i,s]=ct(r,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(e==null?void 0:e.cacheEpoch)||0]);if(n!==0)return null;if(s===0)return e;let o=W(r,i,s);vt(r);let c=JSON.parse(o);if(c==null)return null;let a=pi(Vr({},c),{blob:null});return ht._fileInfoCache.set(t,a),a}catch(e){return null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=ct(r,"duckdb_web_get_global_file_info",["number"],[((t=ht._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return ht._globalFileInfo;let s=W(r,n,i);vt(r);let o=JSON.parse(s);return o==null?null:(ht._globalFileInfo=pi(Vr({},o),{blob:null}),ht._globalFileInfo)}catch(e){return null}},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn(`test for unknown feature: ${t}`),!1}},openFile:(r,t,e)=>{var n;try{ht._fileInfoCache.delete(t);let i=ht.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 3:case 4:{if(e&1&&e&2)throw new Error(`Opening file ${i.fileName} failed: cannot open file with both read and write flags set`);if(e&32)throw new Error(`Opening file ${i.fileName} failed: appending to HTTP/S3 files is not supported`);if(e&2){let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("HEAD",on(i.s3Config,i.dataUrl),!1),sn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.send(null),o.status!=200&&o.status!=404)throw new Error(`Opening file ${i.fileName} failed: Unexpected return status from server (${o.status})`);if(o.status==404&&!(e&8||e&16))throw new Error(`Opening file ${i.fileName} failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag.`);let c=r._malloc(1),a=new Uint8Array;r.HEAPU8.set(a,c);let f=r._malloc(2*8);return r.HEAPF64[(f>>3)+0]=1,r.HEAPF64[(f>>3)+1]=c,f}else if(e!=1)throw new Error(`Opening file ${i.fileName} failed: unsupported file flags: ${e}`);let s=null;try{let o=new XMLHttpRequest;i.dataProtocol==4?(o.open("HEAD",on(i.s3Config,i.dataUrl),!1),sn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.setRequestHeader("Range","bytes=0-"),o.send(null);let c=o.getResponseHeader("Content-Length");if(o.status==206&&c!==null){let a=r._malloc(16);return r.HEAPF64[(a>>3)+0]=+c,r.HEAPF64[(a>>3)+1]=0,a}}catch(o){s=o,console.warn(`HEAD request with range header failed: ${o}`)}if(i.allowFullHttpReads){console.warn(`falling back to full HTTP read for: ${i.dataUrl}`);let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("GET",on(i.s3Config,i.dataUrl),!1),sn(o,i.s3Config,i.dataUrl,"GET")):o.open("GET",i.dataUrl,!1),o.responseType="arraybuffer",o.send(null),o.status==200){let c=r._malloc(o.response.byteLength),a=new Uint8Array(o.response,0,o.response.byteLength);r.HEAPU8.set(a,c);let f=r._malloc(2*8);return r.HEAPF64[(f>>3)+0]=o.response.byteLength,r.HEAPF64[(f>>3)+1]=c,f}}if(s!=null)throw new Error(`Reading file ${i.fileName} failed with error: ${s}`);return 0}case 1:{let s=(n=ht._files)==null?void 0:n.get(i.fileName);if(s){let a=r._malloc(16);return r.HEAPF64[(a>>3)+0]=s.size,r.HEAPF64[(a>>3)+1]=0,a}console.warn(`Buffering missing file: ${i.fileName}`);let o=r._malloc(2*8),c=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=c,o}}}catch(i){console.error(i.toString()),vr(r,i.toString())}return 0},glob:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=ht.getGlobalFileInfo(r);i.open("HEAD",on(s==null?void 0:s.s3Config,n),!1),sn(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);if(i.send(null),i.status!=200&&i.status!==206){vr(r,`HEAD request failed: ${n}`);return}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[n])}}catch(n){return vr(r,n.toString()),0}},checkFile:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=ht.getGlobalFileInfo(r);i.open("HEAD",on(s==null?void 0:s.s3Config,n),!1),sn(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);return i.send(null),i.status==206||i.status==200}}catch(n){return!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{let e=ht.getFileInfo(r,t);switch(ht._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 3:case 4:break;case 1:return}},truncateFile:(r,t,e)=>{let n=ht.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 3:vr(r,"Cannot truncate a http file");return;case 4:vr(r,"Cannot truncate an s3 file");return;case 1:vr(r,"truncateFile not implemented");return}return 0},readFile(r,t,e,n,i){var s;try{let o=ht.getFileInfo(r,t);switch(o==null?void 0:o.dataProtocol){case 3:case 4:{if(!o.dataUrl)throw new Error(`Missing data URL for file ${t}`);try{let c=new XMLHttpRequest;if(o.dataProtocol==4?(c.open("GET",on(o==null?void 0:o.s3Config,o.dataUrl),!1),sn(c,o==null?void 0:o.s3Config,o.dataUrl,"GET")):c.open("GET",o.dataUrl,!1),c.responseType="arraybuffer",c.setRequestHeader("Range",`bytes=${i}-${i+n-1}`),c.send(null),c.status==206||c.status==200&&n==c.response.byteLength&&i==0){let a=new Uint8Array(c.response,0,Math.min(c.response.byteLength,n));return r.HEAPU8.set(a,e),a.byteLength}else throw c.status==200?new Error(`Range request for ${o.dataUrl} did not return a partial response: ${c.status} "${c.statusText}"`):new Error(`Range request for ${o.dataUrl} did returned non-success status: ${c.status} "${c.statusText}"`)}catch(c){throw new Error(`Range request for ${o.dataUrl} failed with error: ${c}"`)}}case 1:{let c=(s=ht._files)==null?void 0:s.get(o.fileName);if(!c)throw new Error(`No handle available for file: ${o.fileName}`);let a=c.slice(i,i+n),f=new Uint8Array(new FileReaderSync().readAsArrayBuffer(a));return r.HEAPU8.set(f,e),f.byteLength}}return 0}catch(o){return vr(r,o.toString()),0}},writeFile:(r,t,e,n,i)=>{let s=ht.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 3:return vr(r,"Cannot write to HTTP file"),0;case 4:{let o=r.HEAPU8.subarray(e,e+n),c=new XMLHttpRequest;return c.open("PUT",on(s==null?void 0:s.s3Config,s.dataUrl),!1),sn(c,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",o),c.send(o),n}case 1:return vr(r,"writefile not implemented"),0}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=ht.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 1:{if(!((n=ht._files)==null?void 0:n.get(e.fileName)))throw Error(`No handle available for file: ${e.fileName}`);return 0}case 3:case 4:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=W(r,t,e);return console.log(`checkDirectory: ${n}`),!1},createDirectory:(r,t,e)=>{let n=W(r,t,e);console.log(`createDirectory: ${n}`)},removeDirectory:(r,t,e)=>{let n=W(r,t,e);console.log(`removeDirectory: ${n}`)},listDirectoryEntries:(r,t,e)=>{let n=W(r,t,e);return console.log(`listDirectoryEntries: ${n}`),!1},moveFile:(r,t,e,n,i)=>{var a,f;let s=W(r,t,e),o=W(r,n,i),c=(a=ht._files)==null?void 0:a.get(s);c!==void 0&&(ht._files.delete(c),ht._files.set(o,c));for(let[m,y]of((f=ht._fileInfoCache)==null?void 0:f.entries())||[])if(y.dataUrl==s){ht._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{uf(ht,r,t,e,n,i,s,o)}};var wc=class extends Xo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new ta(this,ht,t,e).instantiate(n)}};function pf(){let r=new wc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}pf();return Up(xy);})();
|
|
34
27
|
/*! *****************************************************************************
|
|
35
28
|
Copyright (c) Microsoft Corporation.
|
|
36
29
|
|