@loaders.gl/shapefile 4.4.0-alpha.1 → 4.4.0-alpha.9

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 (72) hide show
  1. package/dist/dbf-arrow-loader.d.ts +3 -3
  2. package/dist/dbf-arrow-loader.d.ts.map +1 -1
  3. package/dist/dbf-arrow-loader.js +2 -1
  4. package/dist/dbf-arrow-loader.js.map +1 -0
  5. package/dist/dbf-format.js +1 -0
  6. package/dist/dbf-format.js.map +1 -0
  7. package/dist/dbf-loader.d.ts +3 -2
  8. package/dist/dbf-loader.d.ts.map +1 -1
  9. package/dist/dbf-loader.js +2 -1
  10. package/dist/dbf-loader.js.map +1 -0
  11. package/dist/dbf-worker.js +227 -201
  12. package/dist/dist.dev.js +51 -22
  13. package/dist/dist.min.js +5 -5
  14. package/dist/index.cjs +29 -13
  15. package/dist/index.cjs.map +4 -4
  16. package/dist/index.js +1 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/lib/parsers/parse-dbf-to-arrow.d.ts +1 -1
  19. package/dist/lib/parsers/parse-dbf-to-arrow.d.ts.map +1 -1
  20. package/dist/lib/parsers/parse-dbf-to-arrow.js +3 -1
  21. package/dist/lib/parsers/parse-dbf-to-arrow.js.map +1 -0
  22. package/dist/lib/parsers/parse-dbf.d.ts +1 -1
  23. package/dist/lib/parsers/parse-dbf.d.ts.map +1 -1
  24. package/dist/lib/parsers/parse-dbf.js +3 -1
  25. package/dist/lib/parsers/parse-dbf.js.map +1 -0
  26. package/dist/lib/parsers/parse-shapefile.d.ts +1 -1
  27. package/dist/lib/parsers/parse-shapefile.d.ts.map +1 -1
  28. package/dist/lib/parsers/parse-shapefile.js +16 -4
  29. package/dist/lib/parsers/parse-shapefile.js.map +1 -0
  30. package/dist/lib/parsers/parse-shp-geometry.js +1 -0
  31. package/dist/lib/parsers/parse-shp-geometry.js.map +1 -0
  32. package/dist/lib/parsers/parse-shp-header.js +1 -0
  33. package/dist/lib/parsers/parse-shp-header.js.map +1 -0
  34. package/dist/lib/parsers/parse-shp.d.ts +1 -1
  35. package/dist/lib/parsers/parse-shp.d.ts.map +1 -1
  36. package/dist/lib/parsers/parse-shp.js +3 -1
  37. package/dist/lib/parsers/parse-shp.js.map +1 -0
  38. package/dist/lib/parsers/parse-shx.js +1 -0
  39. package/dist/lib/parsers/parse-shx.js.map +1 -0
  40. package/dist/lib/parsers/types.d.ts +9 -5
  41. package/dist/lib/parsers/types.d.ts.map +1 -1
  42. package/dist/lib/parsers/types.js +1 -0
  43. package/dist/lib/parsers/types.js.map +1 -0
  44. package/dist/lib/streaming/binary-chunk-reader.js +1 -0
  45. package/dist/lib/streaming/binary-chunk-reader.js.map +1 -0
  46. package/dist/lib/streaming/binary-reader.js +1 -0
  47. package/dist/lib/streaming/binary-reader.js.map +1 -0
  48. package/dist/lib/streaming/zip-batch-iterators.js +1 -0
  49. package/dist/lib/streaming/zip-batch-iterators.js.map +1 -0
  50. package/dist/shapefile-loader.d.ts +8 -2
  51. package/dist/shapefile-loader.d.ts.map +1 -1
  52. package/dist/shapefile-loader.js +2 -1
  53. package/dist/shapefile-loader.js.map +1 -0
  54. package/dist/shp-loader.d.ts +3 -3
  55. package/dist/shp-loader.d.ts.map +1 -1
  56. package/dist/shp-loader.js +2 -1
  57. package/dist/shp-loader.js.map +1 -0
  58. package/dist/shp-worker.js +227 -201
  59. package/dist/workers/dbf-worker.js +1 -0
  60. package/dist/workers/dbf-worker.js.map +1 -0
  61. package/dist/workers/shp-worker.js +1 -0
  62. package/dist/workers/shp-worker.js.map +1 -0
  63. package/package.json +12 -6
  64. package/src/dbf-arrow-loader.ts +8 -3
  65. package/src/dbf-loader.ts +9 -3
  66. package/src/lib/parsers/parse-dbf-to-arrow.ts +5 -2
  67. package/src/lib/parsers/parse-dbf.ts +5 -2
  68. package/src/lib/parsers/parse-shapefile.ts +23 -10
  69. package/src/lib/parsers/parse-shp.ts +5 -2
  70. package/src/lib/parsers/types.ts +11 -6
  71. package/src/shapefile-loader.ts +15 -8
  72. package/src/shp-loader.ts +6 -4
package/dist/dist.min.js CHANGED
@@ -4,18 +4,18 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var rd=Object.create;var zn=Object.defineProperty;var id=Object.getOwnPropertyDescriptor;var sd=Object.getOwnPropertyNames;var nd=Object.getPrototypeOf,od=Object.prototype.hasOwnProperty;var ad=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qr=(e,t)=>{for(var r in t)zn(e,r,{get:t[r],enumerable:!0})},Pn=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of sd(t))!od.call(e,s)&&s!==r&&zn(e,s,{get:()=>t[s],enumerable:!(i=id(t,s))||i.enumerable});return e},jn=(e,t,r)=>(Pn(e,t,"default"),r&&Pn(r,t,"default")),hd=(e,t,r)=>(r=e!=null?rd(nd(e)):{},Pn(t||!e||!e.__esModule?zn(r,"default",{value:e,enumerable:!0}):r,e)),ld=e=>Pn(zn({},"__esModule",{value:!0}),e);var ll=ad((E_,hl)=>{hl.exports=globalThis.loaders});var Un={};qr(Un,{DBFArrowLoader:()=>td,DBFArrowWorkerLoader:()=>al,DBFLoader:()=>Ln,DBFWorkerLoader:()=>sl,SHPLoader:()=>Ls,SHPWorkerLoader:()=>za,ShapefileLoader:()=>Jf,_BinaryChunkReader:()=>nr,_BinaryReader:()=>La,_zipBatchIterators:()=>Ta});jn(Un,hd(ll(),1));var nr=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(t){let{maxRewindBytes:r=0}=t||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=r}write(t){this.arrayBuffers.push(t)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(t){let r=-this.offset;for(let i of this.arrayBuffers)if(r+=i.byteLength,r>=t)return!0;return!1}findBufferOffsets(t){let r=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let n=this.arrayBuffers[s];if(r+n.byteLength<=0){r+=n.byteLength;continue}let o=r<=0?Math.abs(r):0,a;if(o+t<=n.byteLength)return a=o+t,i.push([s,[o,a]]),i;a=n.byteLength,i.push([s,[o,a]]),t-=n.byteLength-o,r+=n.byteLength}return null}getDataView(t){let r=this.findBufferOffsets(t);if(!r&&this.ended)throw new Error("binary data exhausted");if(!r)return null;if(r.length===1){let[s,[n,o]]=r[0],a=this.arrayBuffers[s],h=new DataView(a,n,o-n);return this.offset+=t,this.disposeBuffers(),h}let i=new DataView(this._combineArrayBuffers(r));return this.offset+=t,this.disposeBuffers(),i}disposeBuffers(){for(;this.arrayBuffers.length>0&&this.offset-this.maxRewindBytes>=this.arrayBuffers[0].byteLength;)this.offset-=this.arrayBuffers[0].byteLength,this.arrayBuffers.shift()}_combineArrayBuffers(t){let r=0;for(let n of t){let[o,a]=n[1];r+=a-o}let i=new Uint8Array(r),s=0;for(let n of t){let[o,[a,h]]=n,l=new Uint8Array(this.arrayBuffers[o]);i.set(l.subarray(a,h),s),s+=h-a}return i.buffer}skip(t){this.offset+=t}rewind(t){this.offset-=t}};function kn(e){let t={magic:e.getInt32(0,!1),length:e.getInt32(24,!1)*2,version:e.getInt32(28,!0),type:e.getInt32(32,!0),bbox:{minX:e.getFloat64(36,!0),minY:e.getFloat64(44,!0),minZ:e.getFloat64(68,!0),minM:e.getFloat64(84,!0),maxX:e.getFloat64(52,!0),maxY:e.getFloat64(60,!0),maxZ:e.getFloat64(76,!0),maxM:e.getFloat64(92,!0)}};return t.magic!==9994&&console.error(`SHP file: bad magic number ${t.magic}`),t.version!==1e3&&console.error(`SHP file: bad version ${t.version}`),t}function cl(e,t){let{_maxDimensions:r=4}=t?.shp||{},i=0,s=e.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return cd();case 1:return Ra(e,i,Math.min(2,r));case 3:return zi(e,i,Math.min(2,r),"LineString");case 5:return zi(e,i,Math.min(2,r),"Polygon");case 8:return Ua(e,i,Math.min(2,r));case 11:return Ra(e,i,Math.min(4,r));case 13:return zi(e,i,Math.min(4,r),"LineString");case 15:return zi(e,i,Math.min(4,r),"Polygon");case 18:return Ua(e,i,Math.min(4,r));case 21:return Ra(e,i,Math.min(3,r));case 23:return zi(e,i,Math.min(3,r),"LineString");case 25:return zi(e,i,Math.min(3,r),"Polygon");case 28:return Ua(e,i,Math.min(3,r));default:throw new Error(`unsupported shape type: ${s}`)}}function cd(){return null}function Ra(e,t,r){let i;return[i,t]=ri(e,t,1,r),{positions:{value:i,size:r},type:"Point"}}function Ua(e,t,r){t+=4*Float64Array.BYTES_PER_ELEMENT;let i=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let s=null,n=null,o=null;return[s,t]=ri(e,t,i,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[o,t]=ri(e,t,i,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[n,t]=ri(e,t,i,1)),{positions:{value:ul(s,n,o),size:r},type:"Point"}}function zi(e,t,r,i){t+=4*Float64Array.BYTES_PER_ELEMENT;let s=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let n=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let o=e.byteOffset+t,a=s*Int32Array.BYTES_PER_ELEMENT,h=new Int32Array(s+1);h.set(new Int32Array(e.buffer.slice(o,o+a))),h[s]=n,t+=s*Int32Array.BYTES_PER_ELEMENT;let l=null,c=null,u=null;[l,t]=ri(e,t,n,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[u,t]=ri(e,t,n,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[c,t]=ri(e,t,n,1));let d=ul(l,c,u);if(i==="LineString")return{type:i,positions:{value:d,size:r},pathIndices:{value:h,size:1}};let p=[];for(let m=1;m<h.length;m++){let g=h[m-1],v=h[m],I=l.subarray(g*2,v*2);ud(I)>0&&p.push(g)}return p.push(n),{type:i,positions:{value:d,size:r},primitivePolygonIndices:{value:h,size:1},polygonIndices:{value:new Uint32Array(p),size:1}}}function ri(e,t,r,i){let s=e.byteOffset+t,n=r*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(e.buffer.slice(s,s+n)),t+n]}function ul(e,t,r){if(!(t||r))return e;let i=e.length,s=2;r&&r.length&&(i+=r.length,s++),t&&t.length&&(i+=t.length,s++);let n=new Float64Array(i);for(let o=0;o<e.length/2;o++)n[s*o]=e[o*2],n[s*o+1]=e[o*2+1];if(r&&r.length)for(let o=0;o<r.length;o++)n[s*o+2]=r[o];if(t&&t.length)for(let o=0;o<t.length;o++)n[s*o+(s-1)]=t[o];return n}function ud(e){return Math.sign(fd(e))}function fd(e){let t=0,r=e.length/2-1;for(let i=0;i<r;i++)t+=(e[i*2]+e[(i+1)*2])*(e[i*2+1]-e[(i+1)*2+1]);return t/2}var dd=!0,fl=!1,pd=100,Fs=12,ze={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Vn=class{options={};binaryReader=new nr({maxRewindBytes:Fs});state=ze.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(t){this.options=t}write(t){this.binaryReader.write(t),this.state=dl(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=dl(this.state,this.result,this.binaryReader,this.options),this.state!==ze.END&&(this.state=ze.ERROR,this.result.error="SHP incomplete file")}};function Ca(e,t){let r=new Vn(t);return r.write(e),r.end(),r.result}async function*pl(e,t){let r=new Vn(t),i=!1;for await(let s of e)r.write(s),!i&&r.result.header&&(i=!0,yield r.result.header),r.result.geometries.length>0&&(yield r.result.geometries,r.result.geometries=[]);r.end(),r.result.geometries.length>0&&(yield r.result.geometries)}function dl(e,t,r,i){for(;;)try{switch(e){case ze.ERROR:case ze.END:return e;case ze.EXPECTING_HEADER:let s=r.getDataView(pd);if(!s)return e;t.header=kn(s),t.progress={bytesUsed:0,bytesTotal:t.header.length,rows:0},t.currentIndex=1,e=ze.EXPECTING_RECORD;break;case ze.EXPECTING_RECORD:for(;r.hasAvailableBytes(Fs);){let n=r.getDataView(Fs),o={recordNumber:n.getInt32(0,fl),byteLength:n.getInt32(4,fl)*2,type:n.getInt32(8,dd)};if(!r.hasAvailableBytes(o.byteLength-4))return r.rewind(Fs),e;if(o.byteLength<4||o.type!==t.header?.type||o.recordNumber!==t.currentIndex)r.rewind(Fs-4);else{r.rewind(4);let h=r.getDataView(o.byteLength),l=cl(h,i);t.geometries.push(l),t.currentIndex++,t.progress.rows=t.currentIndex-1}}return r.ended&&(e=ze.END),e;default:return e=ze.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=ze.ERROR,t.error=`SHP parsing failed: ${s?.message}`,e}}var md="4.4.0-alpha.0",Pa=[0,0,39,10],za={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:md,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(Pa).buffer],options:{shp:{_maxDimensions:4}}},Ls={...za,parse:async(e,t)=>Ca(e,t),parseSync:Ca,parseInBatches:(e,t)=>pl(e,t)};async function Gn(e,t,r,i){return i._parse(e,t,r,i)}async function Wn(e,t,r,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(e,t,r,i)}function ja(e,t){for(let r of e)r.geometry.coordinates=ml(r.geometry.coordinates,t);return e}function ml(e,t){return yd(e)?t(e):e.map(r=>ml(r,t))}function yd(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}function gl(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function x(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function a(c){try{l(i.next(c))}catch(u){o(u)}}function h(c){try{l(i.throw(c))}catch(u){o(u)}}function l(c){c.done?n(c.value):s(c.value).then(a,h)}l((i=i.apply(e,t||[])).next())})}function yl(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function V(e){return this instanceof V?(this.v=e,this):new V(e)}function _e(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(m){return Promise.resolve(m).then(p,u)}}function a(p,m){i[p]&&(s[p]=function(g){return new Promise(function(v,I){n.push([p,g,v,I])>1||h(p,g)})},m&&(s[p]=m(s[p])))}function h(p,m){try{l(i[p](m))}catch(g){d(n[0][3],g)}}function l(p){p.value instanceof V?Promise.resolve(p.value.v).then(c,u):d(n[0][2],p)}function c(p){h("next",p)}function u(p){h("throw",p)}function d(p,m){p(m),n.shift(),n.length&&h(n[0][0],n[0][1])}}function ji(e){var t,r;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:V(e[s](o)),done:!1}:n?n(o):o}:n}}function je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof yl=="function"?yl(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(a,h){o=e[n](o),s(a,h,o.done,o.value)})}}function s(n,o,a,h){Promise.resolve(h).then(function(l){n({value:l,done:a})},o)}}var qa={};qr(qa,{compareArrayLike:()=>Ha,joinUint8Arrays:()=>be,memcpy:()=>Cs,rebaseValueOffsets:()=>Zn,toArrayBufferView:()=>G,toArrayBufferViewAsyncIterator:()=>Ge,toArrayBufferViewIterator:()=>ar,toBigInt64Array:()=>Kn,toBigUint64Array:()=>Sd,toFloat32Array:()=>Bd,toFloat32ArrayAsyncIterator:()=>Vd,toFloat32ArrayIterator:()=>Ld,toFloat64Array:()=>Ad,toFloat64ArrayAsyncIterator:()=>Gd,toFloat64ArrayIterator:()=>Rd,toInt16Array:()=>xd,toInt16ArrayAsyncIterator:()=>Pd,toInt16ArrayIterator:()=>Od,toInt32Array:()=>ii,toInt32ArrayAsyncIterator:()=>zd,toInt32ArrayIterator:()=>Ed,toInt8Array:()=>wd,toInt8ArrayAsyncIterator:()=>Cd,toInt8ArrayIterator:()=>Td,toUint16Array:()=>Md,toUint16ArrayAsyncIterator:()=>jd,toUint16ArrayIterator:()=>Nd,toUint32Array:()=>Id,toUint32ArrayAsyncIterator:()=>kd,toUint32ArrayIterator:()=>Fd,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>Wa,toUint8ArrayIterator:()=>Ga,toUint8ClampedArray:()=>Dd,toUint8ClampedArrayAsyncIterator:()=>Wd,toUint8ClampedArrayIterator:()=>Ud});var gd=new TextDecoder("utf-8"),Rs=e=>gd.decode(e),_d=new TextEncoder,or=e=>_d.encode(e);var bd=e=>typeof e=="number",_l=e=>typeof e=="boolean",St=e=>typeof e=="function",Gt=e=>e!=null&&Object(e)===e,ke=e=>Gt(e)&&St(e.then);var Ve=e=>Gt(e)&&St(e[Symbol.iterator]),Ae=e=>Gt(e)&&St(e[Symbol.asyncIterator]),Hn=e=>Gt(e)&&Gt(e.schema);var qn=e=>Gt(e)&&"done"in e&&"value"in e;var $n=e=>Gt(e)&&St(e.stat)&&bd(e.fd);var Yn=e=>Gt(e)&&Us(e.body),Jn=e=>"_getDOMStream"in e&&"_getNodeStream"in e,bl=e=>Gt(e)&&St(e.abort)&&St(e.getWriter)&&!Jn(e),Us=e=>Gt(e)&&St(e.cancel)&&St(e.getReader)&&!Jn(e),vl=e=>Gt(e)&&St(e.end)&&St(e.write)&&_l(e.writable)&&!Jn(e),Xn=e=>Gt(e)&&St(e.read)&&St(e.pipe)&&_l(e.readable)&&!Jn(e),wl=e=>Gt(e)&&St(e.clear)&&St(e.bytes)&&St(e.position)&&St(e.setPosition)&&St(e.capacity)&&St(e.getBufferIdentifier)&&St(e.createLong);var Va=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function vd(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,a,h=0,l=0,c=e.length;++h<c;){if(o=t[l],a=e[h],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:s}=o,{byteOffset:i,byteLength:n}=a,r+s<i||i+n<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,r,i-r+n)}return t}function Cs(e,t,r=0,i=t.byteLength){let s=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,s));return n.set(o,r),e}function be(e,t){let r=vd(e),i=r.reduce((c,u)=>c+u.byteLength,0),s,n,o,a=0,h=-1,l=Math.min(t||Number.POSITIVE_INFINITY,i);for(let c=r.length;++h<c;){if(s=r[h],n=s.subarray(0,Math.min(s.length,l-a)),l<=a+n.length){n.length<s.length?r[h]=s.subarray(n.length):n.length===s.length&&h++,o?Cs(o,n,a):o=n;break}Cs(o||(o=new Uint8Array(l)),n,a),a+=n.length}return[o||new Uint8Array(0),r.slice(h),i-(o?o.byteLength:0)]}function G(e,t){let r=qn(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=or(r)),r instanceof ArrayBuffer?new e(r):r instanceof Va?new e(r):wl(r)?G(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var wd=e=>G(Int8Array,e),xd=e=>G(Int16Array,e),ii=e=>G(Int32Array,e),Kn=e=>G(BigInt64Array,e),N=e=>G(Uint8Array,e),Md=e=>G(Uint16Array,e),Id=e=>G(Uint32Array,e),Sd=e=>G(BigUint64Array,e),Bd=e=>G(Float32Array,e),Ad=e=>G(Float64Array,e),Dd=e=>G(Uint8ClampedArray,e),ka=e=>(e.next(),e);function*ar(e,t){let r=function*(s){yield s},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Va?r(t):Ve(t)?t:r(t);return yield*ka(function*(s){let n=null;do n=s.next(yield G(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var Td=e=>ar(Int8Array,e),Od=e=>ar(Int16Array,e),Ed=e=>ar(Int32Array,e),Ga=e=>ar(Uint8Array,e),Nd=e=>ar(Uint16Array,e),Fd=e=>ar(Uint32Array,e),Ld=e=>ar(Float32Array,e),Rd=e=>ar(Float64Array,e),Ud=e=>ar(Uint8ClampedArray,e);function Ge(e,t){return _e(this,arguments,function*(){if(ke(t))return yield V(yield V(yield*ji(je(Ge(e,yield V(t))))));let i=function(o){return _e(this,arguments,function*(){yield yield V(yield V(o))})},s=function(o){return _e(this,arguments,function*(){yield V(yield*ji(je(ka(function*(a){let h=null;do h=a.next(yield h?.value);while(!h.done)}(o[Symbol.iterator]())))))})},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Va?i(t):Ve(t)?s(t):Ae(t)?t:i(t);return yield V(yield*ji(je(ka(function(o){return _e(this,arguments,function*(){let a=null;do a=yield V(o.next(yield yield V(G(e,a))));while(!a.done)})}(n[Symbol.asyncIterator]()))))),yield V(new e)})}var Cd=e=>Ge(Int8Array,e),Pd=e=>Ge(Int16Array,e),zd=e=>Ge(Int32Array,e),Wa=e=>Ge(Uint8Array,e),jd=e=>Ge(Uint16Array,e),kd=e=>Ge(Uint32Array,e),Vd=e=>Ge(Float32Array,e),Gd=e=>Ge(Float64Array,e),Wd=e=>Ge(Uint8ClampedArray,e);function Zn(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i<s;)r[i]+=e}return r.subarray(0,t)}function Ha(e,t){let r=0,i=e.length;if(i!==t.length)return!1;if(i>0)do if(e[r]!==t[r])return!1;while(++r<i);return!0}var Lt={fromIterable(e){return Qn(Hd(e))},fromAsyncIterable(e){return Qn(qd(e))},fromDOMStream(e){return Qn($d(e))},fromNodeStream(e){return Qn(Yd(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Qn=e=>(e.next(),e);function*Hd(e){let t,r=!1,i=[],s,n,o,a=0;function h(){return n==="peek"?be(i,o)[0]:([s,i,a]=be(i,o),s)}({cmd:n,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Ga(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&s.byteLength>0&&(i.push(s),a+=s.byteLength),t||o<=a)do({cmd:n,size:o}=yield h());while(o<a);while(!t)}catch(c){(r=!0)&&typeof l.throw=="function"&&l.throw(c)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function qd(e){return _e(this,arguments,function*(){let r,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?be(s,a)[0]:([n,s,h]=be(s,a),n)}({cmd:o,size:a}=(yield yield V((()=>null)()))||{cmd:"read",size:0});let c=Wa(e)[Symbol.asyncIterator]();try{do if({done:r,value:n}=Number.isNaN(a-h)?yield V(c.next()):yield V(c.next(a-h)),!r&&n.byteLength>0&&(s.push(n),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield V(l()));while(a<h);while(!r)}catch(u){(i=!0)&&typeof c.throw=="function"&&(yield V(c.throw(u)))}finally{i===!1&&typeof c.return=="function"&&(yield V(c.return(new Uint8Array(0))))}return yield V(null)})}function $d(e){return _e(this,arguments,function*(){let r=!1,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?be(s,a)[0]:([n,s,h]=be(s,a),n)}({cmd:o,size:a}=(yield yield V((()=>null)()))||{cmd:"read",size:0});let c=new Ya(e);try{do if({done:r,value:n}=Number.isNaN(a-h)?yield V(c.read()):yield V(c.read(a-h)),!r&&n.byteLength>0&&(s.push(N(n)),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield V(l()));while(a<h);while(!r)}catch(u){(i=!0)&&(yield V(c.cancel(u)))}finally{i===!1?yield V(c.cancel()):e.locked&&c.releaseLock()}return yield V(null)})}var Ya=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return x(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return x(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=N(r)),r})}},$a=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function Yd(e){return _e(this,arguments,function*(){let r=[],i="error",s=!1,n=null,o,a,h=0,l=[],c;function u(){return o==="peek"?be(l,a)[0]:([c,l,h]=be(l,a),c)}if({cmd:o,size:a}=(yield yield V((()=>null)()))||{cmd:"read",size:0},e.isTTY)return yield yield V(new Uint8Array(0)),yield V(null);try{r[0]=$a(e,"end"),r[1]=$a(e,"error");do{if(r[2]=$a(e,"readable"),[i,n]=yield V(Promise.race(r.map(p=>p[2]))),i==="error")break;if((s=i==="end")||(Number.isFinite(a-h)?(c=N(e.read(a-h)),c.byteLength<a-h&&(c=N(e.read()))):c=N(e.read()),c.byteLength>0&&(l.push(c),h+=c.byteLength)),s||a<=h)do({cmd:o,size:a}=yield yield V(u()));while(a<h)}while(!s)}finally{yield V(d(r,i==="error"?n:null))}return yield V(null);function d(p,m){return c=l=null,new Promise((g,v)=>{for(let[I,z]of p)e.off(I,z);try{let I=e.destroy;I&&I.call(e,m),m=void 0}catch(I){m=I||m}finally{m!=null?v(m):g()}})}})}var et;(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"})(et||(et={}));var at;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(at||(at={}));var st;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(st||(st={}));var ft;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ft||(ft={}));var M;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(M||(M={}));var _t;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(_t||(_t={}));var hr=new Int32Array(2),to=new Float32Array(hr.buffer),eo=new Float64Array(hr.buffer),ki=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Ps;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Ps||(Ps={}));var Wt=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Wt(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return hr[0]=this.readInt32(t),to[0]}readFloat64(t){return hr[ki?0:1]=this.readInt32(t),hr[ki?1:0]=this.readInt32(t+4),eo[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){to[0]=r,this.writeInt32(t,hr[0])}writeFloat64(t,r){eo[0]=r,this.writeInt32(t,hr[ki?0:1]),this.writeInt32(t+4,hr[ki?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let i=t-this.readInt32(t);return r<this.readInt16(i)?this.readInt16(i+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+i);return r===Ps.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};var Dr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=Wt.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<i+t+r;){let s=this.bb.capacity();this.bb=Dr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,i){(this.force_defaults||r!=i)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,i){(this.force_defaults||r!=i)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,i){(this.force_defaults||r!=i)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,i){(this.force_defaults||r!==i)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,i){(this.force_defaults||r!=i)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,i){r!=i&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=r<<1,s=Wt.allocate(i);return s.setPosition(i-r),s.bytes().set(t.bytes(),i-r),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let h=this.bb.capacity()-this.vtables[r];if(n==this.bb.readInt16(h)){for(let l=2;l<n;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(h+l))continue t;o=this.vtables[r];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,i){let s=i?4:0;if(r){let n=r;if(this.prep(this.minalign,4+4+s),n.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r<this.bb.readInt16(s)&&this.bb.readInt16(s+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,i){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(i,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)r.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var zs;(function(e){e[e.BUFFER=0]="BUFFER"})(zs||(zs={}));var js;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(js||(js={}));var He=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new He).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):js.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):zs.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,js.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,zs.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,i){return He.startBodyCompression(t),He.addCodec(t,r),He.addMethod(t,i),He.endBodyCompression(t)}};var Vi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Gi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new Gi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Vi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new He).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var $r;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})($r||($r={}));var ks;(function(e){e[e.DenseArray=0]="DenseArray"})(ks||(ks={}));var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,i){return Tt.startInt(t),Tt.addBitWidth(t,r),Tt.addIsSigned(t,i),Tt.endInt(t)}};var ve=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Tt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ks.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,ks.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,i){return ht.startKeyValue(t),ht.addKey(t,r),ht.addValue(t,i),ht.endKeyValue(t)}};var lr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return lr.startBinary(t),lr.endBinary(t)}};var cr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return cr.startBool(t),cr.endBool(t)}};var Qt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return Qt.startDate(t),Qt.addUnit(t,r),Qt.endDate(t)}};var Ot=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,i,s){return Ot.startDecimal(t),Ot.addPrecision(t,r),Ot.addScale(t,i),Ot.addBitWidth(t,s),Ot.endDecimal(t)}};var te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new te).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return te.startDuration(t),te.addUnit(t,r),te.endDuration(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return ee.startFixedSizeBinary(t),ee.addByteWidth(t,r),ee.endFixedSizeBinary(t)}};var re=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new re).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return re.startFixedSizeList(t),re.addListSize(t,r),re.endFixedSizeList(t)}};var ie=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):st.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,st.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return ie.startFloatingPoint(t),ie.addPrecision(t,r),ie.endFloatingPoint(t)}};var se=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new se).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):_t.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,_t.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return se.startInterval(t),se.addUnit(t,r),se.endInterval(t)}};var ur=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return ur.startLargeBinary(t),ur.endLargeBinary(t)}};var fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return fr.startLargeUtf8(t),fr.endLargeUtf8(t)}};var dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return dr.startList(t),dr.endList(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return ne.startMap(t),ne.addKeysSorted(t,r),ne.endMap(t)}};var pr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return pr.startNull(t),pr.endNull(t)}};var mr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return mr.startStruct_(t),mr.endStruct_(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,i){return zt.startTime(t),zt.addUnit(t,r),zt.addBitWidth(t,i),zt.endTime(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,i){return jt.startTimestamp(t),jt.addUnit(t,r),jt.addTimezone(t,i),jt.endTimestamp(t)}};var Et=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,at.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return Et.startUnion(t),Et.addMode(t,r),Et.addTypeIds(t,i),Et.endUnion(t)}};var yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return yr.startUtf8(t),yr.endUtf8(t)}};var ot;(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"})(ot||(ot={}));var wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ot.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new ve).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,ot.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):$r.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,$r.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return pt.startSchema(t),pt.addEndianness(t,r),pt.addFields(t,i),pt.addCustomMetadata(t,s),pt.addFeatures(t,n),pt.endSchema(t)}};var H;(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"})(H||(H={}));var f;(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"})(f||(f={}));var qe;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(qe||(qe={}));var ph={};qr(ph,{clampRange:()=>Ws,createElementComparator:()=>Kr,wrapIndex:()=>mi});var Ja={};qr(Ja,{valueToString:()=>$e});function $e(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>$e(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var Qa={};qr(Qa,{BN:()=>si,bigNumToBigInt:()=>Ml,bigNumToNumber:()=>Za,bigNumToString:()=>qi,isArrowBigNumSymbol:()=>xl});function Y(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Xa(e,t){return Y(e/t)+Y(e%t)/Y(t)}var xl=Symbol.for("isArrowBigNum");function Ye(e,...t){return t.length===0?Object.setPrototypeOf(G(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ye.prototype[xl]=!0;Ye.prototype.toJSON=function(){return`"${qi(this)}"`};Ye.prototype.valueOf=function(e){return Za(this,e)};Ye.prototype.toString=function(){return qi(this)};Ye.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Za(this);case"string":return qi(this);case"default":return Ml(this)}return qi(this)};function Wi(...e){return Ye.apply(this,e)}function Hi(...e){return Ye.apply(this,e)}function Vs(...e){return Ye.apply(this,e)}Object.setPrototypeOf(Wi.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Hi.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Vs.prototype,Object.create(Uint32Array.prototype));Object.assign(Wi.prototype,Ye.prototype,{constructor:Wi,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Hi.prototype,Ye.prototype,{constructor:Hi,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Vs.prototype,Ye.prototype,{constructor:Vs,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Jd=BigInt(4294967296)*BigInt(4294967296),Xd=Jd-BigInt(1);function Za(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),a=n&&o.at(-1)&BigInt(1)<<BigInt(63),h=BigInt(0),l=0;if(a){for(let c of o)h|=(c^Xd)*(BigInt(1)<<BigInt(64*l++));h*=BigInt(-1),h-=BigInt(1)}else for(let c of o)h|=c*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let c=BigInt(Math.pow(10,t)),u=h/c,d=h%c;return Y(u)+Y(d)/Y(c)}return Y(h)}function qi(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Ka(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ka(e);t=t.slice();let i=1;for(let n=0;n<t.length;n++){let o=t[n],a=~o+i;t[n]=a,i&=o===0?1:0}return`-${Ka(t)}`}function Ml(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:qi(e)}function Ka(e){let t="",r=new Uint32Array(2),i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),s=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),n=-1,o=i.length-1;do{for(r[0]=i[n=0];n<o;)i[n++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+i[n];i[n]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}var si=class{static new(t,r){switch(r){case!0:return new Wi(t);case!1:return new Hi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Wi(t)}return t.byteLength===16?new Vs(t):new Hi(t)}static signed(t){return new Wi(t)}static unsigned(t){return new Hi(t)}static decimal(t){return new Vs(t)}constructor(t,r){return si.new(t,r)}};var Il,Sl,Bl,Al,Dl,Tl,Ol,El,Nl,Fl,Ll,Rl,Ul,Cl,Pl,zl,jl,kl,Vl,Gl,Wl,Hl,w=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return w.isUnion(t)&&t.mode===at.Dense}static isSparseUnion(t){return w.isUnion(t)&&t.mode===at.Sparse}constructor(t){this.typeId=t}};Il=Symbol.toStringTag;w[Il]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(w.prototype);var Nt=class extends w{constructor(){super(f.Null)}toString(){return"Null"}};Sl=Symbol.toStringTag;Nt[Sl]=(e=>e[Symbol.toStringTag]="Null")(Nt.prototype);var bt=class extends w{constructor(t,r){super(f.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Bl=Symbol.toStringTag;bt[Bl]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(bt.prototype);var ni=class extends bt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},oi=class extends bt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},we=class extends bt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ai=class extends bt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},hi=class extends bt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},li=class extends bt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ci=class extends bt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ui=class extends bt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ni.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(oi.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(we.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ai.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(hi.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(li.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ci.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(ui.prototype,"ArrayType",{value:BigUint64Array});var oe=class extends w{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case st.HALF:return Uint16Array;case st.SINGLE:return Float32Array;case st.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Al=Symbol.toStringTag;oe[Al]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(oe.prototype);var fi=class extends oe{constructor(){super(st.HALF)}},di=class extends oe{constructor(){super(st.SINGLE)}},pi=class extends oe{constructor(){super(st.DOUBLE)}};Object.defineProperty(fi.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(di.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(pi.prototype,"ArrayType",{value:Float64Array});var Oe=class extends w{constructor(){super(f.Binary)}toString(){return"Binary"}};Dl=Symbol.toStringTag;Oe[Dl]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Oe.prototype);var gr=class extends w{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Tl=Symbol.toStringTag;gr[Tl]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(gr.prototype);var Ee=class extends w{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Ol=Symbol.toStringTag;Ee[Ol]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ee.prototype);var _r=class extends w{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};El=Symbol.toStringTag;_r[El]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(_r.prototype);var Ne=class extends w{constructor(){super(f.Bool)}toString(){return"Bool"}};Nl=Symbol.toStringTag;Ne[Nl]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ne.prototype);var Fe=class extends w{constructor(t,r,i=128){super(f.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Fl=Symbol.toStringTag;Fe[Fl]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Fe.prototype);var xe=class extends w{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ft[this.unit]}>`}get ArrayType(){return this.unit===ft.DAY?Int32Array:BigInt64Array}};Ll=Symbol.toStringTag;xe[Ll]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(xe.prototype);var $i=class extends xe{constructor(){super(ft.DAY)}},Yi=class extends xe{constructor(){super(ft.MILLISECOND)}},Ht=class extends w{constructor(t,r){super(f.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${M[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Rl=Symbol.toStringTag;Ht[Rl]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ht.prototype);var Ji=class extends Ht{constructor(){super(M.SECOND,32)}},Xi=class extends Ht{constructor(){super(M.MILLISECOND,32)}},Ki=class extends Ht{constructor(){super(M.MICROSECOND,64)}},Zi=class extends Ht{constructor(){super(M.NANOSECOND,64)}},qt=class extends w{constructor(t,r){super(f.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${M[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Ul=Symbol.toStringTag;qt[Ul]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(qt.prototype);var Qi=class extends qt{constructor(t){super(M.SECOND,t)}},ts=class extends qt{constructor(t){super(M.MILLISECOND,t)}},es=class extends qt{constructor(t){super(M.MICROSECOND,t)}},rs=class extends qt{constructor(t){super(M.NANOSECOND,t)}},Me=class extends w{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${_t[this.unit]}>`}};Cl=Symbol.toStringTag;Me[Cl]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Me.prototype);var is=class extends Me{constructor(){super(_t.DAY_TIME)}},ss=class extends Me{constructor(){super(_t.YEAR_MONTH)}},br=class extends w{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${M[this.unit]}>`}};Pl=Symbol.toStringTag;br[Pl]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(br.prototype);var ae=class extends w{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};zl=Symbol.toStringTag;ae[zl]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ae.prototype);var Q=class extends w{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};jl=Symbol.toStringTag;Q[jl]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Q.prototype);var Le=class extends w{constructor(t,r,i){super(f.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};kl=Symbol.toStringTag;Le[kl]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Le.prototype);var vr=class extends w{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Vl=Symbol.toStringTag;vr[Vl]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(vr.prototype);var he=class extends w{constructor(t,r){super(f.FixedSizeList),this.listSize=t,this.children=[r]}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}>`}};Gl=Symbol.toStringTag;he[Gl]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(he.prototype);var le=class extends w{constructor(t,r=!1){var i,s,n;if(super(f.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(n=t?.type)===null||n===void 0?void 0:n.children[1];a&&(a.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(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Wl=Symbol.toStringTag;le[Wl]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(le.prototype);var Kd=(e=>()=>++e)(-1),ce=class extends w{constructor(t,r,i,s){super(f.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?Kd():Y(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Hl=Symbol.toStringTag;ce[Hl]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(ce.prototype);function Ie(e){let t=e;switch(e.typeId){case f.Decimal:return e.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var B=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return Zd(this,t,r)}getVisitFnByTypeId(t,r=!0){return ns(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function Zd(e,t,r=!0){return typeof t=="number"?ns(e,t,r):typeof t=="string"&&t in f?ns(e,f[t],r):t&&t instanceof w?ns(e,ql(t),r):t?.type&&t.type instanceof w?ns(e,ql(t.type),r):ns(e,f.NONE,r)}function ns(e,t,r=!0){let i=null;switch(t){case f.Null:i=e.visitNull;break;case f.Bool:i=e.visitBool;break;case f.Int:i=e.visitInt;break;case f.Int8:i=e.visitInt8||e.visitInt;break;case f.Int16:i=e.visitInt16||e.visitInt;break;case f.Int32:i=e.visitInt32||e.visitInt;break;case f.Int64:i=e.visitInt64||e.visitInt;break;case f.Uint8:i=e.visitUint8||e.visitInt;break;case f.Uint16:i=e.visitUint16||e.visitInt;break;case f.Uint32:i=e.visitUint32||e.visitInt;break;case f.Uint64:i=e.visitUint64||e.visitInt;break;case f.Float:i=e.visitFloat;break;case f.Float16:i=e.visitFloat16||e.visitFloat;break;case f.Float32:i=e.visitFloat32||e.visitFloat;break;case f.Float64:i=e.visitFloat64||e.visitFloat;break;case f.Utf8:i=e.visitUtf8;break;case f.LargeUtf8:i=e.visitLargeUtf8;break;case f.Binary:i=e.visitBinary;break;case f.LargeBinary:i=e.visitLargeBinary;break;case f.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case f.Date:i=e.visitDate;break;case f.DateDay:i=e.visitDateDay||e.visitDate;break;case f.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case f.Timestamp:i=e.visitTimestamp;break;case f.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case f.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case f.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case f.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case f.Time:i=e.visitTime;break;case f.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case f.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case f.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case f.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case f.Decimal:i=e.visitDecimal;break;case f.List:i=e.visitList;break;case f.Struct:i=e.visitStruct;break;case f.Union:i=e.visitUnion;break;case f.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case f.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case f.Dictionary:i=e.visitDictionary;break;case f.Interval:i=e.visitInterval;break;case f.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case f.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case f.Duration:i=e.visitDuration;break;case f.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case f.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case f.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case f.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case f.FixedSizeList:i=e.visitFixedSizeList;break;case f.Map:i=e.visitMap;break}if(typeof i=="function")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function ql(e){switch(e.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?f.Int8:f.Uint8;case 16:return r?f.Int16:f.Uint16;case 32:return r?f.Int32:f.Uint32;case 64:return r?f.Int64:f.Uint64}return f.Int}case f.Float:switch(e.precision){case st.HALF:return f.Float16;case st.SINGLE:return f.Float32;case st.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(e.unit){case M.SECOND:return f.TimeSecond;case M.MILLISECOND:return f.TimeMillisecond;case M.MICROSECOND:return f.TimeMicrosecond;case M.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(e.unit){case M.SECOND:return f.TimestampSecond;case M.MILLISECOND:return f.TimestampMillisecond;case M.MICROSECOND:return f.TimestampMicrosecond;case M.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(e.unit){case ft.DAY:return f.DateDay;case ft.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(e.unit){case _t.DAY_TIME:return f.IntervalDayTime;case _t.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(e.unit){case M.SECOND:return f.DurationSecond;case M.MILLISECOND:return f.DurationMillisecond;case M.MICROSECOND:return f.DurationMicrosecond;case M.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(e.mode){case at.Dense:return f.DenseUnion;case at.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[e.typeId]}'`)}B.prototype.visitInt8=null;B.prototype.visitInt16=null;B.prototype.visitInt32=null;B.prototype.visitInt64=null;B.prototype.visitUint8=null;B.prototype.visitUint16=null;B.prototype.visitUint32=null;B.prototype.visitUint64=null;B.prototype.visitFloat16=null;B.prototype.visitFloat32=null;B.prototype.visitFloat64=null;B.prototype.visitDateDay=null;B.prototype.visitDateMillisecond=null;B.prototype.visitTimestampSecond=null;B.prototype.visitTimestampMillisecond=null;B.prototype.visitTimestampMicrosecond=null;B.prototype.visitTimestampNanosecond=null;B.prototype.visitTimeSecond=null;B.prototype.visitTimeMillisecond=null;B.prototype.visitTimeMicrosecond=null;B.prototype.visitTimeNanosecond=null;B.prototype.visitDenseUnion=null;B.prototype.visitSparseUnion=null;B.prototype.visitIntervalDayTime=null;B.prototype.visitIntervalYearMonth=null;B.prototype.visitDuration=null;B.prototype.visitDurationSecond=null;B.prototype.visitDurationMillisecond=null;B.prototype.visitDurationMicrosecond=null;B.prototype.visitDurationNanosecond=null;var th={};qr(th,{float64ToUint16:()=>Gs,uint16ToFloat64:()=>io});var $l=new Float64Array(1),os=new Uint32Array($l.buffer);function io(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Gs(e){if(e!==e)return 32256;$l[0]=e;let t=(os[1]&2147483648)>>16&65535,r=os[1]&2146435072,i=0;return r>=1089470464?os[0]>0?r=31744:(r=(r&2080374784)>>16,i=(os[1]&1048575)>>10):r<=1056964608?(i=1048576+(os[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(os[1]&1048575)+512>>10),t|r|i&65535}var E=class extends B{};function R(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var Qd=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Yl=(e,t,r,i)=>{if(r+1<t.length){let s=Y(t[r]),n=Y(t[r+1]);e.set(i.subarray(0,n-s),s)}},tp=({offset:e,values:t},r,i)=>{let s=e+r;i?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Tr=({values:e},t,r)=>{e[t]=r},eh=({values:e},t,r)=>{e[t]=r},Jl=({values:e},t,r)=>{e[t]=Gs(r)},ep=(e,t,r)=>{switch(e.type.precision){case st.HALF:return Jl(e,t,r);case st.SINGLE:case st.DOUBLE:return eh(e,t,r)}},so=({values:e},t,r)=>{Qd(e,t,r.valueOf())},no=({values:e},t,r)=>{e[t]=BigInt(r)},rh=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},Xl=({values:e,valueOffsets:t},r,i)=>Yl(e,t,r,i),Kl=({values:e,valueOffsets:t},r,i)=>Yl(e,t,r,or(i)),ih=(e,t,r)=>{e.type.unit===ft.DAY?so(e,t,r):no(e,t,r)},oo=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},ao=({values:e},t,r)=>{e[t]=BigInt(r)},ho=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},lo=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},sh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return oo(e,t,r);case M.MILLISECOND:return ao(e,t,r);case M.MICROSECOND:return ho(e,t,r);case M.NANOSECOND:return lo(e,t,r)}},co=({values:e},t,r)=>{e[t]=r},uo=({values:e},t,r)=>{e[t]=r},fo=({values:e},t,r)=>{e[t]=r},po=({values:e},t,r)=>{e[t]=r},nh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return co(e,t,r);case M.MILLISECOND:return uo(e,t,r);case M.MICROSECOND:return fo(e,t,r);case M.NANOSECOND:return po(e,t,r)}},oh=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},rp=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=Rt.getVisitFn(i);if(Array.isArray(r))for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r[++o]);else for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r.get(++o))},ip=(e,t,r)=>{let i=e.children[0],{valueOffsets:s}=e,n=Rt.getVisitFn(i),{[t]:o,[t+1]:a}=s,h=r instanceof Map?r.entries():Object.entries(r);for(let l of h)if(n(i,o,l),++o>=a)break},sp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),np=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),op=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),ap=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),hp=(e,t,r)=>{let i=e.type.children.map(n=>Rt.getVisitFn(n.type)),s=r instanceof Map?op(t,r):r instanceof j?np(t,r):Array.isArray(r)?sp(t,r):ap(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},lp=(e,t,r)=>{e.type.mode===at.Dense?Zl(e,t,r):Ql(e,t,r)},Zl=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,e.valueOffsets[t],r)},Ql=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,t,r)},cp=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},ah=(e,t,r)=>{e.type.unit===_t.DAY_TIME?mo(e,t,r):yo(e,t,r)},mo=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},yo=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},go=({values:e},t,r)=>{e[t]=r},_o=({values:e},t,r)=>{e[t]=r},bo=({values:e},t,r)=>{e[t]=r},vo=({values:e},t,r)=>{e[t]=r},hh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return go(e,t,r);case M.MILLISECOND:return _o(e,t,r);case M.MICROSECOND:return bo(e,t,r);case M.NANOSECOND:return vo(e,t,r)}},up=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=Rt.getVisitFn(s);if(Array.isArray(r))for(let o=-1,a=t*i;++o<i;)n(s,a+o,r[o]);else for(let o=-1,a=t*i;++o<i;)n(s,a+o,r.get(o))};E.prototype.visitBool=R(tp);E.prototype.visitInt=R(Tr);E.prototype.visitInt8=R(Tr);E.prototype.visitInt16=R(Tr);E.prototype.visitInt32=R(Tr);E.prototype.visitInt64=R(Tr);E.prototype.visitUint8=R(Tr);E.prototype.visitUint16=R(Tr);E.prototype.visitUint32=R(Tr);E.prototype.visitUint64=R(Tr);E.prototype.visitFloat=R(ep);E.prototype.visitFloat16=R(Jl);E.prototype.visitFloat32=R(eh);E.prototype.visitFloat64=R(eh);E.prototype.visitUtf8=R(Kl);E.prototype.visitLargeUtf8=R(Kl);E.prototype.visitBinary=R(Xl);E.prototype.visitLargeBinary=R(Xl);E.prototype.visitFixedSizeBinary=R(rh);E.prototype.visitDate=R(ih);E.prototype.visitDateDay=R(so);E.prototype.visitDateMillisecond=R(no);E.prototype.visitTimestamp=R(sh);E.prototype.visitTimestampSecond=R(oo);E.prototype.visitTimestampMillisecond=R(ao);E.prototype.visitTimestampMicrosecond=R(ho);E.prototype.visitTimestampNanosecond=R(lo);E.prototype.visitTime=R(nh);E.prototype.visitTimeSecond=R(co);E.prototype.visitTimeMillisecond=R(uo);E.prototype.visitTimeMicrosecond=R(fo);E.prototype.visitTimeNanosecond=R(po);E.prototype.visitDecimal=R(oh);E.prototype.visitList=R(rp);E.prototype.visitStruct=R(hp);E.prototype.visitUnion=R(lp);E.prototype.visitDenseUnion=R(Zl);E.prototype.visitSparseUnion=R(Ql);E.prototype.visitDictionary=R(cp);E.prototype.visitInterval=R(ah);E.prototype.visitIntervalDayTime=R(mo);E.prototype.visitIntervalYearMonth=R(yo);E.prototype.visitDuration=R(hh);E.prototype.visitDurationSecond=R(go);E.prototype.visitDurationMillisecond=R(_o);E.prototype.visitDurationMicrosecond=R(bo);E.prototype.visitDurationNanosecond=R(vo);E.prototype.visitFixedSizeList=R(up);E.prototype.visitMap=R(ip);var Rt=new E;var Je=Symbol.for("parent"),as=Symbol.for("rowIndex"),Yr=class{constructor(t,r){return this[Je]=t,this[as]=r,new Proxy(this,new ch)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[as],r=this[Je],i=r.type.children,s={};for(let n=-1,o=i.length;++n<o;)s[i[n].name]=xt.visit(r.children[n],t);return s}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new lh(this[Je],this[as])}},lh=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,xt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Yr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Je]:{writable:!0,enumerable:!1,configurable:!1,value:null},[as]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ch=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Je].type.children.map(r=>r.name)}has(t,r){return t[Je].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Je].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[Je].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=xt.visit(t[Je].children[i],t[as]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[Je].type.children.findIndex(n=>n.name===r);return s!==-1?(Rt.visit(t[Je].children[s],t[as],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,i):!1}};var A=class extends B{};function F(e){return(t,r)=>t.getValid(r)?e(t,r):null}var fp=(e,t)=>864e5*e[t],dp=(e,t)=>null,tc=(e,t,r)=>{if(r+1>=t.length)return null;let i=Y(t[r]),s=Y(t[r+1]);return e.subarray(i,s)},pp=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<<i%8)!==0},ec=({values:e},t)=>fp(e,t),rc=({values:e},t)=>Y(e[t]),Jr=({stride:e,values:t},r)=>t[e*r],mp=({stride:e,values:t},r)=>io(t[e*r]),ic=({values:e},t)=>e[t],yp=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),sc=({values:e,valueOffsets:t},r)=>tc(e,t,r),nc=({values:e,valueOffsets:t},r)=>{let i=tc(e,t,r);return i!==null?Rs(i):null},gp=({values:e},t)=>e[t],_p=({type:e,values:t},r)=>e.precision!==st.HALF?t[r]:io(t[r]),bp=(e,t)=>e.type.unit===ft.DAY?ec(e,t):rc(e,t),oc=({values:e},t)=>1e3*Y(e[t]),ac=({values:e},t)=>Y(e[t]),hc=({values:e},t)=>Xa(e[t],BigInt(1e3)),lc=({values:e},t)=>Xa(e[t],BigInt(1e6)),vp=(e,t)=>{switch(e.type.unit){case M.SECOND:return oc(e,t);case M.MILLISECOND:return ac(e,t);case M.MICROSECOND:return hc(e,t);case M.NANOSECOND:return lc(e,t)}},cc=({values:e},t)=>e[t],uc=({values:e},t)=>e[t],fc=({values:e},t)=>e[t],dc=({values:e},t)=>e[t],wp=(e,t)=>{switch(e.type.unit){case M.SECOND:return cc(e,t);case M.MILLISECOND:return uc(e,t);case M.MICROSECOND:return fc(e,t);case M.NANOSECOND:return dc(e,t)}},xp=({values:e,stride:t},r)=>si.decimal(e.subarray(t*r,t*(r+1))),Mp=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,h=s[0].slice(n,o-n);return new j([h])},Ip=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new wr(o.slice(s,n-s))},Sp=(e,t)=>new Yr(e,t),Bp=(e,t)=>e.type.mode===at.Dense?pc(e,t):mc(e,t),pc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,e.valueOffsets[t])},mc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,t)},Ap=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Dp=(e,t)=>e.type.unit===_t.DAY_TIME?yc(e,t):gc(e,t),yc=({values:e},t)=>e.subarray(2*t,2*(t+1)),gc=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},_c=({values:e},t)=>e[t],bc=({values:e},t)=>e[t],vc=({values:e},t)=>e[t],wc=({values:e},t)=>e[t],Tp=(e,t)=>{switch(e.type.unit){case M.SECOND:return _c(e,t);case M.MILLISECOND:return bc(e,t);case M.MICROSECOND:return vc(e,t);case M.NANOSECOND:return wc(e,t)}},Op=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new j([n])};A.prototype.visitNull=F(dp);A.prototype.visitBool=F(pp);A.prototype.visitInt=F(gp);A.prototype.visitInt8=F(Jr);A.prototype.visitInt16=F(Jr);A.prototype.visitInt32=F(Jr);A.prototype.visitInt64=F(ic);A.prototype.visitUint8=F(Jr);A.prototype.visitUint16=F(Jr);A.prototype.visitUint32=F(Jr);A.prototype.visitUint64=F(ic);A.prototype.visitFloat=F(_p);A.prototype.visitFloat16=F(mp);A.prototype.visitFloat32=F(Jr);A.prototype.visitFloat64=F(Jr);A.prototype.visitUtf8=F(nc);A.prototype.visitLargeUtf8=F(nc);A.prototype.visitBinary=F(sc);A.prototype.visitLargeBinary=F(sc);A.prototype.visitFixedSizeBinary=F(yp);A.prototype.visitDate=F(bp);A.prototype.visitDateDay=F(ec);A.prototype.visitDateMillisecond=F(rc);A.prototype.visitTimestamp=F(vp);A.prototype.visitTimestampSecond=F(oc);A.prototype.visitTimestampMillisecond=F(ac);A.prototype.visitTimestampMicrosecond=F(hc);A.prototype.visitTimestampNanosecond=F(lc);A.prototype.visitTime=F(wp);A.prototype.visitTimeSecond=F(cc);A.prototype.visitTimeMillisecond=F(uc);A.prototype.visitTimeMicrosecond=F(fc);A.prototype.visitTimeNanosecond=F(dc);A.prototype.visitDecimal=F(xp);A.prototype.visitList=F(Mp);A.prototype.visitStruct=F(Sp);A.prototype.visitUnion=F(Bp);A.prototype.visitDenseUnion=F(pc);A.prototype.visitSparseUnion=F(mc);A.prototype.visitDictionary=F(Ap);A.prototype.visitInterval=F(Dp);A.prototype.visitIntervalDayTime=F(yc);A.prototype.visitIntervalYearMonth=F(gc);A.prototype.visitDuration=F(Tp);A.prototype.visitDurationSecond=F(_c);A.prototype.visitDurationMillisecond=F(bc);A.prototype.visitDurationMicrosecond=F(vc);A.prototype.visitDurationNanosecond=F(wc);A.prototype.visitFixedSizeList=F(Op);A.prototype.visitMap=F(Ip);var xt=new A;var Xr=Symbol.for("keys"),ls=Symbol.for("vals"),hs=Symbol.for("kKeysAsStrings"),uh=Symbol.for("_kKeysAsStrings"),wr=class{constructor(t){return this[Xr]=new j([t.children[0]]).memoize(),this[ls]=t.children[1],new Proxy(this,new dh)}get[hs](){return this[uh]||(this[uh]=Array.from(this[Xr].toArray(),String))}[Symbol.iterator](){return new fh(this[Xr],this[ls])}get size(){return this[Xr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Xr],r=this[ls],i={};for(let s=-1,n=t.length;++s<n;)i[t.get(s)]=xt.visit(r,s);return i}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},fh=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),xt.visit(this.vals,t)]})}},dh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[hs]}has(t,r){return t[hs].includes(r)}getOwnPropertyDescriptor(t,r){if(t[hs].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[hs].indexOf(r);if(i!==-1){let s=xt.visit(Reflect.get(t,ls),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[hs].indexOf(r);return s!==-1?(Rt.visit(Reflect.get(t,ls),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(wr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ls]:{writable:!0,enumerable:!1,configurable:!1,value:null},[uh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var xc;function Ws(e,t,r,i){let{length:s=0}=e,n=typeof t!="number"?0:t,o=typeof r!="number"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),o<n&&(xc=n,n=o,o=xc),o>s&&(o=s),i?i(e,n,o):[n,o]}var mi=(e,t)=>e<0?t+e:e,Mc=e=>e!==e;function Kr(e){if(typeof e!=="object"||e===null)return Mc(e)?Mc:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?Ha(e,r):!1:e instanceof Map?Np(e):Array.isArray(e)?Ep(e):e instanceof j?Fp(e):Lp(e,!0)}function Ep(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Kr(e[r]);return wo(t)}function Np(e){let t=-1,r=[];for(let i of e.values())r[++t]=Kr(i);return wo(r)}function Fp(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Kr(e.get(r));return wo(t)}function Lp(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let i=[];for(let s=-1,n=r.length;++s<n;)i[s]=Kr(e[r[s]]);return wo(i,r)}function wo(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return Rp(e,r);case Map:return Ic(e,r,r.keys());case wr:case Yr:case Object:case void 0:return Ic(e,r,t||Object.keys(r))}return r instanceof j?Up(e,r):!1}}function Rp(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t[i]))return!1;return!0}function Up(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t.get(i)))return!1;return!0}function Ic(e,t,r){let i=r[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),n=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=e.length,h=n.next(),l=i.next(),c=s.next();for(;o<a&&!l.done&&!c.done&&!h.done&&!(l.value!==c.value||!e[o](h.value));++o,l=i.next(),c=s.next(),h=n.next());return o===a&&l.done&&c.done&&h.done?!0:(i.return&&i.return(),s.return&&s.return(),n.return&&n.return(),!1)}var mh={};qr(mh,{BitIterator:()=>yi,getBit:()=>Sc,getBool:()=>Mo,packBools:()=>_i,popcnt_array:()=>Bc,popcnt_bit_range:()=>Hs,popcnt_uint32:()=>xo,setBool:()=>Cp,truncateBitmap:()=>gi});function Mo(e,t,r,i){return(r&1<<i)!==0}function Sc(e,t,r,i){return(r&1<<i)>>i}function Cp(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function gi(e,t,r){let i=r.byteLength+7&-8;if(e>0||r.byteLength<i){let s=new Uint8Array(i);return s.set(e%8===0?r.subarray(e>>3):_i(new yi(r,e,t,null,Mo)).subarray(0,i)),s}return r}function _i(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<<i),++i===8&&(t[r++]=s,s=i=0);(r===0||i>0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var yi=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Hs(e,t,r){if(r-t<=0)return 0;if(r-t<8){let n=0;for(let o of new yi(e,t,r-t,e,Sc))n+=o;return n}let i=r>>3<<3,s=t+(t%8===0?0:8-t%8);return Hs(e,t,s)+Hs(e,i,r)+Bc(e,s>>3,i-s>>3)}function Bc(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=xo(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=xo(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=xo(n.getUint8(s)),s+=1;return i}function xo(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Pp=-1,q=class{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:t}=this;return w.isSparseUnion(t)?this.children.some(r=>r.nullable):w.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(w.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=Pp&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Hs(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let h;n instanceof q?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=Ie(t),n&&((h=n[0])&&(this.valueOffsets=h),(h=n[1])&&(this.values=h),(h=n[2])&&(this.nullBitmap=h),(h=n[3])&&(this.typeIds=h)))}getValid(t){let{type:r}=this;if(w.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===at.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,r){let i,{type:s}=this;if(w.isUnion(s)){let n=s,o=this.children[n.typeIdToChildIndex[this.typeIds[t]]],a=n.mode===at.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,r)}else{let{nullBitmap:n}=this,{offset:o,length:a}=this,h=o+t,l=1<<h%8,c=h>>3;(!n||n.byteLength<=c)&&(n=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(n.set(gi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let u=n[c];i=(u&l)!==0,n[c]=r?u|l:u&~l}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new q(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,a=s===16?i:1,h=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,h,n.length===0||this.valueOffsets?n:this._sliceChildren(n,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<<r-(r&-8))-1,i>0&&s.set(gi(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[qe.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[qe.TYPE])&&(o[qe.TYPE]=n.subarray(t,t+r)),(n=o[qe.OFFSET])&&(o[qe.OFFSET]=n.subarray(t,t+r+1))||(n=o[qe.DATA])&&(o[qe.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};q.prototype.children=Object.freeze([]);var bi=class extends B{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:i=0,["length"]:s=0}=t;return new q(r,i,s,s)}visitBool(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitInt(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFloat(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=ii(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Kn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=ii(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Kn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDate(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTimestamp(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTime(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDecimal(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitList(t){let{["type"]:r,["offset"]:i=0,["child"]:s}=t,n=N(t.nullBitmap),o=ii(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}visitStruct(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=N(t.nullBitmap),{length:o=s.reduce((h,{length:l})=>Math.max(h,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],s)}visitUnion(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=G(r.ArrayType,t.typeIds),{["length"]:o=n.length,["nullCount"]:a=-1}=t;if(w.isSparseUnion(r))return new q(r,i,o,a,[void 0,void 0,void 0,n],s);let h=ii(t.valueOffsets);return new q(r,i,o,a,[h,void 0,void 0,n],s)}visitDictionary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.indices.ArrayType,t.data),{["dictionary"]:o=new j([new bi().visit({type:r.dictionary})])}=t,{["length"]:a=n.length,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[void 0,n,s],[],o)}visitInterval(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDuration(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFixedSizeList(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new bi().visit({type:r.valueType})}=t,n=N(t.nullBitmap),{["length"]:o=s.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],[s])}visitMap(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new bi().visit({type:r.childType})}=t,n=N(t.nullBitmap),o=ii(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}},zp=new bi;function U(e){return zp.visit(e)}var qs=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Ac(e){return e.some(t=>t.nullable)}function Io(e){return e.reduce((t,r)=>t+r.nullCount,0)}function So(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function Bo(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n<o;){let a=e[n],h=t[n],{length:l}=a;if(h>=i)break;if(r>=h+l)continue;if(h>=r&&h+l<=i){s.push(a);continue}let c=Math.max(0,r-h),u=Math.min(i-h,l);s.push(a.slice(c,u-c))}return s.length===0&&s.push(e[0].slice(0,0)),s}function yh(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r<t[o]?i(e,s,r-t[s]):null;n=s+Math.trunc((o-s)*.5),r<t[n]?o=n:s=n}while(s<o)}function $s(e,t){return e.getValid(t)}function cs(e){function t(r,i,s){return e(r[i],s)}return function(r){let i=this.data;return yh(i,this._offsets,r,t)}}function Ao(e){let t;function r(i,s,n){return e(i[s],n,t)}return function(i,s){let n=this.data;t=s;let o=yh(n,this._offsets,i,r);return t=void 0,o}}function Do(e){let t;function r(i,s,n){let o=n,a=0,h=0;for(let l=s-1,c=i.length;++l<c;){let u=i[l];if(~(a=e(u,t,o)))return h+a;o=0,h+=u.length}return-1}return function(i,s){t=i;let n=this.data,o=typeof s!="number"?r(n,0,0):yh(n,this._offsets,s,r);return t=void 0,o}}var D=class extends B{};function jp(e,t){return t===null&&e.length>0?0:-1}function kp(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new yi(r,e.offset+(t||0),e.length,r,Mo)){if(!s)return i;++i}return-1}function C(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case f.Union:break;case f.Dictionary:break;default:return kp(e,r)}let i=xt.getVisitFn(e),s=Kr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}function Dc(e,t,r){let i=xt.getVisitFn(e),s=Kr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}D.prototype.visitNull=jp;D.prototype.visitBool=C;D.prototype.visitInt=C;D.prototype.visitInt8=C;D.prototype.visitInt16=C;D.prototype.visitInt32=C;D.prototype.visitInt64=C;D.prototype.visitUint8=C;D.prototype.visitUint16=C;D.prototype.visitUint32=C;D.prototype.visitUint64=C;D.prototype.visitFloat=C;D.prototype.visitFloat16=C;D.prototype.visitFloat32=C;D.prototype.visitFloat64=C;D.prototype.visitUtf8=C;D.prototype.visitLargeUtf8=C;D.prototype.visitBinary=C;D.prototype.visitLargeBinary=C;D.prototype.visitFixedSizeBinary=C;D.prototype.visitDate=C;D.prototype.visitDateDay=C;D.prototype.visitDateMillisecond=C;D.prototype.visitTimestamp=C;D.prototype.visitTimestampSecond=C;D.prototype.visitTimestampMillisecond=C;D.prototype.visitTimestampMicrosecond=C;D.prototype.visitTimestampNanosecond=C;D.prototype.visitTime=C;D.prototype.visitTimeSecond=C;D.prototype.visitTimeMillisecond=C;D.prototype.visitTimeMicrosecond=C;D.prototype.visitTimeNanosecond=C;D.prototype.visitDecimal=C;D.prototype.visitList=C;D.prototype.visitStruct=C;D.prototype.visitUnion=C;D.prototype.visitDenseUnion=Dc;D.prototype.visitSparseUnion=Dc;D.prototype.visitDictionary=C;D.prototype.visitInterval=C;D.prototype.visitIntervalDayTime=C;D.prototype.visitIntervalYearMonth=C;D.prototype.visitDuration=C;D.prototype.visitDurationSecond=C;D.prototype.visitDurationMillisecond=C;D.prototype.visitDurationMicrosecond=C;D.prototype.visitDurationNanosecond=C;D.prototype.visitFixedSizeList=C;D.prototype.visitMap=C;var vi=new D;var T=class extends B{};function L(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(w.isInt(t)&&t.bitWidth!==64||w.isTime(t)&&t.bitWidth!==64||w.isFloat(t)&&t.precision!==st.HALF))return new qs(e.data.length,i=>{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new qs(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new gh(o)})}var gh=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};T.prototype.visitNull=L;T.prototype.visitBool=L;T.prototype.visitInt=L;T.prototype.visitInt8=L;T.prototype.visitInt16=L;T.prototype.visitInt32=L;T.prototype.visitInt64=L;T.prototype.visitUint8=L;T.prototype.visitUint16=L;T.prototype.visitUint32=L;T.prototype.visitUint64=L;T.prototype.visitFloat=L;T.prototype.visitFloat16=L;T.prototype.visitFloat32=L;T.prototype.visitFloat64=L;T.prototype.visitUtf8=L;T.prototype.visitLargeUtf8=L;T.prototype.visitBinary=L;T.prototype.visitLargeBinary=L;T.prototype.visitFixedSizeBinary=L;T.prototype.visitDate=L;T.prototype.visitDateDay=L;T.prototype.visitDateMillisecond=L;T.prototype.visitTimestamp=L;T.prototype.visitTimestampSecond=L;T.prototype.visitTimestampMillisecond=L;T.prototype.visitTimestampMicrosecond=L;T.prototype.visitTimestampNanosecond=L;T.prototype.visitTime=L;T.prototype.visitTimeSecond=L;T.prototype.visitTimeMillisecond=L;T.prototype.visitTimeMicrosecond=L;T.prototype.visitTimeNanosecond=L;T.prototype.visitDecimal=L;T.prototype.visitList=L;T.prototype.visitStruct=L;T.prototype.visitUnion=L;T.prototype.visitDenseUnion=L;T.prototype.visitSparseUnion=L;T.prototype.visitDictionary=L;T.prototype.visitInterval=L;T.prototype.visitIntervalDayTime=L;T.prototype.visitIntervalYearMonth=L;T.prototype.visitDuration=L;T.prototype.visitDurationSecond=L;T.prototype.visitDurationMillisecond=L;T.prototype.visitDurationMicrosecond=L;T.prototype.visitDurationNanosecond=L;T.prototype.visitFixedSizeList=L;T.prototype.visitMap=L;var us=new T;var Tc,Oc={},Ec={},j=class{constructor(t){var r,i,s;let n=t[0]instanceof j?t.flatMap(a=>a.data):t;if(n.length===0||n.some(a=>!(a instanceof q)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:h,indexOf:l}=Oc[o.typeId],c=n[0];this.isValid=u=>$s(c,u),this.get=u=>a(c,u),this.set=(u,d)=>h(c,u,d),this.indexOf=u=>l(c,u),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,Ec[o.typeId]),this._offsets=So(n);break}this.data=n,this.type=o,this.stride=Ie(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return Ac(this.data)}get nullCount(){return Io(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(mi(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return us.visit(this)}concat(...t){return new j(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new j(Ws(this,t,r,({data:i,_offsets:s},n,o)=>Bo(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:a,length:h})=>(o.array.set(a.subarray(0,h*s),o.offset),o.offset+=h*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new j(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return w.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(w.isDictionary(this.type)){let t=new fs(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return new fs(this)}unmemoize(){if(w.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return this}};Tc=Symbol.toStringTag;j[Tc]=(e=>{e.type=w.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(f).map(r=>f[r]).filter(r=>typeof r=="number"&&r!==f.NONE);for(let r of t){let i=xt.getVisitFnByTypeId(r),s=Rt.getVisitFnByTypeId(r),n=vi.getVisitFnByTypeId(r);Oc[r]={get:i,set:s,indexOf:n},Ec[r]=Object.create(e,{isValid:{value:cs($s)},get:{value:cs(xt.getVisitFnByTypeId(r))},set:{value:Ao(Rt.getVisitFnByTypeId(r))},indexOf:{value:Do(vi.getVisitFnByTypeId(r))}})}return"Vector"})(j.prototype);var fs=class extends j{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=n[o];if(a!==void 0)return a;let h=r.call(this,o);return n[o]=h,h}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),n[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new fs(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new j(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Nc(e){if(!e||e.length<=0)return function(s){return!0};let t="",r=e.filter(i=>i===i);return r.length>0&&(t=`
7
+ "use strict";var __exports__=(()=>{var sd=Object.create;var jn=Object.defineProperty;var nd=Object.getOwnPropertyDescriptor;var od=Object.getOwnPropertyNames;var ad=Object.getPrototypeOf,hd=Object.prototype.hasOwnProperty;var ld=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$r=(e,t)=>{for(var r in t)jn(e,r,{get:t[r],enumerable:!0})},zn=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of od(t))!hd.call(e,s)&&s!==r&&jn(e,s,{get:()=>t[s],enumerable:!(i=nd(t,s))||i.enumerable});return e},Vn=(e,t,r)=>(zn(e,t,"default"),r&&zn(r,t,"default")),cd=(e,t,r)=>(r=e!=null?sd(ad(e)):{},zn(t||!e||!e.__esModule?jn(r,"default",{value:e,enumerable:!0}):r,e)),ud=e=>zn(jn({},"__esModule",{value:!0}),e);var cl=ld((Lb,ll)=>{ll.exports=globalThis.loaders});var Cn={};$r(Cn,{DBFArrowLoader:()=>rd,DBFArrowWorkerLoader:()=>hl,DBFLoader:()=>Rn,DBFWorkerLoader:()=>nl,SHPLoader:()=>Rs,SHPWorkerLoader:()=>ja,ShapefileLoader:()=>Kf,_BinaryChunkReader:()=>nr,_BinaryReader:()=>Ra,_zipBatchIterators:()=>Oa});Vn(Cn,cd(cl(),1));async function kn(e,t,r,i){return i._parse(e,t,r,i)}async function Gn(e,t,r,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(e,t,r,i)}async function*Dr(e){for await(let t of e)yield fd(t)}function fd(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:i}=e;return ul(t,r,i)}return ul(e)}function ul(e,t=0,r=e.byteLength-t){let i=new Uint8Array(e,t,r),s=new Uint8Array(i.length);return s.set(i),s.buffer}var nr=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(t){let{maxRewindBytes:r=0}=t||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=r}write(t){this.arrayBuffers.push(t)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(t){let r=-this.offset;for(let i of this.arrayBuffers)if(r+=i.byteLength,r>=t)return!0;return!1}findBufferOffsets(t){let r=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let n=this.arrayBuffers[s];if(r+n.byteLength<=0){r+=n.byteLength;continue}let o=r<=0?Math.abs(r):0,a;if(o+t<=n.byteLength)return a=o+t,i.push([s,[o,a]]),i;a=n.byteLength,i.push([s,[o,a]]),t-=n.byteLength-o,r+=n.byteLength}return null}getDataView(t){let r=this.findBufferOffsets(t);if(!r&&this.ended)throw new Error("binary data exhausted");if(!r)return null;if(r.length===1){let[s,[n,o]]=r[0],a=this.arrayBuffers[s],h=new DataView(a,n,o-n);return this.offset+=t,this.disposeBuffers(),h}let i=new DataView(this._combineArrayBuffers(r));return this.offset+=t,this.disposeBuffers(),i}disposeBuffers(){for(;this.arrayBuffers.length>0&&this.offset-this.maxRewindBytes>=this.arrayBuffers[0].byteLength;)this.offset-=this.arrayBuffers[0].byteLength,this.arrayBuffers.shift()}_combineArrayBuffers(t){let r=0;for(let n of t){let[o,a]=n[1];r+=a-o}let i=new Uint8Array(r),s=0;for(let n of t){let[o,[a,h]]=n,l=new Uint8Array(this.arrayBuffers[o]);i.set(l.subarray(a,h),s),s+=h-a}return i.buffer}skip(t){this.offset+=t}rewind(t){this.offset-=t}};function Wn(e){let t={magic:e.getInt32(0,!1),length:e.getInt32(24,!1)*2,version:e.getInt32(28,!0),type:e.getInt32(32,!0),bbox:{minX:e.getFloat64(36,!0),minY:e.getFloat64(44,!0),minZ:e.getFloat64(68,!0),minM:e.getFloat64(84,!0),maxX:e.getFloat64(52,!0),maxY:e.getFloat64(60,!0),maxZ:e.getFloat64(76,!0),maxM:e.getFloat64(92,!0)}};return t.magic!==9994&&console.error(`SHP file: bad magic number ${t.magic}`),t.version!==1e3&&console.error(`SHP file: bad version ${t.version}`),t}function fl(e,t){let{_maxDimensions:r=4}=t?.shp||{},i=0,s=e.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return dd();case 1:return Ua(e,i,Math.min(2,r));case 3:return ji(e,i,Math.min(2,r),"LineString");case 5:return ji(e,i,Math.min(2,r),"Polygon");case 8:return Ca(e,i,Math.min(2,r));case 11:return Ua(e,i,Math.min(4,r));case 13:return ji(e,i,Math.min(4,r),"LineString");case 15:return ji(e,i,Math.min(4,r),"Polygon");case 18:return Ca(e,i,Math.min(4,r));case 21:return Ua(e,i,Math.min(3,r));case 23:return ji(e,i,Math.min(3,r),"LineString");case 25:return ji(e,i,Math.min(3,r),"Polygon");case 28:return Ca(e,i,Math.min(3,r));default:throw new Error(`unsupported shape type: ${s}`)}}function dd(){return null}function Ua(e,t,r){let i;return[i,t]=ii(e,t,1,r),{positions:{value:i,size:r},type:"Point"}}function Ca(e,t,r){t+=4*Float64Array.BYTES_PER_ELEMENT;let i=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let s=null,n=null,o=null;return[s,t]=ii(e,t,i,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[o,t]=ii(e,t,i,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[n,t]=ii(e,t,i,1)),{positions:{value:dl(s,n,o),size:r},type:"Point"}}function ji(e,t,r,i){t+=4*Float64Array.BYTES_PER_ELEMENT;let s=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let n=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let o=e.byteOffset+t,a=s*Int32Array.BYTES_PER_ELEMENT,h=new Int32Array(s+1);h.set(new Int32Array(e.buffer.slice(o,o+a))),h[s]=n,t+=s*Int32Array.BYTES_PER_ELEMENT;let l=null,c=null,u=null;[l,t]=ii(e,t,n,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[u,t]=ii(e,t,n,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[c,t]=ii(e,t,n,1));let d=dl(l,c,u);if(i==="LineString")return{type:i,positions:{value:d,size:r},pathIndices:{value:h,size:1}};let p=[];for(let m=1;m<h.length;m++){let g=h[m-1],v=h[m],I=l.subarray(g*2,v*2);pd(I)>0&&p.push(g)}return p.push(n),{type:i,positions:{value:d,size:r},primitivePolygonIndices:{value:h,size:1},polygonIndices:{value:new Uint32Array(p),size:1}}}function ii(e,t,r,i){let s=e.byteOffset+t,n=r*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(e.buffer.slice(s,s+n)),t+n]}function dl(e,t,r){if(!(t||r))return e;let i=e.length,s=2;r&&r.length&&(i+=r.length,s++),t&&t.length&&(i+=t.length,s++);let n=new Float64Array(i);for(let o=0;o<e.length/2;o++)n[s*o]=e[o*2],n[s*o+1]=e[o*2+1];if(r&&r.length)for(let o=0;o<r.length;o++)n[s*o+2]=r[o];if(t&&t.length)for(let o=0;o<t.length;o++)n[s*o+(s-1)]=t[o];return n}function pd(e){return Math.sign(md(e))}function md(e){let t=0,r=e.length/2-1;for(let i=0;i<r;i++)t+=(e[i*2]+e[(i+1)*2])*(e[i*2+1]-e[(i+1)*2+1]);return t/2}var yd=!0,pl=!1,gd=100,Ls=12,ze={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Hn=class{options={};binaryReader=new nr({maxRewindBytes:Ls});state=ze.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(t){this.options=t}write(t){this.binaryReader.write(t),this.state=ml(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=ml(this.state,this.result,this.binaryReader,this.options),this.state!==ze.END&&(this.state=ze.ERROR,this.result.error="SHP incomplete file")}};function Pa(e,t){let r=new Hn(t);return r.write(e),r.end(),r.result}async function*yl(e,t){let r=new Hn(t),i=!1;for await(let s of Dr(e))r.write(s),!i&&r.result.header&&(i=!0,yield r.result.header),r.result.geometries.length>0&&(yield r.result.geometries,r.result.geometries=[]);r.end(),r.result.geometries.length>0&&(yield r.result.geometries)}function ml(e,t,r,i){for(;;)try{switch(e){case ze.ERROR:case ze.END:return e;case ze.EXPECTING_HEADER:let s=r.getDataView(gd);if(!s)return e;t.header=Wn(s),t.progress={bytesUsed:0,bytesTotal:t.header.length,rows:0},t.currentIndex=1,e=ze.EXPECTING_RECORD;break;case ze.EXPECTING_RECORD:for(;r.hasAvailableBytes(Ls);){let n=r.getDataView(Ls),o={recordNumber:n.getInt32(0,pl),byteLength:n.getInt32(4,pl)*2,type:n.getInt32(8,yd)};if(!r.hasAvailableBytes(o.byteLength-4))return r.rewind(Ls),e;if(o.byteLength<4||o.type!==t.header?.type||o.recordNumber!==t.currentIndex)r.rewind(Ls-4);else{r.rewind(4);let h=r.getDataView(o.byteLength),l=fl(h,i);t.geometries.push(l),t.currentIndex++,t.progress.rows=t.currentIndex-1}}return r.ended&&(e=ze.END),e;default:return e=ze.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=ze.ERROR,t.error=`SHP parsing failed: ${s?.message}`,e}}var bd="4.4.0-alpha.9",za=[0,0,39,10],ja={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:bd,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(za).buffer],options:{shp:{_maxDimensions:4}}},Rs={...ja,parse:async(e,t)=>Pa(e,t),parseSync:Pa,parseInBatches:(e,t)=>yl(e,t)};function Va(e,t){for(let r of e)r.geometry.coordinates=gl(r.geometry.coordinates,t);return e}function gl(e,t){return _d(e)?t(e):e.map(r=>gl(r,t))}function _d(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}function _l(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function x(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function a(c){try{l(i.next(c))}catch(u){o(u)}}function h(c){try{l(i.throw(c))}catch(u){o(u)}}function l(c){c.done?n(c.value):s(c.value).then(a,h)}l((i=i.apply(e,t||[])).next())})}function bl(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function be(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(m){return Promise.resolve(m).then(p,u)}}function a(p,m){i[p]&&(s[p]=function(g){return new Promise(function(v,I){n.push([p,g,v,I])>1||h(p,g)})},m&&(s[p]=m(s[p])))}function h(p,m){try{l(i[p](m))}catch(g){d(n[0][3],g)}}function l(p){p.value instanceof k?Promise.resolve(p.value.v).then(c,u):d(n[0][2],p)}function c(p){h("next",p)}function u(p){h("throw",p)}function d(p,m){p(m),n.shift(),n.length&&h(n[0][0],n[0][1])}}function Vi(e){var t,r;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:k(e[s](o)),done:!1}:n?n(o):o}:n}}function je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof bl=="function"?bl(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(a,h){o=e[n](o),s(a,h,o.done,o.value)})}}function s(n,o,a,h){Promise.resolve(h).then(function(l){n({value:l,done:a})},o)}}var $a={};$r($a,{compareArrayLike:()=>qa,joinUint8Arrays:()=>_e,memcpy:()=>Ps,rebaseValueOffsets:()=>Qn,toArrayBufferView:()=>G,toArrayBufferViewAsyncIterator:()=>Ge,toArrayBufferViewIterator:()=>ar,toBigInt64Array:()=>Zn,toBigUint64Array:()=>Dd,toFloat32Array:()=>Td,toFloat32ArrayAsyncIterator:()=>Hd,toFloat32ArrayIterator:()=>Cd,toFloat64Array:()=>Od,toFloat64ArrayAsyncIterator:()=>qd,toFloat64ArrayIterator:()=>Pd,toInt16Array:()=>Sd,toInt16ArrayAsyncIterator:()=>Vd,toInt16ArrayIterator:()=>Fd,toInt32Array:()=>si,toInt32ArrayAsyncIterator:()=>kd,toInt32ArrayIterator:()=>Ld,toInt8Array:()=>Id,toInt8ArrayAsyncIterator:()=>jd,toInt8ArrayIterator:()=>Nd,toUint16Array:()=>Bd,toUint16ArrayAsyncIterator:()=>Gd,toUint16ArrayIterator:()=>Rd,toUint32Array:()=>Ad,toUint32ArrayAsyncIterator:()=>Wd,toUint32ArrayIterator:()=>Ud,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>Ha,toUint8ArrayIterator:()=>Wa,toUint8ClampedArray:()=>Ed,toUint8ClampedArrayAsyncIterator:()=>$d,toUint8ClampedArrayIterator:()=>zd});var vd=new TextDecoder("utf-8"),Us=e=>vd.decode(e),wd=new TextEncoder,or=e=>wd.encode(e);var xd=e=>typeof e=="number",vl=e=>typeof e=="boolean",St=e=>typeof e=="function",Gt=e=>e!=null&&Object(e)===e,Ve=e=>Gt(e)&&St(e.then);var ke=e=>Gt(e)&&St(e[Symbol.iterator]),Ae=e=>Gt(e)&&St(e[Symbol.asyncIterator]),qn=e=>Gt(e)&&Gt(e.schema);var $n=e=>Gt(e)&&"done"in e&&"value"in e;var Yn=e=>Gt(e)&&St(e.stat)&&xd(e.fd);var Jn=e=>Gt(e)&&Cs(e.body),Xn=e=>"_getDOMStream"in e&&"_getNodeStream"in e,wl=e=>Gt(e)&&St(e.abort)&&St(e.getWriter)&&!Xn(e),Cs=e=>Gt(e)&&St(e.cancel)&&St(e.getReader)&&!Xn(e),xl=e=>Gt(e)&&St(e.end)&&St(e.write)&&vl(e.writable)&&!Xn(e),Kn=e=>Gt(e)&&St(e.read)&&St(e.pipe)&&vl(e.readable)&&!Xn(e),Ml=e=>Gt(e)&&St(e.clear)&&St(e.bytes)&&St(e.position)&&St(e.setPosition)&&St(e.capacity)&&St(e.getBufferIdentifier)&&St(e.createLong);var Ga=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Md(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,a,h=0,l=0,c=e.length;++h<c;){if(o=t[l],a=e[h],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:s}=o,{byteOffset:i,byteLength:n}=a,r+s<i||i+n<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,r,i-r+n)}return t}function Ps(e,t,r=0,i=t.byteLength){let s=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,s));return n.set(o,r),e}function _e(e,t){let r=Md(e),i=r.reduce((c,u)=>c+u.byteLength,0),s,n,o,a=0,h=-1,l=Math.min(t||Number.POSITIVE_INFINITY,i);for(let c=r.length;++h<c;){if(s=r[h],n=s.subarray(0,Math.min(s.length,l-a)),l<=a+n.length){n.length<s.length?r[h]=s.subarray(n.length):n.length===s.length&&h++,o?Ps(o,n,a):o=n;break}Ps(o||(o=new Uint8Array(l)),n,a),a+=n.length}return[o||new Uint8Array(0),r.slice(h),i-(o?o.byteLength:0)]}function G(e,t){let r=$n(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=or(r)),r instanceof ArrayBuffer?new e(r):r instanceof Ga?new e(r):Ml(r)?G(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var Id=e=>G(Int8Array,e),Sd=e=>G(Int16Array,e),si=e=>G(Int32Array,e),Zn=e=>G(BigInt64Array,e),N=e=>G(Uint8Array,e),Bd=e=>G(Uint16Array,e),Ad=e=>G(Uint32Array,e),Dd=e=>G(BigUint64Array,e),Td=e=>G(Float32Array,e),Od=e=>G(Float64Array,e),Ed=e=>G(Uint8ClampedArray,e),ka=e=>(e.next(),e);function*ar(e,t){let r=function*(s){yield s},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ga?r(t):ke(t)?t:r(t);return yield*ka(function*(s){let n=null;do n=s.next(yield G(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var Nd=e=>ar(Int8Array,e),Fd=e=>ar(Int16Array,e),Ld=e=>ar(Int32Array,e),Wa=e=>ar(Uint8Array,e),Rd=e=>ar(Uint16Array,e),Ud=e=>ar(Uint32Array,e),Cd=e=>ar(Float32Array,e),Pd=e=>ar(Float64Array,e),zd=e=>ar(Uint8ClampedArray,e);function Ge(e,t){return be(this,arguments,function*(){if(Ve(t))return yield k(yield k(yield*Vi(je(Ge(e,yield k(t))))));let i=function(o){return be(this,arguments,function*(){yield yield k(yield k(o))})},s=function(o){return be(this,arguments,function*(){yield k(yield*Vi(je(ka(function*(a){let h=null;do h=a.next(yield h?.value);while(!h.done)}(o[Symbol.iterator]())))))})},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ga?i(t):ke(t)?s(t):Ae(t)?t:i(t);return yield k(yield*Vi(je(ka(function(o){return be(this,arguments,function*(){let a=null;do a=yield k(o.next(yield yield k(G(e,a))));while(!a.done)})}(n[Symbol.asyncIterator]()))))),yield k(new e)})}var jd=e=>Ge(Int8Array,e),Vd=e=>Ge(Int16Array,e),kd=e=>Ge(Int32Array,e),Ha=e=>Ge(Uint8Array,e),Gd=e=>Ge(Uint16Array,e),Wd=e=>Ge(Uint32Array,e),Hd=e=>Ge(Float32Array,e),qd=e=>Ge(Float64Array,e),$d=e=>Ge(Uint8ClampedArray,e);function Qn(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i<s;)r[i]+=e}return r.subarray(0,t)}function qa(e,t){let r=0,i=e.length;if(i!==t.length)return!1;if(i>0)do if(e[r]!==t[r])return!1;while(++r<i);return!0}var Lt={fromIterable(e){return to(Yd(e))},fromAsyncIterable(e){return to(Jd(e))},fromDOMStream(e){return to(Xd(e))},fromNodeStream(e){return to(Kd(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},to=e=>(e.next(),e);function*Yd(e){let t,r=!1,i=[],s,n,o,a=0;function h(){return n==="peek"?_e(i,o)[0]:([s,i,a]=_e(i,o),s)}({cmd:n,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Wa(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&s.byteLength>0&&(i.push(s),a+=s.byteLength),t||o<=a)do({cmd:n,size:o}=yield h());while(o<a);while(!t)}catch(c){(r=!0)&&typeof l.throw=="function"&&l.throw(c)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function Jd(e){return be(this,arguments,function*(){let r,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?_e(s,a)[0]:([n,s,h]=_e(s,a),n)}({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0});let c=Ha(e)[Symbol.asyncIterator]();try{do if({done:r,value:n}=Number.isNaN(a-h)?yield k(c.next()):yield k(c.next(a-h)),!r&&n.byteLength>0&&(s.push(n),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield k(l()));while(a<h);while(!r)}catch(u){(i=!0)&&typeof c.throw=="function"&&(yield k(c.throw(u)))}finally{i===!1&&typeof c.return=="function"&&(yield k(c.return(new Uint8Array(0))))}return yield k(null)})}function Xd(e){return be(this,arguments,function*(){let r=!1,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?_e(s,a)[0]:([n,s,h]=_e(s,a),n)}({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0});let c=new Ja(e);try{do if({done:r,value:n}=Number.isNaN(a-h)?yield k(c.read()):yield k(c.read(a-h)),!r&&n.byteLength>0&&(s.push(N(n)),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield k(l()));while(a<h);while(!r)}catch(u){(i=!0)&&(yield k(c.cancel(u)))}finally{i===!1?yield k(c.cancel()):e.locked&&c.releaseLock()}return yield k(null)})}var Ja=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return x(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return x(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=N(r)),r})}},Ya=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function Kd(e){return be(this,arguments,function*(){let r=[],i="error",s=!1,n=null,o,a,h=0,l=[],c;function u(){return o==="peek"?_e(l,a)[0]:([c,l,h]=_e(l,a),c)}if({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0},e.isTTY)return yield yield k(new Uint8Array(0)),yield k(null);try{r[0]=Ya(e,"end"),r[1]=Ya(e,"error");do{if(r[2]=Ya(e,"readable"),[i,n]=yield k(Promise.race(r.map(p=>p[2]))),i==="error")break;if((s=i==="end")||(Number.isFinite(a-h)?(c=N(e.read(a-h)),c.byteLength<a-h&&(c=N(e.read()))):c=N(e.read()),c.byteLength>0&&(l.push(c),h+=c.byteLength)),s||a<=h)do({cmd:o,size:a}=yield yield k(u()));while(a<h)}while(!s)}finally{yield k(d(r,i==="error"?n:null))}return yield k(null);function d(p,m){return c=l=null,new Promise((g,v)=>{for(let[I,z]of p)e.off(I,z);try{let I=e.destroy;I&&I.call(e,m),m=void 0}catch(I){m=I||m}finally{m!=null?v(m):g()}})}})}var et;(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"})(et||(et={}));var at;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(at||(at={}));var st;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(st||(st={}));var ft;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ft||(ft={}));var M;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(M||(M={}));var bt;(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"})(bt||(bt={}));var hr=new Int32Array(2),eo=new Float32Array(hr.buffer),ro=new Float64Array(hr.buffer),ki=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var zs;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(zs||(zs={}));var Wt=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Wt(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return hr[0]=this.readInt32(t),eo[0]}readFloat64(t){return hr[ki?0:1]=this.readInt32(t),hr[ki?1:0]=this.readInt32(t+4),ro[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){eo[0]=r,this.writeInt32(t,hr[0])}writeFloat64(t,r){ro[0]=r,this.writeInt32(t,hr[ki?0:1]),this.writeInt32(t+4,hr[ki?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let i=t-this.readInt32(t);return r<this.readInt16(i)?this.readInt16(i+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+i);return r===zs.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};var Tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=Wt.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<i+t+r;){let s=this.bb.capacity();this.bb=Tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,i){(this.force_defaults||r!=i)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,i){(this.force_defaults||r!=i)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,i){(this.force_defaults||r!=i)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,i){(this.force_defaults||r!==i)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,i){(this.force_defaults||r!=i)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,i){r!=i&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=r<<1,s=Wt.allocate(i);return s.setPosition(i-r),s.bytes().set(t.bytes(),i-r),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let h=this.bb.capacity()-this.vtables[r];if(n==this.bb.readInt16(h)){for(let l=2;l<n;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(h+l))continue t;o=this.vtables[r];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,i){let s=i?4:0;if(r){let n=r;if(this.prep(this.minalign,4+4+s),n.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r<this.bb.readInt16(s)&&this.bb.readInt16(s+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,i){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(i,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)r.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var js;(function(e){e[e.BUFFER=0]="BUFFER"})(js||(js={}));var Vs;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Vs||(Vs={}));var He=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new He).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Vs.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):js.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Vs.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,js.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,i){return He.startBodyCompression(t),He.addCodec(t,r),He.addMethod(t,i),He.endBodyCompression(t)}};var Gi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Wi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new Wi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Gi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new He).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Yr;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Yr||(Yr={}));var ks;(function(e){e[e.DenseArray=0]="DenseArray"})(ks||(ks={}));var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,i){return Tt.startInt(t),Tt.addBitWidth(t,r),Tt.addIsSigned(t,i),Tt.endInt(t)}};var ve=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Tt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ks.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,ks.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,i){return ht.startKeyValue(t),ht.addKey(t,r),ht.addValue(t,i),ht.endKeyValue(t)}};var lr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return lr.startBinary(t),lr.endBinary(t)}};var cr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return cr.startBool(t),cr.endBool(t)}};var Qt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return Qt.startDate(t),Qt.addUnit(t,r),Qt.endDate(t)}};var Ot=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,i,s){return Ot.startDecimal(t),Ot.addPrecision(t,r),Ot.addScale(t,i),Ot.addBitWidth(t,s),Ot.endDecimal(t)}};var te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new te).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return te.startDuration(t),te.addUnit(t,r),te.endDuration(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return ee.startFixedSizeBinary(t),ee.addByteWidth(t,r),ee.endFixedSizeBinary(t)}};var re=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new re).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return re.startFixedSizeList(t),re.addListSize(t,r),re.endFixedSizeList(t)}};var ie=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):st.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,st.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return ie.startFloatingPoint(t),ie.addPrecision(t,r),ie.endFloatingPoint(t)}};var se=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new se).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,bt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return se.startInterval(t),se.addUnit(t,r),se.endInterval(t)}};var ur=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return ur.startLargeBinary(t),ur.endLargeBinary(t)}};var fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return fr.startLargeUtf8(t),fr.endLargeUtf8(t)}};var dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return dr.startList(t),dr.endList(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return ne.startMap(t),ne.addKeysSorted(t,r),ne.endMap(t)}};var pr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return pr.startNull(t),pr.endNull(t)}};var mr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return mr.startStruct_(t),mr.endStruct_(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,i){return zt.startTime(t),zt.addUnit(t,r),zt.addBitWidth(t,i),zt.endTime(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,i){return jt.startTimestamp(t),jt.addUnit(t,r),jt.addTimezone(t,i),jt.endTimestamp(t)}};var Et=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,at.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return Et.startUnion(t),Et.addMode(t,r),Et.addTypeIds(t,i),Et.endUnion(t)}};var yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return yr.startUtf8(t),yr.endUtf8(t)}};var ot;(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"})(ot||(ot={}));var wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ot.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new ve).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,ot.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Yr.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Yr.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return pt.startSchema(t),pt.addEndianness(t,r),pt.addFields(t,i),pt.addCustomMetadata(t,s),pt.addFeatures(t,n),pt.endSchema(t)}};var H;(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"})(H||(H={}));var f;(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"})(f||(f={}));var qe;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(qe||(qe={}));var mh={};$r(mh,{clampRange:()=>Hs,createElementComparator:()=>Zr,wrapIndex:()=>yi});var Xa={};$r(Xa,{valueToString:()=>$e});function $e(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>$e(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var th={};$r(th,{BN:()=>ni,bigNumToBigInt:()=>Sl,bigNumToNumber:()=>Qa,bigNumToString:()=>$i,isArrowBigNumSymbol:()=>Il});function Y(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Ka(e,t){return Y(e/t)+Y(e%t)/Y(t)}var Il=Symbol.for("isArrowBigNum");function Ye(e,...t){return t.length===0?Object.setPrototypeOf(G(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ye.prototype[Il]=!0;Ye.prototype.toJSON=function(){return`"${$i(this)}"`};Ye.prototype.valueOf=function(e){return Qa(this,e)};Ye.prototype.toString=function(){return $i(this)};Ye.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Qa(this);case"string":return $i(this);case"default":return Sl(this)}return $i(this)};function Hi(...e){return Ye.apply(this,e)}function qi(...e){return Ye.apply(this,e)}function Gs(...e){return Ye.apply(this,e)}Object.setPrototypeOf(Hi.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(qi.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Gs.prototype,Object.create(Uint32Array.prototype));Object.assign(Hi.prototype,Ye.prototype,{constructor:Hi,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(qi.prototype,Ye.prototype,{constructor:qi,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Gs.prototype,Ye.prototype,{constructor:Gs,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Zd=BigInt(4294967296)*BigInt(4294967296),Qd=Zd-BigInt(1);function Qa(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),a=n&&o.at(-1)&BigInt(1)<<BigInt(63),h=BigInt(0),l=0;if(a){for(let c of o)h|=(c^Qd)*(BigInt(1)<<BigInt(64*l++));h*=BigInt(-1),h-=BigInt(1)}else for(let c of o)h|=c*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let c=BigInt(Math.pow(10,t)),u=h/c,d=h%c;return Y(u)+Y(d)/Y(c)}return Y(h)}function $i(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Za(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Za(e);t=t.slice();let i=1;for(let n=0;n<t.length;n++){let o=t[n],a=~o+i;t[n]=a,i&=o===0?1:0}return`-${Za(t)}`}function Sl(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:$i(e)}function Za(e){let t="",r=new Uint32Array(2),i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),s=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),n=-1,o=i.length-1;do{for(r[0]=i[n=0];n<o;)i[n++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+i[n];i[n]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}var ni=class{static new(t,r){switch(r){case!0:return new Hi(t);case!1:return new qi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Hi(t)}return t.byteLength===16?new Gs(t):new qi(t)}static signed(t){return new Hi(t)}static unsigned(t){return new qi(t)}static decimal(t){return new Gs(t)}constructor(t,r){return ni.new(t,r)}};var Bl,Al,Dl,Tl,Ol,El,Nl,Fl,Ll,Rl,Ul,Cl,Pl,zl,jl,Vl,kl,Gl,Wl,Hl,ql,$l,w=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return w.isUnion(t)&&t.mode===at.Dense}static isSparseUnion(t){return w.isUnion(t)&&t.mode===at.Sparse}constructor(t){this.typeId=t}};Bl=Symbol.toStringTag;w[Bl]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(w.prototype);var Nt=class extends w{constructor(){super(f.Null)}toString(){return"Null"}};Al=Symbol.toStringTag;Nt[Al]=(e=>e[Symbol.toStringTag]="Null")(Nt.prototype);var _t=class extends w{constructor(t,r){super(f.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Dl=Symbol.toStringTag;_t[Dl]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_t.prototype);var oi=class extends _t{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ai=class extends _t{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},we=class extends _t{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},hi=class extends _t{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},li=class extends _t{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ci=class extends _t{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ui=class extends _t{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},fi=class extends _t{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(oi.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ai.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(we.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(hi.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(li.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ci.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ui.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(fi.prototype,"ArrayType",{value:BigUint64Array});var oe=class extends w{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case st.HALF:return Uint16Array;case st.SINGLE:return Float32Array;case st.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Tl=Symbol.toStringTag;oe[Tl]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(oe.prototype);var di=class extends oe{constructor(){super(st.HALF)}},pi=class extends oe{constructor(){super(st.SINGLE)}},mi=class extends oe{constructor(){super(st.DOUBLE)}};Object.defineProperty(di.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(pi.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(mi.prototype,"ArrayType",{value:Float64Array});var Oe=class extends w{constructor(){super(f.Binary)}toString(){return"Binary"}};Ol=Symbol.toStringTag;Oe[Ol]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Oe.prototype);var gr=class extends w{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};El=Symbol.toStringTag;gr[El]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(gr.prototype);var Ee=class extends w{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Nl=Symbol.toStringTag;Ee[Nl]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ee.prototype);var br=class extends w{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Fl=Symbol.toStringTag;br[Fl]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(br.prototype);var Ne=class extends w{constructor(){super(f.Bool)}toString(){return"Bool"}};Ll=Symbol.toStringTag;Ne[Ll]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ne.prototype);var Fe=class extends w{constructor(t,r,i=128){super(f.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Rl=Symbol.toStringTag;Fe[Rl]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Fe.prototype);var xe=class extends w{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ft[this.unit]}>`}get ArrayType(){return this.unit===ft.DAY?Int32Array:BigInt64Array}};Ul=Symbol.toStringTag;xe[Ul]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(xe.prototype);var Yi=class extends xe{constructor(){super(ft.DAY)}},Ji=class extends xe{constructor(){super(ft.MILLISECOND)}},Ht=class extends w{constructor(t,r){super(f.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${M[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Cl=Symbol.toStringTag;Ht[Cl]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ht.prototype);var Xi=class extends Ht{constructor(){super(M.SECOND,32)}},Ki=class extends Ht{constructor(){super(M.MILLISECOND,32)}},Zi=class extends Ht{constructor(){super(M.MICROSECOND,64)}},Qi=class extends Ht{constructor(){super(M.NANOSECOND,64)}},qt=class extends w{constructor(t,r){super(f.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${M[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Pl=Symbol.toStringTag;qt[Pl]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(qt.prototype);var ts=class extends qt{constructor(t){super(M.SECOND,t)}},es=class extends qt{constructor(t){super(M.MILLISECOND,t)}},rs=class extends qt{constructor(t){super(M.MICROSECOND,t)}},is=class extends qt{constructor(t){super(M.NANOSECOND,t)}},Me=class extends w{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${bt[this.unit]}>`}};zl=Symbol.toStringTag;Me[zl]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Me.prototype);var ss=class extends Me{constructor(){super(bt.DAY_TIME)}},ns=class extends Me{constructor(){super(bt.YEAR_MONTH)}},_r=class extends w{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${M[this.unit]}>`}};jl=Symbol.toStringTag;_r[jl]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(_r.prototype);var ae=class extends w{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Vl=Symbol.toStringTag;ae[Vl]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ae.prototype);var Q=class extends w{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};kl=Symbol.toStringTag;Q[kl]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Q.prototype);var Le=class extends w{constructor(t,r,i){super(f.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Gl=Symbol.toStringTag;Le[Gl]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Le.prototype);var vr=class extends w{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Wl=Symbol.toStringTag;vr[Wl]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(vr.prototype);var he=class extends w{constructor(t,r){super(f.FixedSizeList),this.listSize=t,this.children=[r]}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}>`}};Hl=Symbol.toStringTag;he[Hl]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(he.prototype);var le=class extends w{constructor(t,r=!1){var i,s,n;if(super(f.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(n=t?.type)===null||n===void 0?void 0:n.children[1];a&&(a.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(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ql=Symbol.toStringTag;le[ql]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(le.prototype);var tp=(e=>()=>++e)(-1),ce=class extends w{constructor(t,r,i,s){super(f.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?tp():Y(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};$l=Symbol.toStringTag;ce[$l]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(ce.prototype);function Ie(e){let t=e;switch(e.typeId){case f.Decimal:return e.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var B=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return ep(this,t,r)}getVisitFnByTypeId(t,r=!0){return os(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function ep(e,t,r=!0){return typeof t=="number"?os(e,t,r):typeof t=="string"&&t in f?os(e,f[t],r):t&&t instanceof w?os(e,Yl(t),r):t?.type&&t.type instanceof w?os(e,Yl(t.type),r):os(e,f.NONE,r)}function os(e,t,r=!0){let i=null;switch(t){case f.Null:i=e.visitNull;break;case f.Bool:i=e.visitBool;break;case f.Int:i=e.visitInt;break;case f.Int8:i=e.visitInt8||e.visitInt;break;case f.Int16:i=e.visitInt16||e.visitInt;break;case f.Int32:i=e.visitInt32||e.visitInt;break;case f.Int64:i=e.visitInt64||e.visitInt;break;case f.Uint8:i=e.visitUint8||e.visitInt;break;case f.Uint16:i=e.visitUint16||e.visitInt;break;case f.Uint32:i=e.visitUint32||e.visitInt;break;case f.Uint64:i=e.visitUint64||e.visitInt;break;case f.Float:i=e.visitFloat;break;case f.Float16:i=e.visitFloat16||e.visitFloat;break;case f.Float32:i=e.visitFloat32||e.visitFloat;break;case f.Float64:i=e.visitFloat64||e.visitFloat;break;case f.Utf8:i=e.visitUtf8;break;case f.LargeUtf8:i=e.visitLargeUtf8;break;case f.Binary:i=e.visitBinary;break;case f.LargeBinary:i=e.visitLargeBinary;break;case f.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case f.Date:i=e.visitDate;break;case f.DateDay:i=e.visitDateDay||e.visitDate;break;case f.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case f.Timestamp:i=e.visitTimestamp;break;case f.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case f.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case f.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case f.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case f.Time:i=e.visitTime;break;case f.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case f.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case f.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case f.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case f.Decimal:i=e.visitDecimal;break;case f.List:i=e.visitList;break;case f.Struct:i=e.visitStruct;break;case f.Union:i=e.visitUnion;break;case f.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case f.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case f.Dictionary:i=e.visitDictionary;break;case f.Interval:i=e.visitInterval;break;case f.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case f.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case f.Duration:i=e.visitDuration;break;case f.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case f.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case f.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case f.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case f.FixedSizeList:i=e.visitFixedSizeList;break;case f.Map:i=e.visitMap;break}if(typeof i=="function")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Yl(e){switch(e.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?f.Int8:f.Uint8;case 16:return r?f.Int16:f.Uint16;case 32:return r?f.Int32:f.Uint32;case 64:return r?f.Int64:f.Uint64}return f.Int}case f.Float:switch(e.precision){case st.HALF:return f.Float16;case st.SINGLE:return f.Float32;case st.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(e.unit){case M.SECOND:return f.TimeSecond;case M.MILLISECOND:return f.TimeMillisecond;case M.MICROSECOND:return f.TimeMicrosecond;case M.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(e.unit){case M.SECOND:return f.TimestampSecond;case M.MILLISECOND:return f.TimestampMillisecond;case M.MICROSECOND:return f.TimestampMicrosecond;case M.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(e.unit){case ft.DAY:return f.DateDay;case ft.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(e.unit){case bt.DAY_TIME:return f.IntervalDayTime;case bt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(e.unit){case M.SECOND:return f.DurationSecond;case M.MILLISECOND:return f.DurationMillisecond;case M.MICROSECOND:return f.DurationMicrosecond;case M.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(e.mode){case at.Dense:return f.DenseUnion;case at.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[e.typeId]}'`)}B.prototype.visitInt8=null;B.prototype.visitInt16=null;B.prototype.visitInt32=null;B.prototype.visitInt64=null;B.prototype.visitUint8=null;B.prototype.visitUint16=null;B.prototype.visitUint32=null;B.prototype.visitUint64=null;B.prototype.visitFloat16=null;B.prototype.visitFloat32=null;B.prototype.visitFloat64=null;B.prototype.visitDateDay=null;B.prototype.visitDateMillisecond=null;B.prototype.visitTimestampSecond=null;B.prototype.visitTimestampMillisecond=null;B.prototype.visitTimestampMicrosecond=null;B.prototype.visitTimestampNanosecond=null;B.prototype.visitTimeSecond=null;B.prototype.visitTimeMillisecond=null;B.prototype.visitTimeMicrosecond=null;B.prototype.visitTimeNanosecond=null;B.prototype.visitDenseUnion=null;B.prototype.visitSparseUnion=null;B.prototype.visitIntervalDayTime=null;B.prototype.visitIntervalYearMonth=null;B.prototype.visitDuration=null;B.prototype.visitDurationSecond=null;B.prototype.visitDurationMillisecond=null;B.prototype.visitDurationMicrosecond=null;B.prototype.visitDurationNanosecond=null;var eh={};$r(eh,{float64ToUint16:()=>Ws,uint16ToFloat64:()=>so});var Jl=new Float64Array(1),as=new Uint32Array(Jl.buffer);function so(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Ws(e){if(e!==e)return 32256;Jl[0]=e;let t=(as[1]&2147483648)>>16&65535,r=as[1]&2146435072,i=0;return r>=1089470464?as[0]>0?r=31744:(r=(r&2080374784)>>16,i=(as[1]&1048575)>>10):r<=1056964608?(i=1048576+(as[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(as[1]&1048575)+512>>10),t|r|i&65535}var E=class extends B{};function R(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var rp=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Xl=(e,t,r,i)=>{if(r+1<t.length){let s=Y(t[r]),n=Y(t[r+1]);e.set(i.subarray(0,n-s),s)}},ip=({offset:e,values:t},r,i)=>{let s=e+r;i?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Or=({values:e},t,r)=>{e[t]=r},rh=({values:e},t,r)=>{e[t]=r},Kl=({values:e},t,r)=>{e[t]=Ws(r)},sp=(e,t,r)=>{switch(e.type.precision){case st.HALF:return Kl(e,t,r);case st.SINGLE:case st.DOUBLE:return rh(e,t,r)}},no=({values:e},t,r)=>{rp(e,t,r.valueOf())},oo=({values:e},t,r)=>{e[t]=BigInt(r)},ih=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},Zl=({values:e,valueOffsets:t},r,i)=>Xl(e,t,r,i),Ql=({values:e,valueOffsets:t},r,i)=>Xl(e,t,r,or(i)),sh=(e,t,r)=>{e.type.unit===ft.DAY?no(e,t,r):oo(e,t,r)},ao=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},ho=({values:e},t,r)=>{e[t]=BigInt(r)},lo=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},co=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},nh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return ao(e,t,r);case M.MILLISECOND:return ho(e,t,r);case M.MICROSECOND:return lo(e,t,r);case M.NANOSECOND:return co(e,t,r)}},uo=({values:e},t,r)=>{e[t]=r},fo=({values:e},t,r)=>{e[t]=r},po=({values:e},t,r)=>{e[t]=r},mo=({values:e},t,r)=>{e[t]=r},oh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return uo(e,t,r);case M.MILLISECOND:return fo(e,t,r);case M.MICROSECOND:return po(e,t,r);case M.NANOSECOND:return mo(e,t,r)}},ah=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},np=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=Rt.getVisitFn(i);if(Array.isArray(r))for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r[++o]);else for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r.get(++o))},op=(e,t,r)=>{let i=e.children[0],{valueOffsets:s}=e,n=Rt.getVisitFn(i),{[t]:o,[t+1]:a}=s,h=r instanceof Map?r.entries():Object.entries(r);for(let l of h)if(n(i,o,l),++o>=a)break},ap=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),hp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),lp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),cp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),up=(e,t,r)=>{let i=e.type.children.map(n=>Rt.getVisitFn(n.type)),s=r instanceof Map?lp(t,r):r instanceof j?hp(t,r):Array.isArray(r)?ap(t,r):cp(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},fp=(e,t,r)=>{e.type.mode===at.Dense?tc(e,t,r):ec(e,t,r)},tc=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,e.valueOffsets[t],r)},ec=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,t,r)},dp=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},hh=(e,t,r)=>{e.type.unit===bt.DAY_TIME?yo(e,t,r):go(e,t,r)},yo=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},go=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},bo=({values:e},t,r)=>{e[t]=r},_o=({values:e},t,r)=>{e[t]=r},vo=({values:e},t,r)=>{e[t]=r},wo=({values:e},t,r)=>{e[t]=r},lh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return bo(e,t,r);case M.MILLISECOND:return _o(e,t,r);case M.MICROSECOND:return vo(e,t,r);case M.NANOSECOND:return wo(e,t,r)}},pp=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=Rt.getVisitFn(s);if(Array.isArray(r))for(let o=-1,a=t*i;++o<i;)n(s,a+o,r[o]);else for(let o=-1,a=t*i;++o<i;)n(s,a+o,r.get(o))};E.prototype.visitBool=R(ip);E.prototype.visitInt=R(Or);E.prototype.visitInt8=R(Or);E.prototype.visitInt16=R(Or);E.prototype.visitInt32=R(Or);E.prototype.visitInt64=R(Or);E.prototype.visitUint8=R(Or);E.prototype.visitUint16=R(Or);E.prototype.visitUint32=R(Or);E.prototype.visitUint64=R(Or);E.prototype.visitFloat=R(sp);E.prototype.visitFloat16=R(Kl);E.prototype.visitFloat32=R(rh);E.prototype.visitFloat64=R(rh);E.prototype.visitUtf8=R(Ql);E.prototype.visitLargeUtf8=R(Ql);E.prototype.visitBinary=R(Zl);E.prototype.visitLargeBinary=R(Zl);E.prototype.visitFixedSizeBinary=R(ih);E.prototype.visitDate=R(sh);E.prototype.visitDateDay=R(no);E.prototype.visitDateMillisecond=R(oo);E.prototype.visitTimestamp=R(nh);E.prototype.visitTimestampSecond=R(ao);E.prototype.visitTimestampMillisecond=R(ho);E.prototype.visitTimestampMicrosecond=R(lo);E.prototype.visitTimestampNanosecond=R(co);E.prototype.visitTime=R(oh);E.prototype.visitTimeSecond=R(uo);E.prototype.visitTimeMillisecond=R(fo);E.prototype.visitTimeMicrosecond=R(po);E.prototype.visitTimeNanosecond=R(mo);E.prototype.visitDecimal=R(ah);E.prototype.visitList=R(np);E.prototype.visitStruct=R(up);E.prototype.visitUnion=R(fp);E.prototype.visitDenseUnion=R(tc);E.prototype.visitSparseUnion=R(ec);E.prototype.visitDictionary=R(dp);E.prototype.visitInterval=R(hh);E.prototype.visitIntervalDayTime=R(yo);E.prototype.visitIntervalYearMonth=R(go);E.prototype.visitDuration=R(lh);E.prototype.visitDurationSecond=R(bo);E.prototype.visitDurationMillisecond=R(_o);E.prototype.visitDurationMicrosecond=R(vo);E.prototype.visitDurationNanosecond=R(wo);E.prototype.visitFixedSizeList=R(pp);E.prototype.visitMap=R(op);var Rt=new E;var Je=Symbol.for("parent"),hs=Symbol.for("rowIndex"),Jr=class{constructor(t,r){return this[Je]=t,this[hs]=r,new Proxy(this,new uh)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[hs],r=this[Je],i=r.type.children,s={};for(let n=-1,o=i.length;++n<o;)s[i[n].name]=xt.visit(r.children[n],t);return s}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ch(this[Je],this[hs])}},ch=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,xt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Jr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Je]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hs]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var uh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Je].type.children.map(r=>r.name)}has(t,r){return t[Je].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Je].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[Je].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=xt.visit(t[Je].children[i],t[hs]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[Je].type.children.findIndex(n=>n.name===r);return s!==-1?(Rt.visit(t[Je].children[s],t[hs],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,i):!1}};var A=class extends B{};function F(e){return(t,r)=>t.getValid(r)?e(t,r):null}var mp=(e,t)=>864e5*e[t],yp=(e,t)=>null,rc=(e,t,r)=>{if(r+1>=t.length)return null;let i=Y(t[r]),s=Y(t[r+1]);return e.subarray(i,s)},gp=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<<i%8)!==0},ic=({values:e},t)=>mp(e,t),sc=({values:e},t)=>Y(e[t]),Xr=({stride:e,values:t},r)=>t[e*r],bp=({stride:e,values:t},r)=>so(t[e*r]),nc=({values:e},t)=>e[t],_p=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),oc=({values:e,valueOffsets:t},r)=>rc(e,t,r),ac=({values:e,valueOffsets:t},r)=>{let i=rc(e,t,r);return i!==null?Us(i):null},vp=({values:e},t)=>e[t],wp=({type:e,values:t},r)=>e.precision!==st.HALF?t[r]:so(t[r]),xp=(e,t)=>e.type.unit===ft.DAY?ic(e,t):sc(e,t),hc=({values:e},t)=>1e3*Y(e[t]),lc=({values:e},t)=>Y(e[t]),cc=({values:e},t)=>Ka(e[t],BigInt(1e3)),uc=({values:e},t)=>Ka(e[t],BigInt(1e6)),Mp=(e,t)=>{switch(e.type.unit){case M.SECOND:return hc(e,t);case M.MILLISECOND:return lc(e,t);case M.MICROSECOND:return cc(e,t);case M.NANOSECOND:return uc(e,t)}},fc=({values:e},t)=>e[t],dc=({values:e},t)=>e[t],pc=({values:e},t)=>e[t],mc=({values:e},t)=>e[t],Ip=(e,t)=>{switch(e.type.unit){case M.SECOND:return fc(e,t);case M.MILLISECOND:return dc(e,t);case M.MICROSECOND:return pc(e,t);case M.NANOSECOND:return mc(e,t)}},Sp=({values:e,stride:t},r)=>ni.decimal(e.subarray(t*r,t*(r+1))),Bp=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,h=s[0].slice(n,o-n);return new j([h])},Ap=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new wr(o.slice(s,n-s))},Dp=(e,t)=>new Jr(e,t),Tp=(e,t)=>e.type.mode===at.Dense?yc(e,t):gc(e,t),yc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,e.valueOffsets[t])},gc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,t)},Op=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Ep=(e,t)=>e.type.unit===bt.DAY_TIME?bc(e,t):_c(e,t),bc=({values:e},t)=>e.subarray(2*t,2*(t+1)),_c=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},vc=({values:e},t)=>e[t],wc=({values:e},t)=>e[t],xc=({values:e},t)=>e[t],Mc=({values:e},t)=>e[t],Np=(e,t)=>{switch(e.type.unit){case M.SECOND:return vc(e,t);case M.MILLISECOND:return wc(e,t);case M.MICROSECOND:return xc(e,t);case M.NANOSECOND:return Mc(e,t)}},Fp=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new j([n])};A.prototype.visitNull=F(yp);A.prototype.visitBool=F(gp);A.prototype.visitInt=F(vp);A.prototype.visitInt8=F(Xr);A.prototype.visitInt16=F(Xr);A.prototype.visitInt32=F(Xr);A.prototype.visitInt64=F(nc);A.prototype.visitUint8=F(Xr);A.prototype.visitUint16=F(Xr);A.prototype.visitUint32=F(Xr);A.prototype.visitUint64=F(nc);A.prototype.visitFloat=F(wp);A.prototype.visitFloat16=F(bp);A.prototype.visitFloat32=F(Xr);A.prototype.visitFloat64=F(Xr);A.prototype.visitUtf8=F(ac);A.prototype.visitLargeUtf8=F(ac);A.prototype.visitBinary=F(oc);A.prototype.visitLargeBinary=F(oc);A.prototype.visitFixedSizeBinary=F(_p);A.prototype.visitDate=F(xp);A.prototype.visitDateDay=F(ic);A.prototype.visitDateMillisecond=F(sc);A.prototype.visitTimestamp=F(Mp);A.prototype.visitTimestampSecond=F(hc);A.prototype.visitTimestampMillisecond=F(lc);A.prototype.visitTimestampMicrosecond=F(cc);A.prototype.visitTimestampNanosecond=F(uc);A.prototype.visitTime=F(Ip);A.prototype.visitTimeSecond=F(fc);A.prototype.visitTimeMillisecond=F(dc);A.prototype.visitTimeMicrosecond=F(pc);A.prototype.visitTimeNanosecond=F(mc);A.prototype.visitDecimal=F(Sp);A.prototype.visitList=F(Bp);A.prototype.visitStruct=F(Dp);A.prototype.visitUnion=F(Tp);A.prototype.visitDenseUnion=F(yc);A.prototype.visitSparseUnion=F(gc);A.prototype.visitDictionary=F(Op);A.prototype.visitInterval=F(Ep);A.prototype.visitIntervalDayTime=F(bc);A.prototype.visitIntervalYearMonth=F(_c);A.prototype.visitDuration=F(Np);A.prototype.visitDurationSecond=F(vc);A.prototype.visitDurationMillisecond=F(wc);A.prototype.visitDurationMicrosecond=F(xc);A.prototype.visitDurationNanosecond=F(Mc);A.prototype.visitFixedSizeList=F(Fp);A.prototype.visitMap=F(Ap);var xt=new A;var Kr=Symbol.for("keys"),cs=Symbol.for("vals"),ls=Symbol.for("kKeysAsStrings"),fh=Symbol.for("_kKeysAsStrings"),wr=class{constructor(t){return this[Kr]=new j([t.children[0]]).memoize(),this[cs]=t.children[1],new Proxy(this,new ph)}get[ls](){return this[fh]||(this[fh]=Array.from(this[Kr].toArray(),String))}[Symbol.iterator](){return new dh(this[Kr],this[cs])}get size(){return this[Kr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Kr],r=this[cs],i={};for(let s=-1,n=t.length;++s<n;)i[t.get(s)]=xt.visit(r,s);return i}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},dh=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),xt.visit(this.vals,t)]})}},ph=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ls]}has(t,r){return t[ls].includes(r)}getOwnPropertyDescriptor(t,r){if(t[ls].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[ls].indexOf(r);if(i!==-1){let s=xt.visit(Reflect.get(t,cs),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[ls].indexOf(r);return s!==-1?(Rt.visit(Reflect.get(t,cs),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(wr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Kr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[cs]:{writable:!0,enumerable:!1,configurable:!1,value:null},[fh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Ic;function Hs(e,t,r,i){let{length:s=0}=e,n=typeof t!="number"?0:t,o=typeof r!="number"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),o<n&&(Ic=n,n=o,o=Ic),o>s&&(o=s),i?i(e,n,o):[n,o]}var yi=(e,t)=>e<0?t+e:e,Sc=e=>e!==e;function Zr(e){if(typeof e!=="object"||e===null)return Sc(e)?Sc:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?qa(e,r):!1:e instanceof Map?Rp(e):Array.isArray(e)?Lp(e):e instanceof j?Up(e):Cp(e,!0)}function Lp(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Zr(e[r]);return xo(t)}function Rp(e){let t=-1,r=[];for(let i of e.values())r[++t]=Zr(i);return xo(r)}function Up(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Zr(e.get(r));return xo(t)}function Cp(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let i=[];for(let s=-1,n=r.length;++s<n;)i[s]=Zr(e[r[s]]);return xo(i,r)}function xo(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return Pp(e,r);case Map:return Bc(e,r,r.keys());case wr:case Jr:case Object:case void 0:return Bc(e,r,t||Object.keys(r))}return r instanceof j?zp(e,r):!1}}function Pp(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t[i]))return!1;return!0}function zp(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t.get(i)))return!1;return!0}function Bc(e,t,r){let i=r[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),n=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=e.length,h=n.next(),l=i.next(),c=s.next();for(;o<a&&!l.done&&!c.done&&!h.done&&!(l.value!==c.value||!e[o](h.value));++o,l=i.next(),c=s.next(),h=n.next());return o===a&&l.done&&c.done&&h.done?!0:(i.return&&i.return(),s.return&&s.return(),n.return&&n.return(),!1)}var yh={};$r(yh,{BitIterator:()=>gi,getBit:()=>Ac,getBool:()=>Io,packBools:()=>_i,popcnt_array:()=>Dc,popcnt_bit_range:()=>qs,popcnt_uint32:()=>Mo,setBool:()=>jp,truncateBitmap:()=>bi});function Io(e,t,r,i){return(r&1<<i)!==0}function Ac(e,t,r,i){return(r&1<<i)>>i}function jp(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function bi(e,t,r){let i=r.byteLength+7&-8;if(e>0||r.byteLength<i){let s=new Uint8Array(i);return s.set(e%8===0?r.subarray(e>>3):_i(new gi(r,e,t,null,Io)).subarray(0,i)),s}return r}function _i(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<<i),++i===8&&(t[r++]=s,s=i=0);(r===0||i>0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var gi=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function qs(e,t,r){if(r-t<=0)return 0;if(r-t<8){let n=0;for(let o of new gi(e,t,r-t,e,Ac))n+=o;return n}let i=r>>3<<3,s=t+(t%8===0?0:8-t%8);return qs(e,t,s)+qs(e,i,r)+Dc(e,s>>3,i-s>>3)}function Dc(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=Mo(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=Mo(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=Mo(n.getUint8(s)),s+=1;return i}function Mo(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Vp=-1,q=class{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:t}=this;return w.isSparseUnion(t)?this.children.some(r=>r.nullable):w.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(w.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=Vp&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-qs(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let h;n instanceof q?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=Ie(t),n&&((h=n[0])&&(this.valueOffsets=h),(h=n[1])&&(this.values=h),(h=n[2])&&(this.nullBitmap=h),(h=n[3])&&(this.typeIds=h)))}getValid(t){let{type:r}=this;if(w.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===at.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,r){let i,{type:s}=this;if(w.isUnion(s)){let n=s,o=this.children[n.typeIdToChildIndex[this.typeIds[t]]],a=n.mode===at.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,r)}else{let{nullBitmap:n}=this,{offset:o,length:a}=this,h=o+t,l=1<<h%8,c=h>>3;(!n||n.byteLength<=c)&&(n=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(n.set(bi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let u=n[c];i=(u&l)!==0,n[c]=r?u|l:u&~l}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new q(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,a=s===16?i:1,h=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,h,n.length===0||this.valueOffsets?n:this._sliceChildren(n,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<<r-(r&-8))-1,i>0&&s.set(bi(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[qe.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[qe.TYPE])&&(o[qe.TYPE]=n.subarray(t,t+r)),(n=o[qe.OFFSET])&&(o[qe.OFFSET]=n.subarray(t,t+r+1))||(n=o[qe.DATA])&&(o[qe.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};q.prototype.children=Object.freeze([]);var vi=class extends B{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:i=0,["length"]:s=0}=t;return new q(r,i,s,s)}visitBool(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitInt(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFloat(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDate(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTimestamp(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTime(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDecimal(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitList(t){let{["type"]:r,["offset"]:i=0,["child"]:s}=t,n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}visitStruct(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=N(t.nullBitmap),{length:o=s.reduce((h,{length:l})=>Math.max(h,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],s)}visitUnion(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=G(r.ArrayType,t.typeIds),{["length"]:o=n.length,["nullCount"]:a=-1}=t;if(w.isSparseUnion(r))return new q(r,i,o,a,[void 0,void 0,void 0,n],s);let h=si(t.valueOffsets);return new q(r,i,o,a,[h,void 0,void 0,n],s)}visitDictionary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.indices.ArrayType,t.data),{["dictionary"]:o=new j([new vi().visit({type:r.dictionary})])}=t,{["length"]:a=n.length,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[void 0,n,s],[],o)}visitInterval(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDuration(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFixedSizeList(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new vi().visit({type:r.valueType})}=t,n=N(t.nullBitmap),{["length"]:o=s.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],[s])}visitMap(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new vi().visit({type:r.childType})}=t,n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}},kp=new vi;function U(e){return kp.visit(e)}var $s=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Tc(e){return e.some(t=>t.nullable)}function So(e){return e.reduce((t,r)=>t+r.nullCount,0)}function Bo(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function Ao(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n<o;){let a=e[n],h=t[n],{length:l}=a;if(h>=i)break;if(r>=h+l)continue;if(h>=r&&h+l<=i){s.push(a);continue}let c=Math.max(0,r-h),u=Math.min(i-h,l);s.push(a.slice(c,u-c))}return s.length===0&&s.push(e[0].slice(0,0)),s}function gh(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r<t[o]?i(e,s,r-t[s]):null;n=s+Math.trunc((o-s)*.5),r<t[n]?o=n:s=n}while(s<o)}function Ys(e,t){return e.getValid(t)}function us(e){function t(r,i,s){return e(r[i],s)}return function(r){let i=this.data;return gh(i,this._offsets,r,t)}}function Do(e){let t;function r(i,s,n){return e(i[s],n,t)}return function(i,s){let n=this.data;t=s;let o=gh(n,this._offsets,i,r);return t=void 0,o}}function To(e){let t;function r(i,s,n){let o=n,a=0,h=0;for(let l=s-1,c=i.length;++l<c;){let u=i[l];if(~(a=e(u,t,o)))return h+a;o=0,h+=u.length}return-1}return function(i,s){t=i;let n=this.data,o=typeof s!="number"?r(n,0,0):gh(n,this._offsets,s,r);return t=void 0,o}}var D=class extends B{};function Gp(e,t){return t===null&&e.length>0?0:-1}function Wp(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new gi(r,e.offset+(t||0),e.length,r,Io)){if(!s)return i;++i}return-1}function C(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case f.Union:break;case f.Dictionary:break;default:return Wp(e,r)}let i=xt.getVisitFn(e),s=Zr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}function Oc(e,t,r){let i=xt.getVisitFn(e),s=Zr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}D.prototype.visitNull=Gp;D.prototype.visitBool=C;D.prototype.visitInt=C;D.prototype.visitInt8=C;D.prototype.visitInt16=C;D.prototype.visitInt32=C;D.prototype.visitInt64=C;D.prototype.visitUint8=C;D.prototype.visitUint16=C;D.prototype.visitUint32=C;D.prototype.visitUint64=C;D.prototype.visitFloat=C;D.prototype.visitFloat16=C;D.prototype.visitFloat32=C;D.prototype.visitFloat64=C;D.prototype.visitUtf8=C;D.prototype.visitLargeUtf8=C;D.prototype.visitBinary=C;D.prototype.visitLargeBinary=C;D.prototype.visitFixedSizeBinary=C;D.prototype.visitDate=C;D.prototype.visitDateDay=C;D.prototype.visitDateMillisecond=C;D.prototype.visitTimestamp=C;D.prototype.visitTimestampSecond=C;D.prototype.visitTimestampMillisecond=C;D.prototype.visitTimestampMicrosecond=C;D.prototype.visitTimestampNanosecond=C;D.prototype.visitTime=C;D.prototype.visitTimeSecond=C;D.prototype.visitTimeMillisecond=C;D.prototype.visitTimeMicrosecond=C;D.prototype.visitTimeNanosecond=C;D.prototype.visitDecimal=C;D.prototype.visitList=C;D.prototype.visitStruct=C;D.prototype.visitUnion=C;D.prototype.visitDenseUnion=Oc;D.prototype.visitSparseUnion=Oc;D.prototype.visitDictionary=C;D.prototype.visitInterval=C;D.prototype.visitIntervalDayTime=C;D.prototype.visitIntervalYearMonth=C;D.prototype.visitDuration=C;D.prototype.visitDurationSecond=C;D.prototype.visitDurationMillisecond=C;D.prototype.visitDurationMicrosecond=C;D.prototype.visitDurationNanosecond=C;D.prototype.visitFixedSizeList=C;D.prototype.visitMap=C;var wi=new D;var T=class extends B{};function L(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(w.isInt(t)&&t.bitWidth!==64||w.isTime(t)&&t.bitWidth!==64||w.isFloat(t)&&t.precision!==st.HALF))return new $s(e.data.length,i=>{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new $s(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new bh(o)})}var bh=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};T.prototype.visitNull=L;T.prototype.visitBool=L;T.prototype.visitInt=L;T.prototype.visitInt8=L;T.prototype.visitInt16=L;T.prototype.visitInt32=L;T.prototype.visitInt64=L;T.prototype.visitUint8=L;T.prototype.visitUint16=L;T.prototype.visitUint32=L;T.prototype.visitUint64=L;T.prototype.visitFloat=L;T.prototype.visitFloat16=L;T.prototype.visitFloat32=L;T.prototype.visitFloat64=L;T.prototype.visitUtf8=L;T.prototype.visitLargeUtf8=L;T.prototype.visitBinary=L;T.prototype.visitLargeBinary=L;T.prototype.visitFixedSizeBinary=L;T.prototype.visitDate=L;T.prototype.visitDateDay=L;T.prototype.visitDateMillisecond=L;T.prototype.visitTimestamp=L;T.prototype.visitTimestampSecond=L;T.prototype.visitTimestampMillisecond=L;T.prototype.visitTimestampMicrosecond=L;T.prototype.visitTimestampNanosecond=L;T.prototype.visitTime=L;T.prototype.visitTimeSecond=L;T.prototype.visitTimeMillisecond=L;T.prototype.visitTimeMicrosecond=L;T.prototype.visitTimeNanosecond=L;T.prototype.visitDecimal=L;T.prototype.visitList=L;T.prototype.visitStruct=L;T.prototype.visitUnion=L;T.prototype.visitDenseUnion=L;T.prototype.visitSparseUnion=L;T.prototype.visitDictionary=L;T.prototype.visitInterval=L;T.prototype.visitIntervalDayTime=L;T.prototype.visitIntervalYearMonth=L;T.prototype.visitDuration=L;T.prototype.visitDurationSecond=L;T.prototype.visitDurationMillisecond=L;T.prototype.visitDurationMicrosecond=L;T.prototype.visitDurationNanosecond=L;T.prototype.visitFixedSizeList=L;T.prototype.visitMap=L;var fs=new T;var Ec,Nc={},Fc={},j=class{constructor(t){var r,i,s;let n=t[0]instanceof j?t.flatMap(a=>a.data):t;if(n.length===0||n.some(a=>!(a instanceof q)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:h,indexOf:l}=Nc[o.typeId],c=n[0];this.isValid=u=>Ys(c,u),this.get=u=>a(c,u),this.set=(u,d)=>h(c,u,d),this.indexOf=u=>l(c,u),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,Fc[o.typeId]),this._offsets=Bo(n);break}this.data=n,this.type=o,this.stride=Ie(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return Tc(this.data)}get nullCount(){return So(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(yi(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return fs.visit(this)}concat(...t){return new j(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new j(Hs(this,t,r,({data:i,_offsets:s},n,o)=>Ao(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:a,length:h})=>(o.array.set(a.subarray(0,h*s),o.offset),o.offset+=h*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new j(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return w.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(w.isDictionary(this.type)){let t=new ds(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return new ds(this)}unmemoize(){if(w.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return this}};Ec=Symbol.toStringTag;j[Ec]=(e=>{e.type=w.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(f).map(r=>f[r]).filter(r=>typeof r=="number"&&r!==f.NONE);for(let r of t){let i=xt.getVisitFnByTypeId(r),s=Rt.getVisitFnByTypeId(r),n=wi.getVisitFnByTypeId(r);Nc[r]={get:i,set:s,indexOf:n},Fc[r]=Object.create(e,{isValid:{value:us(Ys)},get:{value:us(xt.getVisitFnByTypeId(r))},set:{value:Do(Rt.getVisitFnByTypeId(r))},indexOf:{value:To(wi.getVisitFnByTypeId(r))}})}return"Vector"})(j.prototype);var ds=class extends j{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=n[o];if(a!==void 0)return a;let h=r.call(this,o);return n[o]=h,h}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),n[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ds(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new j(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Lc(e){if(!e||e.length<=0)return function(s){return!0};let t="",r=e.filter(i=>i===i);return r.length>0&&(t=`
8
8
  switch (x) {${r.map(i=>`
9
- case ${Vp(i)}:`).join("")}
9
+ case ${Hp(i)}:`).join("")}
10
10
  return false;
11
11
  }`),e.length!==r.length&&(t=`if (x !== x) return false;
12
12
  ${t}`),new Function("x",`${t}
13
- return true;`)}function Vp(e){return typeof e!="bigint"?$e(e):`${$e(e)}n`}function _h(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function Fc(e,t=0){return e.length>=t?e.subarray(0,t):Cs(new e.constructor(t),e,0)}var Xe=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?_h(i*1,this.BYTES_PER_ELEMENT):_h(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=_h(t*this.stride,this.BYTES_PER_ELEMENT);let r=Fc(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Fc(this.buffer,t)}},Or=class extends Xe{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ds=class extends Or{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<<n,++this.numValid):o===1&&(i[s]&=~(1<<n),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ps=class extends Or{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let i=this.length-1,s=this.reserve(t-i+1).buffer;return i<t++&&i>=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ut=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ie(t),this._nulls=new ds,r&&r.length>0&&(this._isValid=Nc(r))}toVector(){return new j([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((a,h)=>a+h.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:a,_typeIds:h,_offsets:l,_values:c,_nulls:u}=this;(r=h?.flush(o))?s=l?.flush(o):(s=l?.flush(o))?t=c?.flush(l.last()):t=c?.flush(o),a>0&&(i=u?.flush(o));let d=this.children.map(p=>p.flush());return this.clear(),U({type:n,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};ut.prototype.length=1;ut.prototype.stride=1;ut.prototype.children=null;ut.prototype.finished=!1;ut.prototype.nullValues=null;ut.prototype._isValid=()=>!0;var Mt=class extends ut{constructor(t){super(t),this._values=new Or(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},ue=class extends ut{constructor(t){super(t),this._pendingLength=0,this._offsets=new ps(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof wr?r[Xr].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var wi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var kt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new kt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new wi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new wi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var W=class{constructor(t=[],r,i,s=et.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=bh(this.fields)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new W(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new W(r,this.metadata)}assign(...t){let r=t[0]instanceof W?t[0]:Array.isArray(t[0])?new W(t[0]):new W(t),i=[...this.fields],s=To(To(new Map,this.metadata),r.metadata),n=r.fields.filter(a=>{let h=i.findIndex(l=>l.name===a.name);return~h?(i[h]=a.clone({metadata:To(To(new Map,i[h].metadata),a.metadata)}))&&!1:!0}),o=bh(n,new Map);return new W([...i,...n],s,new Map([...this.dictionaries,...o]))}};W.prototype.fields=null;W.prototype.metadata=null;W.prototype.dictionaries=null;var P=class{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new P(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],P.new(r,i,s,n)}};P.prototype.type=null;P.prototype.name=null;P.prototype.nullable=null;P.prototype.metadata=null;function To(e,t){return new Map([...e||new Map,...t||new Map])}function bh(e,t=new Map){for(let r=-1,i=e.length;++r<i;){let n=e[r].type;if(w.isDictionary(n)){if(!t.has(n.id))t.set(n.id,n.dictionary);else if(t.get(n.id)!==n.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}n.children&&n.children.length>0&&bh(n.children,t)}return t}var Gp=Dr,Wp=Wt,Er=class{static decode(t){t=new Wp(N(t));let r=kt.getRootAsFooter(t),i=W.decode(r.schema(),new Map,r.version());return new vh(i,r)}static encode(t){let r=new Gp,i=W.encode(r,t.schema);kt.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ke.encode(r,o);let s=r.endVector();kt.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ke.encode(r,o);let n=r.endVector();return kt.startFooter(r),kt.addSchema(r,i),kt.addVersion(r,et.V5),kt.addRecordBatches(r,s),kt.addDictionaries(r,n),kt.finishFooterBuffer(r,kt.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=et.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r<i;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,i=this.numDictionaries;++r<i;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var vh=class extends Er{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ke.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ke.decode(r)}return null}},Ke=class{static decode(t){return new Ke(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:i}=r,s=BigInt(r.offset),n=BigInt(r.bodyLength);return wi.createBlock(t,s,i,n)}constructor(t,r,i){this.metaDataLength=t,this.offset=Y(i),this.bodyLength=Y(r)}};var lt=Object.freeze({done:!0,value:void 0}),Ys=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},xi=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Oo=class extends xi{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(lt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return x(this,void 0,void 0,function*(){return yield this.abort(t),lt})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),lt})}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(lt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var xr=class extends Oo{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Rs(this.toUint8Array(!0)):this.toUint8Array(!1).then(Rs)}toUint8Array(t=!1){return t?be(this._values)[0]:(()=>x(this,void 0,void 0,function*(){var r,i,s,n;let o=[],a=0;try{for(var h=!0,l=je(this),c;c=yield l.next(),r=c.done,!r;h=!0){n=c.value,h=!1;let u=n;o.push(u),a+=u.byteLength}}catch(u){i={error:u}}finally{try{!h&&!r&&(s=l.return)&&(yield s.call(l))}finally{if(i)throw i.error}}return be(o,a)[0]}))()}},Mr=class{constructor(t){t&&(this.source=new wh(Lt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},fe=class{constructor(t){t instanceof fe?this.source=t.source:t instanceof xr?this.source=new Nr(Lt.fromAsyncIterable(t)):Xn(t)?this.source=new Nr(Lt.fromNodeStream(t)):Us(t)?this.source=new Nr(Lt.fromDOMStream(t)):Yn(t)?this.source=new Nr(Lt.fromDOMStream(t.body)):Ve(t)?this.source=new Nr(Lt.fromIterable(t)):ke(t)?this.source=new Nr(Lt.fromAsyncIterable(t)):Ae(t)&&(this.source=new Nr(Lt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},wh=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||lt)}return(t){return Object.create(this.source.return&&this.source.return(t)||lt)}},Nr=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return x(this,arguments,void 0,function*(r,i="read"){return yield this.source.next({cmd:i,size:r})})}throw(t){return x(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return x(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Js=class extends Mr{constructor(t,r){super(),this.position=0,this.buffer=N(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:i,position:s}=this;return r&&s<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,s+Math.min(i-s,t)),r.subarray(s,this.position)):null}readAt(t,r){let i=this.buffer,s=Math.min(this.size,t+r);return i?i.subarray(t,s):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Zr=class extends fe{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=(()=>x(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return x(this,void 0,void 0,function*(){let{buffer:r,byteOffset:i}=yield this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)})}seek(t){return x(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i,position:s}=this;if(r&&s<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let n=s,o=0,a=0,h=Math.min(i,n+Math.min(i-n,t)),l=new Uint8Array(Math.max(0,(this.position=h)-n));for(;(n+=a)<h&&(o+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,o,l.byteLength-o,n));return l}return null})}readAt(t,r){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:s}=this;if(i&&t+r<s){let n=Math.min(s,t+r),o=new Uint8Array(n-t);return(yield i.read(o,0,r,t)).buffer}return new Uint8Array(r)})}close(){return x(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Mh={};qr(Mh,{BaseInt64:()=>Xs,Int128:()=>de,Int64:()=>Ft,Uint64:()=>X});function ms(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var ys=8,xh=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Xs=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0<s?65536:0,this.buffer[1]+=n>>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ms(this.buffer[1])} ${ms(this.buffer[0])}`}},X=class extends Xs{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return X.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return X.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.length,s=new X(r);for(let n=0;n<i;){let o=ys<i-n?ys:i-n,a=new X(new Uint32Array([Number.parseInt(t.slice(n,n+o),10),0])),h=new X(new Uint32Array([xh[o],0]));s.times(h),s.plus(a),n+=o}return s}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)X.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new X(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new X(new Uint32Array(t.buffer)).plus(r)}},Ft=class extends Xs{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,i=t.buffer[1]<<0;return r<i||r===i&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return Ft.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return Ft.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.startsWith("-"),s=t.length,n=new Ft(r);for(let o=i?1:0;o<s;){let a=ys<s-o?ys:s-o,h=new Ft(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new Ft(new Uint32Array([xh[a],0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)Ft.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new Ft(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new Ft(new Uint32Array(t.buffer)).plus(r)}},de=class{constructor(t){this.buffer=t}high(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new X(new Uint32Array([this.buffer[3],0])),i=new X(new Uint32Array([this.buffer[2],0])),s=new X(new Uint32Array([this.buffer[1],0])),n=new X(new Uint32Array([this.buffer[0],0])),o=new X(new Uint32Array([t.buffer[3],0])),a=new X(new Uint32Array([t.buffer[2],0])),h=new X(new Uint32Array([t.buffer[1],0])),l=new X(new Uint32Array([t.buffer[0],0])),c=X.multiply(n,l);this.buffer[0]=c.low();let u=new X(new Uint32Array([c.high(),0]));return c=X.multiply(s,l),u.plus(c),c=X.multiply(n,h),u.plus(c),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(c)?1:0,this.buffer[2]=u.high(),new X(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(X.multiply(i,l)).plus(X.multiply(s,h)).plus(X.multiply(n,a)),this.buffer[3]+=X.multiply(r,l).plus(X.multiply(i,h)).plus(X.multiply(s,a)).plus(X.multiply(n,o)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${ms(this.buffer[3])} ${ms(this.buffer[2])} ${ms(this.buffer[1])} ${ms(this.buffer[0])}`}static multiply(t,r){return new de(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new de(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return de.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return de.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith("-"),s=t.length,n=new de(r);for(let o=i?1:0;o<s;){let a=ys<s-o?ys:s-o,h=new de(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new de(new Uint32Array([xh[a],0,0,0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*4);for(let i=-1,s=t.length;++i<s;)de.from(t[i],new Uint32Array(r.buffer,r.byteOffset+4*4*i,4));return r}};var Ks=class extends B{constructor(t,r,i,s,n=et.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=i,this.dictionaries=s,this.metadataVersion=n}visit(t){return super.visit(t instanceof P?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return U({type:t,length:r})}visitBool(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<et.V5&&this.readNullBitmap(t,i),t.mode===at.Sparse?this.visitSparseUnion(t,{length:r,nullCount:i}):this.visitDenseUnion(t,{length:r,nullCount:i})}visitDenseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,i=this.nextBufferRange()){return r>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},Eo=class extends Ks{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):_i(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return w.isTimestamp(t)?G(Uint8Array,Ft.convertArray(i[r])):(w.isInt(t)||w.isTime(t))&&t.bitWidth===64||w.isDuration(t)?G(Uint8Array,Ft.convertArray(i[r])):w.isDate(t)&&t.unit===ft.MILLISECOND?G(Uint8Array,Ft.convertArray(i[r])):w.isDecimal(t)?G(Uint8Array,de.convertArray(i[r])):w.isBinary(t)||w.isLargeBinary(t)||w.isFixedSizeBinary(t)?Hp(i[r]):w.isBool(t)?_i(i[r]):w.isUtf8(t)||w.isLargeUtf8(t)?or(i[r].join("")):G(Uint8Array,G(t.ArrayType,i[r].map(s=>+s)))}};function Hp(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i>>1]=Number.parseInt(t.slice(i,i+2),16);return r}var gs=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let h=a.length;s.set(a,n),i.set(o,h),n+=h}}};var _s=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let h=a.length;s.set(a,n),i.set(o,BigInt(h)),n+=h}}};var No=class extends ut{constructor(t){super(t),this._values=new ds}setValue(t,r){this._values.set(t,+r)}};var Mi=class extends Mt{};Mi.prototype._setValue=ih;var Zs=class extends Mi{};Zs.prototype._setValue=so;var Qs=class extends Mi{};Qs.prototype._setValue=no;var tn=class extends Mt{};tn.prototype._setValue=oh;var Fo=class extends ut{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new ce(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ir({type:this.type.indices,nullValues:r}),this.dictionary=Ir({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var en=class extends Mt{};en.prototype._setValue=rh;var Lo=class extends ut{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=r.length;++n<o;)i.set(s+n,r[n])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new he(this.type.listSize,new P(r,t.type,!0)),i}};var Ii=class extends Mt{setValue(t,r){this._values.set(t,r)}},Ro=class extends Ii{setValue(t,r){super.setValue(t,Gs(r))}},Uo=class extends Ii{},Co=class extends Ii{};var Si=class extends Mt{};Si.prototype._setValue=ah;var rn=class extends Si{};rn.prototype._setValue=mo;var sn=class extends Si{};sn.prototype._setValue=yo;var Fr=class extends Mt{};Fr.prototype._setValue=hh;var nn=class extends Fr{};nn.prototype._setValue=go;var on=class extends Fr{};on.prototype._setValue=_o;var an=class extends Fr{};an.prototype._setValue=bo;var hn=class extends Fr{};hn.prototype._setValue=vo;var Re=class extends Mt{setValue(t,r){this._values.set(t,r)}},Po=class extends Re{},zo=class extends Re{},jo=class extends Re{},ko=class extends Re{},Vo=class extends Re{},Go=class extends Re{},Wo=class extends Re{},Ho=class extends Re{};var qo=class extends ue{constructor(t){super(t),this._offsets=new ps(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ae(new P(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>"u")r.set(s,0);else{let o=n,a=o.length,h=r.set(s,a).buffer[s];for(let l=-1;++l<a;)i.set(h+l,o[l])}}};var $o=class extends ue{set(t,r){return super.set(t,r)}setValue(t,r){let i=r instanceof Map?r:new Map(Object.entries(r)),s=this._pending||(this._pending=new Map),n=s.get(t);n&&(this._pendingLength-=n.size),this._pendingLength+=i.size,s.set(t,i)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new le(new P(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:a}=r.set(s,n.size).buffer;for(let h of n.entries())if(i.set(o,h),++o>=a)break}}};var Yo=class extends ut{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var Jo=class extends ut{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new Q([...this.type.children,new P(r,t.type,!0)]),i}};var Lr=class extends Mt{};Lr.prototype._setValue=sh;var ln=class extends Lr{};ln.prototype._setValue=oo;var cn=class extends Lr{};cn.prototype._setValue=ao;var un=class extends Lr{};un.prototype._setValue=ho;var fn=class extends Lr{};fn.prototype._setValue=lo;var Rr=class extends Mt{};Rr.prototype._setValue=nh;var dn=class extends Rr{};dn.prototype._setValue=co;var pn=class extends Rr{};pn.prototype._setValue=uo;var mn=class extends Rr{};mn.prototype._setValue=fo;var yn=class extends Rr{};yn.prototype._setValue=po;var bs=class extends ut{constructor(t){super(t),this._typeIds=new Or(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,a=[...s,new P(r,t.type)];return this.type=new Le(n,[...o,i],a),i}_valueToChildTypeId(t,r,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Xo=class extends bs{},Ko=class extends bs{constructor(t){super(t),this._offsets=new Or(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r)}};var gn=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};gn.prototype._flushPending=gs.prototype._flushPending;var _n=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};_n.prototype._flushPending=_s.prototype._flushPending;var Ih=class extends B{visitNull(){return Yo}visitBool(){return No}visitInt(){return Re}visitInt8(){return Po}visitInt16(){return zo}visitInt32(){return jo}visitInt64(){return ko}visitUint8(){return Vo}visitUint16(){return Go}visitUint32(){return Wo}visitUint64(){return Ho}visitFloat(){return Ii}visitFloat16(){return Ro}visitFloat32(){return Uo}visitFloat64(){return Co}visitUtf8(){return gn}visitLargeUtf8(){return _n}visitBinary(){return gs}visitLargeBinary(){return _s}visitFixedSizeBinary(){return en}visitDate(){return Mi}visitDateDay(){return Zs}visitDateMillisecond(){return Qs}visitTimestamp(){return Lr}visitTimestampSecond(){return ln}visitTimestampMillisecond(){return cn}visitTimestampMicrosecond(){return un}visitTimestampNanosecond(){return fn}visitTime(){return Rr}visitTimeSecond(){return dn}visitTimeMillisecond(){return pn}visitTimeMicrosecond(){return mn}visitTimeNanosecond(){return yn}visitDecimal(){return tn}visitList(){return qo}visitStruct(){return Jo}visitUnion(){return bs}visitDenseUnion(){return Ko}visitSparseUnion(){return Xo}visitDictionary(){return Fo}visitInterval(){return Si}visitIntervalDayTime(){return rn}visitIntervalYearMonth(){return sn}visitDuration(){return Fr}visitDurationSecond(){return nn}visitDurationMillisecond(){return on}visitDurationMicrosecond(){return an}visitDurationNanosecond(){return hn}visitFixedSizeList(){return Lo}visitMap(){return $o}},Lc=new Ih;var O=class extends B{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function $t(e,t){return t instanceof e.constructor}function Bi(e,t){return e===t||$t(e,t)}function Ur(e,t){return e===t||$t(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Zo(e,t){return e===t||$t(e,t)&&e.precision===t.precision}function qp(e,t){return e===t||$t(e,t)&&e.byteWidth===t.byteWidth}function Sh(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function bn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function vn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function $p(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Yp(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Bh(e,t){return e===t||$t(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&Sr.compareManyFields(e.children,t.children)}function Jp(e,t){return e===t||$t(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Sr.visit(e.indices,t.indices)&&Sr.visit(e.dictionary,t.dictionary)}function Ah(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function wn(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function Xp(e,t){return e===t||$t(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Kp(e,t){return e===t||$t(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}O.prototype.visitNull=Bi;O.prototype.visitBool=Bi;O.prototype.visitInt=Ur;O.prototype.visitInt8=Ur;O.prototype.visitInt16=Ur;O.prototype.visitInt32=Ur;O.prototype.visitInt64=Ur;O.prototype.visitUint8=Ur;O.prototype.visitUint16=Ur;O.prototype.visitUint32=Ur;O.prototype.visitUint64=Ur;O.prototype.visitFloat=Zo;O.prototype.visitFloat16=Zo;O.prototype.visitFloat32=Zo;O.prototype.visitFloat64=Zo;O.prototype.visitUtf8=Bi;O.prototype.visitLargeUtf8=Bi;O.prototype.visitBinary=Bi;O.prototype.visitLargeBinary=Bi;O.prototype.visitFixedSizeBinary=qp;O.prototype.visitDate=Sh;O.prototype.visitDateDay=Sh;O.prototype.visitDateMillisecond=Sh;O.prototype.visitTimestamp=bn;O.prototype.visitTimestampSecond=bn;O.prototype.visitTimestampMillisecond=bn;O.prototype.visitTimestampMicrosecond=bn;O.prototype.visitTimestampNanosecond=bn;O.prototype.visitTime=vn;O.prototype.visitTimeSecond=vn;O.prototype.visitTimeMillisecond=vn;O.prototype.visitTimeMicrosecond=vn;O.prototype.visitTimeNanosecond=vn;O.prototype.visitDecimal=Bi;O.prototype.visitList=$p;O.prototype.visitStruct=Yp;O.prototype.visitUnion=Bh;O.prototype.visitDenseUnion=Bh;O.prototype.visitSparseUnion=Bh;O.prototype.visitDictionary=Jp;O.prototype.visitInterval=Ah;O.prototype.visitIntervalDayTime=Ah;O.prototype.visitIntervalYearMonth=Ah;O.prototype.visitDuration=wn;O.prototype.visitDurationSecond=wn;O.prototype.visitDurationMillisecond=wn;O.prototype.visitDurationMicrosecond=wn;O.prototype.visitDurationNanosecond=wn;O.prototype.visitFixedSizeList=Xp;O.prototype.visitMap=Kp;var Sr=new O;function Ai(e,t){return Sr.compareSchemas(e,t)}function Rc(e,t){return Sr.compareFields(e,t)}function Uc(e,t){return Sr.visit(e,t)}function Ir(e){let t=e.type,r=new(Lc.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,a)=>i[a]||s:({name:o})=>i[o]||s;for(let[o,a]of t.children.entries()){let{type:h}=a,l=n(a,o);r.children.push(Ir(Object.assign(Object.assign({},l),{type:h})))}}return r}function Qo(e,t){return Zp(e,t.map(r=>r.data.concat()))}function Zp(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((u,d)=>Math.max(u,d.length),0)},n=0,o=0,a=-1,h=t.length,l,c=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<h;)c[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(c=Qp(r,o,c,t,s),o>0&&(i[n++]=U({type:new Q(r),length:o,nullCount:0,children:c.slice()})))}return[e=e.assign(r),i.map(u=>new rt(e,u))]}function Qp(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let a=-1,h=i.length;++a<h;){let l=r[a],c=l?.length;if(c>=t)c===t?r[a]=l:(r[a]=l.slice(0,t),s.numBatches=Math.max(s.numBatches,i[a].unshift(l.slice(t,c-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(n=l?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:U({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var Cc,dt=class{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new W([]),this._offsets=[0],this;let s,n;t[0]instanceof W&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=h=>{if(h){if(h instanceof rt)return[h];if(h instanceof dt)return h.batches;if(h instanceof q){if(h.type instanceof Q)return[new rt(new W(h.type.children),h)]}else{if(Array.isArray(h))return h.flatMap(l=>o(l));if(typeof h[Symbol.iterator]=="function")return[...h].flatMap(l=>o(l));if(typeof h=="object"){let l=Object.keys(h),c=l.map(p=>new j([h[p]])),u=s??new W(l.map((p,m)=>new P(String(p),c[m].type,c[m].nullable))),[,d]=Qo(u,c);return d.length===0?[new rt(h)]:d}}}return[]},a=t.flatMap(h=>o(h));if(s=(i=s??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new W([]),!(s instanceof W))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let h of a){if(!(h instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Ai(s,h.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=n??So(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Io(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(mi(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?us.visit(new j(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
13
+ return true;`)}function Hp(e){return typeof e!="bigint"?$e(e):`${$e(e)}n`}function _h(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function Rc(e,t=0){return e.length>=t?e.subarray(0,t):Ps(new e.constructor(t),e,0)}var Xe=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?_h(i*1,this.BYTES_PER_ELEMENT):_h(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=_h(t*this.stride,this.BYTES_PER_ELEMENT);let r=Rc(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Rc(this.buffer,t)}},Er=class extends Xe{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ps=class extends Er{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<<n,++this.numValid):o===1&&(i[s]&=~(1<<n),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ms=class extends Er{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let i=this.length-1,s=this.reserve(t-i+1).buffer;return i<t++&&i>=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ut=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ie(t),this._nulls=new ps,r&&r.length>0&&(this._isValid=Lc(r))}toVector(){return new j([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((a,h)=>a+h.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:a,_typeIds:h,_offsets:l,_values:c,_nulls:u}=this;(r=h?.flush(o))?s=l?.flush(o):(s=l?.flush(o))?t=c?.flush(l.last()):t=c?.flush(o),a>0&&(i=u?.flush(o));let d=this.children.map(p=>p.flush());return this.clear(),U({type:n,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};ut.prototype.length=1;ut.prototype.stride=1;ut.prototype.children=null;ut.prototype.finished=!1;ut.prototype.nullValues=null;ut.prototype._isValid=()=>!0;var Mt=class extends ut{constructor(t){super(t),this._values=new Er(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},ue=class extends ut{constructor(t){super(t),this._pendingLength=0,this._offsets=new ms(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof wr?r[Kr].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var xi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new Vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new xi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new xi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var W=class{constructor(t=[],r,i,s=et.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=vh(this.fields)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new W(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new W(r,this.metadata)}assign(...t){let r=t[0]instanceof W?t[0]:Array.isArray(t[0])?new W(t[0]):new W(t),i=[...this.fields],s=Oo(Oo(new Map,this.metadata),r.metadata),n=r.fields.filter(a=>{let h=i.findIndex(l=>l.name===a.name);return~h?(i[h]=a.clone({metadata:Oo(Oo(new Map,i[h].metadata),a.metadata)}))&&!1:!0}),o=vh(n,new Map);return new W([...i,...n],s,new Map([...this.dictionaries,...o]))}};W.prototype.fields=null;W.prototype.metadata=null;W.prototype.dictionaries=null;var P=class{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new P(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],P.new(r,i,s,n)}};P.prototype.type=null;P.prototype.name=null;P.prototype.nullable=null;P.prototype.metadata=null;function Oo(e,t){return new Map([...e||new Map,...t||new Map])}function vh(e,t=new Map){for(let r=-1,i=e.length;++r<i;){let n=e[r].type;if(w.isDictionary(n)){if(!t.has(n.id))t.set(n.id,n.dictionary);else if(t.get(n.id)!==n.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}n.children&&n.children.length>0&&vh(n.children,t)}return t}var qp=Tr,$p=Wt,Nr=class{static decode(t){t=new $p(N(t));let r=Vt.getRootAsFooter(t),i=W.decode(r.schema(),new Map,r.version());return new wh(i,r)}static encode(t){let r=new qp,i=W.encode(r,t.schema);Vt.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ke.encode(r,o);let s=r.endVector();Vt.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ke.encode(r,o);let n=r.endVector();return Vt.startFooter(r),Vt.addSchema(r,i),Vt.addVersion(r,et.V5),Vt.addRecordBatches(r,s),Vt.addDictionaries(r,n),Vt.finishFooterBuffer(r,Vt.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=et.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r<i;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,i=this.numDictionaries;++r<i;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var wh=class extends Nr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ke.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ke.decode(r)}return null}},Ke=class{static decode(t){return new Ke(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:i}=r,s=BigInt(r.offset),n=BigInt(r.bodyLength);return xi.createBlock(t,s,i,n)}constructor(t,r,i){this.metaDataLength=t,this.offset=Y(i),this.bodyLength=Y(r)}};var lt=Object.freeze({done:!0,value:void 0}),Js=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Mi=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Eo=class extends Mi{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(lt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return x(this,void 0,void 0,function*(){return yield this.abort(t),lt})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),lt})}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(lt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var xr=class extends Eo{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Us(this.toUint8Array(!0)):this.toUint8Array(!1).then(Us)}toUint8Array(t=!1){return t?_e(this._values)[0]:(()=>x(this,void 0,void 0,function*(){var r,i,s,n;let o=[],a=0;try{for(var h=!0,l=je(this),c;c=yield l.next(),r=c.done,!r;h=!0){n=c.value,h=!1;let u=n;o.push(u),a+=u.byteLength}}catch(u){i={error:u}}finally{try{!h&&!r&&(s=l.return)&&(yield s.call(l))}finally{if(i)throw i.error}}return _e(o,a)[0]}))()}},Mr=class{constructor(t){t&&(this.source=new xh(Lt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},fe=class{constructor(t){t instanceof fe?this.source=t.source:t instanceof xr?this.source=new Fr(Lt.fromAsyncIterable(t)):Kn(t)?this.source=new Fr(Lt.fromNodeStream(t)):Cs(t)?this.source=new Fr(Lt.fromDOMStream(t)):Jn(t)?this.source=new Fr(Lt.fromDOMStream(t.body)):ke(t)?this.source=new Fr(Lt.fromIterable(t)):Ve(t)?this.source=new Fr(Lt.fromAsyncIterable(t)):Ae(t)&&(this.source=new Fr(Lt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xh=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||lt)}return(t){return Object.create(this.source.return&&this.source.return(t)||lt)}},Fr=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return x(this,arguments,void 0,function*(r,i="read"){return yield this.source.next({cmd:i,size:r})})}throw(t){return x(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return x(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Xs=class extends Mr{constructor(t,r){super(),this.position=0,this.buffer=N(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:i,position:s}=this;return r&&s<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,s+Math.min(i-s,t)),r.subarray(s,this.position)):null}readAt(t,r){let i=this.buffer,s=Math.min(this.size,t+r);return i?i.subarray(t,s):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Qr=class extends fe{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=(()=>x(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return x(this,void 0,void 0,function*(){let{buffer:r,byteOffset:i}=yield this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)})}seek(t){return x(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i,position:s}=this;if(r&&s<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let n=s,o=0,a=0,h=Math.min(i,n+Math.min(i-n,t)),l=new Uint8Array(Math.max(0,(this.position=h)-n));for(;(n+=a)<h&&(o+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,o,l.byteLength-o,n));return l}return null})}readAt(t,r){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:s}=this;if(i&&t+r<s){let n=Math.min(s,t+r),o=new Uint8Array(n-t);return(yield i.read(o,0,r,t)).buffer}return new Uint8Array(r)})}close(){return x(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ih={};$r(Ih,{BaseInt64:()=>Ks,Int128:()=>de,Int64:()=>Ft,Uint64:()=>X});function ys(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var gs=8,Mh=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ks=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0<s?65536:0,this.buffer[1]+=n>>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ys(this.buffer[1])} ${ys(this.buffer[0])}`}},X=class extends Ks{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return X.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return X.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.length,s=new X(r);for(let n=0;n<i;){let o=gs<i-n?gs:i-n,a=new X(new Uint32Array([Number.parseInt(t.slice(n,n+o),10),0])),h=new X(new Uint32Array([Mh[o],0]));s.times(h),s.plus(a),n+=o}return s}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)X.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new X(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new X(new Uint32Array(t.buffer)).plus(r)}},Ft=class extends Ks{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,i=t.buffer[1]<<0;return r<i||r===i&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return Ft.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return Ft.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.startsWith("-"),s=t.length,n=new Ft(r);for(let o=i?1:0;o<s;){let a=gs<s-o?gs:s-o,h=new Ft(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new Ft(new Uint32Array([Mh[a],0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)Ft.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new Ft(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new Ft(new Uint32Array(t.buffer)).plus(r)}},de=class{constructor(t){this.buffer=t}high(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new X(new Uint32Array([this.buffer[3],0])),i=new X(new Uint32Array([this.buffer[2],0])),s=new X(new Uint32Array([this.buffer[1],0])),n=new X(new Uint32Array([this.buffer[0],0])),o=new X(new Uint32Array([t.buffer[3],0])),a=new X(new Uint32Array([t.buffer[2],0])),h=new X(new Uint32Array([t.buffer[1],0])),l=new X(new Uint32Array([t.buffer[0],0])),c=X.multiply(n,l);this.buffer[0]=c.low();let u=new X(new Uint32Array([c.high(),0]));return c=X.multiply(s,l),u.plus(c),c=X.multiply(n,h),u.plus(c),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(c)?1:0,this.buffer[2]=u.high(),new X(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(X.multiply(i,l)).plus(X.multiply(s,h)).plus(X.multiply(n,a)),this.buffer[3]+=X.multiply(r,l).plus(X.multiply(i,h)).plus(X.multiply(s,a)).plus(X.multiply(n,o)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${ys(this.buffer[3])} ${ys(this.buffer[2])} ${ys(this.buffer[1])} ${ys(this.buffer[0])}`}static multiply(t,r){return new de(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new de(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return de.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return de.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith("-"),s=t.length,n=new de(r);for(let o=i?1:0;o<s;){let a=gs<s-o?gs:s-o,h=new de(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new de(new Uint32Array([Mh[a],0,0,0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*4);for(let i=-1,s=t.length;++i<s;)de.from(t[i],new Uint32Array(r.buffer,r.byteOffset+4*4*i,4));return r}};var Zs=class extends B{constructor(t,r,i,s,n=et.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=i,this.dictionaries=s,this.metadataVersion=n}visit(t){return super.visit(t instanceof P?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return U({type:t,length:r})}visitBool(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<et.V5&&this.readNullBitmap(t,i),t.mode===at.Sparse?this.visitSparseUnion(t,{length:r,nullCount:i}):this.visitDenseUnion(t,{length:r,nullCount:i})}visitDenseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,i=this.nextBufferRange()){return r>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},No=class extends Zs{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):_i(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return w.isTimestamp(t)?G(Uint8Array,Ft.convertArray(i[r])):(w.isInt(t)||w.isTime(t))&&t.bitWidth===64||w.isDuration(t)?G(Uint8Array,Ft.convertArray(i[r])):w.isDate(t)&&t.unit===ft.MILLISECOND?G(Uint8Array,Ft.convertArray(i[r])):w.isDecimal(t)?G(Uint8Array,de.convertArray(i[r])):w.isBinary(t)||w.isLargeBinary(t)||w.isFixedSizeBinary(t)?Yp(i[r]):w.isBool(t)?_i(i[r]):w.isUtf8(t)||w.isLargeUtf8(t)?or(i[r].join("")):G(Uint8Array,G(t.ArrayType,i[r].map(s=>+s)))}};function Yp(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i>>1]=Number.parseInt(t.slice(i,i+2),16);return r}var bs=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let h=a.length;s.set(a,n),i.set(o,h),n+=h}}};var _s=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let h=a.length;s.set(a,n),i.set(o,BigInt(h)),n+=h}}};var Fo=class extends ut{constructor(t){super(t),this._values=new ps}setValue(t,r){this._values.set(t,+r)}};var Ii=class extends Mt{};Ii.prototype._setValue=sh;var Qs=class extends Ii{};Qs.prototype._setValue=no;var tn=class extends Ii{};tn.prototype._setValue=oo;var en=class extends Mt{};en.prototype._setValue=ah;var Lo=class extends ut{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new ce(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ir({type:this.type.indices,nullValues:r}),this.dictionary=Ir({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var rn=class extends Mt{};rn.prototype._setValue=ih;var Ro=class extends ut{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=r.length;++n<o;)i.set(s+n,r[n])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new he(this.type.listSize,new P(r,t.type,!0)),i}};var Si=class extends Mt{setValue(t,r){this._values.set(t,r)}},Uo=class extends Si{setValue(t,r){super.setValue(t,Ws(r))}},Co=class extends Si{},Po=class extends Si{};var Bi=class extends Mt{};Bi.prototype._setValue=hh;var sn=class extends Bi{};sn.prototype._setValue=yo;var nn=class extends Bi{};nn.prototype._setValue=go;var Lr=class extends Mt{};Lr.prototype._setValue=lh;var on=class extends Lr{};on.prototype._setValue=bo;var an=class extends Lr{};an.prototype._setValue=_o;var hn=class extends Lr{};hn.prototype._setValue=vo;var ln=class extends Lr{};ln.prototype._setValue=wo;var Re=class extends Mt{setValue(t,r){this._values.set(t,r)}},zo=class extends Re{},jo=class extends Re{},Vo=class extends Re{},ko=class extends Re{},Go=class extends Re{},Wo=class extends Re{},Ho=class extends Re{},qo=class extends Re{};var $o=class extends ue{constructor(t){super(t),this._offsets=new ms(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ae(new P(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>"u")r.set(s,0);else{let o=n,a=o.length,h=r.set(s,a).buffer[s];for(let l=-1;++l<a;)i.set(h+l,o[l])}}};var Yo=class extends ue{set(t,r){return super.set(t,r)}setValue(t,r){let i=r instanceof Map?r:new Map(Object.entries(r)),s=this._pending||(this._pending=new Map),n=s.get(t);n&&(this._pendingLength-=n.size),this._pendingLength+=i.size,s.set(t,i)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new le(new P(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:a}=r.set(s,n.size).buffer;for(let h of n.entries())if(i.set(o,h),++o>=a)break}}};var Jo=class extends ut{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var Xo=class extends ut{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new Q([...this.type.children,new P(r,t.type,!0)]),i}};var Rr=class extends Mt{};Rr.prototype._setValue=nh;var cn=class extends Rr{};cn.prototype._setValue=ao;var un=class extends Rr{};un.prototype._setValue=ho;var fn=class extends Rr{};fn.prototype._setValue=lo;var dn=class extends Rr{};dn.prototype._setValue=co;var Ur=class extends Mt{};Ur.prototype._setValue=oh;var pn=class extends Ur{};pn.prototype._setValue=uo;var mn=class extends Ur{};mn.prototype._setValue=fo;var yn=class extends Ur{};yn.prototype._setValue=po;var gn=class extends Ur{};gn.prototype._setValue=mo;var vs=class extends ut{constructor(t){super(t),this._typeIds=new Er(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,a=[...s,new P(r,t.type)];return this.type=new Le(n,[...o,i],a),i}_valueToChildTypeId(t,r,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ko=class extends vs{},Zo=class extends vs{constructor(t){super(t),this._offsets=new Er(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r)}};var bn=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};bn.prototype._flushPending=bs.prototype._flushPending;var _n=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};_n.prototype._flushPending=_s.prototype._flushPending;var Sh=class extends B{visitNull(){return Jo}visitBool(){return Fo}visitInt(){return Re}visitInt8(){return zo}visitInt16(){return jo}visitInt32(){return Vo}visitInt64(){return ko}visitUint8(){return Go}visitUint16(){return Wo}visitUint32(){return Ho}visitUint64(){return qo}visitFloat(){return Si}visitFloat16(){return Uo}visitFloat32(){return Co}visitFloat64(){return Po}visitUtf8(){return bn}visitLargeUtf8(){return _n}visitBinary(){return bs}visitLargeBinary(){return _s}visitFixedSizeBinary(){return rn}visitDate(){return Ii}visitDateDay(){return Qs}visitDateMillisecond(){return tn}visitTimestamp(){return Rr}visitTimestampSecond(){return cn}visitTimestampMillisecond(){return un}visitTimestampMicrosecond(){return fn}visitTimestampNanosecond(){return dn}visitTime(){return Ur}visitTimeSecond(){return pn}visitTimeMillisecond(){return mn}visitTimeMicrosecond(){return yn}visitTimeNanosecond(){return gn}visitDecimal(){return en}visitList(){return $o}visitStruct(){return Xo}visitUnion(){return vs}visitDenseUnion(){return Zo}visitSparseUnion(){return Ko}visitDictionary(){return Lo}visitInterval(){return Bi}visitIntervalDayTime(){return sn}visitIntervalYearMonth(){return nn}visitDuration(){return Lr}visitDurationSecond(){return on}visitDurationMillisecond(){return an}visitDurationMicrosecond(){return hn}visitDurationNanosecond(){return ln}visitFixedSizeList(){return Ro}visitMap(){return Yo}},Uc=new Sh;var O=class extends B{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function $t(e,t){return t instanceof e.constructor}function Ai(e,t){return e===t||$t(e,t)}function Cr(e,t){return e===t||$t(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Qo(e,t){return e===t||$t(e,t)&&e.precision===t.precision}function Jp(e,t){return e===t||$t(e,t)&&e.byteWidth===t.byteWidth}function Bh(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function vn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function wn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Xp(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Kp(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Ah(e,t){return e===t||$t(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&Sr.compareManyFields(e.children,t.children)}function Zp(e,t){return e===t||$t(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Sr.visit(e.indices,t.indices)&&Sr.visit(e.dictionary,t.dictionary)}function Dh(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function xn(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function Qp(e,t){return e===t||$t(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function tm(e,t){return e===t||$t(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}O.prototype.visitNull=Ai;O.prototype.visitBool=Ai;O.prototype.visitInt=Cr;O.prototype.visitInt8=Cr;O.prototype.visitInt16=Cr;O.prototype.visitInt32=Cr;O.prototype.visitInt64=Cr;O.prototype.visitUint8=Cr;O.prototype.visitUint16=Cr;O.prototype.visitUint32=Cr;O.prototype.visitUint64=Cr;O.prototype.visitFloat=Qo;O.prototype.visitFloat16=Qo;O.prototype.visitFloat32=Qo;O.prototype.visitFloat64=Qo;O.prototype.visitUtf8=Ai;O.prototype.visitLargeUtf8=Ai;O.prototype.visitBinary=Ai;O.prototype.visitLargeBinary=Ai;O.prototype.visitFixedSizeBinary=Jp;O.prototype.visitDate=Bh;O.prototype.visitDateDay=Bh;O.prototype.visitDateMillisecond=Bh;O.prototype.visitTimestamp=vn;O.prototype.visitTimestampSecond=vn;O.prototype.visitTimestampMillisecond=vn;O.prototype.visitTimestampMicrosecond=vn;O.prototype.visitTimestampNanosecond=vn;O.prototype.visitTime=wn;O.prototype.visitTimeSecond=wn;O.prototype.visitTimeMillisecond=wn;O.prototype.visitTimeMicrosecond=wn;O.prototype.visitTimeNanosecond=wn;O.prototype.visitDecimal=Ai;O.prototype.visitList=Xp;O.prototype.visitStruct=Kp;O.prototype.visitUnion=Ah;O.prototype.visitDenseUnion=Ah;O.prototype.visitSparseUnion=Ah;O.prototype.visitDictionary=Zp;O.prototype.visitInterval=Dh;O.prototype.visitIntervalDayTime=Dh;O.prototype.visitIntervalYearMonth=Dh;O.prototype.visitDuration=xn;O.prototype.visitDurationSecond=xn;O.prototype.visitDurationMillisecond=xn;O.prototype.visitDurationMicrosecond=xn;O.prototype.visitDurationNanosecond=xn;O.prototype.visitFixedSizeList=Qp;O.prototype.visitMap=tm;var Sr=new O;function Di(e,t){return Sr.compareSchemas(e,t)}function Cc(e,t){return Sr.compareFields(e,t)}function Pc(e,t){return Sr.visit(e,t)}function Ir(e){let t=e.type,r=new(Uc.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,a)=>i[a]||s:({name:o})=>i[o]||s;for(let[o,a]of t.children.entries()){let{type:h}=a,l=n(a,o);r.children.push(Ir(Object.assign(Object.assign({},l),{type:h})))}}return r}function ta(e,t){return em(e,t.map(r=>r.data.concat()))}function em(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((u,d)=>Math.max(u,d.length),0)},n=0,o=0,a=-1,h=t.length,l,c=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<h;)c[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(c=rm(r,o,c,t,s),o>0&&(i[n++]=U({type:new Q(r),length:o,nullCount:0,children:c.slice()})))}return[e=e.assign(r),i.map(u=>new rt(e,u))]}function rm(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let a=-1,h=i.length;++a<h;){let l=r[a],c=l?.length;if(c>=t)c===t?r[a]=l:(r[a]=l.slice(0,t),s.numBatches=Math.max(s.numBatches,i[a].unshift(l.slice(t,c-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(n=l?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:U({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var zc,dt=class{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new W([]),this._offsets=[0],this;let s,n;t[0]instanceof W&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=h=>{if(h){if(h instanceof rt)return[h];if(h instanceof dt)return h.batches;if(h instanceof q){if(h.type instanceof Q)return[new rt(new W(h.type.children),h)]}else{if(Array.isArray(h))return h.flatMap(l=>o(l));if(typeof h[Symbol.iterator]=="function")return[...h].flatMap(l=>o(l));if(typeof h=="object"){let l=Object.keys(h),c=l.map(p=>new j([h[p]])),u=s??new W(l.map((p,m)=>new P(String(p),c[m].type,c[m].nullable))),[,d]=ta(u,c);return d.length===0?[new rt(h)]:d}}}return[]},a=t.flatMap(h=>o(h));if(s=(i=s??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new W([]),!(s instanceof W))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let h of a){if(!(h instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Di(s,h.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=n??Bo(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=So(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(yi(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?fs.visit(new j(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
14
14
  ${this.toArray().join(`,
15
15
  `)}
16
- ]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new dt(r,i.map(s=>new rt(r,s)))}slice(t,r){let i=this.schema;[t,r]=Ws({length:this.numRows},t,r);let s=Bo(this.data,this._offsets,t,r);return new dt(i,s.map(n=>new rt(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(i=>i.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=U({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new j(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=n[t].clone({type:r.type}),a=this.schema.fields.map((h,l)=>this.getChildAt(l));[n[t],a[t]]=[o,r],[i,s]=Qo(i,a)}return new dt(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new dt(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((a,h,l)=>{let[c,u]=a,d=r.findIndex(p=>p.name===h.name);return~d?u[d]=l:c.push(l),a},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((a,h)=>[h,s[h]]).map(([a,h])=>h===void 0?this.getChildAt(a):t.getChildAt(h)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new dt(...Qo(n,o))}};Cc=Symbol.toStringTag;dt[Cc]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=cs($s),e.get=cs(xt.getVisitFn(f.Struct)),e.set=Ao(Rt.getVisitFn(f.Struct)),e.indexOf=Do(vi.getVisitFn(f.Struct)),"Table"))(dt.prototype);var zc,rt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof W))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=U({nullCount:0,type:new Q(this.schema.fields),children:this.schema.fields.map(r=>U({type:r.type,nullCount:0}))})]=t,!(this.data instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Pc(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((h,l,c)=>(h.children[c]=r[l],h.length=Math.max(h.length,r[l].length),h.fields[c]=P.new({name:l,type:r[l].type,nullable:!0}),h),{length:0,fields:new Array,children:new Array}),o=new W(i),a=U({type:new Q(i),length:n,children:s,nullCount:0});[this.schema,this.data]=Pc(o,a.children,n);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=jc(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return xt.visit(this.data,t)}at(t){return this.get(mi(t,this.numRows))}set(t,r){return Rt.visit(this.data,t,r)}indexOf(t,r){return vi.visit(this.data,t,r)}[Symbol.iterator](){return us.visit(new j([this.data]))}toArray(){return[...this]}concat(...t){return new dt(this.schema,[this,...t])}slice(t,r){let[i]=new j([this.data]).slice(t,r).data;return new rt(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new j([this.data.children[t]]):null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=s.children.slice(),a=n[t].clone({type:r.type});[n[t],o[t]]=[a,r.data[0]],i=new W(n,new Map(this.schema.metadata)),s=U({type:new Q(n),children:o})}return new rt(i,s)}select(t){let r=this.schema.select(t),i=new Q(r.fields),s=[];for(let n of t){let o=this.schema.fields.findIndex(a=>a.name===n);~o&&(s[o]=this.data.children[o])}return new rt(r,U({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=U({type:new Q(r.fields),length:this.numRows,children:i});return new rt(r,s)}};zc=Symbol.toStringTag;rt[zc]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(rt.prototype);function Pc(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[a,h]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(s[a]=h.clone({nullable:!0}),n[a]=(i=l?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:U({type:h.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),U({type:new Q(s),length:r,children:n})]}function jc(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++n<o;){let{type:a}=e[n],h=t[n];for(let l of[h,...((s=h?.dictionary)===null||s===void 0?void 0:s.data)||[]])jc(a.children,l?.children,r);if(w.isDictionary(a)){let{id:l}=a;if(!r.has(l))h?.dictionary&&r.set(l,h.dictionary);else if(r.get(l)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Di=class extends rt{constructor(t){let r=t.fields.map(s=>U({type:s.type})),i=U({type:new Q(t.fields),nullCount:0,children:r});super(t,i)}};var vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,H.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return vt.startMessage(t),vt.addVersion(t,r),vt.addHeaderType(t,i),vt.addHeader(t,s),vt.addBodyLength(t,n),vt.addCustomMetadata(t,o),vt.endMessage(t)}};var Dh=class extends B{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return pr.startNull(r),pr.endNull(r)}visitInt(t,r){return Tt.startInt(r),Tt.addBitWidth(r,t.bitWidth),Tt.addIsSigned(r,t.isSigned),Tt.endInt(r)}visitFloat(t,r){return ie.startFloatingPoint(r),ie.addPrecision(r,t.precision),ie.endFloatingPoint(r)}visitBinary(t,r){return lr.startBinary(r),lr.endBinary(r)}visitLargeBinary(t,r){return ur.startLargeBinary(r),ur.endLargeBinary(r)}visitBool(t,r){return cr.startBool(r),cr.endBool(r)}visitUtf8(t,r){return yr.startUtf8(r),yr.endUtf8(r)}visitLargeUtf8(t,r){return fr.startLargeUtf8(r),fr.endLargeUtf8(r)}visitDecimal(t,r){return Ot.startDecimal(r),Ot.addScale(r,t.scale),Ot.addPrecision(r,t.precision),Ot.addBitWidth(r,t.bitWidth),Ot.endDecimal(r)}visitDate(t,r){return Qt.startDate(r),Qt.addUnit(r,t.unit),Qt.endDate(r)}visitTime(t,r){return zt.startTime(r),zt.addUnit(r,t.unit),zt.addBitWidth(r,t.bitWidth),zt.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return jt.startTimestamp(r),jt.addUnit(r,t.unit),i!==void 0&&jt.addTimezone(r,i),jt.endTimestamp(r)}visitInterval(t,r){return se.startInterval(r),se.addUnit(r,t.unit),se.endInterval(r)}visitDuration(t,r){return te.startDuration(r),te.addUnit(r,t.unit),te.endDuration(r)}visitList(t,r){return dr.startList(r),dr.endList(r)}visitStruct(t,r){return mr.startStruct_(r),mr.endStruct_(r)}visitUnion(t,r){Et.startTypeIdsVector(r,t.typeIds.length);let i=Et.createTypeIdsVector(r,t.typeIds);return Et.startUnion(r),Et.addMode(r,t.mode),Et.addTypeIds(r,i),Et.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return ve.startDictionaryEncoding(r),ve.addId(r,BigInt(t.id)),ve.addIsOrdered(r,t.isOrdered),i!==void 0&&ve.addIndexType(r,i),ve.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ee.startFixedSizeBinary(r),ee.addByteWidth(r,t.byteWidth),ee.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return re.startFixedSizeList(r),re.addListSize(r,t.listSize),re.endFixedSizeList(r)}visitMap(t,r){return ne.startMap(r),ne.addKeysSorted(r,t.keysSorted),ne.endMap(r)}},ta=new Dh;function Wc(e,t=new Map){return new W(em(e,t),ea(e.metadata),t)}function Th(e){return new Ut(e.count,qc(e.columns),$c(e.columns))}function Hc(e){return new me(Th(e.data),e.id,e.isDelta)}function em(e,t){return(e.fields||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function kc(e,t){return(e.children||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function qc(e){return(e||[]).reduce((t,r)=>[...t,new Ue(r.count,rm(r.VALIDITY)),...qc(r.children)],[])}function $c(e,t=[]){for(let r=-1,i=(e||[]).length;++r<i;){let s=e[r];s.VALIDITY&&t.push(new pe(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new pe(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new pe(t.length,s.OFFSET.length)),s.DATA&&t.push(new pe(t.length,s.DATA.length)),t=$c(s.children,t)}return t}function rm(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function Yc(e,t){let r,i,s,n,o,a;return!t||!(n=e.dictionary)?(o=Gc(e,kc(e,t)),s=new P(e.name,o,e.nullable,ea(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?Vc(i):new we,a=new ce(t.get(r),i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ea(e.metadata))):(i=(i=n.indexType)?Vc(i):new we,t.set(r,o=Gc(e,kc(e,t))),a=new ce(o,i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ea(e.metadata))),s||null}function ea(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function Vc(e){return new bt(e.isSigned,e.bitWidth)}function Gc(e,t){let r=e.type.name;switch(r){case"NONE":return new Nt;case"null":return new Nt;case"binary":return new Oe;case"largebinary":return new gr;case"utf8":return new Ee;case"largeutf8":return new _r;case"bool":return new Ne;case"list":return new ae((t||[])[0]);case"struct":return new Q(t||[]);case"struct_":return new Q(t||[])}switch(r){case"int":{let i=e.type;return new bt(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=e.type;return new oe(st[i.precision])}case"decimal":{let i=e.type;return new Fe(i.scale,i.precision,i.bitWidth)}case"date":{let i=e.type;return new xe(ft[i.unit])}case"time":{let i=e.type;return new Ht(M[i.unit],i.bitWidth)}case"timestamp":{let i=e.type;return new qt(M[i.unit],i.timezone)}case"interval":{let i=e.type;return new Me(_t[i.unit])}case"duration":{let i=e.type;return new br(M[i.unit])}case"union":{let i=e.type,[s,...n]=(i.mode+"").toLowerCase(),o=s.toUpperCase()+n.join("");return new Le(at[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=e.type;return new vr(i.byteWidth)}case"fixedsizelist":{let i=e.type;return new he(i.listSize,(t||[])[0])}case"map":{let i=e.type;return new le((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var im=Dr,sm=Wt,It=class{static fromJSON(t,r){let i=new It(0,et.V5,r);return i._createHeader=nm(t,r),i}static decode(t){t=new sm(N(t));let r=vt.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new It(i,s,n);return o._createHeader=om(r,n),o}static encode(t){let r=new im,i=-1;return t.isSchema()?i=W.encode(r,t.header()):t.isRecordBatch()?i=Ut.encode(r,t.header()):t.isDictionaryBatch()&&(i=me.encode(r,t.header())),vt.startMessage(r),vt.addVersion(r,et.V5),vt.addHeader(r,i),vt.addHeaderType(r,t.headerType),vt.addBodyLength(r,BigInt(t.bodyLength)),vt.finishMessageBuffer(r,vt.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof W)return new It(0,et.V5,H.Schema,t);if(t instanceof Ut)return new It(r,et.V5,H.RecordBatch,t);if(t instanceof me)return new It(r,et.V5,H.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===H.Schema}isRecordBatch(){return this.headerType===H.RecordBatch}isDictionaryBatch(){return this.headerType===H.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Y(t)}},Ut=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=Y(t)}},me=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(t,r,i=!1){this._data=t,this._isDelta=i,this._id=Y(r)}},pe=class{constructor(t,r){this.offset=Y(t),this.length=Y(r)}},Ue=class{constructor(t,r){this.length=Y(t),this.nullCount=Y(r)}};function nm(e,t){return()=>{switch(t){case H.Schema:return W.fromJSON(e);case H.RecordBatch:return Ut.fromJSON(e);case H.DictionaryBatch:return me.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}function om(e,t){return()=>{switch(t){case H.Schema:return W.decode(e.header(new pt),new Map,e.version());case H.RecordBatch:return Ut.decode(e.header(new Pt),e.version());case H.DictionaryBatch:return me.decode(e.header(new Te),e.version())}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}P.encode=gm;P.decode=mm;P.fromJSON=Yc;W.encode=ym;W.decode=am;W.fromJSON=Wc;Ut.encode=_m;Ut.decode=hm;Ut.fromJSON=Th;me.encode=bm;me.decode=lm;me.fromJSON=Hc;Ue.encode=vm;Ue.decode=um;pe.encode=wm;pe.decode=cm;function am(e,t=new Map,r=et.V5){let i=pm(e,t);return new W(i,ra(e),t,r)}function hm(e,t=et.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Ut(e.length(),fm(e),dm(e,t))}function lm(e,t=et.V5){return new me(Ut.decode(e.data(),t),e.id(),e.isDelta())}function cm(e){return new pe(e.offset(),e.length())}function um(e){return new Ue(e.length(),e.nullCount())}function fm(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++i<n;)(r=e.nodes(i))&&(t[++s]=Ue.decode(r));return t}function dm(e,t){let r=[];for(let i,s=-1,n=-1,o=e.buffersLength();++s<o;)(i=e.buffers(s))&&(t<et.V4&&(i.bb_pos+=8*(s+1)),r[++n]=pe.decode(i));return r}function pm(e,t){let r=[];for(let i,s=-1,n=-1,o=e.fieldsLength();++s<o;)(i=e.fields(s))&&(r[++n]=P.decode(i,t));return r}function Jc(e,t){let r=[];for(let i,s=-1,n=-1,o=e.childrenLength();++s<o;)(i=e.children(s))&&(r[++n]=P.decode(i,t));return r}function mm(e,t){let r,i,s,n,o,a;return!t||!(a=e.dictionary())?(s=Kc(e,Jc(e,t)),i=new P(e.name(),s,e.nullable(),ra(e))):t.has(r=Y(a.id()))?(n=(n=a.indexType())?Xc(n):new we,o=new ce(t.get(r),n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ra(e))):(n=(n=a.indexType())?Xc(n):new we,t.set(r,s=Kc(e,Jc(e,t))),o=new ce(s,n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ra(e))),i||null}function ra(e){let t=new Map;if(e)for(let r,i,s=-1,n=Math.trunc(e.customMetadataLength());++s<n;)(r=e.customMetadata(s))&&(i=r.key())!=null&&t.set(i,r.value());return t}function Xc(e){return new bt(e.isSigned(),e.bitWidth())}function Kc(e,t){let r=e.typeType();switch(r){case ot.NONE:return new Nt;case ot.Null:return new Nt;case ot.Binary:return new Oe;case ot.LargeBinary:return new gr;case ot.Utf8:return new Ee;case ot.LargeUtf8:return new _r;case ot.Bool:return new Ne;case ot.List:return new ae((t||[])[0]);case ot.Struct_:return new Q(t||[])}switch(r){case ot.Int:{let i=e.type(new Tt);return new bt(i.isSigned(),i.bitWidth())}case ot.FloatingPoint:{let i=e.type(new ie);return new oe(i.precision())}case ot.Decimal:{let i=e.type(new Ot);return new Fe(i.scale(),i.precision(),i.bitWidth())}case ot.Date:{let i=e.type(new Qt);return new xe(i.unit())}case ot.Time:{let i=e.type(new zt);return new Ht(i.unit(),i.bitWidth())}case ot.Timestamp:{let i=e.type(new jt);return new qt(i.unit(),i.timezone())}case ot.Interval:{let i=e.type(new se);return new Me(i.unit())}case ot.Duration:{let i=e.type(new te);return new br(i.unit())}case ot.Union:{let i=e.type(new Et);return new Le(i.mode(),i.typeIdsArray()||[],t||[])}case ot.FixedSizeBinary:{let i=e.type(new ee);return new vr(i.byteWidth())}case ot.FixedSizeList:{let i=e.type(new re);return new he(i.listSize(),(t||[])[0])}case ot.Map:{let i=e.type(new ne);return new le((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${ot[r]}" (${r})`)}function ym(e,t){let r=t.fields.map(n=>P.encode(e,n));pt.startFieldsVector(e,r.length);let i=pt.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?pt.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let a=e.createString(`${n}`),h=e.createString(`${o}`);return ht.startKeyValue(e),ht.addKey(e,a),ht.addValue(e,h),ht.endKeyValue(e)})):-1;return pt.startSchema(e),pt.addFields(e,i),pt.addEndianness(e,xm?$r.Little:$r.Big),s!==-1&&pt.addCustomMetadata(e,s),pt.endSchema(e)}function gm(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;w.isDictionary(n)?(o=n.dictionary.typeId,s=ta.visit(n,e),i=ta.visit(n.dictionary,e)):i=ta.visit(n,e);let a=(n.children||[]).map(c=>P.encode(e,c)),h=wt.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(e,[...t.metadata].map(([c,u])=>{let d=e.createString(`${c}`),p=e.createString(`${u}`);return ht.startKeyValue(e),ht.addKey(e,d),ht.addValue(e,p),ht.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),wt.startField(e),wt.addType(e,i),wt.addTypeType(e,o),wt.addChildren(e,h),wt.addNullable(e,!!t.nullable),r!==-1&&wt.addName(e,r),s!==-1&&wt.addDictionary(e,s),l!==-1&&wt.addCustomMetadata(e,l),wt.endField(e)}function _m(e,t){let r=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(e,r.length);for(let o of r.slice().reverse())Ue.encode(e,o);let s=e.endVector();Pt.startBuffersVector(e,i.length);for(let o of i.slice().reverse())pe.encode(e,o);let n=e.endVector();return Pt.startRecordBatch(e),Pt.addLength(e,BigInt(t.length)),Pt.addNodes(e,s),Pt.addBuffers(e,n),Pt.endRecordBatch(e)}function bm(e,t){let r=Ut.encode(e,t.data);return Te.startDictionaryBatch(e),Te.addId(e,BigInt(t.id)),Te.addIsDelta(e,t.isDelta),Te.addData(e,r),Te.endDictionaryBatch(e)}function vm(e,t){return Gi.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function wm(e,t){return Vi.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var xm=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var Eh=e=>`Expected ${H[e]} Message in stream, but was null or length 0.`,Nh=e=>`Header pointer of flatbuffer-encoded ${H[e]} Message is null or length 0.`,Zc=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Qc=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,vs=class{constructor(t){this.source=t instanceof Mr?t:new Mr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?lt:t.value===-1&&(t=this.readMetadataLength()).done?lt:(t=this.readMetadata(t.value)).done?lt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Eh(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=N(this.source.read(t));if(r.byteLength<t)throw new Error(Qc(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=H.Schema,i=this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Nh(r));return s}readMetadataLength(){let t=this.source.read(ia),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}}readMetadata(t){let r=this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(Zc(t,r.byteLength));return{done:!1,value:It.decode(r)}}},xn=class{constructor(t,r){this.source=t instanceof fe?t:$n(t)?new Zr(t,r):new fe(t)}[Symbol.asyncIterator](){return this}next(){return x(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?lt:t.value===-1&&(t=yield this.readMetadataLength()).done?lt:(t=yield this.readMetadata(t.value)).done?lt:t})}throw(t){return x(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return x(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return x(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Eh(t));return r.value})}readMessageBody(t){return x(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=N(yield this.source.read(t));if(r.byteLength<t)throw new Error(Qc(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return x(this,arguments,void 0,function*(t=!1){let r=H.Schema,i=yield this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Nh(r));return s})}readMetadataLength(){return x(this,void 0,void 0,function*(){let t=yield this.source.read(ia),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}})}readMetadata(t){return x(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(Zc(t,r.byteLength));return{done:!1,value:It.decode(r)}})}},Mn=class extends vs{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ys?t:new Ys(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:It.fromJSON(t.schema,H.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:It.fromJSON(r,H.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:It.fromJSON(r,H.RecordBatch)}}return this._body=[],lt}readMessageBody(t){return r(this._body);function r(i){return(i||[]).reduce((s,n)=>[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Eh(t));return r.value}readSchema(){let t=H.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(Nh(t));return i}},ia=4,Oh="ARROW1",ws=new Uint8Array(Oh.length);for(let e=0;e<Oh.length;e+=1)ws[e]=Oh.codePointAt(e);function sa(e,t=0){for(let r=-1,i=ws.length;++r<i;)if(ws[r]!==e[t+r])return!1;return!0}var xs=ws.length,Fh=xs+ia,tu=xs*2+ia;var Yt=class extends xi{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return ke(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Lt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Yt?t:Hn(t)?Im(t):$n(t)?Am(t):ke(t)?(()=>x(this,void 0,void 0,function*(){return yield Yt.from(yield t)}))():Yn(t)||Us(t)||Xn(t)||Ae(t)?Bm(new fe(t)):Sm(new Mr(t))}static readAll(t){return t instanceof Yt?t.isSync()?eu(t):ru(t):Hn(t)||ArrayBuffer.isView(t)||Ve(t)||qn(t)?eu(t):ru(t)}},Cr=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return _e(this,arguments,function*(){yield V(yield*ji(je(this[Symbol.iterator]())))})}},Ti=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return x(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,a=je(this),h;h=yield a.next(),t=h.done,!t;o=!0){s=h.value,o=!1;let l=s;n.push(l)}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Oi=class extends Cr{constructor(t){super(t),this._impl=t}},na=class extends Ti{constructor(t){super(t),this._impl=t}},oa=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),s=U({type:new Q(this.schema.fields),length:t.length,children:i});return new rt(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,a=n.get(i),h=o.dictionaries.get(i),l=this._loadVectors(t.data,r,[h]);return(a&&s?a.concat(new j(l)):new j(l)).memoize()}_loadVectors(t,r,i){return new Ks(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},Ms=class extends oa{constructor(t,r){super(r),this._reader=Hn(t)?new Mn(this._handle=t):new vs(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=iu(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):lt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):lt}next(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Di(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Is=class extends oa{constructor(t,r){super(r),this._reader=new xn(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return x(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return x(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=iu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):lt})}return(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):lt})}next(){return x(this,void 0,void 0,function*(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Di(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},aa=class extends Ms{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Js?t:new Js(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-Fh,i=t.readInt32(r),s=t.readAt(r-i,i);return Er.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},Lh=class extends Is{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let i=typeof r[0]!="number"?r.shift():void 0,s=r[0]instanceof Map?r.shift():void 0;super(t instanceof Zr?t:new Zr(t,i),s)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return x(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return x(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return x(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}})}_readFooter(){return x(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-Fh,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return Er.decode(s)})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},Rh=class extends Ms{constructor(t,r){super(t,r)}_loadVectors(t,r,i){return new Eo(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function iu(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*eu(e){let t=Yt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function ru(e){return _e(this,arguments,function*(){let r=yield V(Yt.from(e));try{if(!(yield V(r.open({autoDestroy:!1}))).closed)do yield yield V(r);while(!(yield V(r.reset().open())).closed)}finally{yield V(r.cancel())}})}function Im(e){return new Cr(new Rh(e))}function Sm(e){let t=e.peek(xs+7&-8);return t&&t.byteLength>=4?sa(t)?new Oi(new aa(e.read())):new Cr(new Ms(e)):new Cr(new Ms(function*(){}()))}function Bm(e){return x(this,void 0,void 0,function*(){let t=yield e.peek(xs+7&-8);return t&&t.byteLength>=4?sa(t)?new Oi(new aa(yield e.read())):new Ti(new Is(e)):new Ti(new Is(function(){return _e(this,arguments,function*(){})}()))})}function Am(e){return x(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Zr(e,t);return t>=tu&&sa(yield r.readAt(0,xs+7&-8))?new na(new Lh(r)):new Ti(new Is(r))})}var ct=class extends B{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof rt?n.data.children:n.data),i=new ct;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof j)return this.visitMany(t.data),this;let{type:r}=t;if(!w.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(w.isUnion(r))this.nodes.push(new Ue(i,0));else{let{nullCount:s}=t;w.isNull(r)||Ze.call(this,s<=0?new Uint8Array(0):gi(t.offset,i,t.nullBitmap)),this.nodes.push(new Ue(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ze(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new pe(this._byteLength,t)),this._byteLength+=t,this}function Dm(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(Ze.call(this,s),r.mode===at.Sparse)return Uh.call(this,e);if(r.mode===at.Dense){if(e.offset<=0)return Ze.call(this,n),Uh.call(this,e);{let o=new Int32Array(i),a=Object.create(null),h=Object.create(null);for(let l,c,u=-1;++u<i;)(l=s[u])!==void 0&&((c=a[l])===void 0&&(c=a[l]=n[u]),o[u]=n[u]-c,h[l]=((t=h[l])!==null&&t!==void 0?t:0)+1);Ze.call(this,o),this.visitMany(e.children.map((l,c)=>{let u=r.typeIds[c],d=a[u],p=h[u];return l.slice(d,Math.min(i,p))}))}}return this}function Tm(e){let t;return e.nullCount>=e.length?Ze.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ze.call(this,gi(e.offset,e.length,t)):Ze.call(this,_i(e.values))}function Pr(e){return Ze.call(this,e.values.subarray(0,e.length*e.stride))}function ha(e){let{length:t,values:r,valueOffsets:i}=e,s=Y(i[0]),n=Y(i[t]),o=Math.min(n-s,r.byteLength-s);return Ze.call(this,Zn(-s,t+1,i)),Ze.call(this,r.subarray(s,s+o)),this}function Ch(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return Ze.call(this,Zn(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function Uh(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ct.prototype.visitBool=Tm;ct.prototype.visitInt=Pr;ct.prototype.visitFloat=Pr;ct.prototype.visitUtf8=ha;ct.prototype.visitLargeUtf8=ha;ct.prototype.visitBinary=ha;ct.prototype.visitLargeBinary=ha;ct.prototype.visitFixedSizeBinary=Pr;ct.prototype.visitDate=Pr;ct.prototype.visitTimestamp=Pr;ct.prototype.visitTime=Pr;ct.prototype.visitDecimal=Pr;ct.prototype.visitList=Ch;ct.prototype.visitStruct=Uh;ct.prototype.visitUnion=Dm;ct.prototype.visitInterval=Pr;ct.prototype.visitDuration=Pr;ct.prototype.visitFixedSizeList=Ch;ct.prototype.visitMap=Ch;var Ei=class extends xi{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new xr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Gt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ke(t)?t.then(r=>this.writeAll(r)):Ae(t)?zh(this,t):Ph(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof xr?this._sink=t:(this._sink=new xr,t&&bl(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&vl(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!Ai(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof dt&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof rt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Ai(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof rt?t instanceof Di||this._writeRecordBatch(t):t instanceof dt?this.writeAll(t.batches):Ve(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=It.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=n+o+i&~i,h=a-n-o;return t.headerType===H.RecordBatch?this._recordBatchBlocks.push(new Ke(a,t.bodyLength,this._position)):t.headerType===H.DictionaryBatch&&this._dictionaryBlocks.push(new Ke(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),n>0&&this._write(s),this._writePadding(h)}_write(t){if(this._started){let r=N(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(It.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ws)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=ct.assemble(t),o=new Ut(t.numRows,i,s),a=It.from(o,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(n)}_writeDictionaryBatch(t,r,i=!1){let{byteLength:s,nodes:n,bufferRegions:o,buffers:a}=ct.assemble(new j([t])),h=new Ut(t.length,n,o),l=new me(h,r,i),c=It.from(l,s);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,i,s;for(let n=-1,o=t.length;++n<o;)(r=t[n])&&(i=r.byteLength)>0&&(this._write(r),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){var r,i;for(let[s,n]of t.dictionaries){let o=(r=n?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(s),h=(i=this._dictionaryDeltaOffsets.get(s))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,c]of o.entries())this._writeDictionaryBatch(c,s,l>0);else if(h<o.length)for(let l of o.slice(h))this._writeDictionaryBatch(l,s,!0);this._seenDictionaries.set(s,n),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Ni=class extends Ei{static writeAll(t,r){let i=new Ni(r);return ke(t)?t.then(s=>i.writeAll(s)):Ae(t)?zh(i,t):Ph(i,t)}},Fi=class extends Ei{static writeAll(t){let r=new Fi;return ke(t)?t.then(i=>r.writeAll(i)):Ae(t)?zh(r,t):Ph(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,i=!1){if(!i&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,i)}_writeFooter(t){let r=Er.encode(new Er(t,et.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function Ph(e,t){let r=t;t instanceof dt&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function zh(e,t){return x(this,void 0,void 0,function*(){var r,i,s,n,o,a,h;try{for(r=!0,i=je(t);s=yield i.next(),n=s.done,!n;r=!0){h=s.value,r=!1;let l=h;e.write(l)}}catch(l){o={error:l}}finally{try{!r&&!n&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return e.finish()})}function su(e,t){if(Ae(e))return Em(e,t);if(Ve(e))return Om(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Om(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){let h,l=null,c=o.desiredSize||null;for(;!(l=a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()}}function Em(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return x(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return x(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return x(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){return x(this,void 0,void 0,function*(){let h,l=null,c=o.desiredSize||null;for(;!(l=yield a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()})}}function au(e){return new jh(e)}var jh=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:i,["queueingStrategy"]:s="count"}=t,n=gl(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ir(n),this._getSize=s!=="bytes"?nu:ou;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:h=>{this._maybeFlush(this._builder,this._controller=h)},start:h=>{this._maybeFlush(this._builder,this._controller=h)}},{highWaterMark:o,size:s!=="bytes"?nu:ou}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:h=>this._writeValueAndReturnChunkSize(h)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},nu=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},ou=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function la(e,t){let r=new xr,i=null,s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield r.close()})},start(a){return x(this,void 0,void 0,function*(){yield o(a,i||(i=yield n()))})},pull(a){return x(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return x(this,void 0,void 0,function*(){return yield(yield Yt.from(r)).open(t)})}function o(a,h){return x(this,void 0,void 0,function*(){let l=a.desiredSize,c=null;for(;!(c=yield h.next()).done;)if(a.enqueue(c.value),l!=null&&--l<=0)return;a.close()})}}function ca(e,t){let r=new this(e),i=new fe(r),s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return x(this,void 0,void 0,function*(){yield n(o)})},start(o){return x(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return x(this,void 0,void 0,function*(){let a=null,h=o.desiredSize;for(;a=yield i.read(h||null);)if(o.enqueue(a),h!=null&&(h-=a.byteLength)<=0)return;o.close()})}}var Wm=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Qa),Mh),mh),th),qa),ph),Ja),{compareSchemas:Ai,compareFields:Rc,compareTypes:Uc});Lt.toDOMStream=su;ut.throughDOM=au;Yt.throughDOM=la;Oi.throughDOM=la;Cr.throughDOM=la;Ei.throughDOM=ca;Fi.throughDOM=ca;Ni.throughDOM=ca;function kh(e){return lu(e)}function lu(e){return new W(e.fields.map(t=>Ss(t)),Vh(e.metadata))}function Vh(e){return e?new Map(Object.entries(e)):new Map}function Ss(e){return new P(e.name,cu(e.type),e.nullable,Vh(e.metadata))}function cu(e){if(typeof e=="object")switch(e.type){case"decimal":return new Fe(e.precision,e.scale,e.bitWidth);case"map":let t=e.children.map(s=>Ss(s));return new le(t,e.keysSorted);case"list":let r=Ss(e.children[0]);return new ae(r);case"fixed-size-list":let i=Ss(e.children[0]);return new he(e.listSize,i);case"struct":return t=e.children.map(s=>Ss(s)),new Q(t);default:throw new Error("array type not supported")}switch(e){case"null":return new Nt;case"binary":return new Oe;case"bool":return new Ne;case"int8":return new ni;case"int16":return new oi;case"int32":return new we;case"int64":return new ai;case"uint8":return new hi;case"uint16":return new li;case"uint32":return new ci;case"uint64":return new ui;case"float16":return new fi;case"float32":return new di;case"float64":return new pi;case"utf8":return new Ee;case"date-day":return new $i;case"date-millisecond":return new Yi;case"time-second":return new Ji;case"time-millisecond":return new Xi;case"time-microsecond":return new Ki;case"time-nanosecond":return new Zi;case"timestamp-second":return new Qi;case"timestamp-millisecond":return new ts;case"timestamp-microsecond":return new es;case"timestamp-nanosecond":return new rs;case"interval-daytime":return new is;case"interval-yearmonth":return new ss;default:throw new Error("array type not supported")}}var In=class{schema;arrowSchema;arrowBuilders;length;constructor(t){this.schema=t,this.arrowSchema=kh(t),this.arrowBuilders=this.arrowSchema.fields.map(r=>Ir({type:r.type,nullValues:[null]})),this.length=0}addObjectRow(t){for(let r=0;r<this.arrowBuilders.length;r++){let i=this.schema.fields[r].name,s=t[i];this.arrowBuilders[r].append(s)}this.length++}addArrayRow(t){for(let r=0;r<this.arrowBuilders.length;r++)this.arrowBuilders[r].append(t[r]);this.length++}firstBatch(){let t=this._getArrowRecordBatch();return t.numCols!==0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}flushBatch(){let t=this._getArrowRecordBatch();return t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishBatch(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishTable(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),{shape:"arrow-table",schema:this.schema,data:new dt(t)}}_getArrowRecordBatch(){let{arrowBuilders:t,arrowSchema:r}=this,i=t.map(h=>h.flush()),s=i[0].length,n=new Q(r.fields),o=new q(n,0,s,0,void 0,i);return new rt(r,o)}};function Gh(e,t,r){switch(e.type){case"Point":return qm(e,t,r);case"LineString":return Hm(e,t,r);case"Polygon":return uu(e,t,r);default:let i=e;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function uu(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.polygonIndices.value.filter(h=>h>=t&&h<=r),n=e.primitivePolygonIndices.value.filter(h=>h>=t&&h<=r);if(!(s.length>2)){let h=[];for(let l=0;l<n.length-1;l++){let c=n[l],u=n[l+1],d=ua(i,c,u);h.push(d)}return{type:"Polygon",coordinates:h}}let a=[];for(let h=0;h<s.length-1;h++){let l=s[h],c=s[h+1],u=uu(e,l,c).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function Hm(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:ua(i,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let h=ua(i,s[a],s[a+1]);o.push(h)}return{type:"MultiLineString",coordinates:o}}function qm(e,t,r){let{positions:i}=e,s=ua(i,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function ua(e,t,r){t=t||0,r=r||e.value.length/e.size;let i=[];for(let s=t;s<r;s++){let n=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)n.push(Number(e.value[o]));i.push(n)}return i}function fu(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}var Qe=1,tr=2,du=4,Sn=5,Li=484813681109536e-20,y=Math.PI/2,pu=.16666666666666666,mu=.04722222222222222,yu=.022156084656084655,_=1e-10,Bt=.017453292519943295,er=57.29577951308232,J=Math.PI/4,Bn=Math.PI*2,mt=3.14159265359;var Jt={};Jt.greenwich=0;Jt.lisbon=-9.131906111111;Jt.paris=2.337229166667;Jt.bogota=-74.080916666667;Jt.madrid=-3.687938888889;Jt.rome=12.452333333333;Jt.bern=7.439583333333;Jt.jakarta=106.807719444444;Jt.ferro=-17.666666666667;Jt.brussels=4.367975;Jt.stockholm=18.058277777778;Jt.athens=23.7163375;Jt.oslo=10.722916666667;var gu={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var _u=/[\s_\-\/\(\)]/g;function Se(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(_u,""),s=-1,n,o;++s<r.length;)if(n=r[s],o=n.toLowerCase().replace(_u,""),o===i)return e[n]}function An(e){var t={},r=e.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,h){var l=h.split("=");return l.push(!0),a[l[0].toLowerCase()]=l[1],a},{}),i,s,n,o={proj:"projName",datum:"datumCode",rf:function(a){t.rf=parseFloat(a)},lat_0:function(a){t.lat0=a*Bt},lat_1:function(a){t.lat1=a*Bt},lat_2:function(a){t.lat2=a*Bt},lat_ts:function(a){t.lat_ts=a*Bt},lon_0:function(a){t.long0=a*Bt},lon_1:function(a){t.long1=a*Bt},lon_2:function(a){t.long2=a*Bt},alpha:function(a){t.alpha=parseFloat(a)*Bt},lonc:function(a){t.longc=a*Bt},x_0:function(a){t.x0=parseFloat(a)},y_0:function(a){t.y0=parseFloat(a)},k_0:function(a){t.k0=parseFloat(a)},k:function(a){t.k0=parseFloat(a)},a:function(a){t.a=parseFloat(a)},b:function(a){t.b=parseFloat(a)},r_a:function(){t.R_A=!0},zone:function(a){t.zone=parseInt(a,10)},south:function(){t.utmSouth=!0},towgs84:function(a){t.datum_params=a.split(",").map(function(h){return parseFloat(h)})},to_meter:function(a){t.to_meter=parseFloat(a)},units:function(a){t.units=a;var h=Se(gu,a);h&&(t.to_meter=h.to_meter)},from_greenwich:function(a){t.from_greenwich=a*Bt},pm:function(a){var h=Se(Jt,a);t.from_greenwich=(h||parseFloat(a))*Bt},nadgrids:function(a){a==="@null"?t.datumCode="none":t.nadgrids=a},axis:function(a){var h="ewnsud";a.length===3&&h.indexOf(a.substr(0,1))!==-1&&h.indexOf(a.substr(1,1))!==-1&&h.indexOf(a.substr(2,1))!==-1&&(t.axis=a)}};for(i in r)s=r[i],i in o?(n=o[i],typeof n=="function"?n(s):t[n]=s):t[i]=s;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var bu=Xm,Dn=1,vu=2,wu=3,fa=4,xu=5,Wh=-1,$m=/\s/,Ym=/[A-Za-z]/,Jm=/[A-Za-z84_]/,da=/[,\]]/,Mu=/[\d\.E\-\+]/;function zr(e){if(typeof e!="string")throw new Error("not a string");this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Dn}zr.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==fa)for(;$m.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Dn:return this.neutral(e);case vu:return this.keyword(e);case fa:return this.quoted(e);case xu:return this.afterquote(e);case wu:return this.number(e);case Wh:return}};zr.prototype.afterquote=function(e){if(e==='"'){this.word+='"',this.state=fa;return}if(da.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in afterquote yet, index '+this.place)};zr.prototype.afterItem=function(e){if(e===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Dn;return}if(e==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Dn,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Wh);return}};zr.prototype.number=function(e){if(Mu.test(e)){this.word+=e;return}if(da.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in number yet, index '+this.place)};zr.prototype.quoted=function(e){if(e==='"'){this.state=xu;return}this.word+=e};zr.prototype.keyword=function(e){if(Jm.test(e)){this.word+=e;return}if(e==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Dn;return}if(da.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in keyword yet, index '+this.place)};zr.prototype.neutral=function(e){if(Ym.test(e)){this.word=e,this.state=vu;return}if(e==='"'){this.word="",this.state=fa;return}if(Mu.test(e)){this.word=e,this.state=wu;return}if(da.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in neutral yet, index '+this.place)};zr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Wh)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Xm(e){var t=new zr(e);return t.output()}function Iu(e,t,r){Array.isArray(t)&&(r.unshift(t),t=null);var i=t?{}:e,s=r.reduce(function(n,o){return Ri(o,n),n},i);t&&(e[t]=s)}function Ri(e,t){if(!Array.isArray(e)){t[e]=!0;return}var r=e.shift();if(r==="PARAMETER"&&(r=e.shift()),e.length===1){if(Array.isArray(e[0])){t[r]={},Ri(e[0],t[r]);return}t[r]=e[0];return}if(!e.length){t[r]=!0;return}if(r==="TOWGS84"){t[r]=e;return}if(r==="AXIS"){r in t||(t[r]=[]),t[r].push(e);return}Array.isArray(r)||(t[r]={});var i;switch(r){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[r]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ri(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ri(e[3],t[r]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":e[0]=["name",e[0]],Iu(t,r,e);return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return Ri(e,t[r]);return Iu(t,r,e)}}var Km=.017453292519943295;function Zm(e,t){var r=t[0],i=t[1];!(r in e)&&i in e&&(e[r]=e[i],t.length===3&&(e[r]=t[2](e[r])))}function Br(e){return e*Km}function Qm(e){if(e.type==="GEOGCS"?e.projName="longlat":e.type==="LOCAL_CS"?(e.projName="identity",e.local=!0):typeof e.PROJECTION=="object"?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.AXIS){for(var t="",r=0,i=e.AXIS.length;r<i;++r){var s=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?t+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?t+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?t+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(e.axis=t)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.UNIT.convert&&(e.type==="GEOGCS"?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var n=e.GEOGCS;e.type==="GEOGCS"&&(n=e),n&&(n.DATUM?e.datumCode=n.DATUM.name.toLowerCase():e.datumCode=n.name.toLowerCase(),e.datumCode.slice(0,2)==="d_"&&(e.datumCode=e.datumCode.slice(2)),(e.datumCode==="new_zealand_geodetic_datum_1949"||e.datumCode==="new_zealand_1949")&&(e.datumCode="nzgd49"),(e.datumCode==="wgs_1984"||e.datumCode==="world_geodetic_system_1984")&&(e.PROJECTION==="Mercator_Auxiliary_Sphere"&&(e.sphere=!0),e.datumCode="wgs84"),e.datumCode.slice(-6)==="_ferro"&&(e.datumCode=e.datumCode.slice(0,-6)),e.datumCode.slice(-8)==="_jakarta"&&(e.datumCode=e.datumCode.slice(0,-8)),~e.datumCode.indexOf("belge")&&(e.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(e.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),e.ellps.toLowerCase().slice(0,13)==="international"&&(e.ellps="intl"),e.a=n.DATUM.SPHEROID.a,e.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(e.datum_params=n.DATUM.TOWGS84),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36"),~e.datumCode.indexOf("osni_1952")&&(e.datumCode="osni52"),(~e.datumCode.indexOf("tm65")||~e.datumCode.indexOf("geodetic_datum_of_1965"))&&(e.datumCode="ire65"),e.datumCode==="ch1903+"&&(e.datumCode="ch1903"),~e.datumCode.indexOf("israel")&&(e.datumCode="isr93")),e.b&&!isFinite(e.b)&&(e.b=e.a);function o(l){var c=e.to_meter||1;return l*c}var a=function(l){return Zm(e,l)},h=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Br],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Br],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",Br],["lat0","latitude_of_origin",Br],["lat0","standard_parallel_1",Br],["lat1","standard_parallel_1",Br],["lat2","standard_parallel_2",Br],["azimuth","Azimuth"],["alpha","azimuth",Br],["srsCode","name"]];h.forEach(a),!e.long0&&e.longc&&(e.projName==="Albers_Conic_Equal_Area"||e.projName==="Lambert_Azimuthal_Equal_Area")&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(e.projName==="Stereographic_South_Pole"||e.projName==="Polar Stereographic (variant B)")?(e.lat0=Br(e.lat1>0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName==="Polar_Stereographic"&&(e.lat_ts=e.lat0,e.lat0=Br(e.lat0>0?90:-90))}function pa(e){var t=bu(e),r=t.shift(),i=t.shift();t.unshift(["name",i]),t.unshift(["type",r]);var s={};return Ri(t,s),Qm(s),s}function Ce(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?Ce[e]=An(arguments[1]):Ce[e]=pa(arguments[1]):Ce[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ce.apply(t,i):Ce(i)});if(typeof e=="string"){if(e in Ce)return Ce[e]}else"EPSG"in e?Ce["EPSG:"+e.EPSG]=e:"ESRI"in e?Ce["ESRI:"+e.ESRI]=e:"IAU2000"in e?Ce["IAU2000:"+e.IAU2000]=e:console.log(e);return}}fu(Ce);var Bs=Ce;function t0(e){return typeof e=="string"}function e0(e){return e in Bs}var r0=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function i0(e){return r0.some(function(t){return e.indexOf(t)>-1})}var s0=["3857","900913","3785","102113"];function n0(e){var t=Se(e,"authority");if(t){var r=Se(t,"epsg");return r&&s0.indexOf(r)>-1}}function o0(e){var t=Se(e,"extension");if(t)return Se(t,"proj4")}function a0(e){return e[0]==="+"}function h0(e){if(t0(e)){if(e0(e))return Bs[e];if(i0(e)){var t=pa(e);if(n0(t))return Bs["EPSG:3857"];var r=o0(t);return r?An(r):t}if(a0(e))return An(e)}else return e}var Su=h0;function Hh(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function Vt(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function Ar(e){return e<0?-1:1}function b(e){return Math.abs(e)<=mt?e:e-Ar(e)*Bn}function Xt(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(y-t))/i}function jr(e,t){for(var r=.5*e,i,s,n=y-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=y-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function l0(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Vt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function c0(e){var t=e.x,r=e.y;if(r*er>90&&r*er<-90&&t*er>180&&t*er<-180)return null;var i,s;if(Math.abs(Math.abs(r)-y)<=_)return null;if(this.sphere)i=this.x0+this.a*this.k0*b(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(J+.5*r));else{var n=Math.sin(r),o=Xt(this.e,r,n);i=this.x0+this.a*this.k0*b(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function u0(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=y-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=jr(this.e,n),s===-9999)return null}return i=b(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var f0=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Bu={init:l0,forward:c0,inverse:u0,names:f0};function d0(){}function Au(e){return e}var p0=["longlat","identity"],Du={init:d0,forward:Au,inverse:Au,names:p0};var m0=[Bu,Du],ma={},ya=[];function Tu(e,t){var r=ya.length;return e.names?(ya[r]=e,e.names.forEach(function(i){ma[i.toLowerCase()]=r}),this):(console.log(t),!0)}function y0(e){if(!e)return!1;var t=e.toLowerCase();if(typeof ma[t]<"u"&&ya[ma[t]])return ya[ma[t]]}function g0(){m0.forEach(Tu)}var Ou={start:g0,add:Tu,get:y0};var k={};k.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};k.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};k.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};k.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};k.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};k.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};k.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};k.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};k.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};k.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};k.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};k.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};k.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};k.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};k.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};k.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};k.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};k.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};k.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};k.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};k.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};k.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};k.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};k.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};k.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};k.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};k.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};k.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};k.hough={a:6378270,rf:297,ellipseName:"Hough"};k.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};k.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};k.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};k.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};k.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};k.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};k.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};k.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};k.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};k.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};k.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};k.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Eu=k.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};k.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Nu(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,a=0;i?(e*=1-o*(pu+o*(mu+o*yu)),s=e*e,o=0):a=Math.sqrt(o);var h=(s-n)/n;return{es:o,e:a,ep2:h}}function Fu(e,t,r,i,s){if(!e){var n=Se(k,i);n||(n=Eu),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)<_)&&(s=!0,t=e),{a:e,b:t,rf:r,sphere:s}}var At={};At.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};At.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};At.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};At.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};At.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};At.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};At.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};At.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};At.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};At.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};At.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};At.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};At.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};At.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};At.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};At.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};At.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function _0(e,t,r,i,s,n){var o={};return e===void 0||e==="none"?o.datum_type=Sn:o.datum_type=du,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=Qe),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=tr,o.datum_params[3]*=Li,o.datum_params[4]*=Li,o.datum_params[5]*=Li,o.datum_params[6]=o.datum_params[6]/1e6+1)),o.a=r,o.b=i,o.es=s,o.ep2=n,o}var Lu=_0;function As(e,t){if(!(this instanceof As))return new As(e);t=t||function(h){if(h)throw h};var r=Su(e);if(typeof r!="object"){t(e);return}var i=As.projections.get(r.projName);if(!i){t(e);return}if(r.datumCode&&r.datumCode!=="none"){var s=Se(At,r.datumCode);s&&(r.datum_params=s.towgs84?s.towgs84.split(","):null,r.ellps=s.ellipse,r.datumName=s.datumName?s.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var n=Fu(r.a,r.b,r.rf,r.ellps,r.sphere),o=Nu(n.a,n.b,n.rf,r.R_A),a=r.datum||Lu(r.datumCode,r.datum_params,n.a,n.b,o.es,o.ep2);Hh(this,r),Hh(this,i),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=a,this.init(),t(null,this)}As.projections=Ou;As.projections.start();var Qr=As;function Ru(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===Qe?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===tr?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function ga(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,a,h,l;if(s<-y&&s>-1.001*y)s=-y;else if(s>y&&s<1.001*y)s=y;else{if(s<-y)return{x:-1/0,y:-1/0,z:e.z};if(s>y)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),a=Math.sin(s),l=Math.cos(s),h=a*a,o=r/Math.sqrt(1-t*h),{x:(o+n)*l*Math.cos(i),y:(o+n)*l*Math.sin(i),z:(o*(1-t)+n)*a}}function _a(e,t,r,i){var s=1e-12,n=s*s,o=30,a,h,l,c,u,d,p,m,g,v,I,z,$,nt=e.x,K=e.y,tt=e.z?e.z:0,Ct,gt,sr;if(a=Math.sqrt(nt*nt+K*K),h=Math.sqrt(nt*nt+K*K+tt*tt),a/r<s){if(Ct=0,h/r<s)return gt=y,sr=-i,{x:e.x,y:e.y,z:e.z}}else Ct=Math.atan2(K,nt);l=tt/h,c=a/h,u=1/Math.sqrt(1-t*(2-t)*c*c),m=c*(1-t)*u,g=l*u,$=0;do $++,p=r/Math.sqrt(1-t*g*g),sr=a*m+tt*g-p*(1-t*g*g),d=t*p/(p+sr),u=1/Math.sqrt(1-d*(2-d)*c*c),v=c*(1-d)*u,I=l*u,z=I*m-v*g,m=v,g=I;while(z*z>n&&$<o);return gt=Math.atan(I/Math.abs(v)),{x:Ct,y:gt,z:sr}}function Uu(e,t,r){if(t===Qe)return{x:e.x+r[0],y:e.y+r[1],z:e.z+r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6];return{x:l*(e.x-h*e.y+a*e.z)+i,y:l*(h*e.x+e.y-o*e.z)+s,z:l*(-a*e.x+o*e.y+e.z)+n}}}function Cu(e,t,r){if(t===Qe)return{x:e.x-r[0],y:e.y-r[1],z:e.z-r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6],c=(e.x-i)/l,u=(e.y-s)/l,d=(e.z-n)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}function ba(e){return e===Qe||e===tr}function Pu(e,t,r){return Ru(e,t)||e.datum_type===Sn||t.datum_type===Sn||e.es===t.es&&e.a===t.a&&!ba(e.datum_type)&&!ba(t.datum_type)?r:(r=ga(r,e.es,e.a),ba(e.datum_type)&&(r=Uu(r,e.datum_type,e.datum_params)),ba(t.datum_type)&&(r=Cu(r,t.datum_type,t.datum_params)),_a(r,t.es,t.a,t.b))}function qh(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,a,h,l={};for(h=0;h<3;h++)if(!(t&&h===2&&r.z===void 0))switch(h===0?(o=i,"ew".indexOf(e.axis[h])!==-1?a="x":a="y"):h===1?(o=s,"ns".indexOf(e.axis[h])!==-1?a="y":a="x"):(o=n,a="z"),e.axis[h]){case"e":case"w":case"n":case"s":l[a]=o;break;case"u":r[a]!==void 0&&(l.z=o);break;case"d":r[a]!==void 0&&(l.z=-o);break;default:return null}return l}function va(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ju(e){zu(e.x),zu(e.y)}function zu(e){if(typeof Number.isFinite=="function"){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if(typeof e!="number"||e!==e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function b0(e,t){return(e.datum.datum_type===Qe||e.datum.datum_type===tr)&&t.datumCode!=="WGS84"||(t.datum.datum_type===Qe||t.datum.datum_type===tr)&&e.datumCode!=="WGS84"}function Ui(e,t,r){var i;if(Array.isArray(r)&&(r=va(r)),ju(r),e.datum&&t.datum&&b0(e,t)&&(i=new Qr("WGS84"),r=Ui(e,i,r),e=i),e.axis!=="enu"&&(r=qh(e,!1,r)),e.projName==="longlat")r={x:r.x*Bt,y:r.y*Bt,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;return e.from_greenwich&&(r.x+=e.from_greenwich),r=Pu(e.datum,t.datum,r),t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName==="longlat"?r={x:r.x*er,y:r.y*er,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),t.axis!=="enu"?qh(t,!0,r):r}var ku=Qr("WGS84");function $h(e,t,r){var i,s,n;return Array.isArray(r)?(i=Ui(e,t,r)||{x:NaN,y:NaN},r.length>2?typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(r.splice(3)):[i.x,i.y,r[2]].concat(r.splice(3)):[i.x,i.y].concat(r.splice(2)):[i.x,i.y]):(s=Ui(e,t,r),n=Object.keys(r),n.length===2||n.forEach(function(o){if(typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;s[o]=r[o]}),s)}function Vu(e){return e instanceof Qr?e:e.oProj?e.oProj:Qr(e)}function v0(e,t,r){e=Vu(e);var i=!1,s;return typeof t>"u"?(t=e,e=ku,i=!0):(typeof t.x<"u"||Array.isArray(t))&&(r=t,t=e,e=ku,i=!0),t=Vu(t),r?$h(e,t,r):(s={forward:function(n){return $h(e,t,n)},inverse:function(n){return $h(t,e,n)}},i&&(s.oProj=t),s)}var Be=v0;var Gu=6,Hu="AJSAJS",qu="AFAFAF",Ds=65,ye=73,Pe=79,Tn=86,On=90,$u={forward:Jh,inverse:w0,toPoint:Xh};function Jh(e,t){return t=t||5,I0(x0({lat:e[1],lon:e[0]}),t)}function w0(e){var t=Kh(Ju(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function Xh(e){var t=Kh(Ju(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Yh(e){return e*(Math.PI/180)}function Wu(e){return 180*(e/Math.PI)}function x0(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,a,h,l,c,u,d,p=Yh(t),m=Yh(r),g,v;v=Math.floor((r+180)/6)+1,r===180&&(v=60),t>=56&&t<64&&r>=3&&r<12&&(v=32),t>=72&&t<84&&(r>=0&&r<9?v=31:r>=9&&r<21?v=33:r>=21&&r<33?v=35:r>=33&&r<42&&(v=37)),o=(v-1)*6-180+3,g=Yh(o),a=s/(1-s),h=i/Math.sqrt(1-s*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),c=a*Math.cos(p)*Math.cos(p),u=Math.cos(p)*(m-g),d=i*((1-s/4-3*s*s/64-5*s*s*s/256)*p-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*p)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*p)-35*s*s*s/3072*Math.sin(6*p));var I=n*h*(u+(1-l+c)*u*u*u/6+(5-18*l+l*l+72*c-58*a)*u*u*u*u*u/120)+5e5,z=n*(d+h*Math.tan(p)*(u*u/2+(5-l+9*c+4*c*c)*u*u*u*u/24+(61-58*l+l*l+600*c-330*a)*u*u*u*u*u*u/720));return t<0&&(z+=1e7),{northing:Math.round(z),easting:Math.round(I),zoneNumber:v,zoneLetter:M0(t)}}function Kh(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,a=.00669438,h,l=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),c,u,d,p,m,g,v,I,z,$=r-5e5,nt=t;i<"N"&&(nt-=1e7),v=(s-1)*6-180+3,h=a/(1-a),g=nt/n,I=g/(o*(1-a/4-3*a*a/64-5*a*a*a/256)),z=I+(3*l/2-27*l*l*l/32)*Math.sin(2*I)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*I)+151*l*l*l/96*Math.sin(6*I),c=o/Math.sqrt(1-a*Math.sin(z)*Math.sin(z)),u=Math.tan(z)*Math.tan(z),d=h*Math.cos(z)*Math.cos(z),p=o*(1-a)/Math.pow(1-a*Math.sin(z)*Math.sin(z),1.5),m=$/(c*n);var K=z-c*Math.tan(z)/p*(m*m/2-(5+3*u+10*d-4*d*d-9*h)*m*m*m*m/24+(61+90*u+298*d+45*u*u-252*h-3*d*d)*m*m*m*m*m*m/720);K=Wu(K);var tt=(m-(1+2*u+d)*m*m*m/6+(5-2*d+28*u-3*d*d+8*h+24*u*u)*m*m*m*m*m/120)/Math.cos(z);tt=v+Wu(tt);var Ct;if(e.accuracy){var gt=Kh({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Ct={top:gt.lat,right:gt.lon,bottom:K,left:tt}}else Ct={lat:K,lon:tt};return Ct}function M0(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function I0(e,t){var r="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+S0(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function S0(e,t,r){var i=Yu(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return B0(s,n,i)}function Yu(e){var t=e%Gu;return t===0&&(t=Gu),t}function B0(e,t,r){var i=r-1,s=Hu.charCodeAt(i),n=qu.charCodeAt(i),o=s+e-1,a=n+t,h=!1;o>On&&(o=o-On+Ds-1,h=!0),(o===ye||s<ye&&o>ye||(o>ye||s<ye)&&h)&&o++,(o===Pe||s<Pe&&o>Pe||(o>Pe||s<Pe)&&h)&&(o++,o===ye&&o++),o>On&&(o=o-On+Ds-1),a>Tn?(a=a-Tn+Ds-1,h=!0):h=!1,(a===ye||n<ye&&a>ye||(a>ye||n<ye)&&h)&&a++,(a===Pe||n<Pe&&a>Pe||(a>Pe||n<Pe)&&h)&&(a++,a===ye&&a++),a>Tn&&(a=a-Tn+Ds-1);var l=String.fromCharCode(o)+String.fromCharCode(a);return l}function Ju(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";for(var t=e.length,r=null,i="",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+e;var a=e.charAt(n++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+e;r=e.substring(n,n+=2);for(var h=Yu(o),l=A0(r.charAt(0),h),c=D0(r.charAt(1),h);c<T0(a);)c+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
16
+ ]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new dt(r,i.map(s=>new rt(r,s)))}slice(t,r){let i=this.schema;[t,r]=Hs({length:this.numRows},t,r);let s=Ao(this.data,this._offsets,t,r);return new dt(i,s.map(n=>new rt(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(i=>i.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=U({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new j(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=n[t].clone({type:r.type}),a=this.schema.fields.map((h,l)=>this.getChildAt(l));[n[t],a[t]]=[o,r],[i,s]=ta(i,a)}return new dt(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new dt(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((a,h,l)=>{let[c,u]=a,d=r.findIndex(p=>p.name===h.name);return~d?u[d]=l:c.push(l),a},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((a,h)=>[h,s[h]]).map(([a,h])=>h===void 0?this.getChildAt(a):t.getChildAt(h)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new dt(...ta(n,o))}};zc=Symbol.toStringTag;dt[zc]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=us(Ys),e.get=us(xt.getVisitFn(f.Struct)),e.set=Do(Rt.getVisitFn(f.Struct)),e.indexOf=To(wi.getVisitFn(f.Struct)),"Table"))(dt.prototype);var Vc,rt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof W))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=U({nullCount:0,type:new Q(this.schema.fields),children:this.schema.fields.map(r=>U({type:r.type,nullCount:0}))})]=t,!(this.data instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=jc(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((h,l,c)=>(h.children[c]=r[l],h.length=Math.max(h.length,r[l].length),h.fields[c]=P.new({name:l,type:r[l].type,nullable:!0}),h),{length:0,fields:new Array,children:new Array}),o=new W(i),a=U({type:new Q(i),length:n,children:s,nullCount:0});[this.schema,this.data]=jc(o,a.children,n);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=kc(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return xt.visit(this.data,t)}at(t){return this.get(yi(t,this.numRows))}set(t,r){return Rt.visit(this.data,t,r)}indexOf(t,r){return wi.visit(this.data,t,r)}[Symbol.iterator](){return fs.visit(new j([this.data]))}toArray(){return[...this]}concat(...t){return new dt(this.schema,[this,...t])}slice(t,r){let[i]=new j([this.data]).slice(t,r).data;return new rt(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new j([this.data.children[t]]):null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=s.children.slice(),a=n[t].clone({type:r.type});[n[t],o[t]]=[a,r.data[0]],i=new W(n,new Map(this.schema.metadata)),s=U({type:new Q(n),children:o})}return new rt(i,s)}select(t){let r=this.schema.select(t),i=new Q(r.fields),s=[];for(let n of t){let o=this.schema.fields.findIndex(a=>a.name===n);~o&&(s[o]=this.data.children[o])}return new rt(r,U({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=U({type:new Q(r.fields),length:this.numRows,children:i});return new rt(r,s)}};Vc=Symbol.toStringTag;rt[Vc]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(rt.prototype);function jc(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[a,h]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(s[a]=h.clone({nullable:!0}),n[a]=(i=l?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:U({type:h.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),U({type:new Q(s),length:r,children:n})]}function kc(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++n<o;){let{type:a}=e[n],h=t[n];for(let l of[h,...((s=h?.dictionary)===null||s===void 0?void 0:s.data)||[]])kc(a.children,l?.children,r);if(w.isDictionary(a)){let{id:l}=a;if(!r.has(l))h?.dictionary&&r.set(l,h.dictionary);else if(r.get(l)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Ti=class extends rt{constructor(t){let r=t.fields.map(s=>U({type:s.type})),i=U({type:new Q(t.fields),nullCount:0,children:r});super(t,i)}};var vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,H.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return vt.startMessage(t),vt.addVersion(t,r),vt.addHeaderType(t,i),vt.addHeader(t,s),vt.addBodyLength(t,n),vt.addCustomMetadata(t,o),vt.endMessage(t)}};var Th=class extends B{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return pr.startNull(r),pr.endNull(r)}visitInt(t,r){return Tt.startInt(r),Tt.addBitWidth(r,t.bitWidth),Tt.addIsSigned(r,t.isSigned),Tt.endInt(r)}visitFloat(t,r){return ie.startFloatingPoint(r),ie.addPrecision(r,t.precision),ie.endFloatingPoint(r)}visitBinary(t,r){return lr.startBinary(r),lr.endBinary(r)}visitLargeBinary(t,r){return ur.startLargeBinary(r),ur.endLargeBinary(r)}visitBool(t,r){return cr.startBool(r),cr.endBool(r)}visitUtf8(t,r){return yr.startUtf8(r),yr.endUtf8(r)}visitLargeUtf8(t,r){return fr.startLargeUtf8(r),fr.endLargeUtf8(r)}visitDecimal(t,r){return Ot.startDecimal(r),Ot.addScale(r,t.scale),Ot.addPrecision(r,t.precision),Ot.addBitWidth(r,t.bitWidth),Ot.endDecimal(r)}visitDate(t,r){return Qt.startDate(r),Qt.addUnit(r,t.unit),Qt.endDate(r)}visitTime(t,r){return zt.startTime(r),zt.addUnit(r,t.unit),zt.addBitWidth(r,t.bitWidth),zt.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return jt.startTimestamp(r),jt.addUnit(r,t.unit),i!==void 0&&jt.addTimezone(r,i),jt.endTimestamp(r)}visitInterval(t,r){return se.startInterval(r),se.addUnit(r,t.unit),se.endInterval(r)}visitDuration(t,r){return te.startDuration(r),te.addUnit(r,t.unit),te.endDuration(r)}visitList(t,r){return dr.startList(r),dr.endList(r)}visitStruct(t,r){return mr.startStruct_(r),mr.endStruct_(r)}visitUnion(t,r){Et.startTypeIdsVector(r,t.typeIds.length);let i=Et.createTypeIdsVector(r,t.typeIds);return Et.startUnion(r),Et.addMode(r,t.mode),Et.addTypeIds(r,i),Et.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return ve.startDictionaryEncoding(r),ve.addId(r,BigInt(t.id)),ve.addIsOrdered(r,t.isOrdered),i!==void 0&&ve.addIndexType(r,i),ve.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ee.startFixedSizeBinary(r),ee.addByteWidth(r,t.byteWidth),ee.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return re.startFixedSizeList(r),re.addListSize(r,t.listSize),re.endFixedSizeList(r)}visitMap(t,r){return ne.startMap(r),ne.addKeysSorted(r,t.keysSorted),ne.endMap(r)}},ea=new Th;function qc(e,t=new Map){return new W(sm(e,t),ra(e.metadata),t)}function Oh(e){return new Ut(e.count,Yc(e.columns),Jc(e.columns))}function $c(e){return new me(Oh(e.data),e.id,e.isDelta)}function sm(e,t){return(e.fields||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function Gc(e,t){return(e.children||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function Yc(e){return(e||[]).reduce((t,r)=>[...t,new Ue(r.count,nm(r.VALIDITY)),...Yc(r.children)],[])}function Jc(e,t=[]){for(let r=-1,i=(e||[]).length;++r<i;){let s=e[r];s.VALIDITY&&t.push(new pe(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new pe(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new pe(t.length,s.OFFSET.length)),s.DATA&&t.push(new pe(t.length,s.DATA.length)),t=Jc(s.children,t)}return t}function nm(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function Xc(e,t){let r,i,s,n,o,a;return!t||!(n=e.dictionary)?(o=Hc(e,Gc(e,t)),s=new P(e.name,o,e.nullable,ra(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?Wc(i):new we,a=new ce(t.get(r),i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ra(e.metadata))):(i=(i=n.indexType)?Wc(i):new we,t.set(r,o=Hc(e,Gc(e,t))),a=new ce(o,i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ra(e.metadata))),s||null}function ra(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function Wc(e){return new _t(e.isSigned,e.bitWidth)}function Hc(e,t){let r=e.type.name;switch(r){case"NONE":return new Nt;case"null":return new Nt;case"binary":return new Oe;case"largebinary":return new gr;case"utf8":return new Ee;case"largeutf8":return new br;case"bool":return new Ne;case"list":return new ae((t||[])[0]);case"struct":return new Q(t||[]);case"struct_":return new Q(t||[])}switch(r){case"int":{let i=e.type;return new _t(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=e.type;return new oe(st[i.precision])}case"decimal":{let i=e.type;return new Fe(i.scale,i.precision,i.bitWidth)}case"date":{let i=e.type;return new xe(ft[i.unit])}case"time":{let i=e.type;return new Ht(M[i.unit],i.bitWidth)}case"timestamp":{let i=e.type;return new qt(M[i.unit],i.timezone)}case"interval":{let i=e.type;return new Me(bt[i.unit])}case"duration":{let i=e.type;return new _r(M[i.unit])}case"union":{let i=e.type,[s,...n]=(i.mode+"").toLowerCase(),o=s.toUpperCase()+n.join("");return new Le(at[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=e.type;return new vr(i.byteWidth)}case"fixedsizelist":{let i=e.type;return new he(i.listSize,(t||[])[0])}case"map":{let i=e.type;return new le((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var om=Tr,am=Wt,It=class{static fromJSON(t,r){let i=new It(0,et.V5,r);return i._createHeader=hm(t,r),i}static decode(t){t=new am(N(t));let r=vt.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new It(i,s,n);return o._createHeader=lm(r,n),o}static encode(t){let r=new om,i=-1;return t.isSchema()?i=W.encode(r,t.header()):t.isRecordBatch()?i=Ut.encode(r,t.header()):t.isDictionaryBatch()&&(i=me.encode(r,t.header())),vt.startMessage(r),vt.addVersion(r,et.V5),vt.addHeader(r,i),vt.addHeaderType(r,t.headerType),vt.addBodyLength(r,BigInt(t.bodyLength)),vt.finishMessageBuffer(r,vt.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof W)return new It(0,et.V5,H.Schema,t);if(t instanceof Ut)return new It(r,et.V5,H.RecordBatch,t);if(t instanceof me)return new It(r,et.V5,H.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===H.Schema}isRecordBatch(){return this.headerType===H.RecordBatch}isDictionaryBatch(){return this.headerType===H.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Y(t)}},Ut=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=Y(t)}},me=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(t,r,i=!1){this._data=t,this._isDelta=i,this._id=Y(r)}},pe=class{constructor(t,r){this.offset=Y(t),this.length=Y(r)}},Ue=class{constructor(t,r){this.length=Y(t),this.nullCount=Y(r)}};function hm(e,t){return()=>{switch(t){case H.Schema:return W.fromJSON(e);case H.RecordBatch:return Ut.fromJSON(e);case H.DictionaryBatch:return me.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}function lm(e,t){return()=>{switch(t){case H.Schema:return W.decode(e.header(new pt),new Map,e.version());case H.RecordBatch:return Ut.decode(e.header(new Pt),e.version());case H.DictionaryBatch:return me.decode(e.header(new Te),e.version())}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}P.encode=vm;P.decode=bm;P.fromJSON=Xc;W.encode=_m;W.decode=cm;W.fromJSON=qc;Ut.encode=wm;Ut.decode=um;Ut.fromJSON=Oh;me.encode=xm;me.decode=fm;me.fromJSON=$c;Ue.encode=Mm;Ue.decode=pm;pe.encode=Im;pe.decode=dm;function cm(e,t=new Map,r=et.V5){let i=gm(e,t);return new W(i,ia(e),t,r)}function um(e,t=et.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Ut(e.length(),mm(e),ym(e,t))}function fm(e,t=et.V5){return new me(Ut.decode(e.data(),t),e.id(),e.isDelta())}function dm(e){return new pe(e.offset(),e.length())}function pm(e){return new Ue(e.length(),e.nullCount())}function mm(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++i<n;)(r=e.nodes(i))&&(t[++s]=Ue.decode(r));return t}function ym(e,t){let r=[];for(let i,s=-1,n=-1,o=e.buffersLength();++s<o;)(i=e.buffers(s))&&(t<et.V4&&(i.bb_pos+=8*(s+1)),r[++n]=pe.decode(i));return r}function gm(e,t){let r=[];for(let i,s=-1,n=-1,o=e.fieldsLength();++s<o;)(i=e.fields(s))&&(r[++n]=P.decode(i,t));return r}function Kc(e,t){let r=[];for(let i,s=-1,n=-1,o=e.childrenLength();++s<o;)(i=e.children(s))&&(r[++n]=P.decode(i,t));return r}function bm(e,t){let r,i,s,n,o,a;return!t||!(a=e.dictionary())?(s=Qc(e,Kc(e,t)),i=new P(e.name(),s,e.nullable(),ia(e))):t.has(r=Y(a.id()))?(n=(n=a.indexType())?Zc(n):new we,o=new ce(t.get(r),n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ia(e))):(n=(n=a.indexType())?Zc(n):new we,t.set(r,s=Qc(e,Kc(e,t))),o=new ce(s,n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ia(e))),i||null}function ia(e){let t=new Map;if(e)for(let r,i,s=-1,n=Math.trunc(e.customMetadataLength());++s<n;)(r=e.customMetadata(s))&&(i=r.key())!=null&&t.set(i,r.value());return t}function Zc(e){return new _t(e.isSigned(),e.bitWidth())}function Qc(e,t){let r=e.typeType();switch(r){case ot.NONE:return new Nt;case ot.Null:return new Nt;case ot.Binary:return new Oe;case ot.LargeBinary:return new gr;case ot.Utf8:return new Ee;case ot.LargeUtf8:return new br;case ot.Bool:return new Ne;case ot.List:return new ae((t||[])[0]);case ot.Struct_:return new Q(t||[])}switch(r){case ot.Int:{let i=e.type(new Tt);return new _t(i.isSigned(),i.bitWidth())}case ot.FloatingPoint:{let i=e.type(new ie);return new oe(i.precision())}case ot.Decimal:{let i=e.type(new Ot);return new Fe(i.scale(),i.precision(),i.bitWidth())}case ot.Date:{let i=e.type(new Qt);return new xe(i.unit())}case ot.Time:{let i=e.type(new zt);return new Ht(i.unit(),i.bitWidth())}case ot.Timestamp:{let i=e.type(new jt);return new qt(i.unit(),i.timezone())}case ot.Interval:{let i=e.type(new se);return new Me(i.unit())}case ot.Duration:{let i=e.type(new te);return new _r(i.unit())}case ot.Union:{let i=e.type(new Et);return new Le(i.mode(),i.typeIdsArray()||[],t||[])}case ot.FixedSizeBinary:{let i=e.type(new ee);return new vr(i.byteWidth())}case ot.FixedSizeList:{let i=e.type(new re);return new he(i.listSize(),(t||[])[0])}case ot.Map:{let i=e.type(new ne);return new le((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${ot[r]}" (${r})`)}function _m(e,t){let r=t.fields.map(n=>P.encode(e,n));pt.startFieldsVector(e,r.length);let i=pt.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?pt.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let a=e.createString(`${n}`),h=e.createString(`${o}`);return ht.startKeyValue(e),ht.addKey(e,a),ht.addValue(e,h),ht.endKeyValue(e)})):-1;return pt.startSchema(e),pt.addFields(e,i),pt.addEndianness(e,Sm?Yr.Little:Yr.Big),s!==-1&&pt.addCustomMetadata(e,s),pt.endSchema(e)}function vm(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;w.isDictionary(n)?(o=n.dictionary.typeId,s=ea.visit(n,e),i=ea.visit(n.dictionary,e)):i=ea.visit(n,e);let a=(n.children||[]).map(c=>P.encode(e,c)),h=wt.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(e,[...t.metadata].map(([c,u])=>{let d=e.createString(`${c}`),p=e.createString(`${u}`);return ht.startKeyValue(e),ht.addKey(e,d),ht.addValue(e,p),ht.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),wt.startField(e),wt.addType(e,i),wt.addTypeType(e,o),wt.addChildren(e,h),wt.addNullable(e,!!t.nullable),r!==-1&&wt.addName(e,r),s!==-1&&wt.addDictionary(e,s),l!==-1&&wt.addCustomMetadata(e,l),wt.endField(e)}function wm(e,t){let r=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(e,r.length);for(let o of r.slice().reverse())Ue.encode(e,o);let s=e.endVector();Pt.startBuffersVector(e,i.length);for(let o of i.slice().reverse())pe.encode(e,o);let n=e.endVector();return Pt.startRecordBatch(e),Pt.addLength(e,BigInt(t.length)),Pt.addNodes(e,s),Pt.addBuffers(e,n),Pt.endRecordBatch(e)}function xm(e,t){let r=Ut.encode(e,t.data);return Te.startDictionaryBatch(e),Te.addId(e,BigInt(t.id)),Te.addIsDelta(e,t.isDelta),Te.addData(e,r),Te.endDictionaryBatch(e)}function Mm(e,t){return Wi.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Im(e,t){return Gi.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Sm=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var Nh=e=>`Expected ${H[e]} Message in stream, but was null or length 0.`,Fh=e=>`Header pointer of flatbuffer-encoded ${H[e]} Message is null or length 0.`,tu=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eu=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,ws=class{constructor(t){this.source=t instanceof Mr?t:new Mr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?lt:t.value===-1&&(t=this.readMetadataLength()).done?lt:(t=this.readMetadata(t.value)).done?lt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=N(this.source.read(t));if(r.byteLength<t)throw new Error(eu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=H.Schema,i=this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Fh(r));return s}readMetadataLength(){let t=this.source.read(sa),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}}readMetadata(t){let r=this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(tu(t,r.byteLength));return{done:!1,value:It.decode(r)}}},Mn=class{constructor(t,r){this.source=t instanceof fe?t:Yn(t)?new Qr(t,r):new fe(t)}[Symbol.asyncIterator](){return this}next(){return x(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?lt:t.value===-1&&(t=yield this.readMetadataLength()).done?lt:(t=yield this.readMetadata(t.value)).done?lt:t})}throw(t){return x(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return x(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return x(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value})}readMessageBody(t){return x(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=N(yield this.source.read(t));if(r.byteLength<t)throw new Error(eu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return x(this,arguments,void 0,function*(t=!1){let r=H.Schema,i=yield this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Fh(r));return s})}readMetadataLength(){return x(this,void 0,void 0,function*(){let t=yield this.source.read(sa),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}})}readMetadata(t){return x(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(tu(t,r.byteLength));return{done:!1,value:It.decode(r)}})}},In=class extends ws{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Js?t:new Js(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:It.fromJSON(t.schema,H.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:It.fromJSON(r,H.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:It.fromJSON(r,H.RecordBatch)}}return this._body=[],lt}readMessageBody(t){return r(this._body);function r(i){return(i||[]).reduce((s,n)=>[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value}readSchema(){let t=H.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(Fh(t));return i}},sa=4,Eh="ARROW1",xs=new Uint8Array(Eh.length);for(let e=0;e<Eh.length;e+=1)xs[e]=Eh.codePointAt(e);function na(e,t=0){for(let r=-1,i=xs.length;++r<i;)if(xs[r]!==e[t+r])return!1;return!0}var Ms=xs.length,Lh=Ms+sa,ru=Ms*2+sa;var Yt=class extends Mi{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Ve(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Lt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Yt?t:qn(t)?Am(t):Yn(t)?Om(t):Ve(t)?(()=>x(this,void 0,void 0,function*(){return yield Yt.from(yield t)}))():Jn(t)||Cs(t)||Kn(t)||Ae(t)?Tm(new fe(t)):Dm(new Mr(t))}static readAll(t){return t instanceof Yt?t.isSync()?iu(t):su(t):qn(t)||ArrayBuffer.isView(t)||ke(t)||$n(t)?iu(t):su(t)}},Pr=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return be(this,arguments,function*(){yield k(yield*Vi(je(this[Symbol.iterator]())))})}},Oi=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return x(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,a=je(this),h;h=yield a.next(),t=h.done,!t;o=!0){s=h.value,o=!1;let l=s;n.push(l)}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ei=class extends Pr{constructor(t){super(t),this._impl=t}},oa=class extends Oi{constructor(t){super(t),this._impl=t}},aa=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),s=U({type:new Q(this.schema.fields),length:t.length,children:i});return new rt(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,a=n.get(i),h=o.dictionaries.get(i),l=this._loadVectors(t.data,r,[h]);return(a&&s?a.concat(new j(l)):new j(l)).memoize()}_loadVectors(t,r,i){return new Zs(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},Is=class extends aa{constructor(t,r){super(r),this._reader=qn(t)?new In(this._handle=t):new ws(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=nu(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):lt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):lt}next(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ti(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ss=class extends aa{constructor(t,r){super(r),this._reader=new Mn(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return x(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return x(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=nu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):lt})}return(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):lt})}next(){return x(this,void 0,void 0,function*(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ti(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},ha=class extends Is{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Xs?t:new Xs(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-Lh,i=t.readInt32(r),s=t.readAt(r-i,i);return Nr.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},Rh=class extends Ss{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let i=typeof r[0]!="number"?r.shift():void 0,s=r[0]instanceof Map?r.shift():void 0;super(t instanceof Qr?t:new Qr(t,i),s)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return x(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return x(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return x(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}})}_readFooter(){return x(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-Lh,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return Nr.decode(s)})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},Uh=class extends Is{constructor(t,r){super(t,r)}_loadVectors(t,r,i){return new No(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function nu(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*iu(e){let t=Yt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function su(e){return be(this,arguments,function*(){let r=yield k(Yt.from(e));try{if(!(yield k(r.open({autoDestroy:!1}))).closed)do yield yield k(r);while(!(yield k(r.reset().open())).closed)}finally{yield k(r.cancel())}})}function Am(e){return new Pr(new Uh(e))}function Dm(e){let t=e.peek(Ms+7&-8);return t&&t.byteLength>=4?na(t)?new Ei(new ha(e.read())):new Pr(new Is(e)):new Pr(new Is(function*(){}()))}function Tm(e){return x(this,void 0,void 0,function*(){let t=yield e.peek(Ms+7&-8);return t&&t.byteLength>=4?na(t)?new Ei(new ha(yield e.read())):new Oi(new Ss(e)):new Oi(new Ss(function(){return be(this,arguments,function*(){})}()))})}function Om(e){return x(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Qr(e,t);return t>=ru&&na(yield r.readAt(0,Ms+7&-8))?new oa(new Rh(r)):new Oi(new Ss(r))})}var ct=class extends B{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof rt?n.data.children:n.data),i=new ct;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof j)return this.visitMany(t.data),this;let{type:r}=t;if(!w.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(w.isUnion(r))this.nodes.push(new Ue(i,0));else{let{nullCount:s}=t;w.isNull(r)||Ze.call(this,s<=0?new Uint8Array(0):bi(t.offset,i,t.nullBitmap)),this.nodes.push(new Ue(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ze(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new pe(this._byteLength,t)),this._byteLength+=t,this}function Em(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(Ze.call(this,s),r.mode===at.Sparse)return Ch.call(this,e);if(r.mode===at.Dense){if(e.offset<=0)return Ze.call(this,n),Ch.call(this,e);{let o=new Int32Array(i),a=Object.create(null),h=Object.create(null);for(let l,c,u=-1;++u<i;)(l=s[u])!==void 0&&((c=a[l])===void 0&&(c=a[l]=n[u]),o[u]=n[u]-c,h[l]=((t=h[l])!==null&&t!==void 0?t:0)+1);Ze.call(this,o),this.visitMany(e.children.map((l,c)=>{let u=r.typeIds[c],d=a[u],p=h[u];return l.slice(d,Math.min(i,p))}))}}return this}function Nm(e){let t;return e.nullCount>=e.length?Ze.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ze.call(this,bi(e.offset,e.length,t)):Ze.call(this,_i(e.values))}function zr(e){return Ze.call(this,e.values.subarray(0,e.length*e.stride))}function la(e){let{length:t,values:r,valueOffsets:i}=e,s=Y(i[0]),n=Y(i[t]),o=Math.min(n-s,r.byteLength-s);return Ze.call(this,Qn(-s,t+1,i)),Ze.call(this,r.subarray(s,s+o)),this}function Ph(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return Ze.call(this,Qn(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function Ch(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ct.prototype.visitBool=Nm;ct.prototype.visitInt=zr;ct.prototype.visitFloat=zr;ct.prototype.visitUtf8=la;ct.prototype.visitLargeUtf8=la;ct.prototype.visitBinary=la;ct.prototype.visitLargeBinary=la;ct.prototype.visitFixedSizeBinary=zr;ct.prototype.visitDate=zr;ct.prototype.visitTimestamp=zr;ct.prototype.visitTime=zr;ct.prototype.visitDecimal=zr;ct.prototype.visitList=Ph;ct.prototype.visitStruct=Ch;ct.prototype.visitUnion=Em;ct.prototype.visitInterval=zr;ct.prototype.visitDuration=zr;ct.prototype.visitFixedSizeList=Ph;ct.prototype.visitMap=Ph;var Ni=class extends Mi{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new xr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Gt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ve(t)?t.then(r=>this.writeAll(r)):Ae(t)?jh(this,t):zh(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof xr?this._sink=t:(this._sink=new xr,t&&wl(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&xl(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!Di(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof dt&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof rt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Di(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof rt?t instanceof Ti||this._writeRecordBatch(t):t instanceof dt?this.writeAll(t.batches):ke(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=It.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=n+o+i&~i,h=a-n-o;return t.headerType===H.RecordBatch?this._recordBatchBlocks.push(new Ke(a,t.bodyLength,this._position)):t.headerType===H.DictionaryBatch&&this._dictionaryBlocks.push(new Ke(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),n>0&&this._write(s),this._writePadding(h)}_write(t){if(this._started){let r=N(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(It.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(xs)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=ct.assemble(t),o=new Ut(t.numRows,i,s),a=It.from(o,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(n)}_writeDictionaryBatch(t,r,i=!1){let{byteLength:s,nodes:n,bufferRegions:o,buffers:a}=ct.assemble(new j([t])),h=new Ut(t.length,n,o),l=new me(h,r,i),c=It.from(l,s);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,i,s;for(let n=-1,o=t.length;++n<o;)(r=t[n])&&(i=r.byteLength)>0&&(this._write(r),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){var r,i;for(let[s,n]of t.dictionaries){let o=(r=n?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(s),h=(i=this._dictionaryDeltaOffsets.get(s))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,c]of o.entries())this._writeDictionaryBatch(c,s,l>0);else if(h<o.length)for(let l of o.slice(h))this._writeDictionaryBatch(l,s,!0);this._seenDictionaries.set(s,n),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Fi=class extends Ni{static writeAll(t,r){let i=new Fi(r);return Ve(t)?t.then(s=>i.writeAll(s)):Ae(t)?jh(i,t):zh(i,t)}},Li=class extends Ni{static writeAll(t){let r=new Li;return Ve(t)?t.then(i=>r.writeAll(i)):Ae(t)?jh(r,t):zh(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,i=!1){if(!i&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,i)}_writeFooter(t){let r=Nr.encode(new Nr(t,et.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function zh(e,t){let r=t;t instanceof dt&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function jh(e,t){return x(this,void 0,void 0,function*(){var r,i,s,n,o,a,h;try{for(r=!0,i=je(t);s=yield i.next(),n=s.done,!n;r=!0){h=s.value,r=!1;let l=h;e.write(l)}}catch(l){o={error:l}}finally{try{!r&&!n&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return e.finish()})}function ou(e,t){if(Ae(e))return Lm(e,t);if(ke(e))return Fm(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Fm(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){let h,l=null,c=o.desiredSize||null;for(;!(l=a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()}}function Lm(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return x(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return x(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return x(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){return x(this,void 0,void 0,function*(){let h,l=null,c=o.desiredSize||null;for(;!(l=yield a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()})}}function lu(e){return new Vh(e)}var Vh=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:i,["queueingStrategy"]:s="count"}=t,n=_l(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ir(n),this._getSize=s!=="bytes"?au:hu;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:h=>{this._maybeFlush(this._builder,this._controller=h)},start:h=>{this._maybeFlush(this._builder,this._controller=h)}},{highWaterMark:o,size:s!=="bytes"?au:hu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:h=>this._writeValueAndReturnChunkSize(h)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},au=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},hu=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function ca(e,t){let r=new xr,i=null,s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield r.close()})},start(a){return x(this,void 0,void 0,function*(){yield o(a,i||(i=yield n()))})},pull(a){return x(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return x(this,void 0,void 0,function*(){return yield(yield Yt.from(r)).open(t)})}function o(a,h){return x(this,void 0,void 0,function*(){let l=a.desiredSize,c=null;for(;!(c=yield h.next()).done;)if(a.enqueue(c.value),l!=null&&--l<=0)return;a.close()})}}function ua(e,t){let r=new this(e),i=new fe(r),s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return x(this,void 0,void 0,function*(){yield n(o)})},start(o){return x(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return x(this,void 0,void 0,function*(){let a=null,h=o.desiredSize;for(;a=yield i.read(h||null);)if(o.enqueue(a),h!=null&&(h-=a.byteLength)<=0)return;o.close()})}}var $m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},th),Ih),yh),eh),$a),mh),Xa),{compareSchemas:Di,compareFields:Cc,compareTypes:Pc});Lt.toDOMStream=ou;ut.throughDOM=lu;Yt.throughDOM=ca;Ei.throughDOM=ca;Pr.throughDOM=ca;Ni.throughDOM=ua;Li.throughDOM=ua;Fi.throughDOM=ua;function kh(e){return uu(e)}function uu(e){return new W(e.fields.map(t=>Bs(t)),Gh(e.metadata))}function Gh(e){return e?new Map(Object.entries(e)):new Map}function Bs(e){return new P(e.name,fu(e.type),e.nullable,Gh(e.metadata))}function fu(e){if(typeof e=="object")switch(e.type){case"decimal":return new Fe(e.precision,e.scale,e.bitWidth);case"map":let t=e.children.map(s=>Bs(s));return new le(t,e.keysSorted);case"list":let r=Bs(e.children[0]);return new ae(r);case"fixed-size-list":let i=Bs(e.children[0]);return new he(e.listSize,i);case"struct":return t=e.children.map(s=>Bs(s)),new Q(t);default:throw new Error("array type not supported")}switch(e){case"null":return new Nt;case"binary":return new Oe;case"bool":return new Ne;case"int8":return new oi;case"int16":return new ai;case"int32":return new we;case"int64":return new hi;case"uint8":return new li;case"uint16":return new ci;case"uint32":return new ui;case"uint64":return new fi;case"float16":return new di;case"float32":return new pi;case"float64":return new mi;case"utf8":return new Ee;case"date-day":return new Yi;case"date-millisecond":return new Ji;case"time-second":return new Xi;case"time-millisecond":return new Ki;case"time-microsecond":return new Zi;case"time-nanosecond":return new Qi;case"timestamp-second":return new ts;case"timestamp-millisecond":return new es;case"timestamp-microsecond":return new rs;case"timestamp-nanosecond":return new is;case"interval-daytime":return new ss;case"interval-yearmonth":return new ns;default:throw new Error("array type not supported")}}var Sn=class{schema;arrowSchema;arrowBuilders;length;constructor(t){this.schema=t,this.arrowSchema=kh(t),this.arrowBuilders=this.arrowSchema.fields.map(r=>Ir({type:r.type,nullValues:[null]})),this.length=0}addObjectRow(t){for(let r=0;r<this.arrowBuilders.length;r++){let i=this.schema.fields[r].name,s=t[i];this.arrowBuilders[r].append(s)}this.length++}addArrayRow(t){for(let r=0;r<this.arrowBuilders.length;r++)this.arrowBuilders[r].append(t[r]);this.length++}firstBatch(){let t=this._getArrowRecordBatch();return t.numCols!==0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}flushBatch(){let t=this._getArrowRecordBatch();return t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishBatch(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishTable(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),{shape:"arrow-table",schema:this.schema,data:new dt(t)}}_getArrowRecordBatch(){let{arrowBuilders:t,arrowSchema:r}=this,i=t.map(h=>h.flush()),s=i[0].length,n=new Q(r.fields),o=new q(n,0,s,0,void 0,i);return new rt(r,o)}};function Wh(e,t,r){switch(e.type){case"Point":return Jm(e,t,r);case"LineString":return Ym(e,t,r);case"Polygon":return du(e,t,r);default:let i=e;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function du(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.polygonIndices.value.filter(h=>h>=t&&h<=r),n=e.primitivePolygonIndices.value.filter(h=>h>=t&&h<=r);if(!(s.length>2)){let h=[];for(let l=0;l<n.length-1;l++){let c=n[l],u=n[l+1],d=fa(i,c,u);h.push(d)}return{type:"Polygon",coordinates:h}}let a=[];for(let h=0;h<s.length-1;h++){let l=s[h],c=s[h+1],u=du(e,l,c).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function Ym(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:fa(i,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let h=fa(i,s[a],s[a+1]);o.push(h)}return{type:"MultiLineString",coordinates:o}}function Jm(e,t,r){let{positions:i}=e,s=fa(i,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function fa(e,t,r){t=t||0,r=r||e.value.length/e.size;let i=[];for(let s=t;s<r;s++){let n=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)n.push(Number(e.value[o]));i.push(n)}return i}function pu(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}var Qe=1,tr=2,mu=4,Bn=5,Ri=484813681109536e-20,y=Math.PI/2,yu=.16666666666666666,gu=.04722222222222222,bu=.022156084656084655,b=1e-10,Bt=.017453292519943295,er=57.29577951308232,J=Math.PI/4,An=Math.PI*2,mt=3.14159265359;var Jt={};Jt.greenwich=0;Jt.lisbon=-9.131906111111;Jt.paris=2.337229166667;Jt.bogota=-74.080916666667;Jt.madrid=-3.687938888889;Jt.rome=12.452333333333;Jt.bern=7.439583333333;Jt.jakarta=106.807719444444;Jt.ferro=-17.666666666667;Jt.brussels=4.367975;Jt.stockholm=18.058277777778;Jt.athens=23.7163375;Jt.oslo=10.722916666667;var _u={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var vu=/[\s_\-\/\(\)]/g;function Se(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(vu,""),s=-1,n,o;++s<r.length;)if(n=r[s],o=n.toLowerCase().replace(vu,""),o===i)return e[n]}function Dn(e){var t={},r=e.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,h){var l=h.split("=");return l.push(!0),a[l[0].toLowerCase()]=l[1],a},{}),i,s,n,o={proj:"projName",datum:"datumCode",rf:function(a){t.rf=parseFloat(a)},lat_0:function(a){t.lat0=a*Bt},lat_1:function(a){t.lat1=a*Bt},lat_2:function(a){t.lat2=a*Bt},lat_ts:function(a){t.lat_ts=a*Bt},lon_0:function(a){t.long0=a*Bt},lon_1:function(a){t.long1=a*Bt},lon_2:function(a){t.long2=a*Bt},alpha:function(a){t.alpha=parseFloat(a)*Bt},lonc:function(a){t.longc=a*Bt},x_0:function(a){t.x0=parseFloat(a)},y_0:function(a){t.y0=parseFloat(a)},k_0:function(a){t.k0=parseFloat(a)},k:function(a){t.k0=parseFloat(a)},a:function(a){t.a=parseFloat(a)},b:function(a){t.b=parseFloat(a)},r_a:function(){t.R_A=!0},zone:function(a){t.zone=parseInt(a,10)},south:function(){t.utmSouth=!0},towgs84:function(a){t.datum_params=a.split(",").map(function(h){return parseFloat(h)})},to_meter:function(a){t.to_meter=parseFloat(a)},units:function(a){t.units=a;var h=Se(_u,a);h&&(t.to_meter=h.to_meter)},from_greenwich:function(a){t.from_greenwich=a*Bt},pm:function(a){var h=Se(Jt,a);t.from_greenwich=(h||parseFloat(a))*Bt},nadgrids:function(a){a==="@null"?t.datumCode="none":t.nadgrids=a},axis:function(a){var h="ewnsud";a.length===3&&h.indexOf(a.substr(0,1))!==-1&&h.indexOf(a.substr(1,1))!==-1&&h.indexOf(a.substr(2,1))!==-1&&(t.axis=a)}};for(i in r)s=r[i],i in o?(n=o[i],typeof n=="function"?n(s):t[n]=s):t[i]=s;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var wu=Qm,Tn=1,xu=2,Mu=3,da=4,Iu=5,Hh=-1,Xm=/\s/,Km=/[A-Za-z]/,Zm=/[A-Za-z84_]/,pa=/[,\]]/,Su=/[\d\.E\-\+]/;function jr(e){if(typeof e!="string")throw new Error("not a string");this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Tn}jr.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==da)for(;Xm.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Tn:return this.neutral(e);case xu:return this.keyword(e);case da:return this.quoted(e);case Iu:return this.afterquote(e);case Mu:return this.number(e);case Hh:return}};jr.prototype.afterquote=function(e){if(e==='"'){this.word+='"',this.state=da;return}if(pa.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in afterquote yet, index '+this.place)};jr.prototype.afterItem=function(e){if(e===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Tn;return}if(e==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Tn,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Hh);return}};jr.prototype.number=function(e){if(Su.test(e)){this.word+=e;return}if(pa.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in number yet, index '+this.place)};jr.prototype.quoted=function(e){if(e==='"'){this.state=Iu;return}this.word+=e};jr.prototype.keyword=function(e){if(Zm.test(e)){this.word+=e;return}if(e==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Tn;return}if(pa.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in keyword yet, index '+this.place)};jr.prototype.neutral=function(e){if(Km.test(e)){this.word=e,this.state=xu;return}if(e==='"'){this.word="",this.state=da;return}if(Su.test(e)){this.word=e,this.state=Mu;return}if(pa.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in neutral yet, index '+this.place)};jr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Hh)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Qm(e){var t=new jr(e);return t.output()}function Bu(e,t,r){Array.isArray(t)&&(r.unshift(t),t=null);var i=t?{}:e,s=r.reduce(function(n,o){return Ui(o,n),n},i);t&&(e[t]=s)}function Ui(e,t){if(!Array.isArray(e)){t[e]=!0;return}var r=e.shift();if(r==="PARAMETER"&&(r=e.shift()),e.length===1){if(Array.isArray(e[0])){t[r]={},Ui(e[0],t[r]);return}t[r]=e[0];return}if(!e.length){t[r]=!0;return}if(r==="TOWGS84"){t[r]=e;return}if(r==="AXIS"){r in t||(t[r]=[]),t[r].push(e);return}Array.isArray(r)||(t[r]={});var i;switch(r){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[r]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ui(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ui(e[3],t[r]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":e[0]=["name",e[0]],Bu(t,r,e);return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return Ui(e,t[r]);return Bu(t,r,e)}}var t0=.017453292519943295;function e0(e,t){var r=t[0],i=t[1];!(r in e)&&i in e&&(e[r]=e[i],t.length===3&&(e[r]=t[2](e[r])))}function Br(e){return e*t0}function r0(e){if(e.type==="GEOGCS"?e.projName="longlat":e.type==="LOCAL_CS"?(e.projName="identity",e.local=!0):typeof e.PROJECTION=="object"?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.AXIS){for(var t="",r=0,i=e.AXIS.length;r<i;++r){var s=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?t+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?t+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?t+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(e.axis=t)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.UNIT.convert&&(e.type==="GEOGCS"?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var n=e.GEOGCS;e.type==="GEOGCS"&&(n=e),n&&(n.DATUM?e.datumCode=n.DATUM.name.toLowerCase():e.datumCode=n.name.toLowerCase(),e.datumCode.slice(0,2)==="d_"&&(e.datumCode=e.datumCode.slice(2)),(e.datumCode==="new_zealand_geodetic_datum_1949"||e.datumCode==="new_zealand_1949")&&(e.datumCode="nzgd49"),(e.datumCode==="wgs_1984"||e.datumCode==="world_geodetic_system_1984")&&(e.PROJECTION==="Mercator_Auxiliary_Sphere"&&(e.sphere=!0),e.datumCode="wgs84"),e.datumCode.slice(-6)==="_ferro"&&(e.datumCode=e.datumCode.slice(0,-6)),e.datumCode.slice(-8)==="_jakarta"&&(e.datumCode=e.datumCode.slice(0,-8)),~e.datumCode.indexOf("belge")&&(e.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(e.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),e.ellps.toLowerCase().slice(0,13)==="international"&&(e.ellps="intl"),e.a=n.DATUM.SPHEROID.a,e.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(e.datum_params=n.DATUM.TOWGS84),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36"),~e.datumCode.indexOf("osni_1952")&&(e.datumCode="osni52"),(~e.datumCode.indexOf("tm65")||~e.datumCode.indexOf("geodetic_datum_of_1965"))&&(e.datumCode="ire65"),e.datumCode==="ch1903+"&&(e.datumCode="ch1903"),~e.datumCode.indexOf("israel")&&(e.datumCode="isr93")),e.b&&!isFinite(e.b)&&(e.b=e.a);function o(l){var c=e.to_meter||1;return l*c}var a=function(l){return e0(e,l)},h=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Br],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Br],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",Br],["lat0","latitude_of_origin",Br],["lat0","standard_parallel_1",Br],["lat1","standard_parallel_1",Br],["lat2","standard_parallel_2",Br],["azimuth","Azimuth"],["alpha","azimuth",Br],["srsCode","name"]];h.forEach(a),!e.long0&&e.longc&&(e.projName==="Albers_Conic_Equal_Area"||e.projName==="Lambert_Azimuthal_Equal_Area")&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(e.projName==="Stereographic_South_Pole"||e.projName==="Polar Stereographic (variant B)")?(e.lat0=Br(e.lat1>0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName==="Polar_Stereographic"&&(e.lat_ts=e.lat0,e.lat0=Br(e.lat0>0?90:-90))}function ma(e){var t=wu(e),r=t.shift(),i=t.shift();t.unshift(["name",i]),t.unshift(["type",r]);var s={};return Ui(t,s),r0(s),s}function Ce(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?Ce[e]=Dn(arguments[1]):Ce[e]=ma(arguments[1]):Ce[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ce.apply(t,i):Ce(i)});if(typeof e=="string"){if(e in Ce)return Ce[e]}else"EPSG"in e?Ce["EPSG:"+e.EPSG]=e:"ESRI"in e?Ce["ESRI:"+e.ESRI]=e:"IAU2000"in e?Ce["IAU2000:"+e.IAU2000]=e:console.log(e);return}}pu(Ce);var As=Ce;function i0(e){return typeof e=="string"}function s0(e){return e in As}var n0=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function o0(e){return n0.some(function(t){return e.indexOf(t)>-1})}var a0=["3857","900913","3785","102113"];function h0(e){var t=Se(e,"authority");if(t){var r=Se(t,"epsg");return r&&a0.indexOf(r)>-1}}function l0(e){var t=Se(e,"extension");if(t)return Se(t,"proj4")}function c0(e){return e[0]==="+"}function u0(e){if(i0(e)){if(s0(e))return As[e];if(o0(e)){var t=ma(e);if(h0(t))return As["EPSG:3857"];var r=l0(t);return r?Dn(r):t}if(c0(e))return Dn(e)}else return e}var Au=u0;function qh(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function kt(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function Ar(e){return e<0?-1:1}function _(e){return Math.abs(e)<=mt?e:e-Ar(e)*An}function Xt(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(y-t))/i}function Vr(e,t){for(var r=.5*e,i,s,n=y-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=y-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function f0(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function d0(e){var t=e.x,r=e.y;if(r*er>90&&r*er<-90&&t*er>180&&t*er<-180)return null;var i,s;if(Math.abs(Math.abs(r)-y)<=b)return null;if(this.sphere)i=this.x0+this.a*this.k0*_(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(J+.5*r));else{var n=Math.sin(r),o=Xt(this.e,r,n);i=this.x0+this.a*this.k0*_(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function p0(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=y-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=Vr(this.e,n),s===-9999)return null}return i=_(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var m0=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Du={init:f0,forward:d0,inverse:p0,names:m0};function y0(){}function Tu(e){return e}var g0=["longlat","identity"],Ou={init:y0,forward:Tu,inverse:Tu,names:g0};var b0=[Du,Ou],ya={},ga=[];function Eu(e,t){var r=ga.length;return e.names?(ga[r]=e,e.names.forEach(function(i){ya[i.toLowerCase()]=r}),this):(console.log(t),!0)}function _0(e){if(!e)return!1;var t=e.toLowerCase();if(typeof ya[t]<"u"&&ga[ya[t]])return ga[ya[t]]}function v0(){b0.forEach(Eu)}var Nu={start:v0,add:Eu,get:_0};var V={};V.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};V.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};V.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};V.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};V.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};V.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};V.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};V.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};V.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};V.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};V.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};V.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};V.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};V.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};V.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};V.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};V.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};V.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};V.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};V.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};V.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};V.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};V.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};V.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};V.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};V.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};V.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};V.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};V.hough={a:6378270,rf:297,ellipseName:"Hough"};V.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};V.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};V.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};V.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};V.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};V.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};V.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};V.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};V.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};V.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};V.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};V.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Fu=V.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};V.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Lu(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,a=0;i?(e*=1-o*(yu+o*(gu+o*bu)),s=e*e,o=0):a=Math.sqrt(o);var h=(s-n)/n;return{es:o,e:a,ep2:h}}function Ru(e,t,r,i,s){if(!e){var n=Se(V,i);n||(n=Fu),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)<b)&&(s=!0,t=e),{a:e,b:t,rf:r,sphere:s}}var At={};At.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};At.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};At.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};At.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};At.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};At.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};At.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};At.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};At.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};At.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};At.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};At.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};At.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};At.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};At.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};At.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};At.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function w0(e,t,r,i,s,n){var o={};return e===void 0||e==="none"?o.datum_type=Bn:o.datum_type=mu,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=Qe),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=tr,o.datum_params[3]*=Ri,o.datum_params[4]*=Ri,o.datum_params[5]*=Ri,o.datum_params[6]=o.datum_params[6]/1e6+1)),o.a=r,o.b=i,o.es=s,o.ep2=n,o}var Uu=w0;function Ds(e,t){if(!(this instanceof Ds))return new Ds(e);t=t||function(h){if(h)throw h};var r=Au(e);if(typeof r!="object"){t(e);return}var i=Ds.projections.get(r.projName);if(!i){t(e);return}if(r.datumCode&&r.datumCode!=="none"){var s=Se(At,r.datumCode);s&&(r.datum_params=s.towgs84?s.towgs84.split(","):null,r.ellps=s.ellipse,r.datumName=s.datumName?s.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var n=Ru(r.a,r.b,r.rf,r.ellps,r.sphere),o=Lu(n.a,n.b,n.rf,r.R_A),a=r.datum||Uu(r.datumCode,r.datum_params,n.a,n.b,o.es,o.ep2);qh(this,r),qh(this,i),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=a,this.init(),t(null,this)}Ds.projections=Nu;Ds.projections.start();var ti=Ds;function Cu(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===Qe?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===tr?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function ba(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,a,h,l;if(s<-y&&s>-1.001*y)s=-y;else if(s>y&&s<1.001*y)s=y;else{if(s<-y)return{x:-1/0,y:-1/0,z:e.z};if(s>y)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),a=Math.sin(s),l=Math.cos(s),h=a*a,o=r/Math.sqrt(1-t*h),{x:(o+n)*l*Math.cos(i),y:(o+n)*l*Math.sin(i),z:(o*(1-t)+n)*a}}function _a(e,t,r,i){var s=1e-12,n=s*s,o=30,a,h,l,c,u,d,p,m,g,v,I,z,$,nt=e.x,K=e.y,tt=e.z?e.z:0,Ct,gt,sr;if(a=Math.sqrt(nt*nt+K*K),h=Math.sqrt(nt*nt+K*K+tt*tt),a/r<s){if(Ct=0,h/r<s)return gt=y,sr=-i,{x:e.x,y:e.y,z:e.z}}else Ct=Math.atan2(K,nt);l=tt/h,c=a/h,u=1/Math.sqrt(1-t*(2-t)*c*c),m=c*(1-t)*u,g=l*u,$=0;do $++,p=r/Math.sqrt(1-t*g*g),sr=a*m+tt*g-p*(1-t*g*g),d=t*p/(p+sr),u=1/Math.sqrt(1-d*(2-d)*c*c),v=c*(1-d)*u,I=l*u,z=I*m-v*g,m=v,g=I;while(z*z>n&&$<o);return gt=Math.atan(I/Math.abs(v)),{x:Ct,y:gt,z:sr}}function Pu(e,t,r){if(t===Qe)return{x:e.x+r[0],y:e.y+r[1],z:e.z+r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6];return{x:l*(e.x-h*e.y+a*e.z)+i,y:l*(h*e.x+e.y-o*e.z)+s,z:l*(-a*e.x+o*e.y+e.z)+n}}}function zu(e,t,r){if(t===Qe)return{x:e.x-r[0],y:e.y-r[1],z:e.z-r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6],c=(e.x-i)/l,u=(e.y-s)/l,d=(e.z-n)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}function va(e){return e===Qe||e===tr}function ju(e,t,r){return Cu(e,t)||e.datum_type===Bn||t.datum_type===Bn||e.es===t.es&&e.a===t.a&&!va(e.datum_type)&&!va(t.datum_type)?r:(r=ba(r,e.es,e.a),va(e.datum_type)&&(r=Pu(r,e.datum_type,e.datum_params)),va(t.datum_type)&&(r=zu(r,t.datum_type,t.datum_params)),_a(r,t.es,t.a,t.b))}function $h(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,a,h,l={};for(h=0;h<3;h++)if(!(t&&h===2&&r.z===void 0))switch(h===0?(o=i,"ew".indexOf(e.axis[h])!==-1?a="x":a="y"):h===1?(o=s,"ns".indexOf(e.axis[h])!==-1?a="y":a="x"):(o=n,a="z"),e.axis[h]){case"e":case"w":case"n":case"s":l[a]=o;break;case"u":r[a]!==void 0&&(l.z=o);break;case"d":r[a]!==void 0&&(l.z=-o);break;default:return null}return l}function wa(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ku(e){Vu(e.x),Vu(e.y)}function Vu(e){if(typeof Number.isFinite=="function"){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if(typeof e!="number"||e!==e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function x0(e,t){return(e.datum.datum_type===Qe||e.datum.datum_type===tr)&&t.datumCode!=="WGS84"||(t.datum.datum_type===Qe||t.datum.datum_type===tr)&&e.datumCode!=="WGS84"}function Ci(e,t,r){var i;if(Array.isArray(r)&&(r=wa(r)),ku(r),e.datum&&t.datum&&x0(e,t)&&(i=new ti("WGS84"),r=Ci(e,i,r),e=i),e.axis!=="enu"&&(r=$h(e,!1,r)),e.projName==="longlat")r={x:r.x*Bt,y:r.y*Bt,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;return e.from_greenwich&&(r.x+=e.from_greenwich),r=ju(e.datum,t.datum,r),t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName==="longlat"?r={x:r.x*er,y:r.y*er,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),t.axis!=="enu"?$h(t,!0,r):r}var Gu=ti("WGS84");function Yh(e,t,r){var i,s,n;return Array.isArray(r)?(i=Ci(e,t,r)||{x:NaN,y:NaN},r.length>2?typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(r.splice(3)):[i.x,i.y,r[2]].concat(r.splice(3)):[i.x,i.y].concat(r.splice(2)):[i.x,i.y]):(s=Ci(e,t,r),n=Object.keys(r),n.length===2||n.forEach(function(o){if(typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;s[o]=r[o]}),s)}function Wu(e){return e instanceof ti?e:e.oProj?e.oProj:ti(e)}function M0(e,t,r){e=Wu(e);var i=!1,s;return typeof t>"u"?(t=e,e=Gu,i=!0):(typeof t.x<"u"||Array.isArray(t))&&(r=t,t=e,e=Gu,i=!0),t=Wu(t),r?Yh(e,t,r):(s={forward:function(n){return Yh(e,t,n)},inverse:function(n){return Yh(t,e,n)}},i&&(s.oProj=t),s)}var Be=M0;var Hu=6,$u="AJSAJS",Yu="AFAFAF",Ts=65,ye=73,Pe=79,On=86,En=90,Ju={forward:Xh,inverse:I0,toPoint:Kh};function Xh(e,t){return t=t||5,A0(S0({lat:e[1],lon:e[0]}),t)}function I0(e){var t=Zh(Ku(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function Kh(e){var t=Zh(Ku(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Jh(e){return e*(Math.PI/180)}function qu(e){return 180*(e/Math.PI)}function S0(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,a,h,l,c,u,d,p=Jh(t),m=Jh(r),g,v;v=Math.floor((r+180)/6)+1,r===180&&(v=60),t>=56&&t<64&&r>=3&&r<12&&(v=32),t>=72&&t<84&&(r>=0&&r<9?v=31:r>=9&&r<21?v=33:r>=21&&r<33?v=35:r>=33&&r<42&&(v=37)),o=(v-1)*6-180+3,g=Jh(o),a=s/(1-s),h=i/Math.sqrt(1-s*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),c=a*Math.cos(p)*Math.cos(p),u=Math.cos(p)*(m-g),d=i*((1-s/4-3*s*s/64-5*s*s*s/256)*p-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*p)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*p)-35*s*s*s/3072*Math.sin(6*p));var I=n*h*(u+(1-l+c)*u*u*u/6+(5-18*l+l*l+72*c-58*a)*u*u*u*u*u/120)+5e5,z=n*(d+h*Math.tan(p)*(u*u/2+(5-l+9*c+4*c*c)*u*u*u*u/24+(61-58*l+l*l+600*c-330*a)*u*u*u*u*u*u/720));return t<0&&(z+=1e7),{northing:Math.round(z),easting:Math.round(I),zoneNumber:v,zoneLetter:B0(t)}}function Zh(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,a=.00669438,h,l=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),c,u,d,p,m,g,v,I,z,$=r-5e5,nt=t;i<"N"&&(nt-=1e7),v=(s-1)*6-180+3,h=a/(1-a),g=nt/n,I=g/(o*(1-a/4-3*a*a/64-5*a*a*a/256)),z=I+(3*l/2-27*l*l*l/32)*Math.sin(2*I)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*I)+151*l*l*l/96*Math.sin(6*I),c=o/Math.sqrt(1-a*Math.sin(z)*Math.sin(z)),u=Math.tan(z)*Math.tan(z),d=h*Math.cos(z)*Math.cos(z),p=o*(1-a)/Math.pow(1-a*Math.sin(z)*Math.sin(z),1.5),m=$/(c*n);var K=z-c*Math.tan(z)/p*(m*m/2-(5+3*u+10*d-4*d*d-9*h)*m*m*m*m/24+(61+90*u+298*d+45*u*u-252*h-3*d*d)*m*m*m*m*m*m/720);K=qu(K);var tt=(m-(1+2*u+d)*m*m*m/6+(5-2*d+28*u-3*d*d+8*h+24*u*u)*m*m*m*m*m/120)/Math.cos(z);tt=v+qu(tt);var Ct;if(e.accuracy){var gt=Zh({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Ct={top:gt.lat,right:gt.lon,bottom:K,left:tt}}else Ct={lat:K,lon:tt};return Ct}function B0(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function A0(e,t){var r="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+D0(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function D0(e,t,r){var i=Xu(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return T0(s,n,i)}function Xu(e){var t=e%Hu;return t===0&&(t=Hu),t}function T0(e,t,r){var i=r-1,s=$u.charCodeAt(i),n=Yu.charCodeAt(i),o=s+e-1,a=n+t,h=!1;o>En&&(o=o-En+Ts-1,h=!0),(o===ye||s<ye&&o>ye||(o>ye||s<ye)&&h)&&o++,(o===Pe||s<Pe&&o>Pe||(o>Pe||s<Pe)&&h)&&(o++,o===ye&&o++),o>En&&(o=o-En+Ts-1),a>On?(a=a-On+Ts-1,h=!0):h=!1,(a===ye||n<ye&&a>ye||(a>ye||n<ye)&&h)&&a++,(a===Pe||n<Pe&&a>Pe||(a>Pe||n<Pe)&&h)&&(a++,a===ye&&a++),a>On&&(a=a-On+Ts-1);var l=String.fromCharCode(o)+String.fromCharCode(a);return l}function Ku(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";for(var t=e.length,r=null,i="",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+e;var a=e.charAt(n++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+e;r=e.substring(n,n+=2);for(var h=Xu(o),l=O0(r.charAt(0),h),c=E0(r.charAt(1),h);c<N0(a);)c+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
17
17
  of digits after the zone letter and two 100km letters - front
18
18
  half for easting meters, second half for
19
- northing meters`+e;var d=u/2,p=0,m=0,g,v,I,z,$;return d>0&&(g=1e5/Math.pow(10,d),v=e.substring(n,n+d),p=parseFloat(v)*g,I=e.substring(n+d),m=parseFloat(I)*g),z=p+l,$=m+c,{easting:z,northing:$,zoneLetter:a,zoneNumber:o,accuracy:g}}function A0(e,t){for(var r=Hu.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>On){if(s)throw"Bad character: "+e;r=Ds,s=!0}i+=1e5}return i}function D0(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=qu.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>Tn){if(s)throw"Bad character: "+e;r=Ds,s=!0}i+=1e5}return i}function T0(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}function Ts(e,t,r){if(!(this instanceof Ts))return new Ts(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e=="object")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e=="string"&&typeof t>"u"){var i=e.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ts.fromMGRS=function(e){return new Ts(Xh(e))};Ts.prototype.toMGRS=function(e){return Jh([this.x,this.y],e)};var Xu=Ts;var O0=1,E0=.25,Ku=.046875,Zu=.01953125,Qu=.01068115234375,N0=.75,F0=.46875,L0=.013020833333333334,R0=.007120768229166667,U0=.3645833333333333,C0=.005696614583333333,P0=.3076171875;function wa(e){var t=[];t[0]=O0-e*(E0+e*(Ku+e*(Zu+e*Qu))),t[1]=e*(N0-e*(Ku+e*(Zu+e*Qu)));var r=e*e;return t[2]=r*(F0-e*(L0+e*R0)),r*=e,t[3]=r*(U0-e*C0),t[4]=r*e*P0,t}function Ci(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var z0=20;function xa(e,t,r){for(var i=1/(1-t),s=e,n=z0;n;--n){var o=Math.sin(s),a=1-t*o*o;if(a=(Ci(s,o,Math.cos(s),r)-e)*(a*Math.sqrt(a))*i,s-=a,Math.abs(a)<_)return s}return s}function j0(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=wa(this.es),this.ml0=Ci(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function k0(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n,o,a=Math.sin(r),h=Math.cos(r);if(this.es){var c=h*i,u=Math.pow(c,2),d=this.ep2*Math.pow(h,2),p=Math.pow(d,2),m=Math.abs(h)>_?Math.tan(r):0,g=Math.pow(m,2),v=Math.pow(g,2);s=1-this.es*Math.pow(a,2),c=c/Math.sqrt(s);var I=Ci(r,a,h,this.en);n=this.a*(this.k0*c*(1+u/6*(1-g+d+u/20*(5-18*g+v+14*d-58*g*d+u/42*(61+179*v-v*g-479*g)))))+this.x0,o=this.a*(this.k0*(I-this.ml0+a*i*c/2*(1+u/12*(5-g+9*d+4*p+u/30*(61+v-58*g+270*d-330*g*d+u/56*(1385+543*v-v*g-3111*g))))))+this.y0}else{var l=h*Math.sin(i);if(Math.abs(Math.abs(l)-1)<_)return 93;if(n=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,o=h*Math.cos(i)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(o),l>=1){if(l-1>_)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function V0(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=xa(t,this.es,this.en),Math.abs(r)<y){var u=Math.sin(r),d=Math.cos(r),p=Math.abs(d)>_?Math.tan(r):0,m=this.ep2*Math.pow(d,2),g=Math.pow(m,2),v=Math.pow(p,2),I=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var z=n*Math.sqrt(t)/this.k0,$=Math.pow(z,2);t=t*p,i=r-t*$/(1-this.es)*.5*(1-$/12*(5+3*v-9*m*v+m-4*g-$/30*(61+90*v-252*m*v+45*I+46*m-$/56*(1385+3633*v+4095*I+1574*I*v)))),s=b(this.long0+z*(1-$/6*(1+2*v+m-$/20*(5+28*v+24*I+8*m*v+6*m-$/42*(61+662*v+1320*I+720*I*v))))/d)}else i=y*Ar(o),s=0;else{var a=Math.exp(n/this.k0),h=.5*(a-1/a),l=this.lat0+o/this.k0,c=Math.cos(l);t=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(h,2))),i=Math.asin(t),o<0&&(i=-i),h===0&&c===0?s=0:s=b(Math.atan2(h,c)+this.long0)}return e.x=s,e.y=i,e}var G0=["Transverse_Mercator","Transverse Mercator","tmerc"],tf={init:j0,forward:k0,inverse:V0,names:G0};function Ma(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function En(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function ef(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function rf(e){var t=Math.abs(e);return t=ef(t*(1+t/(En(1,t)+1))),e<0?-t:t}function Ia(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function sf(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function nf(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function Zh(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=Ma(r),o=nf(r),a=2*s*o,h=-2*i*n,l=e.length-1,c=e[l],u=0,d=0,p=0,m,g;--l>=0;)m=d,g=u,d=c,u=p,c=-m+a*d-h*u+e[l],p=-g+h*d+a*u;return a=i*o,h=s*n,[a*c-h*p,a*p+h*c]}function W0(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=Ia(this.cbg,this.lat0);this.Zb=-this.Qn*(i+sf(this.gtu,2*i))}function H0(e){var t=b(e.x-this.long0),r=e.y;r=Ia(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,En(i,s*o)),t=rf(Math.tan(t));var a=Zh(this.gtu,2*r,2*t);r=r+a[0],t=t+a[1];var h,l;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,l=1/0),e.x=h,e.y=l,e}function q0(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=Zh(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(Ma(t));var o=Math.sin(r),a=Math.cos(r),h=Math.sin(t),l=Math.cos(t);r=Math.atan2(o*l,En(h,l*a)),t=Math.atan2(h,l*a),i=b(t+this.long0),s=Ia(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var $0=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Os={init:W0,forward:H0,inverse:q0,names:$0};function of(e,t){if(e===void 0){if(e=Math.floor((b(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Y0="etmerc";function J0(){var e=of(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*Bt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Os.init.apply(this),this.forward=Os.forward,this.inverse=Os.inverse}var X0=["Universal Transverse Mercator System","utm"],af={init:J0,names:X0,dependsOn:Y0};function Sa(e,t){return Math.pow((1-e)/(1+e),t)}var K0=20;function Z0(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+J)/(Math.pow(Math.tan(.5*this.lat0+J),this.C)*Sa(this.e*e,this.ratexp))}function Q0(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+J),this.C)*Sa(this.e*Math.sin(r),this.ratexp))-y,e.x=this.C*t,e}function ty(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+J)/this.K,1/this.C),n=K0;n>0&&(i=2*Math.atan(s*Sa(this.e*Math.sin(e.y),-.5*this.e))-y,!(Math.abs(i-e.y)<t));--n)e.y=i;return n?(e.x=r,e.y=i,e):null}var ey=["gauss"],Ba={init:Z0,forward:Q0,inverse:ty,names:ey};function ry(){Ba.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function iy(e){var t,r,i,s;return e.x=b(e.x-this.long0),Ba.forward.apply(this,[e]),t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*r*i),e.x=s*r*Math.sin(e.x),e.y=s*(this.cosc0*t-this.sinc0*r*i),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function sy(e){var t,r,i,s,n;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,n=Math.sqrt(e.x*e.x+e.y*e.y)){var o=2*Math.atan2(n,this.R2);t=Math.sin(o),r=Math.cos(o),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/n),i=Math.atan2(e.x*t,n*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Ba.inverse.apply(this,[e]),e.x=b(e.x+this.long0),e}var ny=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],hf={init:ry,forward:iy,inverse:sy,names:ny};function oy(e,t,r){return t*=r,Math.tan(.5*(y+e))*Math.pow((1-t)/(1+t),.5*r)}function ay(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=_&&(this.k0=.5*(1+Ar(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=_&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=_&&(this.k0=.5*this.cons*Vt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Xt(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Vt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-y,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function hy(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,a,h,l,c,u=b(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=_&&Math.abs(r+this.lat0)<=_?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(u)),e.x=this.a*n*s*Math.sin(u)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(u))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-y,h=Math.cos(o),a=Math.sin(o),Math.abs(this.coslat0)<=_?(l=Xt(this.e,r*this.con,this.con*i),c=2*this.a*this.k0*l/this.cons,e.x=this.x0+c*Math.sin(t-this.long0),e.y=this.y0-this.con*c*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<_?(n=2*this.a*this.k0/(1+h*Math.cos(u)),e.y=n*a):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(u))),e.y=n*(this.cosX0*a-this.sinX0*h*Math.cos(u))+this.y0),e.x=n*h*Math.sin(u)+this.x0,e))}function ly(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,r=this.lat0,o<=_?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(a)*this.sinlat0+e.y*Math.sin(a)*this.coslat0/o),Math.abs(this.coslat0)<_?this.lat0>0?t=b(this.long0+Math.atan2(e.x,-1*e.y)):t=b(this.long0+Math.atan2(e.x,e.y)):t=b(this.long0+Math.atan2(e.x*Math.sin(a),o*this.coslat0*Math.cos(a)-e.y*this.sinlat0*Math.sin(a))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=_){if(o<=_)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*jr(this.e,i),t=this.con*b(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=_?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=b(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*jr(this.e,Math.tan(.5*(y+n)));return e.x=t,e.y=r,e}var cy=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],lf={init:ay,forward:hy,inverse:ly,names:cy,ssfn_:oy};function uy(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),l=Math.log((1+o*t)/(1-o*t));this.K=a-this.alpha*h+this.alpha*o/2*l}function fy(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,e.x=this.R*o+this.x0,e}function dy(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+o/this.alpha,h=0,l=n,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=a,e.y=l,e}var py=["somerc"],cf={init:uy,forward:fy,inverse:dy,names:py};function my(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var e=Math.sin(this.lat0),t=Math.cos(this.lat0),r=this.e*e;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(t,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-r*r);var i=Xt(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var n,o;if(!isNaN(this.longc))this.lat0>=0?n=s+Math.sqrt(s*s-1):n=s-Math.sqrt(s*s-1),this.el=n*Math.pow(i,this.bl),o=.5*(n-1/n),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(o*Math.tan(this.gamma0))/this.bl;else{var a=Xt(this.e,this.lat1,Math.sin(this.lat1)),h=Xt(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(s+Math.sqrt(s*s-1))*Math.pow(i,this.bl):this.el=(s-Math.sqrt(s*s-1))*Math.pow(i,this.bl);var l=Math.pow(a,this.bl),c=Math.pow(h,this.bl);n=this.el/l,o=.5*(n-1/n);var u=(this.el*this.el-c*l)/(this.el*this.el+c*l),d=(c-l)/(c+l),p=b(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=b(this.long0);var m=b(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/o),this.alpha=Math.asin(s*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha))}function yy(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n,o;if(Math.abs(Math.abs(r)-y)<=_)r>0?o=-1:o=1,n=this.al/this.bl*Math.log(Math.tan(J+o*this.gamma0*.5)),s=-1*o*y*this.al/this.bl;else{var a=Xt(this.e,r,Math.sin(r)),h=this.el/Math.pow(a,this.bl),l=.5*(h-1/h),c=.5*(h+1/h),u=Math.sin(this.bl*i),d=(l*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/c;Math.abs(Math.abs(d)-1)<=_?n=Number.POSITIVE_INFINITY:n=.5*this.al*Math.log((1-d)/(1+d))/this.bl,Math.abs(Math.cos(this.bl*i))<=_?s=this.al*this.bl*i:s=this.al*Math.atan2(l*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+n):(s-=this.uc,e.x=this.x0+n*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-n*Math.sin(this.alpha)),e}function gy(e){var t,r;this.no_rot?(r=e.y-this.y0,t=e.x-this.x0):(r=(e.x-this.x0)*Math.cos(this.alpha)-(e.y-this.y0)*Math.sin(this.alpha),t=(e.y-this.y0)*Math.cos(this.alpha)+(e.x-this.x0)*Math.sin(this.alpha),t+=this.uc);var i=Math.exp(-1*this.bl*r/this.al),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.bl*t/this.al),a=(o*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/n,h=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)<_?(e.x=this.long0,e.y=y):Math.abs(a+1)<_?(e.x=this.long0,e.y=-1*y):(e.y=jr(this.e,h),e.x=b(this.long0-Math.atan2(s*Math.cos(this.gamma0)-o*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var _y=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],uf={init:my,forward:yy,inverse:gy,names:_y};function by(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<_)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),r=Math.cos(this.lat1),i=Vt(this.e,t,r),s=Xt(this.e,this.lat1,t),n=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Vt(this.e,n,o),h=Xt(this.e,this.lat2,n),l=Xt(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>_?this.ns=Math.log(i/a)/Math.log(s/h):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function vy(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=_&&(r=Ar(r)*(y-2*_));var i=Math.abs(Math.abs(r)-y),s,n;if(i>_)s=Xt(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*b(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function wy(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,a=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+a*a),r=1):(t=-Math.sqrt(o*o+a*a),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*o,r*a)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=jr(this.e,i),s===-9999)return null}else s=-y;return n=b(h/this.ns+this.long0),e.x=n,e.y=s,e}var xy=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],ff={init:by,forward:vy,inverse:wy,names:xy};function My(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Iy(e){var t,r,i,s,n,o,a,h=e.x,l=e.y,c=b(h-this.long0);return t=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/t)-this.s45),i=-c*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=a*Math.cos(o)/1,e.x=a*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Sy(e){var t,r,i,s,n,o,a,h,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,a=t,h=0;var c=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-e.y)<1e-10&&(h=1),a=e.y,c+=1;while(h===0&&c<15);return c>=15?null:e}var By=["Krovak","krovak"],df={init:My,forward:Iy,inverse:Sy,names:By};function Dt(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function kr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Vr(e){return .375*e*(1+.25*e*(1+.46875*e))}function Gr(e){return .05859375*e*e*(1+.75*e)}function Wr(e){return e*e*e*(35/3072)}function Hr(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function rr(e){return Math.abs(e)<y?e:e-Ar(e)*Math.PI}function Pi(e,t,r,i,s){var n,o;n=e/t;for(var a=0;a<15;a++)if(o=(e-(t*n-r*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)))/(t-2*r*Math.cos(2*n)+4*i*Math.cos(4*n)-6*s*Math.cos(6*n)),n+=o,Math.abs(o)<=1e-10)return n;return NaN}function Ay(){this.sphere||(this.e0=kr(this.es),this.e1=Vr(this.es),this.e2=Gr(this.es),this.e3=Wr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Dy(e){var t,r,i=e.x,s=e.y;if(i=b(i-this.long0),this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(i)),r=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var n=Math.sin(s),o=Math.cos(s),a=Hr(this.a,this.e,n),h=Math.tan(s)*Math.tan(s),l=i*Math.cos(s),c=l*l,u=this.es*o*o/(1-this.es),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,s);t=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),r=d-this.ml0+a*n/o*c*(.5+(5-h+6*u)*c/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function Ty(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s;if(this.sphere){var n=r+this.lat0;i=Math.asin(Math.sin(n)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(n))}else{var o=this.ml0/this.a+r,a=Pi(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-y)<=_)return e.x=this.long0,e.y=y,r<0&&(e.y*=-1),e;var h=Hr(this.a,this.e,Math.sin(a)),l=h*h*h/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(a),2),u=t*this.a/h,d=u*u;i=a-h*Math.tan(a)/l*u*u*(.5-(1+3*c)*u*u/24),s=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(a)}return e.x=b(s+this.long0),e.y=rr(i),e}var Oy=["Cassini","Cassini_Soldner","cass"],pf={init:Ay,forward:Dy,inverse:Ty,names:Oy};function ir(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var Ey=1,Ny=2,Fy=3,Ly=4;function Ry(){var e=Math.abs(this.lat0);if(Math.abs(e-y)<_?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(e)<_?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=ir(this.e,1),this.mmf=.5/(1-this.es),this.apa=Wy(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=ir(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Uy(e){var t,r,i,s,n,o,a,h,l,c,u=e.x,d=e.y;if(u=b(u-this.long0),this.sphere){if(n=Math.sin(d),c=Math.cos(d),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+c*i:1+this.sinph0*n+this.cosph0*c*i,r<=_)return null;r=Math.sqrt(2/r),t=r*c*Math.sin(u),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(d+this.lat0)<_)return null;r=J-d*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(u),r*=i}}else{switch(a=0,h=0,l=0,i=Math.cos(u),s=Math.sin(u),n=Math.sin(d),o=ir(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*i;break;case this.EQUIT:l=1+h*i;break;case this.N_POLE:l=y+d,o=this.qp-o;break;case this.S_POLE:l=d-y,o=this.qp+o;break}if(Math.abs(l)<_)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),this.mode===this.OBLIQ?r=this.ymf*l*(this.cosb1*a-this.sinb1*h*i):r=(l=Math.sqrt(2/(1+h*i)))*a*this.ymf,t=this.xmf*l*h*s;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?l:-l)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function Cy(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,a,h,l;if(this.sphere){var c=0,u,d=0;if(u=Math.sqrt(t*t+r*r),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),c=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=_?0:Math.asin(r*d/u),t*=d,r=c*u;break;case this.OBLIQ:s=Math.abs(u)<=_?this.lat0:Math.asin(c*this.sinph0+r*d*this.cosph0/u),t*=d*this.cosph0,r=(c-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:r=-r,s=y-s;break;case this.S_POLE:s-=y;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<_)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*h/this.rq),n=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=n*this.sinb1+r*o*this.cosb1/h,a=this.qp*l,r=h*this.cosb1*n-r*this.sinb1*o):(l=r*o/h,a=this.qp*l,r=h*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),a=t*t+r*r,!a)return e.x=this.long0,e.y=this.lat0,e;l=1-a/this.qp,this.mode===this.S_POLE&&(l=-l)}i=Math.atan2(t,r),s=Hy(Math.asin(l),this.apa)}return e.x=b(this.long0+i),e.y=s,e}var Py=.3333333333333333,zy=.17222222222222222,jy=.10257936507936508,ky=.06388888888888888,Vy=.0664021164021164,Gy=.016415012942191543;function Wy(e){var t,r=[];return r[0]=e*Py,t=e*e,r[0]+=t*zy,r[1]=t*ky,t*=e,r[0]+=t*jy,r[1]+=t*Vy,r[2]=t*Gy,r}function Hy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var qy=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],mf={init:Ry,forward:Uy,inverse:Cy,names:qy,S_POLE:Ey,N_POLE:Ny,EQUIT:Fy,OBLIQ:Ly};function ge(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function $y(){Math.abs(this.lat1+this.lat2)<_||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Vt(this.e3,this.sin_po,this.cos_po),this.qs1=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Vt(this.e3,this.sin_po,this.cos_po),this.qs2=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=ir(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>_?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Yy(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=ir(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*b(t-this.long0),o=s*Math.sin(n)+this.x0,a=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=a,e}function Jy(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=b(s/this.ns0+this.long0),e.x=n,e.y=o,e}function Xy(e,t){var r,i,s,n,o,a=ge(.5*t);if(e<_)return a;for(var h=e*e,l=1;l<=25;l++)if(r=Math.sin(a),i=Math.cos(a),s=e*r,n=1-s*s,o=.5*n*n/i*(t/(1-h)-r/n+.5/e*Math.log((1-s)/(1+s))),a=a+o,Math.abs(o)<=1e-7)return a;return null}var Ky=["Albers_Conic_Equal_Area","Albers","aea"],yf={init:$y,forward:Yy,inverse:Jy,names:Ky,phi1z:Xy};function Zy(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Qy(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=b(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,o>0||Math.abs(o)<=_?(a=this.x0+this.a*n*r*Math.sin(i)/o,h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(a=this.x0+this.infinity_dist*r*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function tg(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=ge(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=b(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var eg=["gnom"],gf={init:Zy,forward:Qy,inverse:tg,names:eg};function _f(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*y:y;for(var i=Math.asin(.5*t),s,n,o,a,h=0;h<30;h++)if(n=Math.sin(i),o=Math.cos(i),a=e*n,s=Math.pow(1-a*a,2)/(2*o)*(t/(1-e*e)-n/(1-a*a)+.5/e*Math.log((1-a)/(1+a))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function rg(){this.sphere||(this.k0=Vt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function ig(e){var t=e.x,r=e.y,i,s,n=b(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=ir(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function sg(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=b(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=_f(this.e,2*e.y*this.k0/this.a),t=b(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var ng=["cea"],bf={init:rg,forward:ig,inverse:sg,names:ng};function og(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function ag(e){var t=e.x,r=e.y,i=b(t-this.long0),s=rr(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function hg(e){var t=e.x,r=e.y;return e.x=b(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=rr(this.lat0+(r-this.y0)/this.a),e}var lg=["Equirectangular","Equidistant_Cylindrical","eqc"],vf={init:og,forward:ag,inverse:hg,names:lg};var wf=20;function cg(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Vr(this.es),this.e2=Gr(this.es),this.e3=Wr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function ug(e){var t=e.x,r=e.y,i,s,n,o=b(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=_?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(rr(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=_)i=this.a*o,s=-1*this.ml0;else{var a=Hr(this.a,this.e,Math.sin(r))/Math.tan(r);i=a*Math.sin(n),s=this.a*Dt(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function fg(e){var t,r,i,s,n,o,a,h,l;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=_)t=b(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,a=i*i/this.a/this.a+o*o,h=o;var c;for(n=wf;n;--n)if(c=Math.tan(h),l=-1*(o*(h*c+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),h+=l,Math.abs(l)<=_){r=h;break}t=b(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=_)r=0,t=b(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,a=i*i/this.a/this.a+o*o,h=o;var u,d,p,m,g;for(n=wf;n;--n)if(g=this.e*Math.sin(h),u=Math.sqrt(1-g*g)*Math.tan(h),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,h),p=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),m=d/this.a,l=(o*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*h)*(m*m+a-2*o*m)/(4*u)+(o-m)*(u*p-2/Math.sin(2*h))-p),h-=l,Math.abs(l)<=_){r=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=b(this.long0+Math.asin(i*u/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var dg=["Polyconic","poly"],xf={init:cg,forward:ug,inverse:fg,names:dg};function pg(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function mg(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Li*1e-5,a=n,h=1,l=0;for(t=1;t<=10;t++)h=h*o,l=l+this.A[t]*h;var c=l,u=a,d=1,p=0,m,g,v=0,I=0;for(t=1;t<=6;t++)m=d*c-p*u,g=p*c+d*u,d=m,p=g,v=v+this.B_re[t]*d-this.B_im[t]*p,I=I+this.B_im[t]*d+this.B_re[t]*p;return e.x=I*this.a+this.x0,e.y=v*this.a+this.y0,e}function yg(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,a=s/this.a,h=1,l=0,c,u,d=0,p=0;for(t=1;t<=6;t++)c=h*o-l*a,u=l*o+h*a,h=c,l=u,d=d+this.C_re[t]*h-this.C_im[t]*l,p=p+this.C_im[t]*h+this.C_re[t]*l;for(var m=0;m<this.iterations;m++){var g=d,v=p,I,z,$=o,nt=a;for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,$=$+(t-1)*(this.B_re[t]*g-this.B_im[t]*v),nt=nt+(t-1)*(this.B_im[t]*g+this.B_re[t]*v);g=1,v=0;var K=this.B_re[1],tt=this.B_im[1];for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,K=K+t*(this.B_re[t]*g-this.B_im[t]*v),tt=tt+t*(this.B_im[t]*g+this.B_re[t]*v);var Ct=K*K+tt*tt;d=($*K+nt*tt)/Ct,p=(nt*K-$*tt)/Ct}var gt=d,sr=p,ti=1,ei=0;for(t=1;t<=9;t++)ti=ti*gt,ei=ei+this.D[t]*ti;var Cn=this.lat0+ei*Li*1e5,ed=this.long0+sr;return e.x=ed,e.y=Cn,e}var gg=["New_Zealand_Map_Grid","nzmg"],Mf={init:pg,forward:mg,inverse:yg,names:gg};function _g(){}function bg(e){var t=e.x,r=e.y,i=b(t-this.long0),s=this.x0+this.a*i,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=n,e}function vg(e){e.x-=this.x0,e.y-=this.y0;var t=b(this.long0+e.x/this.a),r=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=r,e}var wg=["Miller_Cylindrical","mill"],If={init:_g,forward:bg,inverse:vg,names:wg};var xg=20;function Mg(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=wa(this.es)}function Ig(e){var t,r,i=e.x,s=e.y;if(i=b(i-this.long0),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var n=this.n*Math.sin(s),o=xg;o;--o){var a=(this.m*s+Math.sin(s)-n)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<_)break}t=this.a*this.C_x*i*(this.m+Math.cos(s)),r=this.a*this.C_y*s}else{var h=Math.sin(s),l=Math.cos(s);r=this.a*Ci(s,h,l,this.en),t=this.a*i*l/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function Sg(e){var t,r,i,s;return e.x-=this.x0,i=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(t))),this.m?t=ge((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=ge(Math.sin(t)/this.n)),i=b(i+this.long0),t=rr(t)):(t=xa(e.y/this.a,this.es,this.en),s=Math.abs(t),s<y?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=b(r)):s-_<y&&(i=this.long0)),e.x=i,e.y=t,e}var Bg=["Sinusoidal","sinu"],Sf={init:Mg,forward:Ig,inverse:Sg,names:Bg};function Ag(){}function Dg(e){for(var t=e.x,r=e.y,i=b(t-this.long0),s=r,n=Math.PI*Math.sin(r);;){var o=-(s+Math.sin(s)-n)/(1+Math.cos(s));if(s+=o,Math.abs(o)<_)break}s/=2,Math.PI/2-Math.abs(r)<_&&(i=0);var a=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=a,e.y=h,e}function Tg(e){var t,r;e.x-=this.x0,e.y-=this.y0,r=e.y/(1.4142135623731*this.a),Math.abs(r)>.999999999999&&(r=.999999999999),t=Math.asin(r);var i=b(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var Og=["Mollweide","moll"],Bf={init:Ag,forward:Dg,inverse:Tg,names:Og};function Eg(){Math.abs(this.lat1+this.lat2)<_||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Vr(this.es),this.e2=Gr(this.es),this.e3=Wr(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Vt(this.e,this.sinphi,this.cosphi),this.ml1=Dt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<_?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Vt(this.e,this.sinphi,this.cosphi),this.ml2=Dt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Dt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Ng(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=Dt(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var n=this.ns*b(t-this.long0),o=this.x0+i*Math.sin(n),a=this.y0+this.rh-i*Math.cos(n);return e.x=o,e.y=a,e}function Fg(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,r,i,s;this.ns>=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=b(this.long0+n/this.ns),i=rr(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=Pi(o,this.e0,this.e1,this.e2,this.e3),s=b(this.long0+n/this.ns),e.x=s,e.y=i,e}var Lg=["Equidistant_Conic","eqdc"],Af={init:Eg,forward:Ng,inverse:Fg,names:Lg};function Rg(){this.R=this.a}function Ug(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n;Math.abs(r)<=_&&(s=this.x0+this.R*i,n=this.y0);var o=ge(2*Math.abs(r/Math.PI));(Math.abs(i)<=_||Math.abs(Math.abs(r)-y)<=_)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/i-i/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,p=u*(2/l-1),m=p*p,g=Math.PI*this.R*(a*(u-m)+Math.sqrt(h*(u-m)*(u-m)-(m+h)*(d-m)))/(m+h);i<0&&(g=-g),s=this.x0+g;var v=h+u;return g=Math.PI*this.R*(p*v-a*Math.sqrt((m+h)*(h+1)-v*v))/(m+h),r>=0?n=this.y0+g:n=this.y0-g,e.x=s,e.y=n,e}function Cg(e){var t,r,i,s,n,o,a,h,l,c,u,d,p;return e.x-=this.x0,e.y-=this.y0,u=Math.PI*this.R,i=e.x/u,s=e.y/u,n=i*i+s*s,o=-Math.abs(s)*(1+n),a=o-2*s*s+i*i,h=-2*o+1+2*s*s+n*n,p=s*s/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,l=(o-a*a/3/h)/h,c=2*Math.sqrt(-l/3),u=3*p/l/c,Math.abs(u)>1&&(u>=0?u=1:u=-1),d=Math.acos(u)/3,e.y>=0?r=(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:r=-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,Math.abs(i)<_?t=this.long0:t=b(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(i*i-s*s)+n*n))/2/i),e.x=t,e.y=r,e}var Pg=["Van_der_Grinten_I","VanDerGrinten","vandg"],Df={init:Rg,forward:Ug,inverse:Cg,names:Pg};function zg(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function jg(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),n=b(t-this.long0),o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt,sr,ti,ei,Cn;return this.sphere?Math.abs(this.sin_p12-1)<=_?(e.x=this.x0+this.a*(y-r)*Math.sin(n),e.y=this.y0-this.a*(y-r)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=_?(e.x=this.x0+this.a*(y+r)*Math.sin(n),e.y=this.y0+this.a*(y+r)*Math.cos(n),e):(Ct=this.sin_p12*i+this.cos_p12*s*Math.cos(n),K=Math.acos(Ct),tt=K?K/Math.sin(K):1,e.x=this.x0+this.a*tt*s*Math.sin(n),e.y=this.y0+this.a*tt*(this.cos_p12*i-this.sin_p12*s*Math.cos(n)),e):(o=kr(this.es),a=Vr(this.es),h=Gr(this.es),l=Wr(this.es),Math.abs(this.sin_p12-1)<=_?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c-u)*Math.sin(n),e.y=this.y0-(c-u)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=_?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c+u)*Math.sin(n),e.y=this.y0+(c+u)*Math.cos(n),e):(d=i/s,p=Hr(this.a,this.e,this.sin_p12),m=Hr(this.a,this.e,i),g=Math.atan((1-this.es)*d+this.es*p*this.sin_p12/(m*s)),v=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(g)-this.sin_p12*Math.cos(n)),v===0?gt=Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):Math.abs(Math.abs(v)-Math.PI)<=_?gt=-Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):gt=Math.asin(Math.sin(n)*Math.cos(g)/Math.sin(v)),I=this.e*this.sin_p12/Math.sqrt(1-this.es),z=this.e*this.cos_p12*Math.cos(v)/Math.sqrt(1-this.es),$=I*z,nt=z*z,sr=gt*gt,ti=sr*gt,ei=ti*gt,Cn=ei*gt,K=p*gt*(1-sr*nt*(1-nt)/6+ti/8*$*(1-2*nt)+ei/120*(nt*(4-7*nt)-3*I*I*(1-7*nt))-Cn/48*$),e.x=this.x0+K*Math.sin(v),e.y=this.y0+K*Math.cos(v),e))}function kg(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*y*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=_?o=this.lat0:(o=ge(s*this.sin_p12+e.y*i*this.cos_p12/t),a=Math.abs(this.lat0)-y,Math.abs(a)<=_?this.lat0>=0?n=b(this.long0+Math.atan2(e.x,-e.y)):n=b(this.long0-Math.atan2(-e.x,e.y)):n=b(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(h=kr(this.es),l=Vr(this.es),c=Gr(this.es),u=Wr(this.es),Math.abs(this.sin_p12-1)<=_?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=d-t,o=Pi(p/this.a,h,l,c,u),n=b(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=_?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-d,o=Pi(p/this.a,h,l,c,u),n=b(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),v=Math.atan2(e.x,e.y),m=Hr(this.a,this.e,this.sin_p12),I=Math.cos(v),z=this.e*this.cos_p12*I,$=-z*z/(1-this.es),nt=3*this.es*(1-$)*this.sin_p12*this.cos_p12*I/(1-this.es),K=t/m,tt=K-$*(1+$)*Math.pow(K,3)/6-nt*(1+3*$)*Math.pow(K,4)/24,Ct=1-$*tt*tt/2-K*tt*tt*tt/6,g=Math.asin(this.sin_p12*Math.cos(tt)+this.cos_p12*Math.sin(tt)*I),n=b(this.long0+Math.asin(Math.sin(v)*Math.sin(tt)/Math.cos(g))),gt=Math.sin(g),o=Math.atan2((gt-this.es*Ct*this.sin_p12)*Math.tan(g),gt*(1-this.es)),e.x=n,e.y=o,e))}var Vg=["Azimuthal_Equidistant","aeqd"],Tf={init:zg,forward:jg,inverse:kg,names:Vg};function Gg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Wg(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=b(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=_)&&(a=this.a*n*r*Math.sin(i),h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function Hg(e){var t,r,i,s,n,o,a;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=ge(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=_?(a=this.lat0,e.x=o,e.y=a,e):(a=ge(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-y,Math.abs(n)<=_?(this.lat0>=0?o=b(this.long0+Math.atan2(e.x,-e.y)):o=b(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=a,e):(o=b(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=a,e))}var qg=["ortho"],Of={init:Gg,forward:Wg,inverse:Hg,names:qg};var yt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},it={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function $g(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=y-J/2?this.face=yt.TOP:this.lat0<=-(y-J/2)?this.face=yt.BOTTOM:Math.abs(this.long0)<=J?this.face=yt.FRONT:Math.abs(this.long0)<=y+J?this.face=this.long0>0?yt.RIGHT:yt.LEFT:this.face=yt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Yg(e){var t={x:0,y:0},r,i,s,n,o,a,h={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===yt.TOP)n=y-r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=i-y):i>y+J||i<=-(y+J)?(h.value=it.AREA_1,s=i>0?i-mt:i+mt):i>-(y+J)&&i<=-J?(h.value=it.AREA_2,s=i+y):(h.value=it.AREA_3,s=i);else if(this.face===yt.BOTTOM)n=y+r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=-i+y):i<J&&i>=-J?(h.value=it.AREA_1,s=-i):i<-J&&i>=-(y+J)?(h.value=it.AREA_2,s=-i-y):(h.value=it.AREA_3,s=i>0?-i+mt:-i-mt);else{var l,c,u,d,p,m,g;this.face===yt.RIGHT?i=Es(i,+y):this.face===yt.BACK?i=Es(i,+mt):this.face===yt.LEFT&&(i=Es(i,-y)),d=Math.sin(r),p=Math.cos(r),m=Math.sin(i),g=Math.cos(i),l=p*g,c=p*m,u=d,this.face===yt.FRONT?(n=Math.acos(l),s=Aa(n,u,c,h)):this.face===yt.RIGHT?(n=Math.acos(c),s=Aa(n,u,-l,h)):this.face===yt.BACK?(n=Math.acos(-l),s=Aa(n,u,-c,h)):this.face===yt.LEFT?(n=Math.acos(-c),s=Aa(n,u,l,h)):(n=s=0,h.value=it.AREA_0)}return a=Math.atan(12/mt*(s+Math.acos(Math.sin(s)*Math.cos(J))-y)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===it.AREA_1?a+=y:h.value===it.AREA_2?a+=mt:h.value===it.AREA_3&&(a+=1.5*mt),t.x=o*Math.cos(a),t.y=o*Math.sin(a),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Jg(e){var t={lam:0,phi:0},r,i,s,n,o,a,h,l,c,u={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?u.value=it.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(u.value=it.AREA_1,r-=y):e.x<0&&-e.x>=Math.abs(e.y)?(u.value=it.AREA_2,r=r<0?r+mt:r-mt):(u.value=it.AREA_3,r+=y),c=mt/12*Math.tan(r),o=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),a=Math.atan(o),s=Math.cos(r),n=Math.tan(i),h=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(a)))),h<-1?h=-1:h>1&&(h=1),this.face===yt.TOP)l=Math.acos(h),t.phi=y-l,u.value===it.AREA_0?t.lam=a+y:u.value===it.AREA_1?t.lam=a<0?a+mt:a-mt:u.value===it.AREA_2?t.lam=a-y:t.lam=a;else if(this.face===yt.BOTTOM)l=Math.acos(h),t.phi=l-y,u.value===it.AREA_0?t.lam=-a+y:u.value===it.AREA_1?t.lam=-a:u.value===it.AREA_2?t.lam=-a-y:t.lam=a<0?-a-mt:-a+mt;else{var d,p,m;d=h,c=d*d,c>=1?m=0:m=Math.sqrt(1-c)*Math.sin(a),c+=m*m,c>=1?p=0:p=Math.sqrt(1-c),u.value===it.AREA_1?(c=p,p=-m,m=c):u.value===it.AREA_2?(p=-p,m=-m):u.value===it.AREA_3&&(c=p,p=m,m=-c),this.face===yt.RIGHT?(c=d,d=-p,p=c):this.face===yt.BACK?(d=-d,p=-p):this.face===yt.LEFT&&(c=d,d=p,p=-c),t.phi=Math.acos(-m)-y,t.lam=Math.atan2(p,d),this.face===yt.RIGHT?t.lam=Es(t.lam,-y):this.face===yt.BACK?t.lam=Es(t.lam,-mt):this.face===yt.LEFT&&(t.lam=Es(t.lam,+y))}if(this.es!==0){var g,v,I;g=t.phi<0?1:0,v=Math.tan(t.phi),I=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-I*I)/(this.one_minus_f*I)),g&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Aa(e,t,r,i){var s;return e<_?(i.value=it.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=J?i.value=it.AREA_0:s>J&&s<=y+J?(i.value=it.AREA_1,s-=y):s>y+J||s<=-(y+J)?(i.value=it.AREA_2,s=s>=0?s-mt:s+mt):(i.value=it.AREA_3,s+=y)),s}function Es(e,t){var r=e+t;return r<-mt?r+=Bn:r>+mt&&(r-=Bn),r}var Xg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Ef={init:$g,forward:Yg,inverse:Jg,names:Xg};var Qh=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Nn=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Nf=.8487,Ff=1.3523,Lf=er/5,Kg=1/Lf,Ns=18,Da=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Zg=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function Qg(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)<r)break}return s}function t_(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function e_(e){var t=b(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*Lf);i<0?i=0:i>=Ns&&(i=Ns-1),r=er*(r-Kg*i);var s={x:Da(Qh[i],r)*t,y:Da(Nn[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*Nf+this.x0,s.y=s.y*this.a*Ff+this.y0,s}function r_(e){var t={x:(e.x-this.x0)/(this.a*Nf),y:Math.abs(e.y-this.y0)/(this.a*Ff)};if(t.y>=1)t.x/=Qh[Ns][0],t.y=e.y<0?-y:y;else{var r=Math.floor(t.y*Ns);for(r<0?r=0:r>=Ns&&(r=Ns-1);;)if(Nn[r][0]>t.y)--r;else if(Nn[r+1][0]<=t.y)++r;else break;var i=Nn[r],s=5*(t.y-i[0])/(Nn[r+1][0]-i[0]);s=Qg(function(n){return(Da(i,n)-t.y)/Zg(i,n)},s,_,100),t.x/=Da(Qh[r],s),t.y=(5*r+s)*Bt,e.y<0&&(t.y=-t.y)}return t.x=b(t.x+this.long0),t}var i_=["Robinson","robin"],Rf={init:t_,forward:e_,inverse:r_,names:i_};function s_(){this.name="geocent"}function n_(e){var t=ga(e,this.es,this.a);return t}function o_(e){var t=_a(e,this.es,this.a,this.b);return t}var a_=["Geocentric","geocentric","geocent","Geocent"],Uf={init:s_,forward:n_,inverse:o_,names:a_};function Cf(e){e.Proj.projections.add(tf),e.Proj.projections.add(Os),e.Proj.projections.add(af),e.Proj.projections.add(hf),e.Proj.projections.add(lf),e.Proj.projections.add(cf),e.Proj.projections.add(uf),e.Proj.projections.add(ff),e.Proj.projections.add(df),e.Proj.projections.add(pf),e.Proj.projections.add(mf),e.Proj.projections.add(yf),e.Proj.projections.add(gf),e.Proj.projections.add(bf),e.Proj.projections.add(vf),e.Proj.projections.add(xf),e.Proj.projections.add(Mf),e.Proj.projections.add(If),e.Proj.projections.add(Sf),e.Proj.projections.add(Bf),e.Proj.projections.add(Af),e.Proj.projections.add(Df),e.Proj.projections.add(Tf),e.Proj.projections.add(Of),e.Proj.projections.add(Ef),e.Proj.projections.add(Rf),e.Proj.projections.add(Uf)}Be.defaultDatum="WGS84";Be.Proj=Qr;Be.WGS84=new Be.Proj("WGS84");Be.Point=Xu;Be.toPoint=va;Be.defs=Bs;Be.transform=Ui;Be.mgrs=$u;Be.version="__VERSION__";Cf(Be);var tl=Be;var Fn=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);tl.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=tl(t,r),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(t){return this._projection.forward(t)}unproject(t){return this._projection.inverse(t)}};var el=100,Pf=!1;function zf(e){let t=new DataView(e,0,el),i=kn(t).length-el,s=new DataView(e,el,i),n=new Int32Array(i),o=new Int32Array(i);for(let a=0;a<i/8;a++)n[a]=s.getInt32(a*8,Pf),o[a]=s.getInt32(a*8+4,Pf);return{offsets:n,lengths:o}}async function*Ta(e,t,r){let i=[],s=[],n=!1,o=!1;for(;!n&&!o;){if(i.length===0&&!n){let{value:h,done:l}=await e.next();l?n=!0:i.push(...h)}if(s.length===0&&!o){let{value:h,done:l}=await t.next();l?o=!0:s.push(...h)}let a=h_(i,s);a&&(yield{batchType:"data",shape:r,length:a.length,data:a})}}function h_(e,t){let r=Math.min(e.length,t.length);if(r===0)return null;let i=[e.slice(0,r),t.slice(0,r)];return e.splice(0,r),t.splice(0,r),i}var rl=!0,jf=32,Kt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Kt||(Kt={}));var Ea=class{binaryReader=new nr;textDecoder;state=Kt.START;result={data:[]};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=kf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=kf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Kt.END&&(this.state=Kt.ERROR,this.result.error="DBF incomplete file")}};function il(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Ea({encoding:r});i.write(e),i.end();let{data:s,schema:n}=i.result;switch(t?.dbf?.shape){case"object-row-table":return{shape:"object-row-table",schema:n,data:s};case"table":return{schema:n,rows:s};case"rows":default:return s}}async function*Vf(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Ea({encoding:r}),s=!1;for await(let n of e)i.write(n),!s&&i.result.dbfHeader&&(s=!0,yield i.result.dbfHeader),i.result.data.length>0&&(yield i.result.data,i.result.data=[]);i.end(),i.result.data.length>0&&(yield i.result.data)}function kf(e,t,r,i){for(;;)try{switch(e){case Kt.ERROR:case Kt.END:return e;case Kt.START:let s=r.getDataView(jf);if(!s)return e;t.dbfHeader=l_(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Kt.FIELD_DESCRIPTORS;break;case Kt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-jf);if(!n)return e;t.dbfFields=c_(n,i),t.schema={fields:t.dbfFields.map(h=>y_(h)),metadata:{}},e=Kt.FIELD_PROPERTIES,r.skip(1);break;case Kt.FIELD_PROPERTIES:let{recordLength:o=0,nRecords:a=0}=t?.dbfHeader||{};for(;t.data.length<a;){let h=r.getDataView(o-1);if(!h)return e;r.skip(1);let l=u_(h,t.dbfFields,i);t.data.push(l),t.progress.rows=t.data.length}e=Kt.END;break;default:return e=Kt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Kt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function l_(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,rl),headerLength:e.getUint16(8,rl),recordLength:e.getUint16(10,rl),languageDriver:e.getUint8(29)}}function c_(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function u_(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=f_(o,n.dataType),s+=n.fieldLength}return i}function f_(e,t){switch(t){case"B":return Oa(e);case"C":return m_(e);case"F":return Oa(e);case"N":return Oa(e);case"O":return Oa(e);case"D":return d_(e);case"L":return p_(e);default:throw new Error("Unsupported data type")}}function d_(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function p_(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Oa(e){let t=parseFloat(e);return isNaN(t)?null:t}function m_(e){return e.trim()||null}function y_({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var g_="4.4.0-alpha.0",sl={name:"DBF",dataType:null,batchType:null,id:"dbf",module:"shapefile",version:g_,worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},Ln={...sl,parse:async(e,t)=>il(e,t),parseSync:il,parseInBatches(e,t){return Vf(e,t)}};async function*Gf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Yf(t,r),h=await Wn(e,Ls,t,r),l=h[Symbol.asyncIterator]?.()||h[Symbol.iterator]?.(),c=null,u=await r?.fetch(Rn(r?.url||"","dbf"));if(u?.ok){let v=await Wn(u,Ln,{...t,dbf:{encoding:o||"latin1"}},r);c=v[Symbol.asyncIterator]?.()||v[Symbol.iterator]()}let d=(await l.next()).value;d&&d.batchType==="metadata"&&(d=(await l.next()).value);let p={};c&&(p=(await c.next()).value,p&&p.batchType==="metadata"&&(p=(await c.next()).value));let m=c?Ta(l,c,"object-row-table"):l,g={[Symbol.asyncIterator](){return m}};for await(let v of g){let I,z;c?[I,z]=v.data:I=v;let $=Hf(I),nt=qf($,z);i&&(nt=$f(nt,a,s)),yield{encoding:o,prj:a,shx:n,header:d,data:nt}}}async function Wf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Yf(t,r),{header:h,geometries:l}=await Gn(e,Ls,t,r),c=Hf(l),u,d=await r?.fetch(Rn(r?.url,"dbf"));d?.ok&&(u=await Gn(d,Ln,{dbf:{shape:"object-row-table",encoding:o||"latin1"}},r));let p=qf(c,u?.data||[]);switch(i&&(p=$f(p,a,s)),t?.shapefile?.shape){case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",encoding:o,schema:u?.schema||{metadata:{},fields:[]},prj:a,shx:n,header:h,features:p};default:return{encoding:o,prj:a,shx:n,header:h,data:p}}}function Hf(e){let t=[];for(let r of e)t.push(Gh(r));return t}function qf(e,t){let r=[];for(let i=0;i<e.length;i++){let n={type:"Feature",geometry:e[i],properties:t&&t[i]||{}};r.push(n)}return r}function $f(e,t,r){if(!t&&!r)return e;let i=new Fn({from:t||"WGS84",to:r||"WGS84"});return ja(e,s=>i.project(s))}async function Yf(e,t){let{url:r,fetch:i}=t,s=i(Rn(r,"shx")),n=i(Rn(r,"cpg")),o=i(Rn(r,"prj"));await Promise.all([s,n,o]);let a,h,l,c=await s;if(c.ok){let p=await c.arrayBuffer();a=zf(p)}let u=await n;u.ok&&(h=await u.text());let d=await o;return d.ok&&(l=await d.text()),{shx:a,cpg:h,prj:l}}function Rn(e,t){let r=__(e),i=b_(e);return i===i.toUpperCase()&&(t=t.toUpperCase()),`${r}.${t}`}function __(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(0,t):"":t}function b_(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(t+1):"":t}var v_="4.4.0-alpha.0",Jf={name:"Shapefile",id:"shapefile",module:"shapefile",version:v_,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(Pa).buffer],options:{shapefile:{shape:"v3"},shp:{_maxDimensions:4}},parse:Wf,parseInBatches:Gf};var nl=!0,Xf=32,Zt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Zt||(Zt={}));var Fa=class{binaryReader=new nr;textDecoder;state=Zt.START;result={};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Kf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Kf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Zt.END&&(this.state=Zt.ERROR,this.result.error="DBF incomplete file")}};function ol(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Fa({encoding:r});return i.write(e),i.end(),i.result.tableBuilder.finishTable()}async function*Zf(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Fa({encoding:r}),s=!1;for await(let a of e){if(i.write(a),!s&&i.result.dbfHeader){s=!0;let u=i.result.tableBuilder.firstBatch();u&&(yield u)}let l=i.result.tableBuilder.flushBatch();l&&(yield l)}i.end();let o=i.result.tableBuilder.finishBatch();o&&(yield o)}function Kf(e,t,r,i){for(;;)try{switch(e){case Zt.ERROR:case Zt.END:return e;case Zt.START:let s=r.getDataView(Xf);if(!s)return e;t.dbfHeader=w_(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Zt.FIELD_DESCRIPTORS;break;case Zt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-Xf);if(!n)return e;t.dbfFields=x_(n,i);let o={fields:t.dbfFields.map(c=>D_(c)),metadata:{}};t.tableBuilder=new In(o),e=Zt.FIELD_PROPERTIES,r.skip(1);break;case Zt.FIELD_PROPERTIES:let{recordLength:a=0,nRecords:h=0}=t?.dbfHeader||{},l=0;for(;l<h;){l++;let c=r.getDataView(a-1);if(!c)return e;r.skip(1);let u=M_(c,t.dbfFields,i);t.tableBuilder.addObjectRow(u)}e=Zt.END;break;default:return e=Zt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Zt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function w_(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,nl),headerLength:e.getUint16(8,nl),recordLength:e.getUint16(10,nl),languageDriver:e.getUint8(29)}}function x_(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function M_(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=I_(o,n.dataType),s+=n.fieldLength}return i}function I_(e,t){switch(t){case"B":return Na(e);case"C":return A_(e);case"F":return Na(e);case"N":return Na(e);case"O":return Na(e);case"D":return S_(e);case"L":return B_(e);default:throw new Error("Unsupported data type")}}function S_(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function B_(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Na(e){let t=parseFloat(e);return isNaN(t)?null:t}function A_(e){return e.trim()||null}function D_({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var Qf={name:"DBF",id:"dbf",module:"shapefile",category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"]};var T_="4.4.0-alpha.0",al={...Qf,dataType:null,batchType:null,version:T_,worker:!0,options:{dbf:{encoding:"latin1"}}},td={...al,parse:async(e,t)=>ol(e,t),parseSync:ol,parseInBatches(e,t){return Zf(e,t)}};var La=class{offset;arrayBuffer;constructor(t){this.offset=0,this.arrayBuffer=t}hasAvailableBytes(t){return this.arrayBuffer.byteLength-this.offset>=t}getDataView(t){if(t&&!this.hasAvailableBytes(t))throw new Error("binary data exhausted");let r=t?new DataView(this.arrayBuffer,this.offset,t):new DataView(this.arrayBuffer,this.offset);return this.offset+=t,r}skip(t){this.offset+=t}rewind(t){this.offset-=t}};return ld(Un);})();
19
+ northing meters`+e;var d=u/2,p=0,m=0,g,v,I,z,$;return d>0&&(g=1e5/Math.pow(10,d),v=e.substring(n,n+d),p=parseFloat(v)*g,I=e.substring(n+d),m=parseFloat(I)*g),z=p+l,$=m+c,{easting:z,northing:$,zoneLetter:a,zoneNumber:o,accuracy:g}}function O0(e,t){for(var r=$u.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>En){if(s)throw"Bad character: "+e;r=Ts,s=!0}i+=1e5}return i}function E0(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=Yu.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>On){if(s)throw"Bad character: "+e;r=Ts,s=!0}i+=1e5}return i}function N0(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}function Os(e,t,r){if(!(this instanceof Os))return new Os(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e=="object")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e=="string"&&typeof t>"u"){var i=e.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Os.fromMGRS=function(e){return new Os(Kh(e))};Os.prototype.toMGRS=function(e){return Xh([this.x,this.y],e)};var Zu=Os;var F0=1,L0=.25,Qu=.046875,tf=.01953125,ef=.01068115234375,R0=.75,U0=.46875,C0=.013020833333333334,P0=.007120768229166667,z0=.3645833333333333,j0=.005696614583333333,V0=.3076171875;function xa(e){var t=[];t[0]=F0-e*(L0+e*(Qu+e*(tf+e*ef))),t[1]=e*(R0-e*(Qu+e*(tf+e*ef)));var r=e*e;return t[2]=r*(U0-e*(C0+e*P0)),r*=e,t[3]=r*(z0-e*j0),t[4]=r*e*V0,t}function Pi(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var k0=20;function Ma(e,t,r){for(var i=1/(1-t),s=e,n=k0;n;--n){var o=Math.sin(s),a=1-t*o*o;if(a=(Pi(s,o,Math.cos(s),r)-e)*(a*Math.sqrt(a))*i,s-=a,Math.abs(a)<b)return s}return s}function G0(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=xa(this.es),this.ml0=Pi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function W0(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n,o,a=Math.sin(r),h=Math.cos(r);if(this.es){var c=h*i,u=Math.pow(c,2),d=this.ep2*Math.pow(h,2),p=Math.pow(d,2),m=Math.abs(h)>b?Math.tan(r):0,g=Math.pow(m,2),v=Math.pow(g,2);s=1-this.es*Math.pow(a,2),c=c/Math.sqrt(s);var I=Pi(r,a,h,this.en);n=this.a*(this.k0*c*(1+u/6*(1-g+d+u/20*(5-18*g+v+14*d-58*g*d+u/42*(61+179*v-v*g-479*g)))))+this.x0,o=this.a*(this.k0*(I-this.ml0+a*i*c/2*(1+u/12*(5-g+9*d+4*p+u/30*(61+v-58*g+270*d-330*g*d+u/56*(1385+543*v-v*g-3111*g))))))+this.y0}else{var l=h*Math.sin(i);if(Math.abs(Math.abs(l)-1)<b)return 93;if(n=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,o=h*Math.cos(i)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(o),l>=1){if(l-1>b)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function H0(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=Ma(t,this.es,this.en),Math.abs(r)<y){var u=Math.sin(r),d=Math.cos(r),p=Math.abs(d)>b?Math.tan(r):0,m=this.ep2*Math.pow(d,2),g=Math.pow(m,2),v=Math.pow(p,2),I=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var z=n*Math.sqrt(t)/this.k0,$=Math.pow(z,2);t=t*p,i=r-t*$/(1-this.es)*.5*(1-$/12*(5+3*v-9*m*v+m-4*g-$/30*(61+90*v-252*m*v+45*I+46*m-$/56*(1385+3633*v+4095*I+1574*I*v)))),s=_(this.long0+z*(1-$/6*(1+2*v+m-$/20*(5+28*v+24*I+8*m*v+6*m-$/42*(61+662*v+1320*I+720*I*v))))/d)}else i=y*Ar(o),s=0;else{var a=Math.exp(n/this.k0),h=.5*(a-1/a),l=this.lat0+o/this.k0,c=Math.cos(l);t=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(h,2))),i=Math.asin(t),o<0&&(i=-i),h===0&&c===0?s=0:s=_(Math.atan2(h,c)+this.long0)}return e.x=s,e.y=i,e}var q0=["Transverse_Mercator","Transverse Mercator","tmerc"],rf={init:G0,forward:W0,inverse:H0,names:q0};function Ia(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Nn(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function sf(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function nf(e){var t=Math.abs(e);return t=sf(t*(1+t/(Nn(1,t)+1))),e<0?-t:t}function Sa(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function of(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function af(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function Qh(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=Ia(r),o=af(r),a=2*s*o,h=-2*i*n,l=e.length-1,c=e[l],u=0,d=0,p=0,m,g;--l>=0;)m=d,g=u,d=c,u=p,c=-m+a*d-h*u+e[l],p=-g+h*d+a*u;return a=i*o,h=s*n,[a*c-h*p,a*p+h*c]}function $0(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=Sa(this.cbg,this.lat0);this.Zb=-this.Qn*(i+of(this.gtu,2*i))}function Y0(e){var t=_(e.x-this.long0),r=e.y;r=Sa(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,Nn(i,s*o)),t=nf(Math.tan(t));var a=Qh(this.gtu,2*r,2*t);r=r+a[0],t=t+a[1];var h,l;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,l=1/0),e.x=h,e.y=l,e}function J0(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=Qh(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(Ia(t));var o=Math.sin(r),a=Math.cos(r),h=Math.sin(t),l=Math.cos(t);r=Math.atan2(o*l,Nn(h,l*a)),t=Math.atan2(h,l*a),i=_(t+this.long0),s=Sa(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var X0=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Es={init:$0,forward:Y0,inverse:J0,names:X0};function hf(e,t){if(e===void 0){if(e=Math.floor((_(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var K0="etmerc";function Z0(){var e=hf(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*Bt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Es.init.apply(this),this.forward=Es.forward,this.inverse=Es.inverse}var Q0=["Universal Transverse Mercator System","utm"],lf={init:Z0,names:Q0,dependsOn:K0};function Ba(e,t){return Math.pow((1-e)/(1+e),t)}var ty=20;function ey(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+J)/(Math.pow(Math.tan(.5*this.lat0+J),this.C)*Ba(this.e*e,this.ratexp))}function ry(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+J),this.C)*Ba(this.e*Math.sin(r),this.ratexp))-y,e.x=this.C*t,e}function iy(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+J)/this.K,1/this.C),n=ty;n>0&&(i=2*Math.atan(s*Ba(this.e*Math.sin(e.y),-.5*this.e))-y,!(Math.abs(i-e.y)<t));--n)e.y=i;return n?(e.x=r,e.y=i,e):null}var sy=["gauss"],Aa={init:ey,forward:ry,inverse:iy,names:sy};function ny(){Aa.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function oy(e){var t,r,i,s;return e.x=_(e.x-this.long0),Aa.forward.apply(this,[e]),t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*r*i),e.x=s*r*Math.sin(e.x),e.y=s*(this.cosc0*t-this.sinc0*r*i),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function ay(e){var t,r,i,s,n;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,n=Math.sqrt(e.x*e.x+e.y*e.y)){var o=2*Math.atan2(n,this.R2);t=Math.sin(o),r=Math.cos(o),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/n),i=Math.atan2(e.x*t,n*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Aa.inverse.apply(this,[e]),e.x=_(e.x+this.long0),e}var hy=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],cf={init:ny,forward:oy,inverse:ay,names:hy};function ly(e,t,r){return t*=r,Math.tan(.5*(y+e))*Math.pow((1-t)/(1+t),.5*r)}function cy(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=b&&(this.k0=.5*(1+Ar(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=b&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=b&&(this.k0=.5*this.cons*kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Xt(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=kt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-y,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function uy(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,a,h,l,c,u=_(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=b&&Math.abs(r+this.lat0)<=b?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(u)),e.x=this.a*n*s*Math.sin(u)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(u))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-y,h=Math.cos(o),a=Math.sin(o),Math.abs(this.coslat0)<=b?(l=Xt(this.e,r*this.con,this.con*i),c=2*this.a*this.k0*l/this.cons,e.x=this.x0+c*Math.sin(t-this.long0),e.y=this.y0-this.con*c*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<b?(n=2*this.a*this.k0/(1+h*Math.cos(u)),e.y=n*a):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(u))),e.y=n*(this.cosX0*a-this.sinX0*h*Math.cos(u))+this.y0),e.x=n*h*Math.sin(u)+this.x0,e))}function fy(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,r=this.lat0,o<=b?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(a)*this.sinlat0+e.y*Math.sin(a)*this.coslat0/o),Math.abs(this.coslat0)<b?this.lat0>0?t=_(this.long0+Math.atan2(e.x,-1*e.y)):t=_(this.long0+Math.atan2(e.x,e.y)):t=_(this.long0+Math.atan2(e.x*Math.sin(a),o*this.coslat0*Math.cos(a)-e.y*this.sinlat0*Math.sin(a))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=b){if(o<=b)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Vr(this.e,i),t=this.con*_(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=b?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=_(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*Vr(this.e,Math.tan(.5*(y+n)));return e.x=t,e.y=r,e}var dy=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],uf={init:cy,forward:uy,inverse:fy,names:dy,ssfn_:ly};function py(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),l=Math.log((1+o*t)/(1-o*t));this.K=a-this.alpha*h+this.alpha*o/2*l}function my(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,e.x=this.R*o+this.x0,e}function yy(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+o/this.alpha,h=0,l=n,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=a,e.y=l,e}var gy=["somerc"],ff={init:py,forward:my,inverse:yy,names:gy};function by(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var e=Math.sin(this.lat0),t=Math.cos(this.lat0),r=this.e*e;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(t,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-r*r);var i=Xt(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var n,o;if(!isNaN(this.longc))this.lat0>=0?n=s+Math.sqrt(s*s-1):n=s-Math.sqrt(s*s-1),this.el=n*Math.pow(i,this.bl),o=.5*(n-1/n),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(o*Math.tan(this.gamma0))/this.bl;else{var a=Xt(this.e,this.lat1,Math.sin(this.lat1)),h=Xt(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(s+Math.sqrt(s*s-1))*Math.pow(i,this.bl):this.el=(s-Math.sqrt(s*s-1))*Math.pow(i,this.bl);var l=Math.pow(a,this.bl),c=Math.pow(h,this.bl);n=this.el/l,o=.5*(n-1/n);var u=(this.el*this.el-c*l)/(this.el*this.el+c*l),d=(c-l)/(c+l),p=_(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=_(this.long0);var m=_(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/o),this.alpha=Math.asin(s*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha))}function _y(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n,o;if(Math.abs(Math.abs(r)-y)<=b)r>0?o=-1:o=1,n=this.al/this.bl*Math.log(Math.tan(J+o*this.gamma0*.5)),s=-1*o*y*this.al/this.bl;else{var a=Xt(this.e,r,Math.sin(r)),h=this.el/Math.pow(a,this.bl),l=.5*(h-1/h),c=.5*(h+1/h),u=Math.sin(this.bl*i),d=(l*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/c;Math.abs(Math.abs(d)-1)<=b?n=Number.POSITIVE_INFINITY:n=.5*this.al*Math.log((1-d)/(1+d))/this.bl,Math.abs(Math.cos(this.bl*i))<=b?s=this.al*this.bl*i:s=this.al*Math.atan2(l*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+n):(s-=this.uc,e.x=this.x0+n*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-n*Math.sin(this.alpha)),e}function vy(e){var t,r;this.no_rot?(r=e.y-this.y0,t=e.x-this.x0):(r=(e.x-this.x0)*Math.cos(this.alpha)-(e.y-this.y0)*Math.sin(this.alpha),t=(e.y-this.y0)*Math.cos(this.alpha)+(e.x-this.x0)*Math.sin(this.alpha),t+=this.uc);var i=Math.exp(-1*this.bl*r/this.al),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.bl*t/this.al),a=(o*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/n,h=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)<b?(e.x=this.long0,e.y=y):Math.abs(a+1)<b?(e.x=this.long0,e.y=-1*y):(e.y=Vr(this.e,h),e.x=_(this.long0-Math.atan2(s*Math.cos(this.gamma0)-o*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var wy=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],df={init:by,forward:_y,inverse:vy,names:wy};function xy(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<b)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),r=Math.cos(this.lat1),i=kt(this.e,t,r),s=Xt(this.e,this.lat1,t),n=Math.sin(this.lat2),o=Math.cos(this.lat2),a=kt(this.e,n,o),h=Xt(this.e,this.lat2,n),l=Xt(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>b?this.ns=Math.log(i/a)/Math.log(s/h):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function My(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=b&&(r=Ar(r)*(y-2*b));var i=Math.abs(Math.abs(r)-y),s,n;if(i>b)s=Xt(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*_(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function Iy(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,a=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+a*a),r=1):(t=-Math.sqrt(o*o+a*a),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*o,r*a)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=Vr(this.e,i),s===-9999)return null}else s=-y;return n=_(h/this.ns+this.long0),e.x=n,e.y=s,e}var Sy=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],pf={init:xy,forward:My,inverse:Iy,names:Sy};function By(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Ay(e){var t,r,i,s,n,o,a,h=e.x,l=e.y,c=_(h-this.long0);return t=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/t)-this.s45),i=-c*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=a*Math.cos(o)/1,e.x=a*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Dy(e){var t,r,i,s,n,o,a,h,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,a=t,h=0;var c=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-e.y)<1e-10&&(h=1),a=e.y,c+=1;while(h===0&&c<15);return c>=15?null:e}var Ty=["Krovak","krovak"],mf={init:By,forward:Ay,inverse:Dy,names:Ty};function Dt(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function kr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Gr(e){return .375*e*(1+.25*e*(1+.46875*e))}function Wr(e){return .05859375*e*e*(1+.75*e)}function Hr(e){return e*e*e*(35/3072)}function qr(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function rr(e){return Math.abs(e)<y?e:e-Ar(e)*Math.PI}function zi(e,t,r,i,s){var n,o;n=e/t;for(var a=0;a<15;a++)if(o=(e-(t*n-r*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)))/(t-2*r*Math.cos(2*n)+4*i*Math.cos(4*n)-6*s*Math.cos(6*n)),n+=o,Math.abs(o)<=1e-10)return n;return NaN}function Oy(){this.sphere||(this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ey(e){var t,r,i=e.x,s=e.y;if(i=_(i-this.long0),this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(i)),r=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var n=Math.sin(s),o=Math.cos(s),a=qr(this.a,this.e,n),h=Math.tan(s)*Math.tan(s),l=i*Math.cos(s),c=l*l,u=this.es*o*o/(1-this.es),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,s);t=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),r=d-this.ml0+a*n/o*c*(.5+(5-h+6*u)*c/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function Ny(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s;if(this.sphere){var n=r+this.lat0;i=Math.asin(Math.sin(n)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(n))}else{var o=this.ml0/this.a+r,a=zi(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-y)<=b)return e.x=this.long0,e.y=y,r<0&&(e.y*=-1),e;var h=qr(this.a,this.e,Math.sin(a)),l=h*h*h/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(a),2),u=t*this.a/h,d=u*u;i=a-h*Math.tan(a)/l*u*u*(.5-(1+3*c)*u*u/24),s=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(a)}return e.x=_(s+this.long0),e.y=rr(i),e}var Fy=["Cassini","Cassini_Soldner","cass"],yf={init:Oy,forward:Ey,inverse:Ny,names:Fy};function ir(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var Ly=1,Ry=2,Uy=3,Cy=4;function Py(){var e=Math.abs(this.lat0);if(Math.abs(e-y)<b?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(e)<b?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=ir(this.e,1),this.mmf=.5/(1-this.es),this.apa=$y(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=ir(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function zy(e){var t,r,i,s,n,o,a,h,l,c,u=e.x,d=e.y;if(u=_(u-this.long0),this.sphere){if(n=Math.sin(d),c=Math.cos(d),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+c*i:1+this.sinph0*n+this.cosph0*c*i,r<=b)return null;r=Math.sqrt(2/r),t=r*c*Math.sin(u),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(d+this.lat0)<b)return null;r=J-d*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(u),r*=i}}else{switch(a=0,h=0,l=0,i=Math.cos(u),s=Math.sin(u),n=Math.sin(d),o=ir(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*i;break;case this.EQUIT:l=1+h*i;break;case this.N_POLE:l=y+d,o=this.qp-o;break;case this.S_POLE:l=d-y,o=this.qp+o;break}if(Math.abs(l)<b)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),this.mode===this.OBLIQ?r=this.ymf*l*(this.cosb1*a-this.sinb1*h*i):r=(l=Math.sqrt(2/(1+h*i)))*a*this.ymf,t=this.xmf*l*h*s;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?l:-l)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function jy(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,a,h,l;if(this.sphere){var c=0,u,d=0;if(u=Math.sqrt(t*t+r*r),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),c=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=b?0:Math.asin(r*d/u),t*=d,r=c*u;break;case this.OBLIQ:s=Math.abs(u)<=b?this.lat0:Math.asin(c*this.sinph0+r*d*this.cosph0/u),t*=d*this.cosph0,r=(c-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:r=-r,s=y-s;break;case this.S_POLE:s-=y;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<b)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*h/this.rq),n=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=n*this.sinb1+r*o*this.cosb1/h,a=this.qp*l,r=h*this.cosb1*n-r*this.sinb1*o):(l=r*o/h,a=this.qp*l,r=h*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),a=t*t+r*r,!a)return e.x=this.long0,e.y=this.lat0,e;l=1-a/this.qp,this.mode===this.S_POLE&&(l=-l)}i=Math.atan2(t,r),s=Yy(Math.asin(l),this.apa)}return e.x=_(this.long0+i),e.y=s,e}var Vy=.3333333333333333,ky=.17222222222222222,Gy=.10257936507936508,Wy=.06388888888888888,Hy=.0664021164021164,qy=.016415012942191543;function $y(e){var t,r=[];return r[0]=e*Vy,t=e*e,r[0]+=t*ky,r[1]=t*Wy,t*=e,r[0]+=t*Gy,r[1]+=t*Hy,r[2]=t*qy,r}function Yy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var Jy=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],gf={init:Py,forward:zy,inverse:jy,names:Jy,S_POLE:Ly,N_POLE:Ry,EQUIT:Uy,OBLIQ:Cy};function ge(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function Xy(){Math.abs(this.lat1+this.lat2)<b||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=kt(this.e3,this.sin_po,this.cos_po),this.qs1=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=kt(this.e3,this.sin_po,this.cos_po),this.qs2=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=ir(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>b?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ky(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=ir(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*_(t-this.long0),o=s*Math.sin(n)+this.x0,a=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=a,e}function Zy(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=_(s/this.ns0+this.long0),e.x=n,e.y=o,e}function Qy(e,t){var r,i,s,n,o,a=ge(.5*t);if(e<b)return a;for(var h=e*e,l=1;l<=25;l++)if(r=Math.sin(a),i=Math.cos(a),s=e*r,n=1-s*s,o=.5*n*n/i*(t/(1-h)-r/n+.5/e*Math.log((1-s)/(1+s))),a=a+o,Math.abs(o)<=1e-7)return a;return null}var tg=["Albers_Conic_Equal_Area","Albers","aea"],bf={init:Xy,forward:Ky,inverse:Zy,names:tg,phi1z:Qy};function eg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function rg(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=_(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,o>0||Math.abs(o)<=b?(a=this.x0+this.a*n*r*Math.sin(i)/o,h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(a=this.x0+this.infinity_dist*r*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function ig(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=ge(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=_(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var sg=["gnom"],_f={init:eg,forward:rg,inverse:ig,names:sg};function vf(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*y:y;for(var i=Math.asin(.5*t),s,n,o,a,h=0;h<30;h++)if(n=Math.sin(i),o=Math.cos(i),a=e*n,s=Math.pow(1-a*a,2)/(2*o)*(t/(1-e*e)-n/(1-a*a)+.5/e*Math.log((1-a)/(1+a))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function ng(){this.sphere||(this.k0=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function og(e){var t=e.x,r=e.y,i,s,n=_(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=ir(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function ag(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=_(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=vf(this.e,2*e.y*this.k0/this.a),t=_(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var hg=["cea"],wf={init:ng,forward:og,inverse:ag,names:hg};function lg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function cg(e){var t=e.x,r=e.y,i=_(t-this.long0),s=rr(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function ug(e){var t=e.x,r=e.y;return e.x=_(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=rr(this.lat0+(r-this.y0)/this.a),e}var fg=["Equirectangular","Equidistant_Cylindrical","eqc"],xf={init:lg,forward:cg,inverse:ug,names:fg};var Mf=20;function dg(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function pg(e){var t=e.x,r=e.y,i,s,n,o=_(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=b?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(rr(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=b)i=this.a*o,s=-1*this.ml0;else{var a=qr(this.a,this.e,Math.sin(r))/Math.tan(r);i=a*Math.sin(n),s=this.a*Dt(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function mg(e){var t,r,i,s,n,o,a,h,l;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=b)t=_(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,a=i*i/this.a/this.a+o*o,h=o;var c;for(n=Mf;n;--n)if(c=Math.tan(h),l=-1*(o*(h*c+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),h+=l,Math.abs(l)<=b){r=h;break}t=_(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=b)r=0,t=_(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,a=i*i/this.a/this.a+o*o,h=o;var u,d,p,m,g;for(n=Mf;n;--n)if(g=this.e*Math.sin(h),u=Math.sqrt(1-g*g)*Math.tan(h),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,h),p=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),m=d/this.a,l=(o*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*h)*(m*m+a-2*o*m)/(4*u)+(o-m)*(u*p-2/Math.sin(2*h))-p),h-=l,Math.abs(l)<=b){r=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=_(this.long0+Math.asin(i*u/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var yg=["Polyconic","poly"],If={init:dg,forward:pg,inverse:mg,names:yg};function gg(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function bg(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Ri*1e-5,a=n,h=1,l=0;for(t=1;t<=10;t++)h=h*o,l=l+this.A[t]*h;var c=l,u=a,d=1,p=0,m,g,v=0,I=0;for(t=1;t<=6;t++)m=d*c-p*u,g=p*c+d*u,d=m,p=g,v=v+this.B_re[t]*d-this.B_im[t]*p,I=I+this.B_im[t]*d+this.B_re[t]*p;return e.x=I*this.a+this.x0,e.y=v*this.a+this.y0,e}function _g(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,a=s/this.a,h=1,l=0,c,u,d=0,p=0;for(t=1;t<=6;t++)c=h*o-l*a,u=l*o+h*a,h=c,l=u,d=d+this.C_re[t]*h-this.C_im[t]*l,p=p+this.C_im[t]*h+this.C_re[t]*l;for(var m=0;m<this.iterations;m++){var g=d,v=p,I,z,$=o,nt=a;for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,$=$+(t-1)*(this.B_re[t]*g-this.B_im[t]*v),nt=nt+(t-1)*(this.B_im[t]*g+this.B_re[t]*v);g=1,v=0;var K=this.B_re[1],tt=this.B_im[1];for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,K=K+t*(this.B_re[t]*g-this.B_im[t]*v),tt=tt+t*(this.B_im[t]*g+this.B_re[t]*v);var Ct=K*K+tt*tt;d=($*K+nt*tt)/Ct,p=(nt*K-$*tt)/Ct}var gt=d,sr=p,ei=1,ri=0;for(t=1;t<=9;t++)ei=ei*gt,ri=ri+this.D[t]*ei;var Pn=this.lat0+ri*Ri*1e5,id=this.long0+sr;return e.x=id,e.y=Pn,e}var vg=["New_Zealand_Map_Grid","nzmg"],Sf={init:gg,forward:bg,inverse:_g,names:vg};function wg(){}function xg(e){var t=e.x,r=e.y,i=_(t-this.long0),s=this.x0+this.a*i,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=n,e}function Mg(e){e.x-=this.x0,e.y-=this.y0;var t=_(this.long0+e.x/this.a),r=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=r,e}var Ig=["Miller_Cylindrical","mill"],Bf={init:wg,forward:xg,inverse:Mg,names:Ig};var Sg=20;function Bg(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=xa(this.es)}function Ag(e){var t,r,i=e.x,s=e.y;if(i=_(i-this.long0),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var n=this.n*Math.sin(s),o=Sg;o;--o){var a=(this.m*s+Math.sin(s)-n)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<b)break}t=this.a*this.C_x*i*(this.m+Math.cos(s)),r=this.a*this.C_y*s}else{var h=Math.sin(s),l=Math.cos(s);r=this.a*Pi(s,h,l,this.en),t=this.a*i*l/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function Dg(e){var t,r,i,s;return e.x-=this.x0,i=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(t))),this.m?t=ge((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=ge(Math.sin(t)/this.n)),i=_(i+this.long0),t=rr(t)):(t=Ma(e.y/this.a,this.es,this.en),s=Math.abs(t),s<y?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=_(r)):s-b<y&&(i=this.long0)),e.x=i,e.y=t,e}var Tg=["Sinusoidal","sinu"],Af={init:Bg,forward:Ag,inverse:Dg,names:Tg};function Og(){}function Eg(e){for(var t=e.x,r=e.y,i=_(t-this.long0),s=r,n=Math.PI*Math.sin(r);;){var o=-(s+Math.sin(s)-n)/(1+Math.cos(s));if(s+=o,Math.abs(o)<b)break}s/=2,Math.PI/2-Math.abs(r)<b&&(i=0);var a=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=a,e.y=h,e}function Ng(e){var t,r;e.x-=this.x0,e.y-=this.y0,r=e.y/(1.4142135623731*this.a),Math.abs(r)>.999999999999&&(r=.999999999999),t=Math.asin(r);var i=_(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var Fg=["Mollweide","moll"],Df={init:Og,forward:Eg,inverse:Ng,names:Fg};function Lg(){Math.abs(this.lat1+this.lat2)<b||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=kt(this.e,this.sinphi,this.cosphi),this.ml1=Dt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<b?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=kt(this.e,this.sinphi,this.cosphi),this.ml2=Dt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Dt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Rg(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=Dt(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var n=this.ns*_(t-this.long0),o=this.x0+i*Math.sin(n),a=this.y0+this.rh-i*Math.cos(n);return e.x=o,e.y=a,e}function Ug(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,r,i,s;this.ns>=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=_(this.long0+n/this.ns),i=rr(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=zi(o,this.e0,this.e1,this.e2,this.e3),s=_(this.long0+n/this.ns),e.x=s,e.y=i,e}var Cg=["Equidistant_Conic","eqdc"],Tf={init:Lg,forward:Rg,inverse:Ug,names:Cg};function Pg(){this.R=this.a}function zg(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n;Math.abs(r)<=b&&(s=this.x0+this.R*i,n=this.y0);var o=ge(2*Math.abs(r/Math.PI));(Math.abs(i)<=b||Math.abs(Math.abs(r)-y)<=b)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/i-i/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,p=u*(2/l-1),m=p*p,g=Math.PI*this.R*(a*(u-m)+Math.sqrt(h*(u-m)*(u-m)-(m+h)*(d-m)))/(m+h);i<0&&(g=-g),s=this.x0+g;var v=h+u;return g=Math.PI*this.R*(p*v-a*Math.sqrt((m+h)*(h+1)-v*v))/(m+h),r>=0?n=this.y0+g:n=this.y0-g,e.x=s,e.y=n,e}function jg(e){var t,r,i,s,n,o,a,h,l,c,u,d,p;return e.x-=this.x0,e.y-=this.y0,u=Math.PI*this.R,i=e.x/u,s=e.y/u,n=i*i+s*s,o=-Math.abs(s)*(1+n),a=o-2*s*s+i*i,h=-2*o+1+2*s*s+n*n,p=s*s/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,l=(o-a*a/3/h)/h,c=2*Math.sqrt(-l/3),u=3*p/l/c,Math.abs(u)>1&&(u>=0?u=1:u=-1),d=Math.acos(u)/3,e.y>=0?r=(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:r=-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,Math.abs(i)<b?t=this.long0:t=_(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(i*i-s*s)+n*n))/2/i),e.x=t,e.y=r,e}var Vg=["Van_der_Grinten_I","VanDerGrinten","vandg"],Of={init:Pg,forward:zg,inverse:jg,names:Vg};function kg(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Gg(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),n=_(t-this.long0),o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt,sr,ei,ri,Pn;return this.sphere?Math.abs(this.sin_p12-1)<=b?(e.x=this.x0+this.a*(y-r)*Math.sin(n),e.y=this.y0-this.a*(y-r)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=b?(e.x=this.x0+this.a*(y+r)*Math.sin(n),e.y=this.y0+this.a*(y+r)*Math.cos(n),e):(Ct=this.sin_p12*i+this.cos_p12*s*Math.cos(n),K=Math.acos(Ct),tt=K?K/Math.sin(K):1,e.x=this.x0+this.a*tt*s*Math.sin(n),e.y=this.y0+this.a*tt*(this.cos_p12*i-this.sin_p12*s*Math.cos(n)),e):(o=kr(this.es),a=Gr(this.es),h=Wr(this.es),l=Hr(this.es),Math.abs(this.sin_p12-1)<=b?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c-u)*Math.sin(n),e.y=this.y0-(c-u)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=b?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c+u)*Math.sin(n),e.y=this.y0+(c+u)*Math.cos(n),e):(d=i/s,p=qr(this.a,this.e,this.sin_p12),m=qr(this.a,this.e,i),g=Math.atan((1-this.es)*d+this.es*p*this.sin_p12/(m*s)),v=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(g)-this.sin_p12*Math.cos(n)),v===0?gt=Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):Math.abs(Math.abs(v)-Math.PI)<=b?gt=-Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):gt=Math.asin(Math.sin(n)*Math.cos(g)/Math.sin(v)),I=this.e*this.sin_p12/Math.sqrt(1-this.es),z=this.e*this.cos_p12*Math.cos(v)/Math.sqrt(1-this.es),$=I*z,nt=z*z,sr=gt*gt,ei=sr*gt,ri=ei*gt,Pn=ri*gt,K=p*gt*(1-sr*nt*(1-nt)/6+ei/8*$*(1-2*nt)+ri/120*(nt*(4-7*nt)-3*I*I*(1-7*nt))-Pn/48*$),e.x=this.x0+K*Math.sin(v),e.y=this.y0+K*Math.cos(v),e))}function Wg(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*y*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=b?o=this.lat0:(o=ge(s*this.sin_p12+e.y*i*this.cos_p12/t),a=Math.abs(this.lat0)-y,Math.abs(a)<=b?this.lat0>=0?n=_(this.long0+Math.atan2(e.x,-e.y)):n=_(this.long0-Math.atan2(-e.x,e.y)):n=_(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(h=kr(this.es),l=Gr(this.es),c=Wr(this.es),u=Hr(this.es),Math.abs(this.sin_p12-1)<=b?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=d-t,o=zi(p/this.a,h,l,c,u),n=_(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=b?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-d,o=zi(p/this.a,h,l,c,u),n=_(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),v=Math.atan2(e.x,e.y),m=qr(this.a,this.e,this.sin_p12),I=Math.cos(v),z=this.e*this.cos_p12*I,$=-z*z/(1-this.es),nt=3*this.es*(1-$)*this.sin_p12*this.cos_p12*I/(1-this.es),K=t/m,tt=K-$*(1+$)*Math.pow(K,3)/6-nt*(1+3*$)*Math.pow(K,4)/24,Ct=1-$*tt*tt/2-K*tt*tt*tt/6,g=Math.asin(this.sin_p12*Math.cos(tt)+this.cos_p12*Math.sin(tt)*I),n=_(this.long0+Math.asin(Math.sin(v)*Math.sin(tt)/Math.cos(g))),gt=Math.sin(g),o=Math.atan2((gt-this.es*Ct*this.sin_p12)*Math.tan(g),gt*(1-this.es)),e.x=n,e.y=o,e))}var Hg=["Azimuthal_Equidistant","aeqd"],Ef={init:kg,forward:Gg,inverse:Wg,names:Hg};function qg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function $g(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=_(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=b)&&(a=this.a*n*r*Math.sin(i),h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function Yg(e){var t,r,i,s,n,o,a;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=ge(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=b?(a=this.lat0,e.x=o,e.y=a,e):(a=ge(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-y,Math.abs(n)<=b?(this.lat0>=0?o=_(this.long0+Math.atan2(e.x,-e.y)):o=_(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=a,e):(o=_(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=a,e))}var Jg=["ortho"],Nf={init:qg,forward:$g,inverse:Yg,names:Jg};var yt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},it={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Xg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=y-J/2?this.face=yt.TOP:this.lat0<=-(y-J/2)?this.face=yt.BOTTOM:Math.abs(this.long0)<=J?this.face=yt.FRONT:Math.abs(this.long0)<=y+J?this.face=this.long0>0?yt.RIGHT:yt.LEFT:this.face=yt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Kg(e){var t={x:0,y:0},r,i,s,n,o,a,h={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===yt.TOP)n=y-r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=i-y):i>y+J||i<=-(y+J)?(h.value=it.AREA_1,s=i>0?i-mt:i+mt):i>-(y+J)&&i<=-J?(h.value=it.AREA_2,s=i+y):(h.value=it.AREA_3,s=i);else if(this.face===yt.BOTTOM)n=y+r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=-i+y):i<J&&i>=-J?(h.value=it.AREA_1,s=-i):i<-J&&i>=-(y+J)?(h.value=it.AREA_2,s=-i-y):(h.value=it.AREA_3,s=i>0?-i+mt:-i-mt);else{var l,c,u,d,p,m,g;this.face===yt.RIGHT?i=Ns(i,+y):this.face===yt.BACK?i=Ns(i,+mt):this.face===yt.LEFT&&(i=Ns(i,-y)),d=Math.sin(r),p=Math.cos(r),m=Math.sin(i),g=Math.cos(i),l=p*g,c=p*m,u=d,this.face===yt.FRONT?(n=Math.acos(l),s=Da(n,u,c,h)):this.face===yt.RIGHT?(n=Math.acos(c),s=Da(n,u,-l,h)):this.face===yt.BACK?(n=Math.acos(-l),s=Da(n,u,-c,h)):this.face===yt.LEFT?(n=Math.acos(-c),s=Da(n,u,l,h)):(n=s=0,h.value=it.AREA_0)}return a=Math.atan(12/mt*(s+Math.acos(Math.sin(s)*Math.cos(J))-y)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===it.AREA_1?a+=y:h.value===it.AREA_2?a+=mt:h.value===it.AREA_3&&(a+=1.5*mt),t.x=o*Math.cos(a),t.y=o*Math.sin(a),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Zg(e){var t={lam:0,phi:0},r,i,s,n,o,a,h,l,c,u={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?u.value=it.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(u.value=it.AREA_1,r-=y):e.x<0&&-e.x>=Math.abs(e.y)?(u.value=it.AREA_2,r=r<0?r+mt:r-mt):(u.value=it.AREA_3,r+=y),c=mt/12*Math.tan(r),o=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),a=Math.atan(o),s=Math.cos(r),n=Math.tan(i),h=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(a)))),h<-1?h=-1:h>1&&(h=1),this.face===yt.TOP)l=Math.acos(h),t.phi=y-l,u.value===it.AREA_0?t.lam=a+y:u.value===it.AREA_1?t.lam=a<0?a+mt:a-mt:u.value===it.AREA_2?t.lam=a-y:t.lam=a;else if(this.face===yt.BOTTOM)l=Math.acos(h),t.phi=l-y,u.value===it.AREA_0?t.lam=-a+y:u.value===it.AREA_1?t.lam=-a:u.value===it.AREA_2?t.lam=-a-y:t.lam=a<0?-a-mt:-a+mt;else{var d,p,m;d=h,c=d*d,c>=1?m=0:m=Math.sqrt(1-c)*Math.sin(a),c+=m*m,c>=1?p=0:p=Math.sqrt(1-c),u.value===it.AREA_1?(c=p,p=-m,m=c):u.value===it.AREA_2?(p=-p,m=-m):u.value===it.AREA_3&&(c=p,p=m,m=-c),this.face===yt.RIGHT?(c=d,d=-p,p=c):this.face===yt.BACK?(d=-d,p=-p):this.face===yt.LEFT&&(c=d,d=p,p=-c),t.phi=Math.acos(-m)-y,t.lam=Math.atan2(p,d),this.face===yt.RIGHT?t.lam=Ns(t.lam,-y):this.face===yt.BACK?t.lam=Ns(t.lam,-mt):this.face===yt.LEFT&&(t.lam=Ns(t.lam,+y))}if(this.es!==0){var g,v,I;g=t.phi<0?1:0,v=Math.tan(t.phi),I=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-I*I)/(this.one_minus_f*I)),g&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Da(e,t,r,i){var s;return e<b?(i.value=it.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=J?i.value=it.AREA_0:s>J&&s<=y+J?(i.value=it.AREA_1,s-=y):s>y+J||s<=-(y+J)?(i.value=it.AREA_2,s=s>=0?s-mt:s+mt):(i.value=it.AREA_3,s+=y)),s}function Ns(e,t){var r=e+t;return r<-mt?r+=An:r>+mt&&(r-=An),r}var Qg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Ff={init:Xg,forward:Kg,inverse:Zg,names:Qg};var tl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Fn=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Lf=.8487,Rf=1.3523,Uf=er/5,tb=1/Uf,Fs=18,Ta=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},eb=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function rb(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)<r)break}return s}function ib(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function sb(e){var t=_(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*Uf);i<0?i=0:i>=Fs&&(i=Fs-1),r=er*(r-tb*i);var s={x:Ta(tl[i],r)*t,y:Ta(Fn[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*Lf+this.x0,s.y=s.y*this.a*Rf+this.y0,s}function nb(e){var t={x:(e.x-this.x0)/(this.a*Lf),y:Math.abs(e.y-this.y0)/(this.a*Rf)};if(t.y>=1)t.x/=tl[Fs][0],t.y=e.y<0?-y:y;else{var r=Math.floor(t.y*Fs);for(r<0?r=0:r>=Fs&&(r=Fs-1);;)if(Fn[r][0]>t.y)--r;else if(Fn[r+1][0]<=t.y)++r;else break;var i=Fn[r],s=5*(t.y-i[0])/(Fn[r+1][0]-i[0]);s=rb(function(n){return(Ta(i,n)-t.y)/eb(i,n)},s,b,100),t.x/=Ta(tl[r],s),t.y=(5*r+s)*Bt,e.y<0&&(t.y=-t.y)}return t.x=_(t.x+this.long0),t}var ob=["Robinson","robin"],Cf={init:ib,forward:sb,inverse:nb,names:ob};function ab(){this.name="geocent"}function hb(e){var t=ba(e,this.es,this.a);return t}function lb(e){var t=_a(e,this.es,this.a,this.b);return t}var cb=["Geocentric","geocentric","geocent","Geocent"],Pf={init:ab,forward:hb,inverse:lb,names:cb};function zf(e){e.Proj.projections.add(rf),e.Proj.projections.add(Es),e.Proj.projections.add(lf),e.Proj.projections.add(cf),e.Proj.projections.add(uf),e.Proj.projections.add(ff),e.Proj.projections.add(df),e.Proj.projections.add(pf),e.Proj.projections.add(mf),e.Proj.projections.add(yf),e.Proj.projections.add(gf),e.Proj.projections.add(bf),e.Proj.projections.add(_f),e.Proj.projections.add(wf),e.Proj.projections.add(xf),e.Proj.projections.add(If),e.Proj.projections.add(Sf),e.Proj.projections.add(Bf),e.Proj.projections.add(Af),e.Proj.projections.add(Df),e.Proj.projections.add(Tf),e.Proj.projections.add(Of),e.Proj.projections.add(Ef),e.Proj.projections.add(Nf),e.Proj.projections.add(Ff),e.Proj.projections.add(Cf),e.Proj.projections.add(Pf)}Be.defaultDatum="WGS84";Be.Proj=ti;Be.WGS84=new Be.Proj("WGS84");Be.Point=Zu;Be.toPoint=wa;Be.defs=As;Be.transform=Ci;Be.mgrs=Ju;Be.version="__VERSION__";zf(Be);var el=Be;var Ln=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);el.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=el(t,r),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(t){return this._projection.forward(t)}unproject(t){return this._projection.inverse(t)}};var rl=100,jf=!1;function Vf(e){let t=new DataView(e,0,rl),i=Wn(t).length-rl,s=new DataView(e,rl,i),n=new Int32Array(i),o=new Int32Array(i);for(let a=0;a<i/8;a++)n[a]=s.getInt32(a*8,jf),o[a]=s.getInt32(a*8+4,jf);return{offsets:n,lengths:o}}async function*Oa(e,t,r){let i=[],s=[],n=!1,o=!1;for(;!n&&!o;){if(i.length===0&&!n){let{value:h,done:l}=await e.next();l?n=!0:i.push(...h)}if(s.length===0&&!o){let{value:h,done:l}=await t.next();l?o=!0:s.push(...h)}let a=ub(i,s);a&&(yield{batchType:"data",shape:r,length:a.length,data:a})}}function ub(e,t){let r=Math.min(e.length,t.length);if(r===0)return null;let i=[e.slice(0,r),t.slice(0,r)];return e.splice(0,r),t.splice(0,r),i}var il=!0,kf=32,Kt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Kt||(Kt={}));var Na=class{binaryReader=new nr;textDecoder;state=Kt.START;result={data:[]};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Gf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Gf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Kt.END&&(this.state=Kt.ERROR,this.result.error="DBF incomplete file")}};function sl(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Na({encoding:r});i.write(e),i.end();let{data:s,schema:n}=i.result;switch(t?.dbf?.shape){case"object-row-table":return{shape:"object-row-table",schema:n,data:s};case"table":return{schema:n,rows:s};case"rows":default:return s}}async function*Wf(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Na({encoding:r}),s=!1;for await(let n of Dr(e))i.write(n),!s&&i.result.dbfHeader&&(s=!0,yield i.result.dbfHeader),i.result.data.length>0&&(yield i.result.data,i.result.data=[]);i.end(),i.result.data.length>0&&(yield i.result.data)}function Gf(e,t,r,i){for(;;)try{switch(e){case Kt.ERROR:case Kt.END:return e;case Kt.START:let s=r.getDataView(kf);if(!s)return e;t.dbfHeader=fb(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Kt.FIELD_DESCRIPTORS;break;case Kt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-kf);if(!n)return e;t.dbfFields=db(n,i),t.schema={fields:t.dbfFields.map(h=>_b(h)),metadata:{}},e=Kt.FIELD_PROPERTIES,r.skip(1);break;case Kt.FIELD_PROPERTIES:let{recordLength:o=0,nRecords:a=0}=t?.dbfHeader||{};for(;t.data.length<a;){let h=r.getDataView(o-1);if(!h)return e;r.skip(1);let l=pb(h,t.dbfFields,i);t.data.push(l),t.progress.rows=t.data.length}e=Kt.END;break;default:return e=Kt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Kt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function fb(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,il),headerLength:e.getUint16(8,il),recordLength:e.getUint16(10,il),languageDriver:e.getUint8(29)}}function db(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function pb(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=mb(o,n.dataType),s+=n.fieldLength}return i}function mb(e,t){switch(t){case"B":return Ea(e);case"C":return bb(e);case"F":return Ea(e);case"N":return Ea(e);case"O":return Ea(e);case"D":return yb(e);case"L":return gb(e);default:throw new Error("Unsupported data type")}}function yb(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function gb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Ea(e){let t=parseFloat(e);return isNaN(t)?null:t}function bb(e){return e.trim()||null}function _b({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var vb="4.4.0-alpha.9",nl={name:"DBF",dataType:null,batchType:null,id:"dbf",module:"shapefile",version:vb,worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},Rn={...nl,parse:async(e,t)=>sl(e,t),parseSync:sl,parseInBatches(e,t){return Wf(e,t)}};async function*Hf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Xf(t,r),h=await Gn(Dr(e),Rs,t,r),l=h[Symbol.asyncIterator]?.()||h[Symbol.iterator]?.(),c=null,u=await r?.fetch(Un(r?.url||"","dbf"));if(u?.ok){let v=await Gn(u,Rn,{...t,dbf:{...t?.dbf,encoding:o||"latin1"}},r);c=v[Symbol.asyncIterator]?.()||v[Symbol.iterator]()}let d=(await l.next()).value;d&&d.batchType==="metadata"&&(d=(await l.next()).value);let p={};c&&(p=(await c.next()).value,p&&p.batchType==="metadata"&&(p=(await c.next()).value));let m=c?Oa(l,c,"object-row-table"):l,g={[Symbol.asyncIterator](){return m}};for await(let v of g){let I,z;c?[I,z]=v.data:I=v;let $=$f(I),nt=Yf($,z);i&&(nt=Jf(nt,a,s)),yield{encoding:o,prj:a,shx:n,header:d,data:nt}}}async function qf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Xf(t,r),{header:h,geometries:l}=await kn(e,Rs,t,r),c=$f(l),u,d=await r?.fetch(Un(r?.url,"dbf"));if(d?.ok){let m={...t,dbf:{...t?.dbf,shape:"object-row-table",encoding:o||"latin1"}};u=await kn(d,Rn,m,r)}let p=Yf(c,u?.data||[]);switch(i&&(p=Jf(p,a,s)),t?.shapefile?.shape){case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",encoding:o,schema:u?.schema||{metadata:{},fields:[]},prj:a,shx:n,header:h,features:p};default:return{encoding:o,prj:a,shx:n,header:h,data:p}}}function $f(e){let t=[];for(let r of e)t.push(Wh(r));return t}function Yf(e,t){let r=[];for(let i=0;i<e.length;i++){let n={type:"Feature",geometry:e[i],properties:t&&t[i]||{}};r.push(n)}return r}function Jf(e,t,r){if(!t&&!r)return e;let i=new Ln({from:t||"WGS84",to:r||"WGS84"});return Va(e,s=>i.project(s))}async function Xf(e,t){let{url:r,fetch:i}=t,s=i(Un(r,"shx")),n=i(Un(r,"cpg")),o=i(Un(r,"prj"));await Promise.all([s,n,o]);let a,h,l,c=await s;if(c.ok){let p=await c.arrayBuffer();a=Vf(p)}let u=await n;u.ok&&(h=await u.text());let d=await o;return d.ok&&(l=await d.text()),{shx:a,cpg:h,prj:l}}function Un(e,t){let r=wb(e),i=xb(e);return i===i.toUpperCase()&&(t=t.toUpperCase()),`${r}.${t}`}function wb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(0,t):"":t}function xb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(t+1):"":t}var Mb="4.4.0-alpha.9",Kf={name:"Shapefile",id:"shapefile",module:"shapefile",version:Mb,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(za).buffer],options:{shapefile:{shape:"v3"},shp:{_maxDimensions:4}},parse:qf,parseInBatches:Hf};var ol=!0,Zf=32,Zt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Zt||(Zt={}));var La=class{binaryReader=new nr;textDecoder;state=Zt.START;result={};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Qf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Qf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Zt.END&&(this.state=Zt.ERROR,this.result.error="DBF incomplete file")}};function al(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new La({encoding:r});return i.write(e),i.end(),i.result.tableBuilder.finishTable()}async function*td(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new La({encoding:r}),s=!1;for await(let a of Dr(e)){if(i.write(a),!s&&i.result.dbfHeader){s=!0;let u=i.result.tableBuilder.firstBatch();u&&(yield u)}let l=i.result.tableBuilder.flushBatch();l&&(yield l)}i.end();let o=i.result.tableBuilder.finishBatch();o&&(yield o)}function Qf(e,t,r,i){for(;;)try{switch(e){case Zt.ERROR:case Zt.END:return e;case Zt.START:let s=r.getDataView(Zf);if(!s)return e;t.dbfHeader=Ib(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Zt.FIELD_DESCRIPTORS;break;case Zt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-Zf);if(!n)return e;t.dbfFields=Sb(n,i);let o={fields:t.dbfFields.map(c=>Eb(c)),metadata:{}};t.tableBuilder=new Sn(o),e=Zt.FIELD_PROPERTIES,r.skip(1);break;case Zt.FIELD_PROPERTIES:let{recordLength:a=0,nRecords:h=0}=t?.dbfHeader||{},l=0;for(;l<h;){l++;let c=r.getDataView(a-1);if(!c)return e;r.skip(1);let u=Bb(c,t.dbfFields,i);t.tableBuilder.addObjectRow(u)}e=Zt.END;break;default:return e=Zt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Zt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function Ib(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,ol),headerLength:e.getUint16(8,ol),recordLength:e.getUint16(10,ol),languageDriver:e.getUint8(29)}}function Sb(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function Bb(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=Ab(o,n.dataType),s+=n.fieldLength}return i}function Ab(e,t){switch(t){case"B":return Fa(e);case"C":return Ob(e);case"F":return Fa(e);case"N":return Fa(e);case"O":return Fa(e);case"D":return Db(e);case"L":return Tb(e);default:throw new Error("Unsupported data type")}}function Db(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function Tb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Fa(e){let t=parseFloat(e);return isNaN(t)?null:t}function Ob(e){return e.trim()||null}function Eb({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var ed={name:"DBF",id:"dbf",module:"shapefile",category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"]};var Nb="4.4.0-alpha.9",hl={...ed,dataType:null,batchType:null,version:Nb,worker:!0,options:{dbf:{encoding:"latin1"}}},rd={...hl,parse:async(e,t)=>al(e,t),parseSync:al,parseInBatches(e,t){return td(e,t)}};var Ra=class{offset;arrayBuffer;constructor(t){this.offset=0,this.arrayBuffer=t}hasAvailableBytes(t){return this.arrayBuffer.byteLength-this.offset>=t}getDataView(t){if(t&&!this.hasAvailableBytes(t))throw new Error("binary data exhausted");let r=t?new DataView(this.arrayBuffer,this.offset,t):new DataView(this.arrayBuffer,this.offset);return this.offset+=t,r}skip(t){this.offset+=t}rewind(t){this.offset-=t}};return ud(Cn);})();
20
20
  return __exports__;
21
21
  });