anyfile-cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +1 -2
  2. package/chunks/{chunk-5OI4NQH7.mjs → chunk-HI7TURZM.mjs} +27 -3
  3. package/chunks/{chunk-UUN2DVDC.mjs → chunk-IGEGIF35.mjs} +178 -37
  4. package/cli-main.mjs +24 -5
  5. package/index.mjs +2 -2
  6. package/package.json +2 -2
  7. package/renderer-host/assets/{amf-CLBaywBr.js → amf-BkE--DNX.js} +1 -1
  8. package/renderer-host/assets/{animation-DnPo99To.js → animation-Dt0WW2cB.js} +1 -1
  9. package/renderer-host/assets/{archive-client-CyhEmSF7.js → archive-client-CL5yOgwH.js} +1 -1
  10. package/renderer-host/assets/{book-worker-DrtzCzPo.js → book-worker-DUt14LJO.js} +1 -1
  11. package/renderer-host/assets/{client-Dp-p4unY.js → client-CU2ERPtk.js} +1 -1
  12. package/renderer-host/assets/container-inspection-ekEPWWcy.js +1 -0
  13. package/renderer-host/assets/decode-hBroL8C1.js +1 -0
  14. package/renderer-host/assets/{decode-tiff-BuYdKp6p.js → decode-tiff-CP1xdrF_.js} +3 -3
  15. package/renderer-host/assets/{dual-track-playback-lNQyU1GR.js → dual-track-playback-CxjGms-W.js} +1 -1
  16. package/renderer-host/assets/{ffmpeg-playback-QcT_NwlK.js → ffmpeg-playback-DzCJz9Ny.js} +1 -1
  17. package/renderer-host/assets/{gltf-Cqq-xStc.js → gltf-PozNLKNg.js} +1 -1
  18. package/renderer-host/assets/{image-load-B1fNI3iO.js → image-load-SK3ULGWm.js} +1 -1
  19. package/renderer-host/assets/index-DtiyOy_J.js +2 -0
  20. package/renderer-host/assets/{lerc-CRhfhhOS.js → lerc-Cuor-Zm2.js} +1 -1
  21. package/renderer-host/assets/{mediabunny-viewer-BnJM6Yo0.js → mediabunny-viewer-BniHVEWJ.js} +1 -1
  22. package/renderer-host/assets/{model-D2YSoRt5.js → model-Drd3vqcF.js} +1 -1
  23. package/renderer-host/assets/{obj-DbUZkDna.js → obj-B3p81LL2.js} +1 -1
  24. package/renderer-host/assets/{off-CzR_R_Tf.js → off-QQbiKPTX.js} +1 -1
  25. package/renderer-host/assets/{ogg-viewer-CT31JEhG.js → ogg-viewer-Dc8K-tas.js} +1 -1
  26. package/renderer-host/assets/{paged-CX-N_Pzy.js → paged-C8AQD7sX.js} +1 -1
  27. package/renderer-host/assets/{ply-C-xrhUaO.js → ply-C3_RRA7n.js} +1 -1
  28. package/renderer-host/assets/{probe-asf-CvcaYQaR.js → probe-asf-C_UpCBly.js} +1 -1
  29. package/renderer-host/assets/{range-reader-9PeAh1Hv.js → range-reader-BMfLhWcp.js} +1 -1
  30. package/renderer-host/assets/{resources-WcZvn3-C.js → resources-6AmS6O5e.js} +1 -1
  31. package/renderer-host/assets/{safe-content-B61Ktgzp.js → safe-content-CWHf8jex.js} +1 -1
  32. package/renderer-host/assets/{scene-adapter-CmaaVwsM.js → scene-adapter-CaCLr1am.js} +1 -1
  33. package/renderer-host/assets/{skp-adapter-ByI1iX8S.js → skp-adapter-jl6q24fW.js} +1 -1
  34. package/renderer-host/assets/{src-DZE9IoBl.js → src-1Won7FxU.js} +1 -1
  35. package/renderer-host/assets/{src-CXRrmfb0.js → src-3RoHqOkA.js} +1 -1
  36. package/renderer-host/assets/{src-vPHMg1Fp.js → src-4zBOL6Jt.js} +1 -1
  37. package/renderer-host/assets/{src-CGx0nUS5.js → src-6v8-hoR3.js} +1 -1
  38. package/renderer-host/assets/{src-D3OyeoQs.js → src-8Jx9gbII.js} +1 -1
  39. package/renderer-host/assets/{src-Bu1cTJNz.js → src-B1WA0dRu.js} +1 -1
  40. package/renderer-host/assets/{src-j_mEQ9Os.js → src-B5ijbemo.js} +2 -2
  41. package/renderer-host/assets/{src-efHN2oAJ.js → src-B8DH2GJe.js} +3 -3
  42. package/renderer-host/assets/{src-B_o7QilB.js → src-B9t_iEO3.js} +1 -1
  43. package/renderer-host/assets/{src-CIDWSV97.js → src-BCC58C0X.js} +1 -1
  44. package/renderer-host/assets/{src-lYIAi6Hw.js → src-BCwENs26.js} +1 -1
  45. package/renderer-host/assets/{src-ClIHDiJ4.js → src-BEirBh4c.js} +1 -1
  46. package/renderer-host/assets/{src-CeGmxOTi.js → src-BHR6n7Fj.js} +1 -1
  47. package/renderer-host/assets/{src-BMrLVJyB.js → src-BIlLq0QT.js} +3 -3
  48. package/renderer-host/assets/{src-C5k8Ydia.js → src-BKlK1jcN.js} +1 -1
  49. package/renderer-host/assets/{src-C_1M1IDo.js → src-BN0FUJhs.js} +1 -1
  50. package/renderer-host/assets/{src-BEn15PBT.js → src-BWElAdlq.js} +1 -1
  51. package/renderer-host/assets/{src-QXdjrTaw.js → src-BXg11IjY.js} +1 -1
  52. package/renderer-host/assets/{src-BwZAUudm.js → src-BbBdnTjJ.js} +2 -2
  53. package/renderer-host/assets/{src-Bw-O8ujJ.js → src-BbFZbZsL.js} +2 -2
  54. package/renderer-host/assets/{src-DPm7_lsi.js → src-BdPbFRd-.js} +1 -1
  55. package/renderer-host/assets/{src-C2LKqLBA.js → src-BpbGaBrT.js} +1 -1
  56. package/renderer-host/assets/{src-DmzigsPg.js → src-BwIl76_H.js} +1 -1
  57. package/renderer-host/assets/{src-CHNgoDf9.js → src-C2e6QJIj.js} +1 -1
  58. package/renderer-host/assets/{src-Cyw_3X-L.js → src-C2gNidHF.js} +1 -1
  59. package/renderer-host/assets/{src-CBE5sqjl.js → src-CBUhG6W5.js} +1 -1
  60. package/renderer-host/assets/{src-Cvb3aCDG.js → src-CQDGi3Qa.js} +1 -1
  61. package/renderer-host/assets/{src-CBo2yHRk.js → src-CRLCRg0N.js} +1 -1
  62. package/renderer-host/assets/{src-Q-oKL3Dw.js → src-CS5rqxBy.js} +1 -1
  63. package/renderer-host/assets/{src-DrYYfoQO.js → src-CWZdSJQw.js} +1 -1
  64. package/renderer-host/assets/{src-B0zJlB0C.js → src-CXnpsVpU.js} +1 -1
  65. package/renderer-host/assets/{src-C4t_UvT8.js → src-CnhXvqQY.js} +1 -1
  66. package/renderer-host/assets/{src-CPUYqpHZ.js → src-CpExg0ZA.js} +1 -1
  67. package/renderer-host/assets/{src-C_HAB_bn.js → src-CrLmL3wU.js} +1 -1
  68. package/renderer-host/assets/{src-2X3Gt6Lk.js → src-CrYEJ5uz.js} +2 -2
  69. package/renderer-host/assets/{src-CifsQr3m.js → src-D-iIkSqZ.js} +1 -1
  70. package/renderer-host/assets/{src-p14e1hma.js → src-D6sH9uTT.js} +1 -1
  71. package/renderer-host/assets/{src-BPG8SYXq.js → src-D8zHDJh_.js} +1 -1
  72. package/renderer-host/assets/{src-D4cv_-u0.js → src-D9OFaPNV.js} +1 -1
  73. package/renderer-host/assets/{src-9k3CCYnZ.js → src-DCI_ff7c.js} +1 -1
  74. package/renderer-host/assets/{src-BB6xj1UK.js → src-DCrbiTpH.js} +1 -1
  75. package/renderer-host/assets/{src-TbSq3WSr.js → src-DK8DvtMd.js} +1 -1
  76. package/renderer-host/assets/{src-eVKtGm4Q.js → src-DWGlOVjt.js} +1 -1
  77. package/renderer-host/assets/{src-DpEmkhrn.js → src-DbvEX_Ct.js} +1 -1
  78. package/renderer-host/assets/{src-Ck1ekdEN.js → src-Dezc2dj1.js} +1 -1
  79. package/renderer-host/assets/{src-TuTvYAR6.js → src-Dh5VD1lL.js} +1 -1
  80. package/renderer-host/assets/{src-BydeR01n.js → src-DlwABqw5.js} +1 -1
  81. package/renderer-host/assets/{src-0QHjkpy0.js → src-DlxETlTh.js} +1 -1
  82. package/renderer-host/assets/{src-R4bKlaNn.js → src-Dmd6BvBh.js} +1 -1
  83. package/renderer-host/assets/{src-BuN3y1yE.js → src-DpgvaJNJ.js} +1 -1
  84. package/renderer-host/assets/{src-C6w9FGSB.js → src-DpjRB2sv.js} +1 -1
  85. package/renderer-host/assets/{src-Blx9jp9x.js → src-Dvn41FR7.js} +1 -1
  86. package/renderer-host/assets/{src-CVc67mQv.js → src-DwcPYp7X.js} +1 -1
  87. package/renderer-host/assets/{src-BZrNtUNO.js → src-HUxhcDlO.js} +1 -1
  88. package/renderer-host/assets/{src-ORHZWeVF.js → src-Jhqg3J8L.js} +2 -2
  89. package/renderer-host/assets/{src-DsVDi0pr.js → src-MO5bLsLj.js} +1 -1
  90. package/renderer-host/assets/{src-n2gsf381.js → src-N8XBQaK4.js} +1 -1
  91. package/renderer-host/assets/{src-BgUXah8O.js → src-XZ_0U972.js} +1 -1
  92. package/renderer-host/assets/{src-5ZJshveh.js → src-Y6mXl4vh.js} +3 -3
  93. package/renderer-host/assets/{src-B4jorJ2U.js → src-b9aXVJde.js} +1 -1
  94. package/renderer-host/assets/{src-CAdKRH5C.js → src-d2U6neq8.js} +1 -1
  95. package/renderer-host/assets/{src-Bl5Lv4-d.js → src-jUGjKzOV.js} +1 -1
  96. package/renderer-host/assets/{src-BgM1jpe4.js → src-vOBd-1zk.js} +1 -1
  97. package/renderer-host/assets/{src-0DTp6SF8.js → src-yCrAObB-.js} +1 -1
  98. package/renderer-host/assets/{src-BLndk63N.js → src-zrBiCtay.js} +1 -1
  99. package/renderer-host/assets/{stl-adapter-D1eozFH9.js → stl-adapter-CLkWHoOn.js} +1 -1
  100. package/renderer-host/assets/{three-mf-CbcWWdM8.js → three-mf-BSrcsdQD.js} +1 -1
  101. package/renderer-host/assets/{webm-_wYh_V7u.js → webm-14HHwfWy.js} +1 -1
  102. package/renderer-host/assets/{zip-core-base-CDv8KjIR.js → zip-core-base-DD8akpjq.js} +1 -1
  103. package/renderer-host/assets/zip-core-custom-CfPFs1lw.js +1 -0
  104. package/renderer-host/assets/{zip-source-C5dFTDt7.js → zip-source-CLF3Hfcg.js} +1 -1
  105. package/renderer-host/index.html +1 -1
  106. package/worker.mjs +3 -2
  107. package/renderer-host/assets/container-inspection-DZoaDYQR.js +0 -1
  108. package/renderer-host/assets/decode-D5vB6JN8.js +0 -1
  109. package/renderer-host/assets/index-BCxD9rBl.js +0 -2
  110. package/renderer-host/assets/src-2tfD0huT.js +0 -16
  111. package/renderer-host/assets/zip-core-custom-D3VVVj-J.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./src-rJN_jaC5.js";import{a as t,n}from"./index-BCxD9rBl.js";import{t as r}from"./src-C9Uz3C-q.js";function i(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function a(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function o(e){return this instanceof o?(this.v=e,this):new o(e)}function s(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,s),i[Symbol.asyncIterator]=function(){return this},i;function s(e){return function(t){return Promise.resolve(t).then(e,te)}}function c(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||l(e,t)})},t&&(i[e]=t(i[e])))}function l(e,t){try{u(r[e](t))}catch(e){ne(a[0][3],e)}}function u(e){e.value instanceof o?Promise.resolve(e.value.v).then(ee,te):ne(a[0][2],e)}function ee(e){l(`next`,e)}function te(e){l(`throw`,e)}function ne(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function c(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:o(e[r](t)),done:!1}:i?i(t):t}:i}}function l(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof a==`function`?a(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}var u=new TextDecoder(`utf-8`),ee=e=>u.decode(e),te=new TextEncoder,ne=e=>te.encode(e),re=e=>typeof e==`number`,ie=e=>typeof e==`boolean`,d=e=>typeof e==`function`,f=e=>e!=null&&Object(e)===e,ae=e=>f(e)&&d(e.then),oe=e=>f(e)&&d(e[Symbol.iterator]),se=e=>f(e)&&d(e[Symbol.asyncIterator]),ce=e=>f(e)&&f(e.schema),le=e=>f(e)&&`done`in e&&`value`in e,ue=e=>f(e)&&d(e.stat)&&re(e.fd),de=e=>f(e)&&me(e.body),fe=e=>`_getDOMStream`in e&&`_getNodeStream`in e,pe=e=>f(e)&&d(e.abort)&&d(e.getWriter)&&!fe(e),me=e=>f(e)&&d(e.cancel)&&d(e.getReader)&&!fe(e),he=e=>f(e)&&d(e.end)&&d(e.write)&&ie(e.writable)&&!fe(e),ge=e=>f(e)&&d(e.read)&&d(e.pipe)&&ie(e.readable)&&!fe(e),_e=e=>f(e)&&d(e.clear)&&d(e.bytes)&&d(e.position)&&d(e.setPosition)&&d(e.capacity)&&d(e.getBufferIdentifier)&&d(e.createLong),ve=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function ye(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function be(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function xe(e,t){let n=ye(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?be(o,a,s):o=a;break}be(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function p(e,t){let n=le(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=ne(n)),n instanceof ArrayBuffer||n instanceof ve?new e(n):_e(n)?p(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var Se=e=>p(Int32Array,e),Ce=e=>p(BigInt64Array,e),m=e=>p(Uint8Array,e),we=e=>(e.next(),e);function*Te(e,t){let n=function*(e){yield e};return yield*we((function*(t){let n=null;do n=t.next(yield p(e,n));while(!n.done)})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ve?n(t):oe(t)?t:n(t))[Symbol.iterator]())),new e}var Ee=e=>Te(Uint8Array,e);function De(e,t){return s(this,arguments,function*(){if(ae(t))return yield o(yield o(yield*c(l(De(e,yield o(t))))));let n=function(e){return s(this,arguments,function*(){yield yield o(yield o(e))})};return yield o(yield*c(l(we((function(t){return s(this,arguments,function*(){let n=null;do n=yield o(t.next(yield yield o(p(e,n))));while(!n.done)})})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ve?n(t):oe(t)?function(e){return s(this,arguments,function*(){yield o(yield*c(l(we((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):se(t)?t:n(t))[Symbol.asyncIterator]()))))),yield o(new e)})}var Oe=e=>De(Uint8Array,e);function ke(e,t,n){if(e!==0){n=n.slice(0,t);for(let t=-1,r=n.length;++t<r;)n[t]+=e}return n.subarray(0,t)}function Ae(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var je={fromIterable(e){return Me(Ne(e))},fromAsyncIterable(e){return Me(Pe(e))},fromDOMStream(e){return Me(Fe(e))},fromNodeStream(e){return Me(Re(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}},Me=e=>(e.next(),e);function*Ne(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?xe(r,o)[0]:([i,r,s]=xe(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=Ee(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){(n=!0)&&typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function Pe(e){return s(this,arguments,function*(){let t,n=!1,r=[],i,a,s,c=0;function l(){return a===`peek`?xe(r,s)[0]:([i,r,c]=xe(r,s),i)}({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0});let u=Oe(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(s-c)?yield o(u.next()):yield o(u.next(s-c)),!t&&i.byteLength>0&&(r.push(i),c+=i.byteLength),t||s<=c)do({cmd:a,size:s}=yield yield o(l()));while(s<c);while(!t)}catch(e){(n=!0)&&typeof u.throw==`function`&&(yield o(u.throw(e)))}finally{n===!1&&typeof u.return==`function`&&(yield o(u.return(new Uint8Array)))}return yield o(null)})}function Fe(e){return s(this,arguments,function*(){let t=!1,n=!1,r=[],i,a,s,c=0;function l(){return a===`peek`?xe(r,s)[0]:([i,r,c]=xe(r,s),i)}({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0});let u=new Ie(e);try{do if({done:t,value:i}=Number.isNaN(s-c)?yield o(u.read()):yield o(u.read(s-c)),!t&&i.byteLength>0&&(r.push(m(i)),c+=i.byteLength),t||s<=c)do({cmd:a,size:s}=yield yield o(l()));while(s<c);while(!t)}catch(e){(n=!0)&&(yield o(u.cancel(e)))}finally{n===!1?yield o(u.cancel()):e.locked&&u.releaseLock()}return yield o(null)})}var Ie=class{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return i(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 i(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=m(t)),t})}},Le=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Re(e){return s(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,s,c=0,l=[],u;function ee(){return a===`peek`?xe(l,s)[0]:([u,l,c]=xe(l,s),u)}if({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0},e.isTTY)return yield yield o(new Uint8Array),yield o(null);try{t[0]=Le(e,`end`),t[1]=Le(e,`error`);do{if(t[2]=Le(e,`readable`),[n,i]=yield o(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(s-c)?(u=m(e.read(s-c)),u.byteLength<s-c&&(u=m(e.read()))):u=m(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),r||s<=c)do({cmd:a,size:s}=yield yield o(ee()));while(s<c)}while(!r)}finally{yield o(te(t,n===`error`?i:null))}return yield o(null);function te(t,n){return u=l=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var h;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(h||={});var g;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(g||={});var _;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(_||={});var v;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(v||={});var y;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(y||={});var ze;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(ze||={});var Be=new Int32Array(2),Ve=new Float32Array(Be.buffer),He=new Float64Array(Be.buffer),Ue=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,We;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(We||={});var Ge=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Be[0]=this.readInt32(e),Ve[0]}readFloat64(e){return Be[+!Ue]=this.readInt32(e),Be[+!!Ue]=this.readInt32(e+4),He[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Ve[0]=t,this.writeInt32(e,Be[0])}writeFloat64(e,t){He[0]=t,this.writeInt32(e,Be[+!Ue]),this.writeInt32(e+4,Be[+!!Ue])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===We.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},Ke=class e{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;t=e||1024,this.bb=Ge.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=Ge.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)throw TypeError(`FlatBuffers: file identifier must be length 4`);for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},qe;(function(e){e[e.BUFFER=0]=`BUFFER`})(qe||={});var Je;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(Je||={});var Ye=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Je.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):qe.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Je.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,qe.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},Xe=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Ze=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Qe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ze).__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 Xe).__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 Ye).__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,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static endRecordBatch(e){return e.endObject()}},$e=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Qe).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},et;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(et||={});var tt;(function(e){e[e.DenseArray=0]=`DenseArray`})(tt||={});var nt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},rt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new nt).__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):tt.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,tt.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},b=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},it=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},at=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},ot=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,v.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},st=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,y.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},lt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},ut=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},dt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,_.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},ft=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ze.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ze.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},pt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},mt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},ht=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},gt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},_t=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},vt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},yt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.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,y.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},bt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.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,y.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},xt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):g.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,g.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},St=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},x;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`})(x||={});var S=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):x.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 rt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new b).__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,x.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()}},Ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):et.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new S).__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 b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,et.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(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},C;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(C||={});var w;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`})(w||={});var wt;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(wt||={});var Tt=void 0;function Et(e){if(e===null)return`null`;if(e===Tt)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>Et(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function T(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Dt(e,t){return T(e/t)+T(e%t)/T(t)}var Ot=Symbol.for(`isArrowBigNum`);function E(e,...t){return t.length===0?Object.setPrototypeOf(p(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}E.prototype[Ot]=!0,E.prototype.toJSON=function(){return`"${Pt(this)}"`},E.prototype.valueOf=function(e){return Nt(this,e)},E.prototype.toString=function(){return Pt(this)},E.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return Nt(this);case`string`:return Pt(this);case`default`:return Ft(this)}return Pt(this)};function kt(...e){return E.apply(this,e)}function At(...e){return E.apply(this,e)}function jt(...e){return E.apply(this,e)}Object.setPrototypeOf(kt.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(At.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(jt.prototype,Object.create(Uint32Array.prototype)),Object.assign(kt.prototype,E.prototype,{constructor:kt,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(At.prototype,E.prototype,{constructor:At,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(jt.prototype,E.prototype,{constructor:jt,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Mt=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function Nt(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^Mt)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`){let e=BigInt(10**t),n=c/e,r=c%e;return T(n)+T(r)/T(e)}return T(c)}function Pt(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return It(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return It(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${It(t)}`}function Ft(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Pt(e)}function It(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var Lt=class e{static new(e,t){switch(t){case!0:return new kt(e);case!1:return new At(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new kt(e)}return e.byteLength===16?new jt(e):new At(e)}static signed(e){return new kt(e)}static unsigned(e){return new At(e)}static decimal(e){return new jt(e)}constructor(t,n){return e.new(t,n)}},Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,D=class e{static isNull(e){return e?.typeId===w.Null}static isInt(e){return e?.typeId===w.Int}static isFloat(e){return e?.typeId===w.Float}static isBinary(e){return e?.typeId===w.Binary}static isLargeBinary(e){return e?.typeId===w.LargeBinary}static isUtf8(e){return e?.typeId===w.Utf8}static isLargeUtf8(e){return e?.typeId===w.LargeUtf8}static isBool(e){return e?.typeId===w.Bool}static isDecimal(e){return e?.typeId===w.Decimal}static isDate(e){return e?.typeId===w.Date}static isTime(e){return e?.typeId===w.Time}static isTimestamp(e){return e?.typeId===w.Timestamp}static isInterval(e){return e?.typeId===w.Interval}static isDuration(e){return e?.typeId===w.Duration}static isList(e){return e?.typeId===w.List}static isStruct(e){return e?.typeId===w.Struct}static isUnion(e){return e?.typeId===w.Union}static isFixedSizeBinary(e){return e?.typeId===w.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===w.FixedSizeList}static isMap(e){return e?.typeId===w.Map}static isDictionary(e){return e?.typeId===w.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===g.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===g.Sparse}constructor(e){this.typeId=e}};Rt=Symbol.toStringTag,D[Rt]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=`DataType`))(D.prototype);var sn=class extends D{constructor(){super(w.Null)}toString(){return`Null`}};zt=Symbol.toStringTag,sn[zt]=(e=>e[Symbol.toStringTag]=`Null`)(sn.prototype);var O=class extends D{constructor(e,t){super(w.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};Bt=Symbol.toStringTag,O[Bt]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(O.prototype);var cn=class extends O{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ln=class extends O{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},un=class extends O{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},dn=class extends O{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},fn=class extends O{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},pn=class extends O{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},mn=class extends O{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},hn=class extends O{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(cn.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(ln.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(un.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(dn.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(fn.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(pn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(mn.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(hn.prototype,"ArrayType",{value:BigUint64Array});var gn=class extends D{constructor(e){super(w.Float),this.precision=e}get ArrayType(){switch(this.precision){case _.HALF:return Uint16Array;case _.SINGLE:return Float32Array;case _.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Vt=Symbol.toStringTag,gn[Vt]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(gn.prototype);var _n=class extends gn{constructor(){super(_.HALF)}},vn=class extends gn{constructor(){super(_.SINGLE)}},yn=class extends gn{constructor(){super(_.DOUBLE)}};Object.defineProperty(_n.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(vn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(yn.prototype,"ArrayType",{value:Float64Array});var bn=class extends D{constructor(){super(w.Binary)}toString(){return`Binary`}};Ht=Symbol.toStringTag,bn[Ht]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(bn.prototype);var xn=class extends D{constructor(){super(w.LargeBinary)}toString(){return`LargeBinary`}};Ut=Symbol.toStringTag,xn[Ut]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(xn.prototype);var Sn=class extends D{constructor(){super(w.Utf8)}toString(){return`Utf8`}};Wt=Symbol.toStringTag,Sn[Wt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(Sn.prototype);var Cn=class extends D{constructor(){super(w.LargeUtf8)}toString(){return`LargeUtf8`}};Gt=Symbol.toStringTag,Cn[Gt]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(Cn.prototype);var wn=class extends D{constructor(){super(w.Bool)}toString(){return`Bool`}};Kt=Symbol.toStringTag,wn[Kt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(wn.prototype);var Tn=class extends D{constructor(e,t,n=128){super(w.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};qt=Symbol.toStringTag,Tn[qt]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(Tn.prototype);var En=class extends D{constructor(e){super(w.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${v[this.unit]}>`}get ArrayType(){return this.unit===v.DAY?Int32Array:BigInt64Array}};Jt=Symbol.toStringTag,En[Jt]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(En.prototype);var Dn=class extends D{constructor(e,t){super(w.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${y[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Yt=Symbol.toStringTag,Dn[Yt]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(Dn.prototype);var On=class extends D{constructor(e,t){super(w.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${y[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};Xt=Symbol.toStringTag,On[Xt]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(On.prototype);var kn=class extends D{constructor(e){super(w.Interval),this.unit=e}toString(){return`Interval<${ze[this.unit]}>`}};Zt=Symbol.toStringTag,kn[Zt]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(kn.prototype);var An=class extends D{constructor(e){super(w.Duration),this.unit=e}toString(){return`Duration<${y[this.unit]}>`}};Qt=Symbol.toStringTag,An[Qt]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(An.prototype);var jn=class extends D{constructor(e){super(w.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$t=Symbol.toStringTag,jn[$t]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(jn.prototype);var k=class extends D{constructor(e){super(w.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};en=Symbol.toStringTag,k[en]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(k.prototype);var Mn=class extends D{constructor(e,t,n){super(w.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};tn=Symbol.toStringTag,Mn[tn]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(Mn.prototype);var Nn=class extends D{constructor(e){super(w.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};nn=Symbol.toStringTag,Nn[nn]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(Nn.prototype);var Pn=class extends D{constructor(e,t){super(w.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};rn=Symbol.toStringTag,Pn[rn]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(Pn.prototype);var Fn=class extends D{constructor(e,t=!1){if(super(w.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};an=Symbol.toStringTag,Fn[an]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(Fn.prototype);var In=(e=>()=>++e)(-1),Ln=class extends D{constructor(e,t,n,r){super(w.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?In():T(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};on=Symbol.toStringTag,Ln[on]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(Ln.prototype);function Rn(e){let t=e;switch(e.typeId){case w.Decimal:return e.bitWidth/32;case w.Interval:return 1+t.unit;case w.FixedSizeList:return t.listSize;case w.FixedSizeBinary:return t.byteWidth;default:return 1}}var A=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return zn(this,e,t)}getVisitFnByTypeId(e,t=!0){return Bn(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(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}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function zn(e,t,n=!0){return typeof t==`number`?Bn(e,t,n):typeof t==`string`&&t in w?Bn(e,w[t],n):t&&t instanceof D?Bn(e,Vn(t),n):t?.type&&t.type instanceof D?Bn(e,Vn(t.type),n):Bn(e,w.NONE,n)}function Bn(e,t,n=!0){let r=null;switch(t){case w.Null:r=e.visitNull;break;case w.Bool:r=e.visitBool;break;case w.Int:r=e.visitInt;break;case w.Int8:r=e.visitInt8||e.visitInt;break;case w.Int16:r=e.visitInt16||e.visitInt;break;case w.Int32:r=e.visitInt32||e.visitInt;break;case w.Int64:r=e.visitInt64||e.visitInt;break;case w.Uint8:r=e.visitUint8||e.visitInt;break;case w.Uint16:r=e.visitUint16||e.visitInt;break;case w.Uint32:r=e.visitUint32||e.visitInt;break;case w.Uint64:r=e.visitUint64||e.visitInt;break;case w.Float:r=e.visitFloat;break;case w.Float16:r=e.visitFloat16||e.visitFloat;break;case w.Float32:r=e.visitFloat32||e.visitFloat;break;case w.Float64:r=e.visitFloat64||e.visitFloat;break;case w.Utf8:r=e.visitUtf8;break;case w.LargeUtf8:r=e.visitLargeUtf8;break;case w.Binary:r=e.visitBinary;break;case w.LargeBinary:r=e.visitLargeBinary;break;case w.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case w.Date:r=e.visitDate;break;case w.DateDay:r=e.visitDateDay||e.visitDate;break;case w.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case w.Timestamp:r=e.visitTimestamp;break;case w.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case w.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case w.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case w.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case w.Time:r=e.visitTime;break;case w.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case w.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case w.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case w.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case w.Decimal:r=e.visitDecimal;break;case w.List:r=e.visitList;break;case w.Struct:r=e.visitStruct;break;case w.Union:r=e.visitUnion;break;case w.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case w.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case w.Dictionary:r=e.visitDictionary;break;case w.Interval:r=e.visitInterval;break;case w.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case w.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case w.Duration:r=e.visitDuration;break;case w.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case w.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case w.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case w.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case w.FixedSizeList:r=e.visitFixedSizeList;break;case w.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${w[t]}'`)}function Vn(e){switch(e.typeId){case w.Null:return w.Null;case w.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?w.Int8:w.Uint8;case 16:return n?w.Int16:w.Uint16;case 32:return n?w.Int32:w.Uint32;case 64:return n?w.Int64:w.Uint64}return w.Int}case w.Float:switch(e.precision){case _.HALF:return w.Float16;case _.SINGLE:return w.Float32;case _.DOUBLE:return w.Float64}return w.Float;case w.Binary:return w.Binary;case w.LargeBinary:return w.LargeBinary;case w.Utf8:return w.Utf8;case w.LargeUtf8:return w.LargeUtf8;case w.Bool:return w.Bool;case w.Decimal:return w.Decimal;case w.Time:switch(e.unit){case y.SECOND:return w.TimeSecond;case y.MILLISECOND:return w.TimeMillisecond;case y.MICROSECOND:return w.TimeMicrosecond;case y.NANOSECOND:return w.TimeNanosecond}return w.Time;case w.Timestamp:switch(e.unit){case y.SECOND:return w.TimestampSecond;case y.MILLISECOND:return w.TimestampMillisecond;case y.MICROSECOND:return w.TimestampMicrosecond;case y.NANOSECOND:return w.TimestampNanosecond}return w.Timestamp;case w.Date:switch(e.unit){case v.DAY:return w.DateDay;case v.MILLISECOND:return w.DateMillisecond}return w.Date;case w.Interval:switch(e.unit){case ze.DAY_TIME:return w.IntervalDayTime;case ze.YEAR_MONTH:return w.IntervalYearMonth}return w.Interval;case w.Duration:switch(e.unit){case y.SECOND:return w.DurationSecond;case y.MILLISECOND:return w.DurationMillisecond;case y.MICROSECOND:return w.DurationMicrosecond;case y.NANOSECOND:return w.DurationNanosecond}return w.Duration;case w.Map:return w.Map;case w.List:return w.List;case w.Struct:return w.Struct;case w.Union:switch(e.mode){case g.Dense:return w.DenseUnion;case g.Sparse:return w.SparseUnion}return w.Union;case w.FixedSizeBinary:return w.FixedSizeBinary;case w.FixedSizeList:return w.FixedSizeList;case w.Dictionary:return w.Dictionary}throw Error(`Unrecognized type '${w[e.typeId]}'`)}A.prototype.visitInt8=null,A.prototype.visitInt16=null,A.prototype.visitInt32=null,A.prototype.visitInt64=null,A.prototype.visitUint8=null,A.prototype.visitUint16=null,A.prototype.visitUint32=null,A.prototype.visitUint64=null,A.prototype.visitFloat16=null,A.prototype.visitFloat32=null,A.prototype.visitFloat64=null,A.prototype.visitDateDay=null,A.prototype.visitDateMillisecond=null,A.prototype.visitTimestampSecond=null,A.prototype.visitTimestampMillisecond=null,A.prototype.visitTimestampMicrosecond=null,A.prototype.visitTimestampNanosecond=null,A.prototype.visitTimeSecond=null,A.prototype.visitTimeMillisecond=null,A.prototype.visitTimeMicrosecond=null,A.prototype.visitTimeNanosecond=null,A.prototype.visitDenseUnion=null,A.prototype.visitSparseUnion=null,A.prototype.visitIntervalDayTime=null,A.prototype.visitIntervalYearMonth=null,A.prototype.visitDuration=null,A.prototype.visitDurationSecond=null,A.prototype.visitDurationMillisecond=null,A.prototype.visitDurationMicrosecond=null,A.prototype.visitDurationNanosecond=null;var Hn=new Float64Array(1),Un=new Uint32Array(Hn.buffer);function Wn(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Gn(e){if(e!==e)return 32256;Hn[0]=e;let t=(Un[1]&2147483648)>>16&65535,n=Un[1]&2146435072,r=0;return n>=1089470464?Un[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Un[1]&1048575)>>10):n<=1056964608?(r=1048576+(Un[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Un[1]&1048575)+512>>10),t|n|r&65535}var j=class extends A{};function M(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Kn=(e,t,n)=>{e[t]=Math.floor(n/864e5)},qn=(e,t,n,r)=>{if(n+1<t.length){let i=T(t[n]),a=T(t[n+1]);e.set(r.subarray(0,a-i),i)}},Jn=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Yn=({values:e},t,n)=>{e[t]=n},Xn=({values:e},t,n)=>{e[t]=n},Zn=({values:e},t,n)=>{e[t]=Gn(n)},Qn=(e,t,n)=>{switch(e.type.precision){case _.HALF:return Zn(e,t,n);case _.SINGLE:case _.DOUBLE:return Xn(e,t,n)}},$n=({values:e},t,n)=>{Kn(e,t,n.valueOf())},er=({values:e},t,n)=>{e[t]=BigInt(n)},tr=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},nr=({values:e,valueOffsets:t},n,r)=>qn(e,t,n,r),rr=({values:e,valueOffsets:t},n,r)=>qn(e,t,n,ne(r)),ir=(e,t,n)=>{e.type.unit===v.DAY?$n(e,t,n):er(e,t,n)},ar=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},or=({values:e},t,n)=>{e[t]=BigInt(n)},sr=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},cr=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},lr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return ar(e,t,n);case y.MILLISECOND:return or(e,t,n);case y.MICROSECOND:return sr(e,t,n);case y.NANOSECOND:return cr(e,t,n)}},ur=({values:e},t,n)=>{e[t]=n},dr=({values:e},t,n)=>{e[t]=n},fr=({values:e},t,n)=>{e[t]=n},pr=({values:e},t,n)=>{e[t]=n},mr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return ur(e,t,n);case y.MILLISECOND:return dr(e,t,n);case y.MICROSECOND:return fr(e,t,n);case y.NANOSECOND:return pr(e,t,n)}},hr=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},gr=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=N.getVisitFn(r);if(Array.isArray(n))for(let e=-1,o=i[t],s=i[t+1];o<s;)a(r,o++,n[++e]);else for(let e=-1,o=i[t],s=i[t+1];o<s;)a(r,o++,n.get(++e))},_r=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=N.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},vr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),yr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),br=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),xr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),Sr=(e,t,n)=>{let r=e.type.children.map(e=>N.getVisitFn(e.type)),i=n instanceof Map?br(t,n):n instanceof U?yr(t,n):Array.isArray(n)?vr(t,n):xr(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},Cr=(e,t,n)=>{e.type.mode===g.Dense?wr(e,t,n):Tr(e,t,n)},wr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];N.visit(i,e.valueOffsets[t],n)},Tr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];N.visit(i,t,n)},Er=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},Dr=(e,t,n)=>{e.type.unit===ze.DAY_TIME?Or(e,t,n):kr(e,t,n)},Or=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},kr=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ar=({values:e},t,n)=>{e[t]=n},jr=({values:e},t,n)=>{e[t]=n},Mr=({values:e},t,n)=>{e[t]=n},Nr=({values:e},t,n)=>{e[t]=n},Pr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return Ar(e,t,n);case y.MILLISECOND:return jr(e,t,n);case y.MICROSECOND:return Mr(e,t,n);case y.NANOSECOND:return Nr(e,t,n)}},Fr=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=N.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};j.prototype.visitBool=M(Jn),j.prototype.visitInt=M(Yn),j.prototype.visitInt8=M(Yn),j.prototype.visitInt16=M(Yn),j.prototype.visitInt32=M(Yn),j.prototype.visitInt64=M(Yn),j.prototype.visitUint8=M(Yn),j.prototype.visitUint16=M(Yn),j.prototype.visitUint32=M(Yn),j.prototype.visitUint64=M(Yn),j.prototype.visitFloat=M(Qn),j.prototype.visitFloat16=M(Zn),j.prototype.visitFloat32=M(Xn),j.prototype.visitFloat64=M(Xn),j.prototype.visitUtf8=M(rr),j.prototype.visitLargeUtf8=M(rr),j.prototype.visitBinary=M(nr),j.prototype.visitLargeBinary=M(nr),j.prototype.visitFixedSizeBinary=M(tr),j.prototype.visitDate=M(ir),j.prototype.visitDateDay=M($n),j.prototype.visitDateMillisecond=M(er),j.prototype.visitTimestamp=M(lr),j.prototype.visitTimestampSecond=M(ar),j.prototype.visitTimestampMillisecond=M(or),j.prototype.visitTimestampMicrosecond=M(sr),j.prototype.visitTimestampNanosecond=M(cr),j.prototype.visitTime=M(mr),j.prototype.visitTimeSecond=M(ur),j.prototype.visitTimeMillisecond=M(dr),j.prototype.visitTimeMicrosecond=M(fr),j.prototype.visitTimeNanosecond=M(pr),j.prototype.visitDecimal=M(hr),j.prototype.visitList=M(gr),j.prototype.visitStruct=M(Sr),j.prototype.visitUnion=M(Cr),j.prototype.visitDenseUnion=M(wr),j.prototype.visitSparseUnion=M(Tr),j.prototype.visitDictionary=M(Er),j.prototype.visitInterval=M(Dr),j.prototype.visitIntervalDayTime=M(Or),j.prototype.visitIntervalYearMonth=M(kr),j.prototype.visitDuration=M(Pr),j.prototype.visitDurationSecond=M(Ar),j.prototype.visitDurationMillisecond=M(jr),j.prototype.visitDurationMicrosecond=M(Mr),j.prototype.visitDurationNanosecond=M(Nr),j.prototype.visitFixedSizeList=M(Fr),j.prototype.visitMap=M(_r);var N=new j,Ir=Symbol.for(`parent`),Lr=Symbol.for(`rowIndex`),Rr=class{constructor(e,t){return this[Ir]=e,this[Lr]=t,new Proxy(this,new Br)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Lr],t=this[Ir],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=I.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${Et(e)}: ${Et(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new zr(this[Ir],this[Lr])}},zr=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,I.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Rr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ir]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Lr]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Br=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Ir].type.children.map(e=>e.name)}has(e,t){return e[Ir].type.children.findIndex(e=>e.name===t)!==-1}getOwnPropertyDescriptor(e,t){if(e[Ir].type.children.findIndex(e=>e.name===t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Ir].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=I.visit(e[Ir].children[n],e[Lr]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Ir].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(N.visit(e[Ir].children[r],e[Lr],n),Reflect.set(e,t,n))}},P=class extends A{};function F(e){return(t,n)=>t.getValid(n)?e(t,n):null}var Vr=(e,t)=>864e5*e[t],Hr=(e,t)=>null,Ur=(e,t,n)=>{if(n+1>=t.length)return null;let r=T(t[n]),i=T(t[n+1]);return e.subarray(r,i)},Wr=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},Gr=({values:e},t)=>Vr(e,t),Kr=({values:e},t)=>T(e[t]),qr=({stride:e,values:t},n)=>t[e*n],Jr=({stride:e,values:t},n)=>Wn(t[e*n]),Yr=({values:e},t)=>e[t],Xr=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Zr=({values:e,valueOffsets:t},n)=>Ur(e,t,n),Qr=({values:e,valueOffsets:t},n)=>{let r=Ur(e,t,n);return r===null?null:ee(r)},$r=({values:e},t)=>e[t],ei=({type:e,values:t},n)=>e.precision===_.HALF?Wn(t[n]):t[n],ti=(e,t)=>e.type.unit===v.DAY?Gr(e,t):Kr(e,t),ni=({values:e},t)=>1e3*T(e[t]),ri=({values:e},t)=>T(e[t]),ii=({values:e},t)=>Dt(e[t],BigInt(1e3)),ai=({values:e},t)=>Dt(e[t],BigInt(1e6)),oi=(e,t)=>{switch(e.type.unit){case y.SECOND:return ni(e,t);case y.MILLISECOND:return ri(e,t);case y.MICROSECOND:return ii(e,t);case y.NANOSECOND:return ai(e,t)}},si=({values:e},t)=>e[t],ci=({values:e},t)=>e[t],li=({values:e},t)=>e[t],ui=({values:e},t)=>e[t],di=(e,t)=>{switch(e.type.unit){case y.SECOND:return si(e,t);case y.MILLISECOND:return ci(e,t);case y.MICROSECOND:return li(e,t);case y.NANOSECOND:return ui(e,t)}},fi=({values:e,stride:t},n)=>Lt.decimal(e.subarray(t*n,t*(n+1))),pi=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:a,[t*r+1]:o}=n;return new U([i[0].slice(a,o-a)])},mi=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new Ni(o.slice(i,a-i))},hi=(e,t)=>new Rr(e,t),gi=(e,t)=>e.type.mode===g.Dense?_i(e,t):vi(e,t),_i=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return I.visit(r,e.valueOffsets[t])},vi=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return I.visit(r,t)},yi=(e,t)=>e.dictionary?.get(e.values[t]),bi=(e,t)=>e.type.unit===ze.DAY_TIME?xi(e,t):Si(e,t),xi=({values:e},t)=>e.subarray(2*t,2*(t+1)),Si=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Ci=({values:e},t)=>e[t],wi=({values:e},t)=>e[t],Ti=({values:e},t)=>e[t],Ei=({values:e},t)=>e[t],Di=(e,t)=>{switch(e.type.unit){case y.SECOND:return Ci(e,t);case y.MILLISECOND:return wi(e,t);case y.MICROSECOND:return Ti(e,t);case y.NANOSECOND:return Ei(e,t)}},Oi=(e,t)=>{let{stride:n,children:r}=e;return new U([r[0].slice(t*n,n)])};P.prototype.visitNull=F(Hr),P.prototype.visitBool=F(Wr),P.prototype.visitInt=F($r),P.prototype.visitInt8=F(qr),P.prototype.visitInt16=F(qr),P.prototype.visitInt32=F(qr),P.prototype.visitInt64=F(Yr),P.prototype.visitUint8=F(qr),P.prototype.visitUint16=F(qr),P.prototype.visitUint32=F(qr),P.prototype.visitUint64=F(Yr),P.prototype.visitFloat=F(ei),P.prototype.visitFloat16=F(Jr),P.prototype.visitFloat32=F(qr),P.prototype.visitFloat64=F(qr),P.prototype.visitUtf8=F(Qr),P.prototype.visitLargeUtf8=F(Qr),P.prototype.visitBinary=F(Zr),P.prototype.visitLargeBinary=F(Zr),P.prototype.visitFixedSizeBinary=F(Xr),P.prototype.visitDate=F(ti),P.prototype.visitDateDay=F(Gr),P.prototype.visitDateMillisecond=F(Kr),P.prototype.visitTimestamp=F(oi),P.prototype.visitTimestampSecond=F(ni),P.prototype.visitTimestampMillisecond=F(ri),P.prototype.visitTimestampMicrosecond=F(ii),P.prototype.visitTimestampNanosecond=F(ai),P.prototype.visitTime=F(di),P.prototype.visitTimeSecond=F(si),P.prototype.visitTimeMillisecond=F(ci),P.prototype.visitTimeMicrosecond=F(li),P.prototype.visitTimeNanosecond=F(ui),P.prototype.visitDecimal=F(fi),P.prototype.visitList=F(pi),P.prototype.visitStruct=F(hi),P.prototype.visitUnion=F(gi),P.prototype.visitDenseUnion=F(_i),P.prototype.visitSparseUnion=F(vi),P.prototype.visitDictionary=F(yi),P.prototype.visitInterval=F(bi),P.prototype.visitIntervalDayTime=F(xi),P.prototype.visitIntervalYearMonth=F(Si),P.prototype.visitDuration=F(Di),P.prototype.visitDurationSecond=F(Ci),P.prototype.visitDurationMillisecond=F(wi),P.prototype.visitDurationMicrosecond=F(Ti),P.prototype.visitDurationNanosecond=F(Ei),P.prototype.visitFixedSizeList=F(Oi),P.prototype.visitMap=F(mi);var I=new P,ki=Symbol.for(`keys`),Ai=Symbol.for(`vals`),ji=Symbol.for(`kKeysAsStrings`),Mi=Symbol.for(`_kKeysAsStrings`),Ni=class{constructor(e){return this[ki]=new U([e.children[0]]).memoize(),this[Ai]=e.children[1],new Proxy(this,new Fi)}get[ji](){return this[Mi]||(this[Mi]=Array.from(this[ki].toArray(),String))}[Symbol.iterator](){return new Pi(this[ki],this[Ai])}get size(){return this[ki].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[ki],t=this[Ai],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=I.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${Et(e)}: ${Et(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},Pi=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),I.visit(this.vals,e)]})}},Fi=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[ji]}has(e,t){return e[ji].includes(t)}getOwnPropertyDescriptor(e,t){if(e[ji].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[ji].indexOf(t);if(n!==-1){let r=I.visit(Reflect.get(e,Ai),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[ji].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(N.visit(Reflect.get(e,Ai),r,n),Reflect.set(e,t,n))}};Object.defineProperties(Ni.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[ki]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ai]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Mi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Ii;function Li(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Ii=a,a=o,o=Ii),o>i&&(o=i),r?r(e,a,o):[a,o]}var Ri=(e,t)=>e<0?t+e:e,zi=e=>e!==e;function Bi(e){if(typeof e!=`object`||!e)return zi(e)?zi:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?Ae(e,t):!1:e instanceof Map?Hi(e):Array.isArray(e)?Vi(e):e instanceof U?Ui(e):Wi(e,!0)}function Vi(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Bi(e[n]);return Gi(t)}function Hi(e){let t=-1,n=[];for(let r of e.values())n[++t]=Bi(r);return Gi(n)}function Ui(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Bi(e.get(n));return Gi(t)}function Wi(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=Bi(e[n[t]]);return Gi(r,n)}function Gi(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return Ki(e,n);case Map:return Ji(e,n,n.keys());case Ni:case Rr:case Object:case void 0:return Ji(e,n,t||Object.keys(n))}return n instanceof U&&qi(e,n)}}function Ki(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function qi(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Ji(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function Yi(e,t,n,r){return!!(n&1<<r)}function Xi(e,t,n,r){return(n&1<<r)>>r}function Zi(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):Qi(new $i(n,e,t,null,Yi)).subarray(0,r)),i}return n}function Qi(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var $i=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ea(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new $i(e,t,n-t,e,Xi))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return ea(e,t,i)+ea(e,r,n)+ta(e,i>>3,r-i>>3)}function ta(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=na(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=na(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=na(a.getUint8(i)),i+=1;return r}function na(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var L=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return D.isSparseUnion(e)||D.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(D.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-ea(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=Rn(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}getValid(e){let{type:t}=this;if(D.isUnion(t)){let n=t,r=this.children[n.typeIdToChildIndex[this.typeIds[e]]],i=n.mode===g.Dense?this.valueOffsets[e]:e;return r.getValid(i)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(D.isUnion(r)){let i=r,a=this.children[i.typeIdToChildIndex[this.typeIds[e]]],o=i.mode===g.Dense?this.valueOffsets[e]:e;n=a.getValid(o),a.setValid(o,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Zi(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children){return new e(t,n,r,i,a,o,this.dictionary)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===w.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(Zi(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[wt.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;return(i=a[wt.TYPE])&&(a[wt.TYPE]=i.subarray(e,e+t)),(i=a[wt.OFFSET])&&(a[wt.OFFSET]=i.subarray(e,e+t+1))||(i=a[wt.DATA])&&(a[wt.DATA]=r===6?i:i.subarray(n*e,n*(e+t))),a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};L.prototype.children=Object.freeze([]);var ra=new class e extends A{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new L(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Ce(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Ce(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=m(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=p(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return D.isSparseUnion(t)?new L(t,n,a,o,[void 0,void 0,void 0,i],r):new L(t,n,a,o,[Se(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=m(t.nullBitmap),a=p(n.indices.ArrayType,t.data),{dictionary:o=new U([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new L(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=m(t.nullBitmap),{length:o=i.length/Rn(n),nullCount:s=t.nullBitmap?-1:0}=t;return new L(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=m(t.nullBitmap),o=Se(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new L(n,r,s,c,[o,void 0,a],[i])}};function R(e){return ra.visit(e)}var ia=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function aa(e){return e.some(e=>e.nullable)}function oa(e){return e.reduce((e,t)=>e+t.nullCount,0)}function sa(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function ca(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function la(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function ua(e,t){return e.getValid(t)}function da(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return la(n,this._offsets,e,t)}}function fa(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=la(i,this._offsets,e,n);return t=void 0,a}}function pa(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?la(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var z=class extends A{};function ma(e,t){return t===null&&e.length>0?0:-1}function ha(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new $i(n,e.offset+(t||0),e.length,n,Yi)){if(!i)return r;++r}return-1}function B(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case w.Union:break;case w.Dictionary:break;default:return ha(e,n)}let r=I.getVisitFn(e),i=Bi(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function ga(e,t,n){let r=I.getVisitFn(e),i=Bi(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}z.prototype.visitNull=ma,z.prototype.visitBool=B,z.prototype.visitInt=B,z.prototype.visitInt8=B,z.prototype.visitInt16=B,z.prototype.visitInt32=B,z.prototype.visitInt64=B,z.prototype.visitUint8=B,z.prototype.visitUint16=B,z.prototype.visitUint32=B,z.prototype.visitUint64=B,z.prototype.visitFloat=B,z.prototype.visitFloat16=B,z.prototype.visitFloat32=B,z.prototype.visitFloat64=B,z.prototype.visitUtf8=B,z.prototype.visitLargeUtf8=B,z.prototype.visitBinary=B,z.prototype.visitLargeBinary=B,z.prototype.visitFixedSizeBinary=B,z.prototype.visitDate=B,z.prototype.visitDateDay=B,z.prototype.visitDateMillisecond=B,z.prototype.visitTimestamp=B,z.prototype.visitTimestampSecond=B,z.prototype.visitTimestampMillisecond=B,z.prototype.visitTimestampMicrosecond=B,z.prototype.visitTimestampNanosecond=B,z.prototype.visitTime=B,z.prototype.visitTimeSecond=B,z.prototype.visitTimeMillisecond=B,z.prototype.visitTimeMicrosecond=B,z.prototype.visitTimeNanosecond=B,z.prototype.visitDecimal=B,z.prototype.visitList=B,z.prototype.visitStruct=B,z.prototype.visitUnion=B,z.prototype.visitDenseUnion=ga,z.prototype.visitSparseUnion=ga,z.prototype.visitDictionary=B,z.prototype.visitInterval=B,z.prototype.visitIntervalDayTime=B,z.prototype.visitIntervalYearMonth=B,z.prototype.visitDuration=B,z.prototype.visitDurationSecond=B,z.prototype.visitDurationMillisecond=B,z.prototype.visitDurationMicrosecond=B,z.prototype.visitDurationNanosecond=B,z.prototype.visitFixedSizeList=B,z.prototype.visitMap=B;var _a=new z,V=class extends A{};function H(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(D.isInt(t)&&t.bitWidth!==64||D.isTime(t)&&t.bitWidth!==64||D.isFloat(t)&&t.precision!==_.HALF))return new ia(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new ia(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new va(i)})}var va=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};V.prototype.visitNull=H,V.prototype.visitBool=H,V.prototype.visitInt=H,V.prototype.visitInt8=H,V.prototype.visitInt16=H,V.prototype.visitInt32=H,V.prototype.visitInt64=H,V.prototype.visitUint8=H,V.prototype.visitUint16=H,V.prototype.visitUint32=H,V.prototype.visitUint64=H,V.prototype.visitFloat=H,V.prototype.visitFloat16=H,V.prototype.visitFloat32=H,V.prototype.visitFloat64=H,V.prototype.visitUtf8=H,V.prototype.visitLargeUtf8=H,V.prototype.visitBinary=H,V.prototype.visitLargeBinary=H,V.prototype.visitFixedSizeBinary=H,V.prototype.visitDate=H,V.prototype.visitDateDay=H,V.prototype.visitDateMillisecond=H,V.prototype.visitTimestamp=H,V.prototype.visitTimestampSecond=H,V.prototype.visitTimestampMillisecond=H,V.prototype.visitTimestampMicrosecond=H,V.prototype.visitTimestampNanosecond=H,V.prototype.visitTime=H,V.prototype.visitTimeSecond=H,V.prototype.visitTimeMillisecond=H,V.prototype.visitTimeMicrosecond=H,V.prototype.visitTimeNanosecond=H,V.prototype.visitDecimal=H,V.prototype.visitList=H,V.prototype.visitStruct=H,V.prototype.visitUnion=H,V.prototype.visitDenseUnion=H,V.prototype.visitSparseUnion=H,V.prototype.visitDictionary=H,V.prototype.visitInterval=H,V.prototype.visitIntervalDayTime=H,V.prototype.visitIntervalYearMonth=H,V.prototype.visitDuration=H,V.prototype.visitDurationSecond=H,V.prototype.visitDurationMillisecond=H,V.prototype.visitDurationMicrosecond=H,V.prototype.visitDurationNanosecond=H,V.prototype.visitFixedSizeList=H,V.prototype.visitMap=H;var ya=new V,ba,xa={},Sa={},U=class e{constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof L)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=xa[r.typeId],a=n[0];this.isValid=e=>ua(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,Sa[r.typeId]),this._offsets=sa(n)}this.data=n,this.type=r,this.stride=Rn(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return aa(this.data)}get nullCount(){return oa(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${w[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Ri(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return ya.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(Li(this,t,n,({data:e,_offsets:t},n,r)=>ca(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case w.Int:case w.Float:case w.Decimal:case w.Time:case w.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){let t=new Ca(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new Ca(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};ba=Symbol.toStringTag,U[ba]=(e=>{e.type=D.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(w).map(e=>w[e]).filter(e=>typeof e==`number`&&e!==w.NONE);for(let n of t)xa[n]={get:I.getVisitFnByTypeId(n),set:N.getVisitFnByTypeId(n),indexOf:_a.getVisitFnByTypeId(n)},Sa[n]=Object.create(e,{isValid:{value:da(ua)},get:{value:da(I.getVisitFnByTypeId(n))},set:{value:fa(N.getVisitFnByTypeId(n))},indexOf:{value:pa(_a.getVisitFnByTypeId(n))}});return`Vector`})(U.prototype);var Ca=class e extends U{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new U(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},wa=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},Ta=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):h.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Ct).__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 wa).__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 wa).__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 b).__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,h.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)}},W=class e{constructor(e=[],t,n,r=h.V5){this.fields=e||[],this.metadata=t||new Map,n||=Da(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Ea(Ea(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:Ea(Ea(new Map,r[t].metadata),e.metadata)}))&&!1}),o=Da(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};W.prototype.fields=null,W.prototype.metadata=null,W.prototype.dictionaries=null;var G=class e{static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};G.prototype.type=null,G.prototype.name=null,G.prototype.nullable=null,G.prototype.metadata=null;function Ea(e,t){return new Map([...e||new Map,...t||new Map])}function Da(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(D.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&Da(r.children,t)}return t}var Oa=Ke,ka=Ge,Aa=class{static decode(e){e=new ka(m(e));let t=Ta.getRootAsFooter(e);return new ja(W.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new Oa,n=W.encode(t,e.schema);Ta.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())Ma.encode(t,n);let r=t.endVector();Ta.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())Ma.encode(t,n);let i=t.endVector();return Ta.startFooter(t),Ta.addSchema(t,n),Ta.addVersion(t,h.V5),Ta.addRecordBatches(t,r),Ta.addDictionaries(t,i),Ta.finishFooterBuffer(t,Ta.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=h.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},ja=class extends Aa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Ma.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Ma.decode(t)}return null}},Ma=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return wa.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=T(n),this.bodyLength=T(t)}},K=Object.freeze({done:!0,value:void 0}),Na=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Pa=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},Fa=class extends Pa{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return i(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(K);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return je.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return je.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return i(this,void 0,void 0,function*(){return yield this.abort(e),K})}return(e){return i(this,void 0,void 0,function*(){return yield this.close(),K})}read(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(K)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Ia=class extends Fa{write(e){if((e=m(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?ee(this.toUint8Array(!0)):this.toUint8Array(!1).then(ee)}toUint8Array(e=!1){return e?xe(this._values)[0]:i(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=l(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return xe(i,a)[0]})}},La=class{constructor(e){e&&(this.source=new za(je.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)}},Ra=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Ia?this.source=new Ba(je.fromAsyncIterable(t)):ge(t)?this.source=new Ba(je.fromNodeStream(t)):me(t)?this.source=new Ba(je.fromDOMStream(t)):de(t)?this.source=new Ba(je.fromDOMStream(t.body)):oe(t)?this.source=new Ba(je.fromIterable(t)):(ae(t)||se(t))&&(this.source=new Ba(je.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},za=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)||K)}return(e){return Object.create(this.source.return&&this.source.return(e)||K)}},Ba=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return i(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return i(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return i(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||K;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return i(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||K;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},Va=class extends La{constructor(e,t){super(),this.position=0,this.buffer=m(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},Ha=class extends Ra{constructor(e,t){super(),this.position=0,this._handle=e,typeof t==`number`?this.size=t:this._pending=i(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return i(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 i(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 i(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,t){return i(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r}=this;if(n&&e+t<r){let i=Math.min(r,e+t),a=new Uint8Array(i-e);return(yield n.read(a,0,t,e)).buffer}return new Uint8Array(t)})}close(){return i(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return i(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return i(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}},Ua=65536;function Wa(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ga=8,Ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],qa=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?Ua:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Wa(this.buffer[1])} ${Wa(this.buffer[0])}`}},q=class e extends qa{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=Ga<r-n?Ga:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([Ka[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ja=class e extends qa{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=Ga<i-n?Ga:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([Ka[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ya=class e{constructor(e){this.buffer=e}high(){return new Ja(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ja(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 q(new Uint32Array([this.buffer[3],0])),n=new q(new Uint32Array([this.buffer[2],0])),r=new q(new Uint32Array([this.buffer[1],0])),i=new q(new Uint32Array([this.buffer[0],0])),a=new q(new Uint32Array([e.buffer[3],0])),o=new q(new Uint32Array([e.buffer[2],0])),s=new q(new Uint32Array([e.buffer[1],0])),c=new q(new Uint32Array([e.buffer[0],0])),l=q.multiply(i,c);this.buffer[0]=l.low();let u=new q(new Uint32Array([l.high(),0]));return l=q.multiply(r,c),u.plus(l),l=q.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new q(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(q.multiply(n,c)).plus(q.multiply(r,s)).plus(q.multiply(i,o)),this.buffer[3]+=q.multiply(t,c).plus(q.multiply(n,s)).plus(q.multiply(r,o)).plus(q.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Wa(this.buffer[3])} ${Wa(this.buffer[2])} ${Wa(this.buffer[1])} ${Wa(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=Ga<i-n?Ga:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([Ka[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}},Xa=class extends A{constructor(e,t,n,r,i=h.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i}visit(e){return super.visit(e instanceof G?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return R({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<h.V5&&this.readNullBitmap(e,n),e.mode===g.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readDictionary(e){return this.dictionaries.get(e.id)}},Za=class extends Xa{constructor(e,t,n,r,i){super(new Uint8Array,t,n,r,i),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:Qi(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return p(Uint8Array,p(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return p(Uint8Array,p(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(e)||(D.isInt(e)||D.isTime(e))&&e.bitWidth===64||D.isDuration(e)||D.isDate(e)&&e.unit===v.MILLISECOND?p(Uint8Array,Ja.convertArray(n[t])):D.isDecimal(e)?p(Uint8Array,Ya.convertArray(n[t])):D.isBinary(e)||D.isLargeBinary(e)||D.isFixedSizeBinary(e)?Qa(n[t]):D.isBool(e)?Qi(n[t]):D.isUtf8(e)||D.isLargeUtf8(e)?ne(n[t].join(``)):p(Uint8Array,p(e.ArrayType,n[t].map(e=>+e)))}};function Qa(e){let t=e.join(``),n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e>>1]=Number.parseInt(t.slice(e,e+2),16);return n}var J=class extends A{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function Y(e,t){return t instanceof e.constructor}function $a(e,t){return e===t||Y(e,t)}function eo(e,t){return e===t||Y(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function to(e,t){return e===t||Y(e,t)&&e.precision===t.precision}function no(e,t){return e===t||Y(e,t)&&e.byteWidth===t.byteWidth}function ro(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function io(e,t){return e===t||Y(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ao(e,t){return e===t||Y(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function oo(e,t){return e===t||Y(e,t)&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function so(e,t){return e===t||Y(e,t)&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function co(e,t){return e===t||Y(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&ho.compareManyFields(e.children,t.children)}function lo(e,t){return e===t||Y(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&ho.visit(e.indices,t.indices)&&ho.visit(e.dictionary,t.dictionary)}function uo(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function fo(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function po(e,t){return e===t||Y(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function mo(e,t){return e===t||Y(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}J.prototype.visitNull=$a,J.prototype.visitBool=$a,J.prototype.visitInt=eo,J.prototype.visitInt8=eo,J.prototype.visitInt16=eo,J.prototype.visitInt32=eo,J.prototype.visitInt64=eo,J.prototype.visitUint8=eo,J.prototype.visitUint16=eo,J.prototype.visitUint32=eo,J.prototype.visitUint64=eo,J.prototype.visitFloat=to,J.prototype.visitFloat16=to,J.prototype.visitFloat32=to,J.prototype.visitFloat64=to,J.prototype.visitUtf8=$a,J.prototype.visitLargeUtf8=$a,J.prototype.visitBinary=$a,J.prototype.visitLargeBinary=$a,J.prototype.visitFixedSizeBinary=no,J.prototype.visitDate=ro,J.prototype.visitDateDay=ro,J.prototype.visitDateMillisecond=ro,J.prototype.visitTimestamp=io,J.prototype.visitTimestampSecond=io,J.prototype.visitTimestampMillisecond=io,J.prototype.visitTimestampMicrosecond=io,J.prototype.visitTimestampNanosecond=io,J.prototype.visitTime=ao,J.prototype.visitTimeSecond=ao,J.prototype.visitTimeMillisecond=ao,J.prototype.visitTimeMicrosecond=ao,J.prototype.visitTimeNanosecond=ao,J.prototype.visitDecimal=$a,J.prototype.visitList=oo,J.prototype.visitStruct=so,J.prototype.visitUnion=co,J.prototype.visitDenseUnion=co,J.prototype.visitSparseUnion=co,J.prototype.visitDictionary=lo,J.prototype.visitInterval=uo,J.prototype.visitIntervalDayTime=uo,J.prototype.visitIntervalYearMonth=uo,J.prototype.visitDuration=fo,J.prototype.visitDurationSecond=fo,J.prototype.visitDurationMillisecond=fo,J.prototype.visitDurationMicrosecond=fo,J.prototype.visitDurationNanosecond=fo,J.prototype.visitFixedSizeList=po,J.prototype.visitMap=mo;var ho=new J;function go(e,t){return ho.compareSchemas(e,t)}function _o(e,t){return vo(e,t.map(e=>e.data.concat()))}function vo(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=yo(n,o,u,t,i),o>0&&(r[a++]=R({type:new k(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new X(e,t))]}function yo(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??R({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var bo,xo=class e{constructor(...t){if(t.length===0)return this.batches=[],this.schema=new W([]),this._offsets=[0],this;let n,r;t[0]instanceof W&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof X)return[t];if(t instanceof e)return t.batches;if(t instanceof L){if(t.type instanceof k)return[new X(new W(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new U([t[e]])),[,i]=_o(n??new W(e.map((e,t)=>new G(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new X(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new W([]),!(n instanceof W))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof X))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!go(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??sa(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=oa(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Ri(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?ya.visit(new U(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
1
+ import{t as e}from"./src-rJN_jaC5.js";import{a as t,n}from"./index-DtiyOy_J.js";import{t as r}from"./src-C9Uz3C-q.js";function i(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function a(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function o(e){return this instanceof o?(this.v=e,this):new o(e)}function s(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,s),i[Symbol.asyncIterator]=function(){return this},i;function s(e){return function(t){return Promise.resolve(t).then(e,te)}}function c(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||l(e,t)})},t&&(i[e]=t(i[e])))}function l(e,t){try{u(r[e](t))}catch(e){ne(a[0][3],e)}}function u(e){e.value instanceof o?Promise.resolve(e.value.v).then(ee,te):ne(a[0][2],e)}function ee(e){l(`next`,e)}function te(e){l(`throw`,e)}function ne(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function c(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:o(e[r](t)),done:!1}:i?i(t):t}:i}}function l(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof a==`function`?a(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}var u=new TextDecoder(`utf-8`),ee=e=>u.decode(e),te=new TextEncoder,ne=e=>te.encode(e),re=e=>typeof e==`number`,ie=e=>typeof e==`boolean`,d=e=>typeof e==`function`,f=e=>e!=null&&Object(e)===e,ae=e=>f(e)&&d(e.then),oe=e=>f(e)&&d(e[Symbol.iterator]),se=e=>f(e)&&d(e[Symbol.asyncIterator]),ce=e=>f(e)&&f(e.schema),le=e=>f(e)&&`done`in e&&`value`in e,ue=e=>f(e)&&d(e.stat)&&re(e.fd),de=e=>f(e)&&me(e.body),fe=e=>`_getDOMStream`in e&&`_getNodeStream`in e,pe=e=>f(e)&&d(e.abort)&&d(e.getWriter)&&!fe(e),me=e=>f(e)&&d(e.cancel)&&d(e.getReader)&&!fe(e),he=e=>f(e)&&d(e.end)&&d(e.write)&&ie(e.writable)&&!fe(e),ge=e=>f(e)&&d(e.read)&&d(e.pipe)&&ie(e.readable)&&!fe(e),_e=e=>f(e)&&d(e.clear)&&d(e.bytes)&&d(e.position)&&d(e.setPosition)&&d(e.capacity)&&d(e.getBufferIdentifier)&&d(e.createLong),ve=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function ye(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function be(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function xe(e,t){let n=ye(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?be(o,a,s):o=a;break}be(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function p(e,t){let n=le(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=ne(n)),n instanceof ArrayBuffer||n instanceof ve?new e(n):_e(n)?p(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var Se=e=>p(Int32Array,e),Ce=e=>p(BigInt64Array,e),m=e=>p(Uint8Array,e),we=e=>(e.next(),e);function*Te(e,t){let n=function*(e){yield e};return yield*we((function*(t){let n=null;do n=t.next(yield p(e,n));while(!n.done)})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ve?n(t):oe(t)?t:n(t))[Symbol.iterator]())),new e}var Ee=e=>Te(Uint8Array,e);function De(e,t){return s(this,arguments,function*(){if(ae(t))return yield o(yield o(yield*c(l(De(e,yield o(t))))));let n=function(e){return s(this,arguments,function*(){yield yield o(yield o(e))})};return yield o(yield*c(l(we((function(t){return s(this,arguments,function*(){let n=null;do n=yield o(t.next(yield yield o(p(e,n))));while(!n.done)})})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ve?n(t):oe(t)?function(e){return s(this,arguments,function*(){yield o(yield*c(l(we((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):se(t)?t:n(t))[Symbol.asyncIterator]()))))),yield o(new e)})}var Oe=e=>De(Uint8Array,e);function ke(e,t,n){if(e!==0){n=n.slice(0,t);for(let t=-1,r=n.length;++t<r;)n[t]+=e}return n.subarray(0,t)}function Ae(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var je={fromIterable(e){return Me(Ne(e))},fromAsyncIterable(e){return Me(Pe(e))},fromDOMStream(e){return Me(Fe(e))},fromNodeStream(e){return Me(Re(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}},Me=e=>(e.next(),e);function*Ne(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?xe(r,o)[0]:([i,r,s]=xe(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=Ee(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){(n=!0)&&typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function Pe(e){return s(this,arguments,function*(){let t,n=!1,r=[],i,a,s,c=0;function l(){return a===`peek`?xe(r,s)[0]:([i,r,c]=xe(r,s),i)}({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0});let u=Oe(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(s-c)?yield o(u.next()):yield o(u.next(s-c)),!t&&i.byteLength>0&&(r.push(i),c+=i.byteLength),t||s<=c)do({cmd:a,size:s}=yield yield o(l()));while(s<c);while(!t)}catch(e){(n=!0)&&typeof u.throw==`function`&&(yield o(u.throw(e)))}finally{n===!1&&typeof u.return==`function`&&(yield o(u.return(new Uint8Array)))}return yield o(null)})}function Fe(e){return s(this,arguments,function*(){let t=!1,n=!1,r=[],i,a,s,c=0;function l(){return a===`peek`?xe(r,s)[0]:([i,r,c]=xe(r,s),i)}({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0});let u=new Ie(e);try{do if({done:t,value:i}=Number.isNaN(s-c)?yield o(u.read()):yield o(u.read(s-c)),!t&&i.byteLength>0&&(r.push(m(i)),c+=i.byteLength),t||s<=c)do({cmd:a,size:s}=yield yield o(l()));while(s<c);while(!t)}catch(e){(n=!0)&&(yield o(u.cancel(e)))}finally{n===!1?yield o(u.cancel()):e.locked&&u.releaseLock()}return yield o(null)})}var Ie=class{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return i(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 i(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=m(t)),t})}},Le=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Re(e){return s(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,s,c=0,l=[],u;function ee(){return a===`peek`?xe(l,s)[0]:([u,l,c]=xe(l,s),u)}if({cmd:a,size:s}=(yield yield o(null))||{cmd:`read`,size:0},e.isTTY)return yield yield o(new Uint8Array),yield o(null);try{t[0]=Le(e,`end`),t[1]=Le(e,`error`);do{if(t[2]=Le(e,`readable`),[n,i]=yield o(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(s-c)?(u=m(e.read(s-c)),u.byteLength<s-c&&(u=m(e.read()))):u=m(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),r||s<=c)do({cmd:a,size:s}=yield yield o(ee()));while(s<c)}while(!r)}finally{yield o(te(t,n===`error`?i:null))}return yield o(null);function te(t,n){return u=l=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var h;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(h||={});var g;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(g||={});var _;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(_||={});var v;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(v||={});var y;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(y||={});var ze;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(ze||={});var Be=new Int32Array(2),Ve=new Float32Array(Be.buffer),He=new Float64Array(Be.buffer),Ue=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,We;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(We||={});var Ge=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Be[0]=this.readInt32(e),Ve[0]}readFloat64(e){return Be[+!Ue]=this.readInt32(e),Be[+!!Ue]=this.readInt32(e+4),He[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Ve[0]=t,this.writeInt32(e,Be[0])}writeFloat64(e,t){He[0]=t,this.writeInt32(e,Be[+!Ue]),this.writeInt32(e+4,Be[+!!Ue])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===We.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},Ke=class e{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;t=e||1024,this.bb=Ge.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=Ge.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)throw TypeError(`FlatBuffers: file identifier must be length 4`);for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},qe;(function(e){e[e.BUFFER=0]=`BUFFER`})(qe||={});var Je;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(Je||={});var Ye=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Je.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):qe.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Je.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,qe.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},Xe=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Ze=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Qe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ze).__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 Xe).__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 Ye).__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,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static endRecordBatch(e){return e.endObject()}},$e=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Qe).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},et;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(et||={});var tt;(function(e){e[e.DenseArray=0]=`DenseArray`})(tt||={});var nt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},rt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new nt).__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):tt.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,tt.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},b=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},it=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},at=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},ot=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,v.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},st=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,y.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},lt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},ut=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},dt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,_.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},ft=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ze.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ze.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},pt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},mt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},ht=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},gt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},_t=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},vt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},yt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.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,y.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},bt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.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,y.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},xt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):g.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,g.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},St=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},x;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`})(x||={});var S=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):x.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 rt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new b).__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,x.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()}},Ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):et.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new S).__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 b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,et.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(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},C;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(C||={});var w;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`})(w||={});var wt;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(wt||={});var Tt=void 0;function Et(e){if(e===null)return`null`;if(e===Tt)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>Et(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function T(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Dt(e,t){return T(e/t)+T(e%t)/T(t)}var Ot=Symbol.for(`isArrowBigNum`);function E(e,...t){return t.length===0?Object.setPrototypeOf(p(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}E.prototype[Ot]=!0,E.prototype.toJSON=function(){return`"${Pt(this)}"`},E.prototype.valueOf=function(e){return Nt(this,e)},E.prototype.toString=function(){return Pt(this)},E.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return Nt(this);case`string`:return Pt(this);case`default`:return Ft(this)}return Pt(this)};function kt(...e){return E.apply(this,e)}function At(...e){return E.apply(this,e)}function jt(...e){return E.apply(this,e)}Object.setPrototypeOf(kt.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(At.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(jt.prototype,Object.create(Uint32Array.prototype)),Object.assign(kt.prototype,E.prototype,{constructor:kt,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(At.prototype,E.prototype,{constructor:At,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(jt.prototype,E.prototype,{constructor:jt,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Mt=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function Nt(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^Mt)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`){let e=BigInt(10**t),n=c/e,r=c%e;return T(n)+T(r)/T(e)}return T(c)}function Pt(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return It(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return It(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${It(t)}`}function Ft(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Pt(e)}function It(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var Lt=class e{static new(e,t){switch(t){case!0:return new kt(e);case!1:return new At(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new kt(e)}return e.byteLength===16?new jt(e):new At(e)}static signed(e){return new kt(e)}static unsigned(e){return new At(e)}static decimal(e){return new jt(e)}constructor(t,n){return e.new(t,n)}},Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,D=class e{static isNull(e){return e?.typeId===w.Null}static isInt(e){return e?.typeId===w.Int}static isFloat(e){return e?.typeId===w.Float}static isBinary(e){return e?.typeId===w.Binary}static isLargeBinary(e){return e?.typeId===w.LargeBinary}static isUtf8(e){return e?.typeId===w.Utf8}static isLargeUtf8(e){return e?.typeId===w.LargeUtf8}static isBool(e){return e?.typeId===w.Bool}static isDecimal(e){return e?.typeId===w.Decimal}static isDate(e){return e?.typeId===w.Date}static isTime(e){return e?.typeId===w.Time}static isTimestamp(e){return e?.typeId===w.Timestamp}static isInterval(e){return e?.typeId===w.Interval}static isDuration(e){return e?.typeId===w.Duration}static isList(e){return e?.typeId===w.List}static isStruct(e){return e?.typeId===w.Struct}static isUnion(e){return e?.typeId===w.Union}static isFixedSizeBinary(e){return e?.typeId===w.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===w.FixedSizeList}static isMap(e){return e?.typeId===w.Map}static isDictionary(e){return e?.typeId===w.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===g.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===g.Sparse}constructor(e){this.typeId=e}};Rt=Symbol.toStringTag,D[Rt]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=`DataType`))(D.prototype);var sn=class extends D{constructor(){super(w.Null)}toString(){return`Null`}};zt=Symbol.toStringTag,sn[zt]=(e=>e[Symbol.toStringTag]=`Null`)(sn.prototype);var O=class extends D{constructor(e,t){super(w.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};Bt=Symbol.toStringTag,O[Bt]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(O.prototype);var cn=class extends O{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ln=class extends O{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},un=class extends O{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},dn=class extends O{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},fn=class extends O{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},pn=class extends O{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},mn=class extends O{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},hn=class extends O{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(cn.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(ln.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(un.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(dn.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(fn.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(pn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(mn.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(hn.prototype,"ArrayType",{value:BigUint64Array});var gn=class extends D{constructor(e){super(w.Float),this.precision=e}get ArrayType(){switch(this.precision){case _.HALF:return Uint16Array;case _.SINGLE:return Float32Array;case _.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Vt=Symbol.toStringTag,gn[Vt]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(gn.prototype);var _n=class extends gn{constructor(){super(_.HALF)}},vn=class extends gn{constructor(){super(_.SINGLE)}},yn=class extends gn{constructor(){super(_.DOUBLE)}};Object.defineProperty(_n.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(vn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(yn.prototype,"ArrayType",{value:Float64Array});var bn=class extends D{constructor(){super(w.Binary)}toString(){return`Binary`}};Ht=Symbol.toStringTag,bn[Ht]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(bn.prototype);var xn=class extends D{constructor(){super(w.LargeBinary)}toString(){return`LargeBinary`}};Ut=Symbol.toStringTag,xn[Ut]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(xn.prototype);var Sn=class extends D{constructor(){super(w.Utf8)}toString(){return`Utf8`}};Wt=Symbol.toStringTag,Sn[Wt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(Sn.prototype);var Cn=class extends D{constructor(){super(w.LargeUtf8)}toString(){return`LargeUtf8`}};Gt=Symbol.toStringTag,Cn[Gt]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(Cn.prototype);var wn=class extends D{constructor(){super(w.Bool)}toString(){return`Bool`}};Kt=Symbol.toStringTag,wn[Kt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(wn.prototype);var Tn=class extends D{constructor(e,t,n=128){super(w.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};qt=Symbol.toStringTag,Tn[qt]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(Tn.prototype);var En=class extends D{constructor(e){super(w.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${v[this.unit]}>`}get ArrayType(){return this.unit===v.DAY?Int32Array:BigInt64Array}};Jt=Symbol.toStringTag,En[Jt]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(En.prototype);var Dn=class extends D{constructor(e,t){super(w.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${y[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Yt=Symbol.toStringTag,Dn[Yt]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(Dn.prototype);var On=class extends D{constructor(e,t){super(w.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${y[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};Xt=Symbol.toStringTag,On[Xt]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(On.prototype);var kn=class extends D{constructor(e){super(w.Interval),this.unit=e}toString(){return`Interval<${ze[this.unit]}>`}};Zt=Symbol.toStringTag,kn[Zt]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(kn.prototype);var An=class extends D{constructor(e){super(w.Duration),this.unit=e}toString(){return`Duration<${y[this.unit]}>`}};Qt=Symbol.toStringTag,An[Qt]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(An.prototype);var jn=class extends D{constructor(e){super(w.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$t=Symbol.toStringTag,jn[$t]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(jn.prototype);var k=class extends D{constructor(e){super(w.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};en=Symbol.toStringTag,k[en]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(k.prototype);var Mn=class extends D{constructor(e,t,n){super(w.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};tn=Symbol.toStringTag,Mn[tn]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(Mn.prototype);var Nn=class extends D{constructor(e){super(w.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};nn=Symbol.toStringTag,Nn[nn]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(Nn.prototype);var Pn=class extends D{constructor(e,t){super(w.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};rn=Symbol.toStringTag,Pn[rn]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(Pn.prototype);var Fn=class extends D{constructor(e,t=!1){if(super(w.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};an=Symbol.toStringTag,Fn[an]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(Fn.prototype);var In=(e=>()=>++e)(-1),Ln=class extends D{constructor(e,t,n,r){super(w.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?In():T(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};on=Symbol.toStringTag,Ln[on]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(Ln.prototype);function Rn(e){let t=e;switch(e.typeId){case w.Decimal:return e.bitWidth/32;case w.Interval:return 1+t.unit;case w.FixedSizeList:return t.listSize;case w.FixedSizeBinary:return t.byteWidth;default:return 1}}var A=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return zn(this,e,t)}getVisitFnByTypeId(e,t=!0){return Bn(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(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}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function zn(e,t,n=!0){return typeof t==`number`?Bn(e,t,n):typeof t==`string`&&t in w?Bn(e,w[t],n):t&&t instanceof D?Bn(e,Vn(t),n):t?.type&&t.type instanceof D?Bn(e,Vn(t.type),n):Bn(e,w.NONE,n)}function Bn(e,t,n=!0){let r=null;switch(t){case w.Null:r=e.visitNull;break;case w.Bool:r=e.visitBool;break;case w.Int:r=e.visitInt;break;case w.Int8:r=e.visitInt8||e.visitInt;break;case w.Int16:r=e.visitInt16||e.visitInt;break;case w.Int32:r=e.visitInt32||e.visitInt;break;case w.Int64:r=e.visitInt64||e.visitInt;break;case w.Uint8:r=e.visitUint8||e.visitInt;break;case w.Uint16:r=e.visitUint16||e.visitInt;break;case w.Uint32:r=e.visitUint32||e.visitInt;break;case w.Uint64:r=e.visitUint64||e.visitInt;break;case w.Float:r=e.visitFloat;break;case w.Float16:r=e.visitFloat16||e.visitFloat;break;case w.Float32:r=e.visitFloat32||e.visitFloat;break;case w.Float64:r=e.visitFloat64||e.visitFloat;break;case w.Utf8:r=e.visitUtf8;break;case w.LargeUtf8:r=e.visitLargeUtf8;break;case w.Binary:r=e.visitBinary;break;case w.LargeBinary:r=e.visitLargeBinary;break;case w.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case w.Date:r=e.visitDate;break;case w.DateDay:r=e.visitDateDay||e.visitDate;break;case w.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case w.Timestamp:r=e.visitTimestamp;break;case w.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case w.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case w.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case w.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case w.Time:r=e.visitTime;break;case w.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case w.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case w.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case w.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case w.Decimal:r=e.visitDecimal;break;case w.List:r=e.visitList;break;case w.Struct:r=e.visitStruct;break;case w.Union:r=e.visitUnion;break;case w.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case w.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case w.Dictionary:r=e.visitDictionary;break;case w.Interval:r=e.visitInterval;break;case w.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case w.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case w.Duration:r=e.visitDuration;break;case w.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case w.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case w.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case w.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case w.FixedSizeList:r=e.visitFixedSizeList;break;case w.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${w[t]}'`)}function Vn(e){switch(e.typeId){case w.Null:return w.Null;case w.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?w.Int8:w.Uint8;case 16:return n?w.Int16:w.Uint16;case 32:return n?w.Int32:w.Uint32;case 64:return n?w.Int64:w.Uint64}return w.Int}case w.Float:switch(e.precision){case _.HALF:return w.Float16;case _.SINGLE:return w.Float32;case _.DOUBLE:return w.Float64}return w.Float;case w.Binary:return w.Binary;case w.LargeBinary:return w.LargeBinary;case w.Utf8:return w.Utf8;case w.LargeUtf8:return w.LargeUtf8;case w.Bool:return w.Bool;case w.Decimal:return w.Decimal;case w.Time:switch(e.unit){case y.SECOND:return w.TimeSecond;case y.MILLISECOND:return w.TimeMillisecond;case y.MICROSECOND:return w.TimeMicrosecond;case y.NANOSECOND:return w.TimeNanosecond}return w.Time;case w.Timestamp:switch(e.unit){case y.SECOND:return w.TimestampSecond;case y.MILLISECOND:return w.TimestampMillisecond;case y.MICROSECOND:return w.TimestampMicrosecond;case y.NANOSECOND:return w.TimestampNanosecond}return w.Timestamp;case w.Date:switch(e.unit){case v.DAY:return w.DateDay;case v.MILLISECOND:return w.DateMillisecond}return w.Date;case w.Interval:switch(e.unit){case ze.DAY_TIME:return w.IntervalDayTime;case ze.YEAR_MONTH:return w.IntervalYearMonth}return w.Interval;case w.Duration:switch(e.unit){case y.SECOND:return w.DurationSecond;case y.MILLISECOND:return w.DurationMillisecond;case y.MICROSECOND:return w.DurationMicrosecond;case y.NANOSECOND:return w.DurationNanosecond}return w.Duration;case w.Map:return w.Map;case w.List:return w.List;case w.Struct:return w.Struct;case w.Union:switch(e.mode){case g.Dense:return w.DenseUnion;case g.Sparse:return w.SparseUnion}return w.Union;case w.FixedSizeBinary:return w.FixedSizeBinary;case w.FixedSizeList:return w.FixedSizeList;case w.Dictionary:return w.Dictionary}throw Error(`Unrecognized type '${w[e.typeId]}'`)}A.prototype.visitInt8=null,A.prototype.visitInt16=null,A.prototype.visitInt32=null,A.prototype.visitInt64=null,A.prototype.visitUint8=null,A.prototype.visitUint16=null,A.prototype.visitUint32=null,A.prototype.visitUint64=null,A.prototype.visitFloat16=null,A.prototype.visitFloat32=null,A.prototype.visitFloat64=null,A.prototype.visitDateDay=null,A.prototype.visitDateMillisecond=null,A.prototype.visitTimestampSecond=null,A.prototype.visitTimestampMillisecond=null,A.prototype.visitTimestampMicrosecond=null,A.prototype.visitTimestampNanosecond=null,A.prototype.visitTimeSecond=null,A.prototype.visitTimeMillisecond=null,A.prototype.visitTimeMicrosecond=null,A.prototype.visitTimeNanosecond=null,A.prototype.visitDenseUnion=null,A.prototype.visitSparseUnion=null,A.prototype.visitIntervalDayTime=null,A.prototype.visitIntervalYearMonth=null,A.prototype.visitDuration=null,A.prototype.visitDurationSecond=null,A.prototype.visitDurationMillisecond=null,A.prototype.visitDurationMicrosecond=null,A.prototype.visitDurationNanosecond=null;var Hn=new Float64Array(1),Un=new Uint32Array(Hn.buffer);function Wn(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Gn(e){if(e!==e)return 32256;Hn[0]=e;let t=(Un[1]&2147483648)>>16&65535,n=Un[1]&2146435072,r=0;return n>=1089470464?Un[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Un[1]&1048575)>>10):n<=1056964608?(r=1048576+(Un[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Un[1]&1048575)+512>>10),t|n|r&65535}var j=class extends A{};function M(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Kn=(e,t,n)=>{e[t]=Math.floor(n/864e5)},qn=(e,t,n,r)=>{if(n+1<t.length){let i=T(t[n]),a=T(t[n+1]);e.set(r.subarray(0,a-i),i)}},Jn=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Yn=({values:e},t,n)=>{e[t]=n},Xn=({values:e},t,n)=>{e[t]=n},Zn=({values:e},t,n)=>{e[t]=Gn(n)},Qn=(e,t,n)=>{switch(e.type.precision){case _.HALF:return Zn(e,t,n);case _.SINGLE:case _.DOUBLE:return Xn(e,t,n)}},$n=({values:e},t,n)=>{Kn(e,t,n.valueOf())},er=({values:e},t,n)=>{e[t]=BigInt(n)},tr=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},nr=({values:e,valueOffsets:t},n,r)=>qn(e,t,n,r),rr=({values:e,valueOffsets:t},n,r)=>qn(e,t,n,ne(r)),ir=(e,t,n)=>{e.type.unit===v.DAY?$n(e,t,n):er(e,t,n)},ar=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},or=({values:e},t,n)=>{e[t]=BigInt(n)},sr=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},cr=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},lr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return ar(e,t,n);case y.MILLISECOND:return or(e,t,n);case y.MICROSECOND:return sr(e,t,n);case y.NANOSECOND:return cr(e,t,n)}},ur=({values:e},t,n)=>{e[t]=n},dr=({values:e},t,n)=>{e[t]=n},fr=({values:e},t,n)=>{e[t]=n},pr=({values:e},t,n)=>{e[t]=n},mr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return ur(e,t,n);case y.MILLISECOND:return dr(e,t,n);case y.MICROSECOND:return fr(e,t,n);case y.NANOSECOND:return pr(e,t,n)}},hr=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},gr=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=N.getVisitFn(r);if(Array.isArray(n))for(let e=-1,o=i[t],s=i[t+1];o<s;)a(r,o++,n[++e]);else for(let e=-1,o=i[t],s=i[t+1];o<s;)a(r,o++,n.get(++e))},_r=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=N.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},vr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),yr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),br=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),xr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),Sr=(e,t,n)=>{let r=e.type.children.map(e=>N.getVisitFn(e.type)),i=n instanceof Map?br(t,n):n instanceof U?yr(t,n):Array.isArray(n)?vr(t,n):xr(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},Cr=(e,t,n)=>{e.type.mode===g.Dense?wr(e,t,n):Tr(e,t,n)},wr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];N.visit(i,e.valueOffsets[t],n)},Tr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];N.visit(i,t,n)},Er=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},Dr=(e,t,n)=>{e.type.unit===ze.DAY_TIME?Or(e,t,n):kr(e,t,n)},Or=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},kr=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ar=({values:e},t,n)=>{e[t]=n},jr=({values:e},t,n)=>{e[t]=n},Mr=({values:e},t,n)=>{e[t]=n},Nr=({values:e},t,n)=>{e[t]=n},Pr=(e,t,n)=>{switch(e.type.unit){case y.SECOND:return Ar(e,t,n);case y.MILLISECOND:return jr(e,t,n);case y.MICROSECOND:return Mr(e,t,n);case y.NANOSECOND:return Nr(e,t,n)}},Fr=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=N.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};j.prototype.visitBool=M(Jn),j.prototype.visitInt=M(Yn),j.prototype.visitInt8=M(Yn),j.prototype.visitInt16=M(Yn),j.prototype.visitInt32=M(Yn),j.prototype.visitInt64=M(Yn),j.prototype.visitUint8=M(Yn),j.prototype.visitUint16=M(Yn),j.prototype.visitUint32=M(Yn),j.prototype.visitUint64=M(Yn),j.prototype.visitFloat=M(Qn),j.prototype.visitFloat16=M(Zn),j.prototype.visitFloat32=M(Xn),j.prototype.visitFloat64=M(Xn),j.prototype.visitUtf8=M(rr),j.prototype.visitLargeUtf8=M(rr),j.prototype.visitBinary=M(nr),j.prototype.visitLargeBinary=M(nr),j.prototype.visitFixedSizeBinary=M(tr),j.prototype.visitDate=M(ir),j.prototype.visitDateDay=M($n),j.prototype.visitDateMillisecond=M(er),j.prototype.visitTimestamp=M(lr),j.prototype.visitTimestampSecond=M(ar),j.prototype.visitTimestampMillisecond=M(or),j.prototype.visitTimestampMicrosecond=M(sr),j.prototype.visitTimestampNanosecond=M(cr),j.prototype.visitTime=M(mr),j.prototype.visitTimeSecond=M(ur),j.prototype.visitTimeMillisecond=M(dr),j.prototype.visitTimeMicrosecond=M(fr),j.prototype.visitTimeNanosecond=M(pr),j.prototype.visitDecimal=M(hr),j.prototype.visitList=M(gr),j.prototype.visitStruct=M(Sr),j.prototype.visitUnion=M(Cr),j.prototype.visitDenseUnion=M(wr),j.prototype.visitSparseUnion=M(Tr),j.prototype.visitDictionary=M(Er),j.prototype.visitInterval=M(Dr),j.prototype.visitIntervalDayTime=M(Or),j.prototype.visitIntervalYearMonth=M(kr),j.prototype.visitDuration=M(Pr),j.prototype.visitDurationSecond=M(Ar),j.prototype.visitDurationMillisecond=M(jr),j.prototype.visitDurationMicrosecond=M(Mr),j.prototype.visitDurationNanosecond=M(Nr),j.prototype.visitFixedSizeList=M(Fr),j.prototype.visitMap=M(_r);var N=new j,Ir=Symbol.for(`parent`),Lr=Symbol.for(`rowIndex`),Rr=class{constructor(e,t){return this[Ir]=e,this[Lr]=t,new Proxy(this,new Br)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Lr],t=this[Ir],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=I.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${Et(e)}: ${Et(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new zr(this[Ir],this[Lr])}},zr=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,I.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Rr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ir]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Lr]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Br=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Ir].type.children.map(e=>e.name)}has(e,t){return e[Ir].type.children.findIndex(e=>e.name===t)!==-1}getOwnPropertyDescriptor(e,t){if(e[Ir].type.children.findIndex(e=>e.name===t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Ir].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=I.visit(e[Ir].children[n],e[Lr]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Ir].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(N.visit(e[Ir].children[r],e[Lr],n),Reflect.set(e,t,n))}},P=class extends A{};function F(e){return(t,n)=>t.getValid(n)?e(t,n):null}var Vr=(e,t)=>864e5*e[t],Hr=(e,t)=>null,Ur=(e,t,n)=>{if(n+1>=t.length)return null;let r=T(t[n]),i=T(t[n+1]);return e.subarray(r,i)},Wr=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},Gr=({values:e},t)=>Vr(e,t),Kr=({values:e},t)=>T(e[t]),qr=({stride:e,values:t},n)=>t[e*n],Jr=({stride:e,values:t},n)=>Wn(t[e*n]),Yr=({values:e},t)=>e[t],Xr=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Zr=({values:e,valueOffsets:t},n)=>Ur(e,t,n),Qr=({values:e,valueOffsets:t},n)=>{let r=Ur(e,t,n);return r===null?null:ee(r)},$r=({values:e},t)=>e[t],ei=({type:e,values:t},n)=>e.precision===_.HALF?Wn(t[n]):t[n],ti=(e,t)=>e.type.unit===v.DAY?Gr(e,t):Kr(e,t),ni=({values:e},t)=>1e3*T(e[t]),ri=({values:e},t)=>T(e[t]),ii=({values:e},t)=>Dt(e[t],BigInt(1e3)),ai=({values:e},t)=>Dt(e[t],BigInt(1e6)),oi=(e,t)=>{switch(e.type.unit){case y.SECOND:return ni(e,t);case y.MILLISECOND:return ri(e,t);case y.MICROSECOND:return ii(e,t);case y.NANOSECOND:return ai(e,t)}},si=({values:e},t)=>e[t],ci=({values:e},t)=>e[t],li=({values:e},t)=>e[t],ui=({values:e},t)=>e[t],di=(e,t)=>{switch(e.type.unit){case y.SECOND:return si(e,t);case y.MILLISECOND:return ci(e,t);case y.MICROSECOND:return li(e,t);case y.NANOSECOND:return ui(e,t)}},fi=({values:e,stride:t},n)=>Lt.decimal(e.subarray(t*n,t*(n+1))),pi=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:a,[t*r+1]:o}=n;return new U([i[0].slice(a,o-a)])},mi=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new Ni(o.slice(i,a-i))},hi=(e,t)=>new Rr(e,t),gi=(e,t)=>e.type.mode===g.Dense?_i(e,t):vi(e,t),_i=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return I.visit(r,e.valueOffsets[t])},vi=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return I.visit(r,t)},yi=(e,t)=>e.dictionary?.get(e.values[t]),bi=(e,t)=>e.type.unit===ze.DAY_TIME?xi(e,t):Si(e,t),xi=({values:e},t)=>e.subarray(2*t,2*(t+1)),Si=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Ci=({values:e},t)=>e[t],wi=({values:e},t)=>e[t],Ti=({values:e},t)=>e[t],Ei=({values:e},t)=>e[t],Di=(e,t)=>{switch(e.type.unit){case y.SECOND:return Ci(e,t);case y.MILLISECOND:return wi(e,t);case y.MICROSECOND:return Ti(e,t);case y.NANOSECOND:return Ei(e,t)}},Oi=(e,t)=>{let{stride:n,children:r}=e;return new U([r[0].slice(t*n,n)])};P.prototype.visitNull=F(Hr),P.prototype.visitBool=F(Wr),P.prototype.visitInt=F($r),P.prototype.visitInt8=F(qr),P.prototype.visitInt16=F(qr),P.prototype.visitInt32=F(qr),P.prototype.visitInt64=F(Yr),P.prototype.visitUint8=F(qr),P.prototype.visitUint16=F(qr),P.prototype.visitUint32=F(qr),P.prototype.visitUint64=F(Yr),P.prototype.visitFloat=F(ei),P.prototype.visitFloat16=F(Jr),P.prototype.visitFloat32=F(qr),P.prototype.visitFloat64=F(qr),P.prototype.visitUtf8=F(Qr),P.prototype.visitLargeUtf8=F(Qr),P.prototype.visitBinary=F(Zr),P.prototype.visitLargeBinary=F(Zr),P.prototype.visitFixedSizeBinary=F(Xr),P.prototype.visitDate=F(ti),P.prototype.visitDateDay=F(Gr),P.prototype.visitDateMillisecond=F(Kr),P.prototype.visitTimestamp=F(oi),P.prototype.visitTimestampSecond=F(ni),P.prototype.visitTimestampMillisecond=F(ri),P.prototype.visitTimestampMicrosecond=F(ii),P.prototype.visitTimestampNanosecond=F(ai),P.prototype.visitTime=F(di),P.prototype.visitTimeSecond=F(si),P.prototype.visitTimeMillisecond=F(ci),P.prototype.visitTimeMicrosecond=F(li),P.prototype.visitTimeNanosecond=F(ui),P.prototype.visitDecimal=F(fi),P.prototype.visitList=F(pi),P.prototype.visitStruct=F(hi),P.prototype.visitUnion=F(gi),P.prototype.visitDenseUnion=F(_i),P.prototype.visitSparseUnion=F(vi),P.prototype.visitDictionary=F(yi),P.prototype.visitInterval=F(bi),P.prototype.visitIntervalDayTime=F(xi),P.prototype.visitIntervalYearMonth=F(Si),P.prototype.visitDuration=F(Di),P.prototype.visitDurationSecond=F(Ci),P.prototype.visitDurationMillisecond=F(wi),P.prototype.visitDurationMicrosecond=F(Ti),P.prototype.visitDurationNanosecond=F(Ei),P.prototype.visitFixedSizeList=F(Oi),P.prototype.visitMap=F(mi);var I=new P,ki=Symbol.for(`keys`),Ai=Symbol.for(`vals`),ji=Symbol.for(`kKeysAsStrings`),Mi=Symbol.for(`_kKeysAsStrings`),Ni=class{constructor(e){return this[ki]=new U([e.children[0]]).memoize(),this[Ai]=e.children[1],new Proxy(this,new Fi)}get[ji](){return this[Mi]||(this[Mi]=Array.from(this[ki].toArray(),String))}[Symbol.iterator](){return new Pi(this[ki],this[Ai])}get size(){return this[ki].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[ki],t=this[Ai],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=I.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${Et(e)}: ${Et(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},Pi=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),I.visit(this.vals,e)]})}},Fi=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[ji]}has(e,t){return e[ji].includes(t)}getOwnPropertyDescriptor(e,t){if(e[ji].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[ji].indexOf(t);if(n!==-1){let r=I.visit(Reflect.get(e,Ai),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[ji].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(N.visit(Reflect.get(e,Ai),r,n),Reflect.set(e,t,n))}};Object.defineProperties(Ni.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[ki]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ai]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Mi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Ii;function Li(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Ii=a,a=o,o=Ii),o>i&&(o=i),r?r(e,a,o):[a,o]}var Ri=(e,t)=>e<0?t+e:e,zi=e=>e!==e;function Bi(e){if(typeof e!=`object`||!e)return zi(e)?zi:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?Ae(e,t):!1:e instanceof Map?Hi(e):Array.isArray(e)?Vi(e):e instanceof U?Ui(e):Wi(e,!0)}function Vi(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Bi(e[n]);return Gi(t)}function Hi(e){let t=-1,n=[];for(let r of e.values())n[++t]=Bi(r);return Gi(n)}function Ui(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Bi(e.get(n));return Gi(t)}function Wi(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=Bi(e[n[t]]);return Gi(r,n)}function Gi(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return Ki(e,n);case Map:return Ji(e,n,n.keys());case Ni:case Rr:case Object:case void 0:return Ji(e,n,t||Object.keys(n))}return n instanceof U&&qi(e,n)}}function Ki(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function qi(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Ji(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function Yi(e,t,n,r){return!!(n&1<<r)}function Xi(e,t,n,r){return(n&1<<r)>>r}function Zi(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):Qi(new $i(n,e,t,null,Yi)).subarray(0,r)),i}return n}function Qi(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var $i=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ea(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new $i(e,t,n-t,e,Xi))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return ea(e,t,i)+ea(e,r,n)+ta(e,i>>3,r-i>>3)}function ta(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=na(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=na(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=na(a.getUint8(i)),i+=1;return r}function na(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var L=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return D.isSparseUnion(e)||D.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(D.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-ea(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=Rn(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}getValid(e){let{type:t}=this;if(D.isUnion(t)){let n=t,r=this.children[n.typeIdToChildIndex[this.typeIds[e]]],i=n.mode===g.Dense?this.valueOffsets[e]:e;return r.getValid(i)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(D.isUnion(r)){let i=r,a=this.children[i.typeIdToChildIndex[this.typeIds[e]]],o=i.mode===g.Dense?this.valueOffsets[e]:e;n=a.getValid(o),a.setValid(o,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Zi(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children){return new e(t,n,r,i,a,o,this.dictionary)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===w.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(Zi(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[wt.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;return(i=a[wt.TYPE])&&(a[wt.TYPE]=i.subarray(e,e+t)),(i=a[wt.OFFSET])&&(a[wt.OFFSET]=i.subarray(e,e+t+1))||(i=a[wt.DATA])&&(a[wt.DATA]=r===6?i:i.subarray(n*e,n*(e+t))),a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};L.prototype.children=Object.freeze([]);var ra=new class e extends A{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new L(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Ce(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=m(e.data),i=m(e.nullBitmap),a=Ce(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=m(e.nullBitmap),a=Se(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new L(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=m(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=p(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return D.isSparseUnion(t)?new L(t,n,a,o,[void 0,void 0,void 0,i],r):new L(t,n,a,o,[Se(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=m(t.nullBitmap),a=p(n.indices.ArrayType,t.data),{dictionary:o=new U([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new L(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length/Rn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=m(e.nullBitmap),i=p(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new L(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=m(t.nullBitmap),{length:o=i.length/Rn(n),nullCount:s=t.nullBitmap?-1:0}=t;return new L(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=m(t.nullBitmap),o=Se(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new L(n,r,s,c,[o,void 0,a],[i])}};function R(e){return ra.visit(e)}var ia=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function aa(e){return e.some(e=>e.nullable)}function oa(e){return e.reduce((e,t)=>e+t.nullCount,0)}function sa(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function ca(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function la(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function ua(e,t){return e.getValid(t)}function da(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return la(n,this._offsets,e,t)}}function fa(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=la(i,this._offsets,e,n);return t=void 0,a}}function pa(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?la(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var z=class extends A{};function ma(e,t){return t===null&&e.length>0?0:-1}function ha(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new $i(n,e.offset+(t||0),e.length,n,Yi)){if(!i)return r;++r}return-1}function B(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case w.Union:break;case w.Dictionary:break;default:return ha(e,n)}let r=I.getVisitFn(e),i=Bi(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function ga(e,t,n){let r=I.getVisitFn(e),i=Bi(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}z.prototype.visitNull=ma,z.prototype.visitBool=B,z.prototype.visitInt=B,z.prototype.visitInt8=B,z.prototype.visitInt16=B,z.prototype.visitInt32=B,z.prototype.visitInt64=B,z.prototype.visitUint8=B,z.prototype.visitUint16=B,z.prototype.visitUint32=B,z.prototype.visitUint64=B,z.prototype.visitFloat=B,z.prototype.visitFloat16=B,z.prototype.visitFloat32=B,z.prototype.visitFloat64=B,z.prototype.visitUtf8=B,z.prototype.visitLargeUtf8=B,z.prototype.visitBinary=B,z.prototype.visitLargeBinary=B,z.prototype.visitFixedSizeBinary=B,z.prototype.visitDate=B,z.prototype.visitDateDay=B,z.prototype.visitDateMillisecond=B,z.prototype.visitTimestamp=B,z.prototype.visitTimestampSecond=B,z.prototype.visitTimestampMillisecond=B,z.prototype.visitTimestampMicrosecond=B,z.prototype.visitTimestampNanosecond=B,z.prototype.visitTime=B,z.prototype.visitTimeSecond=B,z.prototype.visitTimeMillisecond=B,z.prototype.visitTimeMicrosecond=B,z.prototype.visitTimeNanosecond=B,z.prototype.visitDecimal=B,z.prototype.visitList=B,z.prototype.visitStruct=B,z.prototype.visitUnion=B,z.prototype.visitDenseUnion=ga,z.prototype.visitSparseUnion=ga,z.prototype.visitDictionary=B,z.prototype.visitInterval=B,z.prototype.visitIntervalDayTime=B,z.prototype.visitIntervalYearMonth=B,z.prototype.visitDuration=B,z.prototype.visitDurationSecond=B,z.prototype.visitDurationMillisecond=B,z.prototype.visitDurationMicrosecond=B,z.prototype.visitDurationNanosecond=B,z.prototype.visitFixedSizeList=B,z.prototype.visitMap=B;var _a=new z,V=class extends A{};function H(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(D.isInt(t)&&t.bitWidth!==64||D.isTime(t)&&t.bitWidth!==64||D.isFloat(t)&&t.precision!==_.HALF))return new ia(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new ia(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new va(i)})}var va=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};V.prototype.visitNull=H,V.prototype.visitBool=H,V.prototype.visitInt=H,V.prototype.visitInt8=H,V.prototype.visitInt16=H,V.prototype.visitInt32=H,V.prototype.visitInt64=H,V.prototype.visitUint8=H,V.prototype.visitUint16=H,V.prototype.visitUint32=H,V.prototype.visitUint64=H,V.prototype.visitFloat=H,V.prototype.visitFloat16=H,V.prototype.visitFloat32=H,V.prototype.visitFloat64=H,V.prototype.visitUtf8=H,V.prototype.visitLargeUtf8=H,V.prototype.visitBinary=H,V.prototype.visitLargeBinary=H,V.prototype.visitFixedSizeBinary=H,V.prototype.visitDate=H,V.prototype.visitDateDay=H,V.prototype.visitDateMillisecond=H,V.prototype.visitTimestamp=H,V.prototype.visitTimestampSecond=H,V.prototype.visitTimestampMillisecond=H,V.prototype.visitTimestampMicrosecond=H,V.prototype.visitTimestampNanosecond=H,V.prototype.visitTime=H,V.prototype.visitTimeSecond=H,V.prototype.visitTimeMillisecond=H,V.prototype.visitTimeMicrosecond=H,V.prototype.visitTimeNanosecond=H,V.prototype.visitDecimal=H,V.prototype.visitList=H,V.prototype.visitStruct=H,V.prototype.visitUnion=H,V.prototype.visitDenseUnion=H,V.prototype.visitSparseUnion=H,V.prototype.visitDictionary=H,V.prototype.visitInterval=H,V.prototype.visitIntervalDayTime=H,V.prototype.visitIntervalYearMonth=H,V.prototype.visitDuration=H,V.prototype.visitDurationSecond=H,V.prototype.visitDurationMillisecond=H,V.prototype.visitDurationMicrosecond=H,V.prototype.visitDurationNanosecond=H,V.prototype.visitFixedSizeList=H,V.prototype.visitMap=H;var ya=new V,ba,xa={},Sa={},U=class e{constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof L)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=xa[r.typeId],a=n[0];this.isValid=e=>ua(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,Sa[r.typeId]),this._offsets=sa(n)}this.data=n,this.type=r,this.stride=Rn(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return aa(this.data)}get nullCount(){return oa(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${w[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Ri(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return ya.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(Li(this,t,n,({data:e,_offsets:t},n,r)=>ca(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case w.Int:case w.Float:case w.Decimal:case w.Time:case w.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){let t=new Ca(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new Ca(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};ba=Symbol.toStringTag,U[ba]=(e=>{e.type=D.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(w).map(e=>w[e]).filter(e=>typeof e==`number`&&e!==w.NONE);for(let n of t)xa[n]={get:I.getVisitFnByTypeId(n),set:N.getVisitFnByTypeId(n),indexOf:_a.getVisitFnByTypeId(n)},Sa[n]=Object.create(e,{isValid:{value:da(ua)},get:{value:da(I.getVisitFnByTypeId(n))},set:{value:fa(N.getVisitFnByTypeId(n))},indexOf:{value:pa(_a.getVisitFnByTypeId(n))}});return`Vector`})(U.prototype);var Ca=class e extends U{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new U(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},wa=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},Ta=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):h.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Ct).__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 wa).__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 wa).__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 b).__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,h.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)}},W=class e{constructor(e=[],t,n,r=h.V5){this.fields=e||[],this.metadata=t||new Map,n||=Da(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Ea(Ea(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:Ea(Ea(new Map,r[t].metadata),e.metadata)}))&&!1}),o=Da(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};W.prototype.fields=null,W.prototype.metadata=null,W.prototype.dictionaries=null;var G=class e{static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};G.prototype.type=null,G.prototype.name=null,G.prototype.nullable=null,G.prototype.metadata=null;function Ea(e,t){return new Map([...e||new Map,...t||new Map])}function Da(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(D.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&Da(r.children,t)}return t}var Oa=Ke,ka=Ge,Aa=class{static decode(e){e=new ka(m(e));let t=Ta.getRootAsFooter(e);return new ja(W.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new Oa,n=W.encode(t,e.schema);Ta.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())Ma.encode(t,n);let r=t.endVector();Ta.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())Ma.encode(t,n);let i=t.endVector();return Ta.startFooter(t),Ta.addSchema(t,n),Ta.addVersion(t,h.V5),Ta.addRecordBatches(t,r),Ta.addDictionaries(t,i),Ta.finishFooterBuffer(t,Ta.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=h.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},ja=class extends Aa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Ma.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Ma.decode(t)}return null}},Ma=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return wa.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=T(n),this.bodyLength=T(t)}},K=Object.freeze({done:!0,value:void 0}),Na=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Pa=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},Fa=class extends Pa{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return i(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(K);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return je.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return je.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return i(this,void 0,void 0,function*(){return yield this.abort(e),K})}return(e){return i(this,void 0,void 0,function*(){return yield this.close(),K})}read(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(K)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Ia=class extends Fa{write(e){if((e=m(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?ee(this.toUint8Array(!0)):this.toUint8Array(!1).then(ee)}toUint8Array(e=!1){return e?xe(this._values)[0]:i(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=l(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return xe(i,a)[0]})}},La=class{constructor(e){e&&(this.source=new za(je.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)}},Ra=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Ia?this.source=new Ba(je.fromAsyncIterable(t)):ge(t)?this.source=new Ba(je.fromNodeStream(t)):me(t)?this.source=new Ba(je.fromDOMStream(t)):de(t)?this.source=new Ba(je.fromDOMStream(t.body)):oe(t)?this.source=new Ba(je.fromIterable(t)):(ae(t)||se(t))&&(this.source=new Ba(je.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},za=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)||K)}return(e){return Object.create(this.source.return&&this.source.return(e)||K)}},Ba=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return i(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return i(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return i(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return i(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||K;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return i(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||K;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},Va=class extends La{constructor(e,t){super(),this.position=0,this.buffer=m(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},Ha=class extends Ra{constructor(e,t){super(),this.position=0,this._handle=e,typeof t==`number`?this.size=t:this._pending=i(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return i(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 i(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 i(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,t){return i(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r}=this;if(n&&e+t<r){let i=Math.min(r,e+t),a=new Uint8Array(i-e);return(yield n.read(a,0,t,e)).buffer}return new Uint8Array(t)})}close(){return i(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return i(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return i(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}},Ua=65536;function Wa(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ga=8,Ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],qa=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?Ua:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Wa(this.buffer[1])} ${Wa(this.buffer[0])}`}},q=class e extends qa{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=Ga<r-n?Ga:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([Ka[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ja=class e extends qa{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=Ga<i-n?Ga:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([Ka[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ya=class e{constructor(e){this.buffer=e}high(){return new Ja(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ja(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 q(new Uint32Array([this.buffer[3],0])),n=new q(new Uint32Array([this.buffer[2],0])),r=new q(new Uint32Array([this.buffer[1],0])),i=new q(new Uint32Array([this.buffer[0],0])),a=new q(new Uint32Array([e.buffer[3],0])),o=new q(new Uint32Array([e.buffer[2],0])),s=new q(new Uint32Array([e.buffer[1],0])),c=new q(new Uint32Array([e.buffer[0],0])),l=q.multiply(i,c);this.buffer[0]=l.low();let u=new q(new Uint32Array([l.high(),0]));return l=q.multiply(r,c),u.plus(l),l=q.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new q(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(q.multiply(n,c)).plus(q.multiply(r,s)).plus(q.multiply(i,o)),this.buffer[3]+=q.multiply(t,c).plus(q.multiply(n,s)).plus(q.multiply(r,o)).plus(q.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Wa(this.buffer[3])} ${Wa(this.buffer[2])} ${Wa(this.buffer[1])} ${Wa(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=Ga<i-n?Ga:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([Ka[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}},Xa=class extends A{constructor(e,t,n,r,i=h.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i}visit(e){return super.visit(e instanceof G?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return R({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<h.V5&&this.readNullBitmap(e,n),e.mode===g.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return R({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readDictionary(e){return this.dictionaries.get(e.id)}},Za=class extends Xa{constructor(e,t,n,r,i){super(new Uint8Array,t,n,r,i),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:Qi(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return p(Uint8Array,p(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return p(Uint8Array,p(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(e)||(D.isInt(e)||D.isTime(e))&&e.bitWidth===64||D.isDuration(e)||D.isDate(e)&&e.unit===v.MILLISECOND?p(Uint8Array,Ja.convertArray(n[t])):D.isDecimal(e)?p(Uint8Array,Ya.convertArray(n[t])):D.isBinary(e)||D.isLargeBinary(e)||D.isFixedSizeBinary(e)?Qa(n[t]):D.isBool(e)?Qi(n[t]):D.isUtf8(e)||D.isLargeUtf8(e)?ne(n[t].join(``)):p(Uint8Array,p(e.ArrayType,n[t].map(e=>+e)))}};function Qa(e){let t=e.join(``),n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e>>1]=Number.parseInt(t.slice(e,e+2),16);return n}var J=class extends A{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function Y(e,t){return t instanceof e.constructor}function $a(e,t){return e===t||Y(e,t)}function eo(e,t){return e===t||Y(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function to(e,t){return e===t||Y(e,t)&&e.precision===t.precision}function no(e,t){return e===t||Y(e,t)&&e.byteWidth===t.byteWidth}function ro(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function io(e,t){return e===t||Y(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ao(e,t){return e===t||Y(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function oo(e,t){return e===t||Y(e,t)&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function so(e,t){return e===t||Y(e,t)&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function co(e,t){return e===t||Y(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&ho.compareManyFields(e.children,t.children)}function lo(e,t){return e===t||Y(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&ho.visit(e.indices,t.indices)&&ho.visit(e.dictionary,t.dictionary)}function uo(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function fo(e,t){return e===t||Y(e,t)&&e.unit===t.unit}function po(e,t){return e===t||Y(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}function mo(e,t){return e===t||Y(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&ho.compareManyFields(e.children,t.children)}J.prototype.visitNull=$a,J.prototype.visitBool=$a,J.prototype.visitInt=eo,J.prototype.visitInt8=eo,J.prototype.visitInt16=eo,J.prototype.visitInt32=eo,J.prototype.visitInt64=eo,J.prototype.visitUint8=eo,J.prototype.visitUint16=eo,J.prototype.visitUint32=eo,J.prototype.visitUint64=eo,J.prototype.visitFloat=to,J.prototype.visitFloat16=to,J.prototype.visitFloat32=to,J.prototype.visitFloat64=to,J.prototype.visitUtf8=$a,J.prototype.visitLargeUtf8=$a,J.prototype.visitBinary=$a,J.prototype.visitLargeBinary=$a,J.prototype.visitFixedSizeBinary=no,J.prototype.visitDate=ro,J.prototype.visitDateDay=ro,J.prototype.visitDateMillisecond=ro,J.prototype.visitTimestamp=io,J.prototype.visitTimestampSecond=io,J.prototype.visitTimestampMillisecond=io,J.prototype.visitTimestampMicrosecond=io,J.prototype.visitTimestampNanosecond=io,J.prototype.visitTime=ao,J.prototype.visitTimeSecond=ao,J.prototype.visitTimeMillisecond=ao,J.prototype.visitTimeMicrosecond=ao,J.prototype.visitTimeNanosecond=ao,J.prototype.visitDecimal=$a,J.prototype.visitList=oo,J.prototype.visitStruct=so,J.prototype.visitUnion=co,J.prototype.visitDenseUnion=co,J.prototype.visitSparseUnion=co,J.prototype.visitDictionary=lo,J.prototype.visitInterval=uo,J.prototype.visitIntervalDayTime=uo,J.prototype.visitIntervalYearMonth=uo,J.prototype.visitDuration=fo,J.prototype.visitDurationSecond=fo,J.prototype.visitDurationMillisecond=fo,J.prototype.visitDurationMicrosecond=fo,J.prototype.visitDurationNanosecond=fo,J.prototype.visitFixedSizeList=po,J.prototype.visitMap=mo;var ho=new J;function go(e,t){return ho.compareSchemas(e,t)}function _o(e,t){return vo(e,t.map(e=>e.data.concat()))}function vo(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=yo(n,o,u,t,i),o>0&&(r[a++]=R({type:new k(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new X(e,t))]}function yo(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??R({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var bo,xo=class e{constructor(...t){if(t.length===0)return this.batches=[],this.schema=new W([]),this._offsets=[0],this;let n,r;t[0]instanceof W&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof X)return[t];if(t instanceof e)return t.batches;if(t instanceof L){if(t.type instanceof k)return[new X(new W(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new U([t[e]])),[,i]=_o(n??new W(e.map((e,t)=>new G(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new X(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new W([]),!(n instanceof W))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof X))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!go(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??sa(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=oa(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Ri(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?ya.visit(new U(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
2
2
  `)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new X(n,e)))}slice(t,n){let r=this.schema;[t,n]=Li({length:this.numRows},t,n);let i=ca(this.data,this._offsets,t,n);return new e(r,i.map(e=>new X(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(t=>t.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=R({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new U(t)}return null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||=new U([R({type:new sn,length:this.numRows})]);let e=r.fields.slice(),a=e[t].clone({type:n.type}),o=this.schema.fields.map((e,t)=>this.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=_o(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(..._o(a,o))}};bo=Symbol.toStringTag,xo[bo]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=da(ua),e.get=da(I.getVisitFn(w.Struct)),e.set=fa(N.getVisitFn(w.Struct)),e.indexOf=pa(_a.getVisitFn(w.Struct)),`Table`))(xo.prototype);var So,X=class e{constructor(...e){switch(e.length){case 2:if([this.schema]=e,!(this.schema instanceof W)||([,this.data=R({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>R({type:e.type,nullCount:0}))})]=e,!(this.data instanceof L)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=Co(this.schema,this.data.children);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=G.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new W(n),o=R({type:new k(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Co(a,o.children,i);break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get dictionaries(){return this._dictionaries||=wo(this.schema.fields,this.data.children)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return I.visit(this.data,e)}at(e){return this.get(Ri(e,this.numRows))}set(e,t){return N.visit(this.data,e,t)}indexOf(e,t){return _a.visit(this.data,e,t)}[Symbol.iterator](){return ya.visit(new U([this.data]))}toArray(){return[...this]}concat(...e){return new xo(this.schema,[this,...e])}slice(t,n){let[r]=new U([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(e){return this.getChildAt(this.schema.fields?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new U([this.data.children[e]]):null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||=new U([R({type:new sn,length:this.numRows})]);let e=r.fields.slice(),a=i.children.slice(),o=e[t].clone({type:n.type});[e[t],a[t]]=[o,n.data[0]],r=new W(e,new Map(this.schema.metadata)),i=R({type:new k(e),children:a})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new k(n.fields),i=[];for(let e of t){let t=this.schema.fields.findIndex(t=>t.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,R({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=R({type:new k(n.fields),length:this.numRows,children:r});return new e(n,i)}};So=Symbol.toStringTag,X[So]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,`RecordBatch`))(X.prototype);function Co(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){let r=[...e.fields],i=[...t],a=(n+63&-64)>>3;for(let[o,s]of e.fields.entries()){let e=t[o];(!e||e.length!==n)&&(r[o]=s.clone({nullable:!0}),i[o]=e?._changeLengthAndBackfillNullBitmap(n)??R({type:s.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(r),R({type:new k(r),length:n,children:i})]}function wo(e,t,n=new Map){if((e?.length??0)>0&&e?.length===t?.length)for(let r=-1,i=e.length;++r<i;){let{type:i}=e[r],a=t[r];for(let e of[a,...a?.dictionary?.data||[]])wo(i.children,e?.children,n);if(D.isDictionary(i)){let{id:e}=i;if(!n.has(e))a?.dictionary&&n.set(e,a.dictionary);else if(n.get(e)!==a.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}}return n}var To=class extends X{constructor(e){let t=e.fields.map(e=>R({type:e.type})),n=R({type:new k(e.fields),nullCount:0,children:t});super(e,n)}},Eo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):h.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):C.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new b).__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,h.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,C.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt(`0`))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}},Do=new class extends A{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return _t.startNull(t),_t.endNull(t)}visitInt(e,t){return nt.startInt(t),nt.addBitWidth(t,e.bitWidth),nt.addIsSigned(t,e.isSigned),nt.endInt(t)}visitFloat(e,t){return dt.startFloatingPoint(t),dt.addPrecision(t,e.precision),dt.endFloatingPoint(t)}visitBinary(e,t){return it.startBinary(t),it.endBinary(t)}visitLargeBinary(e,t){return pt.startLargeBinary(t),pt.endLargeBinary(t)}visitBool(e,t){return at.startBool(t),at.endBool(t)}visitUtf8(e,t){return St.startUtf8(t),St.endUtf8(t)}visitLargeUtf8(e,t){return mt.startLargeUtf8(t),mt.endLargeUtf8(t)}visitDecimal(e,t){return st.startDecimal(t),st.addScale(t,e.scale),st.addPrecision(t,e.precision),st.addBitWidth(t,e.bitWidth),st.endDecimal(t)}visitDate(e,t){return ot.startDate(t),ot.addUnit(t,e.unit),ot.endDate(t)}visitTime(e,t){return yt.startTime(t),yt.addUnit(t,e.unit),yt.addBitWidth(t,e.bitWidth),yt.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return bt.startTimestamp(t),bt.addUnit(t,e.unit),n!==void 0&&bt.addTimezone(t,n),bt.endTimestamp(t)}visitInterval(e,t){return ft.startInterval(t),ft.addUnit(t,e.unit),ft.endInterval(t)}visitDuration(e,t){return ct.startDuration(t),ct.addUnit(t,e.unit),ct.endDuration(t)}visitList(e,t){return ht.startList(t),ht.endList(t)}visitStruct(e,t){return vt.startStruct_(t),vt.endStruct_(t)}visitUnion(e,t){xt.startTypeIdsVector(t,e.typeIds.length);let n=xt.createTypeIdsVector(t,e.typeIds);return xt.startUnion(t),xt.addMode(t,e.mode),xt.addTypeIds(t,n),xt.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return rt.startDictionaryEncoding(t),rt.addId(t,BigInt(e.id)),rt.addIsOrdered(t,e.isOrdered),n!==void 0&&rt.addIndexType(t,n),rt.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return lt.startFixedSizeBinary(t),lt.addByteWidth(t,e.byteWidth),lt.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return ut.startFixedSizeList(t),ut.addListSize(t,e.listSize),ut.endFixedSizeList(t)}visitMap(e,t){return gt.startMap(t),gt.addKeysSorted(t,e.keysSorted),gt.endMap(t)}};function Oo(e,t=new Map){return new W(jo(e,t),Lo(e.metadata),t)}function ko(e){return new Z(e.count,No(e.columns),Po(e.columns))}function Ao(e){return new Uo(ko(e.data),e.id,e.isDelta)}function jo(e,t){return(e.fields||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function Mo(e,t){return(e.children||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function No(e){return(e||[]).reduce((e,t)=>[...e,new Go(t.count,Fo(t.VALIDITY)),...No(t.children)],[])}function Po(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let r=e[n];r.VALIDITY&&t.push(new Wo(t.length,r.VALIDITY.length)),r.TYPE_ID&&t.push(new Wo(t.length,r.TYPE_ID.length)),r.OFFSET&&t.push(new Wo(t.length,r.OFFSET.length)),r.DATA&&t.push(new Wo(t.length,r.DATA.length)),t=Po(r.children,t)}return t}function Fo(e){return(e||[]).reduce((e,t)=>e+ +(t===0),0)}function Io(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=zo(e,Mo(e,t)),i=new G(e.name,o,e.nullable,Lo(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?Ro(r):new un,s=new Ln(t.get(n),r,n,a.isOrdered),i=new G(e.name,s,e.nullable,Lo(e.metadata))):(r=(r=a.indexType)?Ro(r):new un,t.set(n,o=zo(e,Mo(e,t))),s=new Ln(o,r,n,a.isOrdered),i=new G(e.name,s,e.nullable,Lo(e.metadata))),i||null}function Lo(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function Ro(e){return new O(e.isSigned,e.bitWidth)}function zo(e,t){let n=e.type.name;switch(n){case`NONE`:return new sn;case`null`:return new sn;case`binary`:return new bn;case`largebinary`:return new xn;case`utf8`:return new Sn;case`largeutf8`:return new Cn;case`bool`:return new wn;case`list`:return new jn((t||[])[0]);case`struct`:return new k(t||[]);case`struct_`:return new k(t||[])}switch(n){case`int`:{let t=e.type;return new O(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new gn(_[t.precision])}case`decimal`:{let t=e.type;return new Tn(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new En(v[t.unit])}case`time`:{let t=e.type;return new Dn(y[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new On(y[t.unit],t.timezone)}case`interval`:{let t=e.type;return new kn(ze[t.unit])}case`duration`:{let t=e.type;return new An(y[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new Mn(g[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new Nn(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new Pn(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new Fn((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var Bo=Ke,Vo=Ge,Ho=class e{static fromJSON(t,n){let r=new e(0,h.V5,n);return r._createHeader=Ko(t,n),r}static decode(t){t=new Vo(m(t));let n=Eo.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=new e(r,i,a);return o._createHeader=qo(n,a),o}static encode(e){let t=new Bo,n=-1;return e.isSchema()?n=W.encode(t,e.header()):e.isRecordBatch()?n=Z.encode(t,e.header()):e.isDictionaryBatch()&&(n=Uo.encode(t,e.header())),Eo.startMessage(t),Eo.addVersion(t,h.V5),Eo.addHeader(t,n),Eo.addHeaderType(t,e.headerType),Eo.addBodyLength(t,BigInt(e.bodyLength)),Eo.finishMessageBuffer(t,Eo.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof W)return new e(0,h.V5,C.Schema,t);if(t instanceof Z)return new e(n,h.V5,C.RecordBatch,t);if(t instanceof Uo)return new e(n,h.V5,C.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===C.Schema}isRecordBatch(){return this.headerType===C.RecordBatch}isDictionaryBatch(){return this.headerType===C.DictionaryBatch}constructor(e,t,n,r){this._version=t,this._headerType=n,this.body=new Uint8Array,r&&(this._createHeader=()=>r),this._bodyLength=T(e)}},Z=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,n){this._nodes=t,this._buffers=n,this._length=T(e)}},Uo=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=T(t)}},Wo=class{constructor(e,t){this.offset=T(e),this.length=T(t)}},Go=class{constructor(e,t){this.length=T(e),this.nullCount=T(t)}};function Ko(e,t){return(()=>{switch(t){case C.Schema:return W.fromJSON(e);case C.RecordBatch:return Z.fromJSON(e);case C.DictionaryBatch:return Uo.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)})}function qo(e,t){return(()=>{switch(t){case C.Schema:return W.decode(e.header(new Ct),new Map,e.version());case C.RecordBatch:return Z.decode(e.header(new Qe),e.version());case C.DictionaryBatch:return Uo.decode(e.header(new $e),e.version())}throw Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)})}G.encode=cs,G.decode=rs,G.fromJSON=Io,W.encode=ss,W.decode=Jo,W.fromJSON=Oo,Z.encode=ls,Z.decode=Yo,Z.fromJSON=ko,Uo.encode=us,Uo.decode=Xo,Uo.fromJSON=Ao,Go.encode=ds,Go.decode=Qo,Wo.encode=fs,Wo.decode=Zo;function Jo(e,t=new Map,n=h.V5){return new W(ts(e,t),is(e),t,n)}function Yo(e,t=h.V5){if(e.compression()!==null)throw Error(`Record batch compression not implemented`);return new Z(e.length(),$o(e),es(e,t))}function Xo(e,t=h.V5){return new Uo(Z.decode(e.data(),t),e.id(),e.isDelta())}function Zo(e){return new Wo(e.offset(),e.length())}function Qo(e){return new Go(e.length(),e.nullCount())}function $o(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++r<a;)(n=e.nodes(r))&&(t[++i]=Go.decode(n));return t}function es(e,t){let n=[];for(let r,i=-1,a=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<h.V4&&(r.bb_pos+=8*(i+1)),n[++a]=Wo.decode(r));return n}function ts(e,t){let n=[];for(let r,i=-1,a=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++a]=G.decode(r,t));return n}function ns(e,t){let n=[];for(let r,i=-1,a=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++a]=G.decode(r,t));return n}function rs(e,t){let n,r,i,a,o,s;return!t||!(s=e.dictionary())?(i=os(e,ns(e,t)),r=new G(e.name(),i,e.nullable(),is(e))):t.has(n=T(s.id()))?(a=(a=s.indexType())?as(a):new un,o=new Ln(t.get(n),a,n,s.isOrdered()),r=new G(e.name(),o,e.nullable(),is(e))):(a=(a=s.indexType())?as(a):new un,t.set(n,i=os(e,ns(e,t))),o=new Ln(i,a,n,s.isOrdered()),r=new G(e.name(),o,e.nullable(),is(e))),r||null}function is(e){let t=new Map;if(e)for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function as(e){return new O(e.isSigned(),e.bitWidth())}function os(e,t){let n=e.typeType();switch(n){case x.NONE:return new sn;case x.Null:return new sn;case x.Binary:return new bn;case x.LargeBinary:return new xn;case x.Utf8:return new Sn;case x.LargeUtf8:return new Cn;case x.Bool:return new wn;case x.List:return new jn((t||[])[0]);case x.Struct_:return new k(t||[])}switch(n){case x.Int:{let t=e.type(new nt);return new O(t.isSigned(),t.bitWidth())}case x.FloatingPoint:return new gn(e.type(new dt).precision());case x.Decimal:{let t=e.type(new st);return new Tn(t.scale(),t.precision(),t.bitWidth())}case x.Date:return new En(e.type(new ot).unit());case x.Time:{let t=e.type(new yt);return new Dn(t.unit(),t.bitWidth())}case x.Timestamp:{let t=e.type(new bt);return new On(t.unit(),t.timezone())}case x.Interval:return new kn(e.type(new ft).unit());case x.Duration:return new An(e.type(new ct).unit());case x.Union:{let n=e.type(new xt);return new Mn(n.mode(),n.typeIdsArray()||[],t||[])}case x.FixedSizeBinary:return new Nn(e.type(new lt).byteWidth());case x.FixedSizeList:return new Pn(e.type(new ut).listSize(),(t||[])[0]);case x.Map:{let n=e.type(new gt);return new Fn((t||[])[0],n.keysSorted())}}throw Error(`Unrecognized type: "${x[n]}" (${n})`)}function ss(e,t){let n=t.fields.map(t=>G.encode(e,t));Ct.startFieldsVector(e,n.length);let r=Ct.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Ct.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return Ct.startSchema(e),Ct.addFields(e,r),Ct.addEndianness(e,ps?et.Little:et.Big),i!==-1&&Ct.addCustomMetadata(e,i),Ct.endSchema(e)}function cs(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;D.isDictionary(a)?(o=a.dictionary.typeId,i=Do.visit(a,e),r=Do.visit(a.dictionary,e)):r=Do.visit(a,e);let s=(a.children||[]).map(t=>G.encode(e,t)),c=S.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?S.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),S.startField(e),S.addType(e,r),S.addTypeType(e,o),S.addChildren(e,c),S.addNullable(e,!!t.nullable),n!==-1&&S.addName(e,n),i!==-1&&S.addDictionary(e,i),l!==-1&&S.addCustomMetadata(e,l),S.endField(e)}function ls(e,t){let n=t.nodes||[],r=t.buffers||[];Qe.startNodesVector(e,n.length);for(let t of n.slice().reverse())Go.encode(e,t);let i=e.endVector();Qe.startBuffersVector(e,r.length);for(let t of r.slice().reverse())Wo.encode(e,t);let a=e.endVector();return Qe.startRecordBatch(e),Qe.addLength(e,BigInt(t.length)),Qe.addNodes(e,i),Qe.addBuffers(e,a),Qe.endRecordBatch(e)}function us(e,t){let n=Z.encode(e,t.data);return $e.startDictionaryBatch(e),$e.addId(e,BigInt(t.id)),$e.addIsDelta(e,t.isDelta),$e.addData(e,n),$e.endDictionaryBatch(e)}function ds(e,t){return Ze.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function fs(e,t){return Xe.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var ps=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),ms=e=>`Expected ${C[e]} Message in stream, but was null or length 0.`,hs=e=>`Header pointer of flatbuffer-encoded ${C[e]} Message is null or length 0.`,gs=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,_s=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,vs=class{constructor(e){this.source=e instanceof La?e:new La(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?K:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(ms(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=m(this.source.read(e));if(t.byteLength<e)throw Error(_s(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=C.Schema,n=this.readMessage(t)?.header();if(e&&!n)throw Error(hs(t));return n}readMetadataLength(){let e=this.source.read(4),t=(e&&new Ge(e))?.readInt32(0)||0;return{done:t===0,value:t}}readMetadata(e){let t=this.source.read(e);if(!t)return K;if(t.byteLength<e)throw Error(gs(e,t.byteLength));return{done:!1,value:Ho.decode(t)}}},ys=class{constructor(e,t){this.source=e instanceof Ra?e:ue(e)?new Ha(e,t):new Ra(e)}[Symbol.asyncIterator](){return this}next(){return i(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?K:e})}throw(e){return i(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return i(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return i(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(ms(e));return t.value})}readMessageBody(e){return i(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array;let t=m(yield this.source.read(e));if(t.byteLength<e)throw Error(_s(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return i(this,arguments,void 0,function*(e=!1){let t=C.Schema,n=(yield this.readMessage(t))?.header();if(e&&!n)throw Error(hs(t));return n})}readMetadataLength(){return i(this,void 0,void 0,function*(){let e=yield this.source.read(4),t=(e&&new Ge(e))?.readInt32(0)||0;return{done:t===0,value:t}})}readMetadata(e){return i(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return K;if(t.byteLength<e)throw Error(gs(e,t.byteLength));return{done:!1,value:Ho.decode(t)}})}},bs=class extends vs{constructor(e){super(new Uint8Array),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Na?e:new Na(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ho.fromJSON(e.schema,C.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:Ho.fromJSON(t,C.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:Ho.fromJSON(t,C.RecordBatch)}}return this._body=[],K}readMessageBody(e){return t(this._body);function t(e){return(e||[]).reduce((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(ms(e));return t.value}readSchema(){let e=C.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(hs(e));return n}},xs=`ARROW1`,Ss=new Uint8Array(6);for(let e=0;e<6;e+=1)Ss[e]=xs.codePointAt(e);function Cs(e,t=0){for(let n=-1,r=Ss.length;++n<r;)if(Ss[n]!==e[t+n])return!1;return!0}var ws=Ss.length,Ts=ws+4,Es=ws*2+4,Ds=class e extends Pa{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 ae(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 je.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return je.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:ce(t)?Vs(t):ue(t)?Ws(t):ae(t)?i(this,void 0,void 0,function*(){return yield e.from(yield t)}):de(t)||me(t)||ge(t)||se(t)?Us(new Ra(t)):Hs(new La(t))}static readAll(t){return t instanceof e?t.isSync()?zs(t):Bs(t):ce(t)||ArrayBuffer.isView(t)||oe(t)||le(t)?zs(t):Bs(t)}},Os=class extends Ds{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return s(this,arguments,function*(){yield o(yield*c(l(this[Symbol.iterator]())))})}},ks=class extends Ds{constructor(e){super(e),this._impl=e}readAll(){return i(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=l(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},As=class extends Os{constructor(e){super(e),this._impl=e}},js=class extends ks{constructor(e){super(e),this._impl=e}},Ms=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){let n=this._loadVectors(e,t,this.schema.fields),r=R({type:new k(this.schema.fields),length:e.length,children:n});return new X(this.schema,r)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new U(c)):new U(c)).memoize()}_loadVectors(e,t,n){return new Xa(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Ns=class extends Ms{constructor(e,t){super(t),this._reader=ce(e)?new bs(this._handle=e):new vs(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=Rs(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):K}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):K}next(){if(this.closed)return K;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new To(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},Ps=class extends Ms{constructor(e,t){super(t),this._reader=new ys(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return i(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 i(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Rs(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return i(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):K})}return(e){return i(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):K})}next(){return i(this,void 0,void 0,function*(){if(this.closed)return K;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new To(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return i(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},Fs=class extends Ns{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof Va?e:new Va(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer?.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(C.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n)}}return null}_readDictionaryBatch(e){let t=this._footer?.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(C.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-Ts,n=e.readInt32(t),r=e.readAt(t-n,n);return Aa.decode(r)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer?.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},Is=class extends Ps{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]==`number`?void 0:t.shift(),r=t[0]instanceof Map?t.shift():void 0;super(e instanceof Ha?e:new Ha(e,n),r)}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return i(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return i(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer?.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(C.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n)}}return null})}_readDictionaryBatch(e){return i(this,void 0,void 0,function*(){let t=this._footer?.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(C.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return i(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Ts,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return Aa.decode(r)})}_readNextMessageAndValidate(e){return i(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})}},Ls=class extends Ns{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new Za(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Rs(e,t){return t&&typeof t.autoDestroy==`boolean`?t.autoDestroy:e.autoDestroy}function*zs(e){let t=Ds.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Bs(e){return s(this,arguments,function*(){let t=yield o(Ds.from(e));try{if(!(yield o(t.open({autoDestroy:!1}))).closed)do yield yield o(t);while(!(yield o(t.reset().open())).closed)}finally{yield o(t.cancel())}})}function Vs(e){return new Os(new Ls(e))}function Hs(e){let t=e.peek(ws+7&-8);return t&&t.byteLength>=4?Cs(t)?new As(new Fs(e.read())):new Os(new Ns(e)):new Os(new Ns(function*(){}()))}function Us(e){return i(this,void 0,void 0,function*(){let t=yield e.peek(ws+7&-8);return t&&t.byteLength>=4?Cs(t)?new As(new Fs(yield e.read())):new ks(new Ps(e)):new ks(new Ps(function(){return s(this,arguments,function*(){})}()))})}function Ws(e){return i(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Ha(e,t);return t>=Es&&Cs(yield n.readAt(0,ws+7&-8))?new js(new Is(n)):new ks(new Ps(n))})}var Q=class e extends A{static assemble(...t){let n=e=>e.flatMap(e=>Array.isArray(e)?n(e):e instanceof X?e.data.children:e.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof U)return this.visitMany(e.data),this;let{type:t}=e;if(!D.isDictionary(t)){let{length:n}=e;if(n>2147483647)throw RangeError(`Cannot write arrays larger than 2^31 - 1 in length`);if(D.isUnion(t))this.nodes.push(new Go(n,0));else{let{nullCount:r}=e;D.isNull(t)||Gs.call(this,r<=0?new Uint8Array:Zi(e.offset,n,e.nullBitmap)),this.nodes.push(new Go(n,r))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Gs(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Wo(this._byteLength,t)),this._byteLength+=t,this}function Ks(e){let{type:t,length:n,typeIds:r,valueOffsets:i}=e;if(Gs.call(this,r),t.mode===g.Sparse)return Zs.call(this,e);if(t.mode===g.Dense){if(e.offset<=0)return Gs.call(this,i),Zs.call(this,e);{let a=new Int32Array(n),o=Object.create(null),s=Object.create(null);for(let e,t,c=-1;++c<n;)(e=r[c])!==void 0&&((t=o[e])===void 0&&(t=o[e]=i[c]),a[c]=i[c]-t,s[e]=(s[e]??0)+1);Gs.call(this,a),this.visitMany(e.children.map((e,r)=>{let i=t.typeIds[r],a=o[i],c=s[i];return e.slice(a,Math.min(n,c))}))}}return this}function qs(e){let t;return e.nullCount>=e.length?Gs.call(this,new Uint8Array):(t=e.values)instanceof Uint8Array?Gs.call(this,Zi(e.offset,e.length,t)):Gs.call(this,Qi(e.values))}function Js(e){return Gs.call(this,e.values.subarray(0,e.length*e.stride))}function Ys(e){let{length:t,values:n,valueOffsets:r}=e,i=T(r[0]),a=T(r[t]),o=Math.min(a-i,n.byteLength-i);return Gs.call(this,ke(-i,t+1,r)),Gs.call(this,n.subarray(i,i+o)),this}function Xs(e){let{length:t,valueOffsets:n}=e;if(n){let{0:r,[t]:i}=n;return Gs.call(this,ke(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function Zs(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Q.prototype.visitBool=qs,Q.prototype.visitInt=Js,Q.prototype.visitFloat=Js,Q.prototype.visitUtf8=Ys,Q.prototype.visitLargeUtf8=Ys,Q.prototype.visitBinary=Ys,Q.prototype.visitLargeBinary=Ys,Q.prototype.visitFixedSizeBinary=Js,Q.prototype.visitDate=Js,Q.prototype.visitTimestamp=Js,Q.prototype.visitTime=Js,Q.prototype.visitDecimal=Js,Q.prototype.visitList=Xs,Q.prototype.visitStruct=Zs,Q.prototype.visitUnion=Ks,Q.prototype.visitInterval=Js,Q.prototype.visitDuration=Js,Q.prototype.visitFixedSizeList=Xs,Q.prototype.visitMap=Xs;var Qs=class extends Pa{static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}constructor(e){super(),this._position=0,this._started=!1,this._sink=new Ia,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,f(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy!=`boolean`||e.autoDestroy,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat==`boolean`&&e.writeLegacyIpcFormat}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return ae(e)?e.then(e=>this.writeAll(e)):se(e)?nc(this,e):tc(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 Ia?this._sink=e:(this._sink=new Ia,e&&pe(e)?this.toDOMStream({type:`bytes`}).pipeTo(e):e&&he(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!t||!go(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)throw Error(`RecordBatchWriter is closed`);if(e==null||e instanceof xo&&!(t=e.schema)||e instanceof X&&!(t=e.schema))return this.finish()&&void 0;if(t&&!go(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof X?e instanceof To||this._writeRecordBatch(e):e instanceof xo?this.writeAll(e.batches):oe(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,r=Ho.encode(e),i=r.byteLength,a=this._writeLegacyIpcFormat?4:8,o=i+a+n&~n,s=o-i-a;return e.headerType===C.RecordBatch?this._recordBatchBlocks.push(new Ma(o,e.bodyLength,this._position)):e.headerType===C.DictionaryBatch&&this._dictionaryBlocks.push(new Ma(o,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-a)),i>0&&this._write(r),this._writePadding(s)}_write(e){if(this._started){let t=m(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(Ho.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Ss)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:r,buffers:i}=Q.assemble(e),a=new Z(e.numRows,n,r),o=Ho.from(a,t);return this._writeDictionaries(e)._writeMessage(o)._writeBodyBuffers(i)}_writeDictionaryBatch(e,t,n=!1){let{byteLength:r,nodes:i,bufferRegions:a,buffers:o}=Q.assemble(new U([e])),s=new Uo(new Z(e.length,i,a),t,n),c=Ho.from(s,r);return this._writeMessage(c)._writeBodyBuffers(o)}_writeBodyBuffers(e){let t,n,r;for(let i=-1,a=e.length;++i<a;)(t=e[i])&&(n=t.byteLength)>0&&(this._write(t),(r=(n+7&-8)-n)>0&&this._writePadding(r));return this}_writeDictionaries(e){for(let[t,n]of e.dictionaries){let e=n?.data??[],r=this._seenDictionaries.get(t),i=this._dictionaryDeltaOffsets.get(t)??0;if(!r||r.data[0]!==e[0])for(let[n,r]of e.entries())this._writeDictionaryBatch(r,t,n>0);else if(i<e.length)for(let n of e.slice(i))this._writeDictionaryBatch(n,t,!0);this._seenDictionaries.set(t,n),this._dictionaryDeltaOffsets.set(t,e.length)}return this}},$s=class e extends Qs{static writeAll(t,n){let r=new e(n);return ae(t)?t.then(e=>r.writeAll(e)):se(t)?nc(r,t):tc(r,t)}},ec=class e extends Qs{static writeAll(t){let n=new e;return ae(t)?t.then(e=>n.writeAll(e)):se(t)?nc(n,t):tc(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,t,n=!1){if(!n&&this._seenDictionaries.has(t))throw Error(`The Arrow File format does not support replacement dictionaries. `);return super._writeDictionaryBatch(e,t,n)}_writeFooter(e){let t=Aa.encode(new Aa(e,h.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}};function tc(e,t){let n=t;t instanceof xo&&(n=t.batches,e.reset(void 0,t.schema));for(let t of n)e.write(t);return e.finish()}function nc(e,t){return i(this,void 0,void 0,function*(){var n,r,i,a,o,s,c;try{for(n=!0,r=l(t);i=yield r.next(),a=i.done,!a;n=!0){c=i.value,n=!1;let t=c;e.write(t)}}catch(e){o={error:e}}finally{try{!n&&!a&&(s=r.return)&&(yield s.call(r))}finally{if(o)throw o.error}}return e.finish()})}function rc(e,t=`stream`){return(t===`stream`?$s:ec).writeAll(e).toUint8Array(!0)}var ic=Object.create,ac=Object.defineProperty,oc=Object.getOwnPropertyDescriptor,sc=Object.getOwnPropertyNames,cc=Object.getPrototypeOf,lc=Object.prototype.hasOwnProperty,uc=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dc=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of sc(t))!lc.call(e,i)&&i!==n&&ac(e,i,{get:()=>t[i],enumerable:!(r=oc(t,i))||r.enumerable});return e},fc=(e,t,n)=>(n=e==null?{}:ic(cc(e)),dc(t||!e||!e.__esModule?ac(n,`default`,{value:e,enumerable:!0}):n,e)),pc=uc((e,t)=>{t.exports=Worker}),mc=(e=>(e[e.UNDEFINED=0]=`UNDEFINED`,e[e.AUTOMATIC=1]=`AUTOMATIC`,e[e.READ_ONLY=2]=`READ_ONLY`,e[e.READ_WRITE=3]=`READ_WRITE`,e))(mc||{}),hc=(e=>(e[e.IDENTIFIER=0]=`IDENTIFIER`,e[e.NUMERIC_CONSTANT=1]=`NUMERIC_CONSTANT`,e[e.STRING_CONSTANT=2]=`STRING_CONSTANT`,e[e.OPERATOR=3]=`OPERATOR`,e[e.KEYWORD=4]=`KEYWORD`,e[e.COMMENT=5]=`COMMENT`,e))(hc||{}),gc=(e=>(e[e.NONE=0]=`NONE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARNING=3]=`WARNING`,e[e.ERROR=4]=`ERROR`,e))(gc||{}),_c=(e=>(e[e.NONE=0]=`NONE`,e[e.CONNECT=1]=`CONNECT`,e[e.DISCONNECT=2]=`DISCONNECT`,e[e.OPEN=3]=`OPEN`,e[e.QUERY=4]=`QUERY`,e[e.INSTANTIATE=5]=`INSTANTIATE`,e))(_c||{}),vc=(e=>(e[e.NONE=0]=`NONE`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`,e[e.START=3]=`START`,e[e.RUN=4]=`RUN`,e[e.CAPTURE=5]=`CAPTURE`,e))(vc||{}),yc=(e=>(e[e.NONE=0]=`NONE`,e[e.WEB_WORKER=1]=`WEB_WORKER`,e[e.NODE_WORKER=2]=`NODE_WORKER`,e[e.BINDINGS=3]=`BINDINGS`,e[e.ASYNC_DUCKDB=4]=`ASYNC_DUCKDB`,e))(yc||{}),bc=class{log(e){}},xc=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.MAX_ARROW_ERROR=255]=`MAX_ARROW_ERROR`,e[e.DUCKDB_WASM_RETRY=256]=`DUCKDB_WASM_RETRY`,e))(xc||{}),Sc=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=Ds.from(t);return console.assert(n.isSync(),`Reader is not sync`),console.assert(n.isFile(),`Reader is not file`),new xo(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;){if(this._bindings.isDetached()){console.error(`cannot send a message since the worker is not set!`);return}n=await this._bindings.pollPendingQuery(this._conn)}let r=new Cc(this._bindings,this._conn,n),i=await Ds.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new wc(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=rc(e,`stream`);await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},Cc=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e=null;for(this._inFlight!=null&&(e=await this._inFlight,this._inFlight=null);e==null;)e=await this.db.fetchQueryResults(this.conn);return this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},wc=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Ds.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new xo(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new Cc(this.bindings,this.connectionId,t),r=await Ds.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Tc=(e=>(e.CANCEL_PENDING_QUERY=`CANCEL_PENDING_QUERY`,e.CLOSE_PREPARED=`CLOSE_PREPARED`,e.COLLECT_FILE_STATISTICS=`COLLECT_FILE_STATISTICS`,e.REGISTER_OPFS_FILE_NAME=`REGISTER_OPFS_FILE_NAME`,e.CONNECT=`CONNECT`,e.COPY_FILE_TO_BUFFER=`COPY_FILE_TO_BUFFER`,e.COPY_FILE_TO_PATH=`COPY_FILE_TO_PATH`,e.CREATE_PREPARED=`CREATE_PREPARED`,e.DISCONNECT=`DISCONNECT`,e.DROP_FILE=`DROP_FILE`,e.DROP_FILES=`DROP_FILES`,e.EXPORT_FILE_STATISTICS=`EXPORT_FILE_STATISTICS`,e.FETCH_QUERY_RESULTS=`FETCH_QUERY_RESULTS`,e.FLUSH_FILES=`FLUSH_FILES`,e.GET_FEATURE_FLAGS=`GET_FEATURE_FLAGS`,e.GET_TABLE_NAMES=`GET_TABLE_NAMES`,e.GET_VERSION=`GET_VERSION`,e.GLOB_FILE_INFOS=`GLOB_FILE_INFOS`,e.INSERT_ARROW_FROM_IPC_STREAM=`INSERT_ARROW_FROM_IPC_STREAM`,e.INSERT_CSV_FROM_PATH=`IMPORT_CSV_FROM_PATH`,e.INSERT_JSON_FROM_PATH=`IMPORT_JSON_FROM_PATH`,e.INSTANTIATE=`INSTANTIATE`,e.OPEN=`OPEN`,e.PING=`PING`,e.POLL_PENDING_QUERY=`POLL_PENDING_QUERY`,e.REGISTER_FILE_BUFFER=`REGISTER_FILE_BUFFER`,e.REGISTER_FILE_HANDLE=`REGISTER_FILE_HANDLE`,e.REGISTER_FILE_URL=`REGISTER_FILE_URL`,e.RESET=`RESET`,e.RUN_PREPARED=`RUN_PREPARED`,e.RUN_QUERY=`RUN_QUERY`,e.SEND_PREPARED=`SEND_PREPARED`,e.START_PENDING_QUERY=`START_PENDING_QUERY`,e.TOKENIZE=`TOKENIZE`,e))(Tc||{}),Ec=(e=>(e.CONNECTION_INFO=`CONNECTION_INFO`,e.ERROR=`ERROR`,e.FEATURE_FLAGS=`FEATURE_FLAGS`,e.FILE_BUFFER=`FILE_BUFFER`,e.FILE_INFOS=`FILE_INFOS`,e.FILE_SIZE=`FILE_SIZE`,e.FILE_STATISTICS=`FILE_STATISTICS`,e.INSTANTIATE_PROGRESS=`INSTANTIATE_PROGRESS`,e.LOG=`LOG`,e.PROGRESS_UPDATE=`PROGRESS_UPDATE`,e.OK=`OK`,e.PREPARED_STATEMENT_ID=`PREPARED_STATEMENT_ID`,e.QUERY_PLAN=`QUERY_PLAN`,e.QUERY_RESULT=`QUERY_RESULT`,e.QUERY_RESULT_CHUNK=`QUERY_RESULT_CHUNK`,e.QUERY_RESULT_HEADER=`QUERY_RESULT_HEADER`,e.QUERY_RESULT_HEADER_OR_NULL=`QUERY_RESULT_HEADER_OR_NULL`,e.REGISTERED_FILE=`REGISTERED_FILE`,e.SCRIPT_TOKENS=`SCRIPT_TOKENS`,e.SUCCESS=`SUCCESS`,e.TABLE_NAMES=`TABLE_NAMES`,e.VERSION_STRING=`VERSION_STRING`,e))(Ec||{}),$=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((e,t)=>{this.promiseResolver=e,this.promiseRejecter=t})}};function Dc(e){switch(e.typeId){case w.Binary:return{sqlType:`binary`};case w.Bool:return{sqlType:`bool`};case w.Date:return{sqlType:`date`};case w.DateDay:return{sqlType:`date32[d]`};case w.DateMillisecond:return{sqlType:`date64[ms]`};case w.Decimal:{let t=e;return{sqlType:`decimal`,precision:t.precision,scale:t.scale}}case w.Float:return{sqlType:`float`};case w.Float16:return{sqlType:`float16`};case w.Float32:return{sqlType:`float32`};case w.Float64:return{sqlType:`float64`};case w.Int:return{sqlType:`int32`};case w.Int16:return{sqlType:`int16`};case w.Int32:return{sqlType:`int32`};case w.Int64:return{sqlType:`int64`};case w.Uint16:return{sqlType:`uint16`};case w.Uint32:return{sqlType:`uint32`};case w.Uint64:return{sqlType:`uint64`};case w.Uint8:return{sqlType:`uint8`};case w.IntervalDayTime:return{sqlType:`interval[dt]`};case w.IntervalYearMonth:return{sqlType:`interval[m]`};case w.List:return{sqlType:`list`,valueType:Dc(e.valueType)};case w.FixedSizeBinary:return{sqlType:`fixedsizebinary`,byteWidth:e.byteWidth};case w.Null:return{sqlType:`null`};case w.Utf8:return{sqlType:`utf8`};case w.Struct:return{sqlType:`struct`,fields:e.children.map(e=>Oc(e.name,e.type))};case w.Map:{let t=e;return{sqlType:`map`,keyType:Dc(t.keyType),valueType:Dc(t.valueType)}}case w.Time:return{sqlType:`time[s]`};case w.TimeMicrosecond:return{sqlType:`time[us]`};case w.TimeMillisecond:return{sqlType:`time[ms]`};case w.TimeNanosecond:return{sqlType:`time[ns]`};case w.TimeSecond:return{sqlType:`time[s]`};case w.Timestamp:return{sqlType:`timestamp`,timezone:e.timezone||void 0};case w.TimestampSecond:return{sqlType:`timestamp[s]`,timezone:e.timezone||void 0};case w.TimestampMicrosecond:return{sqlType:`timestamp[us]`,timezone:e.timezone||void 0};case w.TimestampNanosecond:return{sqlType:`timestamp[ns]`,timezone:e.timezone||void 0};case w.TimestampMillisecond:return{sqlType:`timestamp[ms]`,timezone:e.timezone||void 0}}throw Error(`unsupported arrow type: ${e.toString()}`)}function Oc(e,t){let n=Dc(t);return n.name=e,n}var kc=/'(opfs:\/\/\S*?)'/g,Ac=/(opfs:\/\/\S*?)/g;function jc(e){return e.search(Ac)>-1}function Mc(e){return[...e.matchAll(kc)].map(e=>e[1])}var Nc=new TextEncoder,Pc=class{constructor(e,t=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._config={},this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}get config(){return this._config}attach(e){this._worker=e,this._worker.addEventListener(`message`,this._onMessageHandler),this._worker.addEventListener(`error`,this._onErrorHandler),this._worker.addEventListener(`close`,this._onCloseHandler),this._workerShutdownPromise=new Promise((e,t)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener(`message`,this._onMessageHandler),this._worker.removeEventListener(`error`,this._onErrorHandler),this._worker.removeEventListener(`close`,this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error(`cannot send a message since the worker is not set!:`+e.type+`,`+e.data);return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case`PROGRESS_UPDATE`:for(let e of this._onExecutionProgress)e(n.data);return;case`LOG`:this._logger.log(n.data);return;case`INSTANTIATE_PROGRESS`:for(let e of this._onInstantiationProgress)e(n.data);return}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn(`unassociated response: [${n.requestId}, ${n.type.toString()}]`);return}if(this._pendingRequests.delete(n.requestId),n.type==`ERROR`){let e=Error(n.data.message);e.name=n.data.name,(t=Object.getOwnPropertyDescriptor(e,`stack`))!=null&&t.writable&&(e.stack=n.data.stack),r.promiseRejecter(e);return}switch(r.type){case`CLOSE_PREPARED`:case`COLLECT_FILE_STATISTICS`:case`REGISTER_OPFS_FILE_NAME`:case`COPY_FILE_TO_PATH`:case`DISCONNECT`:case`DROP_FILE`:case`DROP_FILES`:case`FLUSH_FILES`:case`INSERT_ARROW_FROM_IPC_STREAM`:case`IMPORT_CSV_FROM_PATH`:case`IMPORT_JSON_FROM_PATH`:case`OPEN`:case`PING`:case`REGISTER_FILE_BUFFER`:case`REGISTER_FILE_HANDLE`:case`REGISTER_FILE_URL`:case`RESET`:if(n.type==`OK`){r.promiseResolver(n.data);return}break;case`INSTANTIATE`:if(this._onInstantiationProgress=[],n.type==`OK`){r.promiseResolver(n.data);return}break;case`GLOB_FILE_INFOS`:if(n.type==`FILE_INFOS`){r.promiseResolver(n.data);return}break;case`GET_VERSION`:if(n.type==`VERSION_STRING`){r.promiseResolver(n.data);return}break;case`GET_FEATURE_FLAGS`:if(n.type==`FEATURE_FLAGS`){r.promiseResolver(n.data);return}break;case`GET_TABLE_NAMES`:if(n.type==`TABLE_NAMES`){r.promiseResolver(n.data);return}break;case`TOKENIZE`:if(n.type==`SCRIPT_TOKENS`){r.promiseResolver(n.data);return}break;case`COPY_FILE_TO_BUFFER`:if(n.type==`FILE_BUFFER`){r.promiseResolver(n.data);return}break;case`EXPORT_FILE_STATISTICS`:if(n.type==`FILE_STATISTICS`){r.promiseResolver(n.data);return}break;case`CONNECT`:if(n.type==`CONNECTION_INFO`){r.promiseResolver(n.data);return}break;case`RUN_PREPARED`:case`RUN_QUERY`:if(n.type==`QUERY_RESULT`){r.promiseResolver(n.data);return}break;case`SEND_PREPARED`:if(n.type==`QUERY_RESULT_HEADER`){r.promiseResolver(n.data);return}break;case`START_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`POLL_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`CANCEL_PENDING_QUERY`:if(this._onInstantiationProgress=[],n.type==`SUCCESS`){r.promiseResolver(n.data);return}break;case`FETCH_QUERY_RESULTS`:if(n.type==`QUERY_RESULT_CHUNK`){r.promiseResolver(n.data);return}break;case`CREATE_PREPARED`:if(n.type==`PREPARED_STATEMENT_ID`){r.promiseResolver(n.data);return}}r.promiseRejecter(Error(`unexpected response type: ${n.type.toString()}`))}onError(e){console.error(e),console.error(`error in duckdb worker: ${e.message}`),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn(`worker terminated with ${this._pendingRequests.size} pending requests`);return}this._pendingRequests.clear()}isDetached(){return!this._worker}async reset(){let e=new $(`RESET`,null);return await this.postTask(e)}async ping(){let e=new $(`PING`,null);await this.postTask(e)}async dropFile(e){let t=new $(`DROP_FILE`,e);return await this.postTask(t)}async dropFiles(e){let t=new $(`DROP_FILES`,e);return await this.postTask(t)}async flushFiles(){let e=new $(`FLUSH_FILES`,null);return await this.postTask(e)}async instantiate(e,t=null,n=e=>{}){this._onInstantiationProgress.push(n);let r=new $(`INSTANTIATE`,[e,t]);return await this.postTask(r)}async getVersion(){let e=new $(`GET_VERSION`,null);return await this.postTask(e)}async getFeatureFlags(){let e=new $(`GET_FEATURE_FLAGS`,null);return await this.postTask(e)}async open(e){this._config=e;let t=new $(`OPEN`,e);await this.postTask(t)}async tokenize(e){let t=new $(`TOKENIZE`,e);return await this.postTask(t)}async connectInternal(){let e=new $(`CONNECT`,null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new Sc(this,e)}async disconnect(e){let t=new $(`DISCONNECT`,e);await this.postTask(t)}async runQuery(e,t){if(this.shouldOPFSFileHandling()){let n=await this.registerOPFSFileFromSQL(t);try{return await this._runQueryAsync(e,t)}finally{n.length>0&&await this.dropFiles(n)}}else return await this._runQueryAsync(e,t)}async _runQueryAsync(e,t){let n=new $(`RUN_QUERY`,[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){if(this.shouldOPFSFileHandling()){let r=await this.registerOPFSFileFromSQL(t);try{return await this._startPendingQueryAsync(e,t,n)}finally{r.length>0&&await this.dropFiles(r)}}else return await this._startPendingQueryAsync(e,t,n)}async _startPendingQueryAsync(e,t,n=!1){let r=new $(`START_PENDING_QUERY`,[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new $(`POLL_PENDING_QUERY`,e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new $(`CANCEL_PENDING_QUERY`,e);return await this.postTask(t)}async fetchQueryResults(e){let t=new $(`FETCH_QUERY_RESULTS`,e);return await this.postTask(t)}async getTableNames(e,t){let n=new $(`GET_TABLE_NAMES`,[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new $(`CREATE_PREPARED`,[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new $(`CLOSE_PREPARED`,[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new $(`RUN_PREPARED`,[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new $(`SEND_PREPARED`,[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new $(`GLOB_FILE_INFOS`,e);return await this.postTask(t)}async registerFileText(e,t){let n=Nc.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new $(`REGISTER_FILE_URL`,[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new $(`REGISTER_FILE_BUFFER`,[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new $(`REGISTER_FILE_HANDLE`,[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new $(`REGISTER_OPFS_FILE_NAME`,[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new $(`COLLECT_FILE_STATISTICS`,[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new $(`EXPORT_FILE_STATISTICS`,e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new $(`COPY_FILE_TO_BUFFER`,e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new $(`COPY_FILE_TO_PATH`,[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new $(`INSERT_ARROW_FROM_IPC_STREAM`,[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(Oc(t,r))}n.columnsFlat=e,delete n.columns}let r=new $(`IMPORT_CSV_FROM_PATH`,[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(Oc(t,r))}n.columnsFlat=e,delete n.columns}let r=new $(`IMPORT_JSON_FROM_PATH`,[e,t,n]);await this.postTask(r)}shouldOPFSFileHandling(){return jc(this.config.path??``)?this.config.opfs?.fileHandling==`auto`:!1}async registerOPFSFileFromSQL(e){let t=Mc(e),n=[];for(let e of t)try{await this.registerOPFSFileName(e),n.push(e)}catch(t){throw console.error(t),Error(`File Not found:`+e)}return n}};function Fc(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<`u`&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}Fc();var Ic=(e=>(e[e.BUFFER=0]=`BUFFER`,e[e.NODE_FS=1]=`NODE_FS`,e[e.BROWSER_FILEREADER=2]=`BROWSER_FILEREADER`,e[e.BROWSER_FSACCESS=3]=`BROWSER_FSACCESS`,e[e.HTTP=4]=`HTTP`,e[e.S3=5]=`S3`,e))(Ic||{}),Lc=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Rc=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),zc=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Bc=()=>(async e=>{try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Vc={name:`@duckdb/duckdb-wasm`,version:`1.32.0`,description:`DuckDB powered by WebAssembly`,license:`MIT`,repository:{type:`git`,url:`https://github.com/duckdb/duckdb-wasm.git`},keywords:[`sql`,`duckdb`,`relational`,`database`,`data`,`query`,`wasm`,`analytics`,`olap`,`arrow`,`parquet`,`json`,`csv`],dependencies:{"apache-arrow":`^17.0.0`},devDependencies:{"@types/emscripten":`^1.39.10`,"@types/jasmine":`^5.1.4`,"@typescript-eslint/eslint-plugin":`^6.21.0`,"@typescript-eslint/parser":`^6.21.0`,esbuild:`^0.20.2`,eslint:`^8.57.0`,"eslint-plugin-jasmine":`^4.1.3`,"eslint-plugin-react":`^7.34.0`,"fast-glob":`^3.3.2`,jasmine:`^5.1.0`,"jasmine-core":`^5.1.2`,"jasmine-spec-reporter":`^7.0.0`,"js-sha256":`^0.11.1`,karma:`^6.4.2`,"karma-chrome-launcher":`^3.2.0`,"karma-coverage":`^2.2.1`,"karma-firefox-launcher":`^2.1.3`,"karma-jasmine":`^5.1.0`,"karma-jasmine-html-reporter":`^2.1.0`,"karma-sourcemap-loader":`^0.4.0`,"karma-spec-reporter":`^0.0.36`,"make-dir":`^4.0.0`,nyc:`^15.1.0`,prettier:`^3.2.5`,puppeteer:`^22.8.0`,rimraf:`^5.0.5`,s3rver:`^3.7.1`,typedoc:`^0.25.13`,typescript:`^5.3.3`,"wasm-feature-detect":`^1.6.1`,"web-worker":`^1.2.0`},scripts:{"build:debug":`node bundle.mjs debug && tsc --emitDeclarationOnly`,"build:release":`node bundle.mjs release && tsc --emitDeclarationOnly`,docs:`typedoc`,format:`prettier --write "**/*.+(js|ts)"`,report:`node ./coverage.mjs`,"test:node":`node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:debug":`node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:coverage":`nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:firefox":`karma start ./karma/tests-firefox.cjs`,"test:chrome":`karma start ./karma/tests-chrome.cjs`,"test:chrome:eh":`karma start ./karma/tests-chrome-eh.cjs`,"test:chrome:coverage":`karma start ./karma/tests-chrome-coverage.cjs`,"test:browser":`karma start ./karma/tests-all.cjs`,"test:browser:debug":`karma start ./karma/tests-debug.cjs`,test:`npm run test:chrome && npm run test:node`,"test:coverage":`npm run test:chrome:coverage && npm run test:node:coverage && npm run report`,lint:`eslint src test`},files:[`dist`,`!dist/tests-*`,`!dist/duckdb-browser-mvp.worker.js.map`,`!dist/types/test`],main:`dist/duckdb-browser.cjs`,module:`dist/duckdb-browser.mjs`,types:`dist/duckdb-browser.d.ts`,jsdelivr:`dist/duckdb-browser.cjs`,unpkg:`dist/duckdb-browser.mjs`,sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":`./dist/duckdb-mvp.wasm`,"./dist/duckdb-eh.wasm":`./dist/duckdb-eh.wasm`,"./dist/duckdb-coi.wasm":`./dist/duckdb-coi.wasm`,"./dist/duckdb-browser":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser.cjs":`./dist/duckdb-browser.cjs`,"./dist/duckdb-browser.mjs":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser-coi.pthread.worker.js":`./dist/duckdb-browser-coi.pthread.worker.js`,"./dist/duckdb-browser-coi.worker.js":`./dist/duckdb-browser-coi.worker.js`,"./dist/duckdb-browser-eh.worker.js":`./dist/duckdb-browser-eh.worker.js`,"./dist/duckdb-browser-mvp.worker.js":`./dist/duckdb-browser-mvp.worker.js`,"./dist/duckdb-node":`./dist/duckdb-node.cjs`,"./dist/duckdb-node.cjs":`./dist/duckdb-node.cjs`,"./dist/duckdb-node-blocking":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-blocking.cjs":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-eh.worker.cjs":`./dist/duckdb-node-eh.worker.cjs`,"./dist/duckdb-node-mvp.worker.cjs":`./dist/duckdb-node-mvp.worker.cjs`,"./blocking":{node:{types:`./dist/duckdb-node-blocking.d.ts`,require:`./dist/duckdb-node-blocking.cjs`,import:`./dist/duckdb-node-blocking.cjs`},types:`./dist/duckdb-node-blocking.d.ts`,import:`./dist/duckdb-node-blocking.mjs`,require:`./dist/duckdb-node-blocking.cjs`},".":{browser:{types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`},node:{types:`./dist/duckdb-node.d.ts`,import:`./dist/duckdb-node.cjs`,require:`./dist/duckdb-node.cjs`},types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`}}},Hc=Vc.name,Uc=Vc.version,Wc=Vc.version.split(`.`);Wc[0],Wc[1],Wc[2];var Gc=()=>typeof navigator>`u`;function Kc(){let e=`https://cdn.jsdelivr.net/npm/${Hc}@${Uc}/dist/`;return{mvp:{mainModule:`${e}duckdb-mvp.wasm`,mainWorker:`${e}duckdb-browser-mvp.worker.js`},eh:{mainModule:`${e}duckdb-eh.wasm`,mainWorker:`${e}duckdb-browser-eh.worker.js`}}}var qc=null,Jc=null,Yc=null,Xc=null,Zc=null;async function Qc(){return qc??=typeof BigInt64Array<`u`,Jc??=await Rc(),Yc??=await Bc(),Xc??=await zc(),Zc??=await Lc(),{bigInt64Array:qc,crossOriginIsolated:Gc()||globalThis.crossOriginIsolated||!1,wasmExceptions:Jc,wasmSIMD:Xc,wasmThreads:Yc,wasmBulkMemory:Zc}}async function $c(e){let t=await Qc();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var el=fc(pc());async function tl(e){let t=new Request(e),n=await fetch(t),r=URL.createObjectURL(await n.blob());return new el.default(r)}function nl(e){if(e==null)return``;if(e instanceof Uint8Array)return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);if(typeof e==`object`)try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)}catch{return String(e)}return String(e)}var rl=`https://assets.anyfile.top/vendor/duckdb/1.32.0`,il={mvp:{mainModule:`${rl}/duckdb-mvp.wasm`,mainWorker:`${rl}/duckdb-browser-mvp.worker.js`},eh:{mainModule:`${rl}/duckdb-eh.wasm`,mainWorker:`${rl}/duckdb-browser-eh.worker.js`}},al=`/vendor/duckdb/1.32.0`;function ol(e){let t=`${al}/${e}`,n=globalThis.location?.origin;return n&&n!==`null`?`${n}${t}`:t}var sl=()=>({mvp:{mainModule:ol(`duckdb-mvp.wasm`),mainWorker:ol(`duckdb-browser-mvp.worker.js`)},eh:{mainModule:ol(`duckdb-eh.wasm`),mainWorker:ol(`duckdb-browser-eh.worker.js`)}});async function cl(e){let t=[{name:`jsDelivr`,value:Kc()},{name:`R2`,value:il},{name:`local`,value:sl()}];return n({signal:e,sources:t,errorMessage:`Unable to initialize DuckDB from jsDelivr, R2, or local assets`,abortMessage:`Viewer operation aborted.`,async createAttempt(e){let t=await $c(e.value);if(!t.mainWorker)throw Error(`No compatible DuckDB worker bundle`);let n=await tl(t.mainWorker),r=new Pc(new bc,n);return{async initialize(){return await r.instantiate(t.mainModule,t.pthreadWorker),r},async dispose(){await r.terminate().catch(()=>void 0)}}}})}var ll=[{kind:`csv`,name:{en:`CSV data`,"zh-CN":`CSV 数据`},extensions:[`.csv`,`.csv.gz`,`.csv.zst`],mimeTypes:[`text/csv`,`application/gzip`,`application/zstd`]},{kind:`tsv`,name:{en:`TSV data`,"zh-CN":`TSV 数据`},extensions:[`.tsv`,`.tab`,`.tsv.gz`,`.tab.gz`,`.tsv.zst`,`.tab.zst`],mimeTypes:[`text/tab-separated-values`,`application/gzip`,`application/zstd`]},{kind:`json`,name:{en:`JSON data`,"zh-CN":`JSON 数据`},extensions:[`.json`,`.jsonl`,`.ndjson`,`.json.gz`,`.jsonl.gz`,`.ndjson.gz`,`.json.zst`,`.jsonl.zst`,`.ndjson.zst`],mimeTypes:[`application/json`,`application/jsonl`,`application/x-ndjson`]},{kind:`parquet`,name:{en:`Parquet data`,"zh-CN":`Parquet 数据`},extensions:[`.parquet`,`.parq`,`.pq`],mimeTypes:[`application/vnd.apache.parquet`,`application/x-parquet`]},{kind:`arrow`,name:{en:`Arrow IPC data`,"zh-CN":`Arrow IPC 数据`},extensions:[`.arrow`,`.arrows`,`.ipc`,`.feather`],mimeTypes:[`application/vnd.apache.arrow.file`,`application/vnd.apache.arrow.stream`]},{kind:`database`,name:{en:`DuckDB database`,"zh-CN":`DuckDB 数据库`},extensions:[`.duckdb`,`.ddb`],mimeTypes:[`application/vnd.duckdb`,`application/x-duckdb`]}];function ul(e){let t=e.toLowerCase();for(let e of ll){let n=e.extensions.find(e=>t.endsWith(e));if(n)return{format:e,extension:n}}}var dl=`source`,fl=2147483648,pl=`https://assets.anyfile.top/vendor/duckdb/1.32.0/extensions`;function ml(){let e=globalThis.location?.origin;return e&&e!==`null`?`${e}/vendor/duckdb/1.32.0/extensions`:void 0}async function hl(e,t){let n=[pl,ml()].filter(e=>!!e);for(let r of n)try{await e.query(`SET custom_extension_repository = '${r}'`),await e.query(`LOAD ${t}`);return}catch{}await e.query(`SET custom_extension_repository = ''`).catch(()=>void 0)}function gl(e){return`"${e.replaceAll(`"`,`""`)}"`}function _l(e,t){switch(e){case`csv`:return{id:`source`,label:`CSV 数据`,sql:`read_csv_auto('${t}', header=true)`};case`tsv`:return{id:`source`,label:`TSV 数据`,sql:`read_csv_auto('${t}', header=true, delim='\\t')`};case`json`:return{id:`source`,label:`JSON 数据`,sql:`read_json_auto('${t}')`};case`parquet`:return{id:`source`,label:`Parquet 数据`,sql:`read_parquet('${t}')`};default:throw Error(`Unsupported data file extension`)}}async function vl(e,t,n){let r=await Ds.from(t.stream()),i=()=>void r.cancel();n.addEventListener(`abort`,i,{once:!0});let a=!1;try{for await(let t of r){if(n.aborted)throw new DOMException(`Viewer operation aborted.`,`AbortError`);await e.insertArrowTable(new xo(t),{name:`arrow_data`,create:!a}),a=!0}return a||await e.insertArrowTable(new xo(r.schema,[]),{name:`arrow_data`,create:!0}),{id:`arrow_data`,label:`Arrow IPC 数据`,sql:`"main"."arrow_data"`}}finally{n.removeEventListener(`abort`,i)}}function yl(e){let t=e.getChildAt(0),n=e.getChildAt(1),r=e.getChildAt(2);return!t||!n||!r?[]:Array.from({length:e.numRows},(e,i)=>{let a=String(t.get(i)),o=String(n.get(i)),s=String(r.get(i));return{id:`${a}.${o}.${s}`,label:o===`main`?s:`${o}.${s}`,sql:`${gl(a)}.${gl(o)}.${gl(s)}`}})}async function bl(e){return yl(await e.query(`
3
3
  SELECT table_catalog, table_schema, table_name
4
4
  FROM information_schema.tables