@loaders.gl/shapefile 4.3.2 → 4.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dbf-arrow-loader.d.ts +52 -0
- package/dist/dbf-arrow-loader.d.ts.map +1 -0
- package/dist/dbf-arrow-loader.js +32 -0
- package/dist/dbf-format.d.ts +10 -0
- package/dist/dbf-format.d.ts.map +1 -0
- package/dist/dbf-format.js +12 -0
- package/dist/dbf-loader.js +1 -1
- package/dist/dbf-worker.js +1 -1
- package/dist/dist.dev.js +12231 -33
- package/dist/dist.min.js +11 -2
- package/dist/index.cjs +277 -10
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/parsers/parse-dbf-to-arrow.d.ts +26 -0
- package/dist/lib/parsers/parse-dbf-to-arrow.d.ts.map +1 -0
- package/dist/lib/parsers/parse-dbf-to-arrow.js +321 -0
- package/dist/lib/parsers/parse-dbf.d.ts +1 -1
- package/dist/lib/parsers/parse-dbf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shapefile.js +2 -2
- package/dist/lib/parsers/parse-shp-geometry.d.ts +1 -1
- package/dist/lib/parsers/parse-shp-geometry.d.ts.map +1 -1
- package/dist/lib/parsers/types.d.ts +1 -1
- package/dist/lib/parsers/types.d.ts.map +1 -1
- package/dist/shapefile-loader.d.ts.map +1 -1
- package/dist/shapefile-loader.js +1 -1
- package/dist/shp-loader.js +1 -1
- package/dist/shp-worker.js +1 -1
- package/package.json +6 -6
- package/src/dbf-arrow-loader.ts +46 -0
- package/src/dbf-format.ts +15 -0
- package/src/index.ts +1 -0
- package/src/lib/parsers/parse-dbf-to-arrow.ts +382 -0
- package/src/lib/parsers/parse-dbf.ts +1 -1
- package/src/lib/parsers/parse-shapefile.ts +2 -2
- package/src/lib/parsers/parse-shp-geometry.ts +1 -1
- package/src/lib/parsers/types.ts +1 -1
- package/src/shapefile-loader.ts +1 -1
package/dist/dist.min.js
CHANGED
|
@@ -4,9 +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 Cs=Object.create;var kt=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var Ts=Object.getOwnPropertyNames;var Ds=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty;var Bs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Gs=(t,e)=>{for(var a in e)kt(t,a,{get:e[a],enumerable:!0})},jt=(t,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ts(e))!Os.call(t,s)&&s!==a&&kt(t,s,{get:()=>e[s],enumerable:!(i=Ls(e,s))||i.enumerable});return t},Ht=(t,e,a)=>(jt(t,e,"default"),a&&jt(a,e,"default")),Fs=(t,e,a)=>(a=t!=null?Cs(Ds(t)):{},jt(e||!t||!t.__esModule?kt(a,"default",{value:t,enumerable:!0}):a,t)),qs=t=>jt(kt({},"__esModule",{value:!0}),t);var qe=Bs((Ah,Fe)=>{Fe.exports=globalThis.loaders});var qt={};Gs(qt,{DBFLoader:()=>Gt,DBFWorkerLoader:()=>Ge,SHPLoader:()=>Nt,SHPWorkerLoader:()=>ge,ShapefileLoader:()=>Rs,_BinaryChunkReader:()=>ot,_BinaryReader:()=>de,_zipBatchIterators:()=>ce});Ht(qt,Fs(qe(),1));var ot=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(e){let{maxRewindBytes:a=0}=e||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=a}write(e){this.arrayBuffers.push(e)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(e){let a=-this.offset;for(let i of this.arrayBuffers)if(a+=i.byteLength,a>=e)return!0;return!1}findBufferOffsets(e){let a=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let r=this.arrayBuffers[s];if(a+r.byteLength<=0){a+=r.byteLength;continue}let n=a<=0?Math.abs(a):0,h;if(n+e<=r.byteLength)return h=n+e,i.push([s,[n,h]]),i;h=r.byteLength,i.push([s,[n,h]]),e-=r.byteLength-n,a+=r.byteLength}return null}getDataView(e){let a=this.findBufferOffsets(e);if(!a&&this.ended)throw new Error("binary data exhausted");if(!a)return null;if(a.length===1){let[s,[r,n]]=a[0],h=this.arrayBuffers[s],o=new DataView(h,r,n-r);return this.offset+=e,this.disposeBuffers(),o}let i=new DataView(this._combineArrayBuffers(a));return this.offset+=e,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(e){let a=0;for(let r of e){let[n,h]=r[1];a+=h-n}let i=new Uint8Array(a),s=0;for(let r of e){let[n,[h,o]]=r,l=new Uint8Array(this.arrayBuffers[n]);i.set(l.subarray(h,o),s),s+=o-h}return i.buffer}skip(e){this.offset+=e}rewind(e){this.offset-=e}};function Ut(t){let e={magic:t.getInt32(0,!1),length:t.getInt32(24,!1)*2,version:t.getInt32(28,!0),type:t.getInt32(32,!0),bbox:{minX:t.getFloat64(36,!0),minY:t.getFloat64(44,!0),minZ:t.getFloat64(68,!0),minM:t.getFloat64(84,!0),maxX:t.getFloat64(52,!0),maxY:t.getFloat64(60,!0),maxZ:t.getFloat64(76,!0),maxM:t.getFloat64(92,!0)}};return e.magic!==9994&&console.error(`SHP file: bad magic number ${e.magic}`),e.version!==1e3&&console.error(`SHP file: bad version ${e.version}`),e}function ze(t,e){let{_maxDimensions:a=4}=e?.shp||{},i=0,s=t.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return zs();case 1:return pe(t,i,Math.min(2,a));case 3:return yt(t,i,Math.min(2,a),"LineString");case 5:return yt(t,i,Math.min(2,a),"Polygon");case 8:return ve(t,i,Math.min(2,a));case 11:return pe(t,i,Math.min(4,a));case 13:return yt(t,i,Math.min(4,a),"LineString");case 15:return yt(t,i,Math.min(4,a),"Polygon");case 18:return ve(t,i,Math.min(4,a));case 21:return pe(t,i,Math.min(3,a));case 23:return yt(t,i,Math.min(3,a),"LineString");case 25:return yt(t,i,Math.min(3,a),"Polygon");case 28:return ve(t,i,Math.min(3,a));default:throw new Error(`unsupported shape type: ${s}`)}}function zs(){return null}function pe(t,e,a){let i;return[i,e]=ct(t,e,1,a),{positions:{value:i,size:a},type:"Point"}}function ve(t,e,a){e+=4*Float64Array.BYTES_PER_ELEMENT;let i=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let s=null,r=null,n=null;return[s,e]=ct(t,e,i,2),a===4&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[n,e]=ct(t,e,i,1)),a>=3&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[r,e]=ct(t,e,i,1)),{positions:{value:je(s,r,n),size:a},type:"Point"}}function yt(t,e,a,i){e+=4*Float64Array.BYTES_PER_ELEMENT;let s=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let r=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let n=t.byteOffset+e,h=s*Int32Array.BYTES_PER_ELEMENT,o=new Int32Array(s+1);o.set(new Int32Array(t.buffer.slice(n,n+h))),o[s]=r,e+=s*Int32Array.BYTES_PER_ELEMENT;let l=null,u=null,f=null;[l,e]=ct(t,e,r,2),a===4&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[f,e]=ct(t,e,r,1)),a>=3&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[u,e]=ct(t,e,r,1));let c=je(l,u,f);if(i==="LineString")return{type:i,positions:{value:c,size:a},pathIndices:{value:o,size:1}};let M=[];for(let d=1;d<o.length;d++){let y=o[d-1],x=o[d],g=l.subarray(y*2,x*2);js(g)>0&&M.push(y)}return M.push(r),{type:i,positions:{value:c,size:a},primitivePolygonIndices:{value:o,size:1},polygonIndices:{value:new Uint32Array(M),size:1}}}function ct(t,e,a,i){let s=t.byteOffset+e,r=a*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(t.buffer.slice(s,s+r)),e+r]}function je(t,e,a){if(!(e||a))return t;let i=t.length,s=2;a&&a.length&&(i+=a.length,s++),e&&e.length&&(i+=e.length,s++);let r=new Float64Array(i);for(let n=0;n<t.length/2;n++)r[s*n]=t[n*2],r[s*n+1]=t[n*2+1];if(a&&a.length)for(let n=0;n<a.length;n++)r[s*n+2]=a[n];if(e&&e.length)for(let n=0;n<e.length;n++)r[s*n+(s-1)]=e[n];return r}function js(t){return Math.sign(ks(t))}function ks(t){let e=0,a=t.length/2-1;for(let i=0;i<a;i++)e+=(t[i*2]+t[(i+1)*2])*(t[i*2+1]-t[(i+1)*2+1]);return e/2}var Hs=!0,ke=!1,Us=100,Pt=12,J={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Wt=class{options={};binaryReader=new ot({maxRewindBytes:Pt});state=J.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(e){this.options=e}write(e){this.binaryReader.write(e),this.state=He(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=He(this.state,this.result,this.binaryReader,this.options),this.state!==J.END&&(this.state=J.ERROR,this.result.error="SHP incomplete file")}};function ye(t,e){let a=new Wt(e);return a.write(t),a.end(),a.result}async function*Ue(t,e){let a=new Wt(e),i=!1;for await(let s of t)a.write(s),!i&&a.result.header&&(i=!0,yield a.result.header),a.result.geometries.length>0&&(yield a.result.geometries,a.result.geometries=[]);a.end(),a.result.geometries.length>0&&(yield a.result.geometries)}function He(t,e,a,i){for(;;)try{switch(t){case J.ERROR:case J.END:return t;case J.EXPECTING_HEADER:let s=a.getDataView(Us);if(!s)return t;e.header=Ut(s),e.progress={bytesUsed:0,bytesTotal:e.header.length,rows:0},e.currentIndex=1,t=J.EXPECTING_RECORD;break;case J.EXPECTING_RECORD:for(;a.hasAvailableBytes(Pt);){let r=a.getDataView(Pt),n={recordNumber:r.getInt32(0,ke),byteLength:r.getInt32(4,ke)*2,type:r.getInt32(8,Hs)};if(!a.hasAvailableBytes(n.byteLength-4))return a.rewind(Pt),t;if(n.byteLength<4||n.type!==e.header?.type||n.recordNumber!==e.currentIndex)a.rewind(Pt-4);else{a.rewind(4);let o=a.getDataView(n.byteLength),l=ze(o,i);e.geometries.push(l),e.currentIndex++,e.progress.rows=e.currentIndex-1}}return a.ended&&(t=J.END),t;default:return t=J.ERROR,e.error=`illegal parser state ${t}`,t}}catch(s){return t=J.ERROR,e.error=`SHP parsing failed: ${s?.message}`,t}}var Ws="4.3.1",xe=[0,0,39,10],ge={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:Ws,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(xe).buffer],options:{shp:{_maxDimensions:4}}},Nt={...ge,parse:async(t,e)=>ye(t,e),parseSync:ye,parseInBatches:(t,e)=>Ue(t,e)};async function Jt(t,e,a,i){return i._parse(t,e,a,i)}async function Xt(t,e,a,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(t,e,a,i)}function _e(t,e,a){switch(t.type){case"Point":return Xs(t,e,a);case"LineString":return Js(t,e,a);case"Polygon":return We(t,e,a);default:let i=t;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function We(t,e=-1/0,a=1/0){let{positions:i}=t,s=t.polygonIndices.value.filter(o=>o>=e&&o<=a),r=t.primitivePolygonIndices.value.filter(o=>o>=e&&o<=a);if(!(s.length>2)){let o=[];for(let l=0;l<r.length-1;l++){let u=r[l],f=r[l+1],c=Qt(i,u,f);o.push(c)}return{type:"Polygon",coordinates:o}}let h=[];for(let o=0;o<s.length-1;o++){let l=s[o],u=s[o+1],f=We(t,l,u).coordinates;h.push(f)}return{type:"MultiPolygon",coordinates:h}}function Js(t,e=-1/0,a=1/0){let{positions:i}=t,s=t.pathIndices.value.filter(h=>h>=e&&h<=a);if(!(s.length>2))return{type:"LineString",coordinates:Qt(i,s[0],s[1])};let n=[];for(let h=0;h<s.length-1;h++){let o=Qt(i,s[h],s[h+1]);n.push(o)}return{type:"MultiLineString",coordinates:n}}function Xs(t,e,a){let{positions:i}=t,s=Qt(i,e,a);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Qt(t,e,a){e=e||0,a=a||t.value.length/t.size;let i=[];for(let s=e;s<a;s++){let r=Array();for(let n=s*t.size;n<(s+1)*t.size;n++)r.push(Number(t.value[n]));i.push(r)}return i}function be(t,e){for(let a of t)a.geometry.coordinates=Je(a.geometry.coordinates,e);return t}function Je(t,e){return Qs(t)?e(t):t.map(a=>Je(a,e))}function Qs(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function Xe(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("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"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var X=1,Q=2,Qe=4,St=5,mt=484813681109536e-20,m=Math.PI/2,Ve=.16666666666666666,Ke=.04722222222222222,Ye=.022156084656084655,p=1e-10,L=.017453292519943295,V=57.29577951308232,I=Math.PI/4,Rt=Math.PI*2,R=3.14159265359;var G={};G.greenwich=0;G.lisbon=-9.131906111111;G.paris=2.337229166667;G.bogota=-74.080916666667;G.madrid=-3.687938888889;G.rome=12.452333333333;G.bern=7.439583333333;G.jakarta=106.807719444444;G.ferro=-17.666666666667;G.brussels=4.367975;G.stockholm=18.058277777778;G.athens=23.7163375;G.oslo=10.722916666667;var Ze={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var $e=/[\s_\-\/\(\)]/g;function k(t,e){if(t[e])return t[e];for(var a=Object.keys(t),i=e.toLowerCase().replace($e,""),s=-1,r,n;++s<a.length;)if(r=a[s],n=r.toLowerCase().replace($e,""),n===i)return t[r]}function wt(t){var e={},a=t.split("+").map(function(h){return h.trim()}).filter(function(h){return h}).reduce(function(h,o){var l=o.split("=");return l.push(!0),h[l[0].toLowerCase()]=l[1],h},{}),i,s,r,n={proj:"projName",datum:"datumCode",rf:function(h){e.rf=parseFloat(h)},lat_0:function(h){e.lat0=h*L},lat_1:function(h){e.lat1=h*L},lat_2:function(h){e.lat2=h*L},lat_ts:function(h){e.lat_ts=h*L},lon_0:function(h){e.long0=h*L},lon_1:function(h){e.long1=h*L},lon_2:function(h){e.long2=h*L},alpha:function(h){e.alpha=parseFloat(h)*L},lonc:function(h){e.longc=h*L},x_0:function(h){e.x0=parseFloat(h)},y_0:function(h){e.y0=parseFloat(h)},k_0:function(h){e.k0=parseFloat(h)},k:function(h){e.k0=parseFloat(h)},a:function(h){e.a=parseFloat(h)},b:function(h){e.b=parseFloat(h)},r_a:function(){e.R_A=!0},zone:function(h){e.zone=parseInt(h,10)},south:function(){e.utmSouth=!0},towgs84:function(h){e.datum_params=h.split(",").map(function(o){return parseFloat(o)})},to_meter:function(h){e.to_meter=parseFloat(h)},units:function(h){e.units=h;var o=k(Ze,h);o&&(e.to_meter=o.to_meter)},from_greenwich:function(h){e.from_greenwich=h*L},pm:function(h){var o=k(G,h);e.from_greenwich=(o||parseFloat(h))*L},nadgrids:function(h){h==="@null"?e.datumCode="none":e.nadgrids=h},axis:function(h){var o="ewnsud";h.length===3&&o.indexOf(h.substr(0,1))!==-1&&o.indexOf(h.substr(1,1))!==-1&&o.indexOf(h.substr(2,1))!==-1&&(e.axis=h)}};for(i in a)s=a[i],i in n?(r=n[i],typeof r=="function"?r(s):e[r]=s):e[i]=s;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}var ta=Zs,Ct=1,ea=2,aa=3,Vt=4,sa=5,Ee=-1,Vs=/\s/,Ks=/[A-Za-z]/,Ys=/[A-Za-z84_]/,Kt=/[,\]]/,ia=/[\d\.E\-\+]/;function et(t){if(typeof t!="string")throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Ct}et.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==Vt)for(;Vs.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Ct:return this.neutral(t);case ea:return this.keyword(t);case Vt:return this.quoted(t);case sa:return this.afterquote(t);case aa:return this.number(t);case Ee:return}};et.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=Vt;return}if(Kt.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};et.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Ct;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Ct,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Ee);return}};et.prototype.number=function(t){if(ia.test(t)){this.word+=t;return}if(Kt.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};et.prototype.quoted=function(t){if(t==='"'){this.state=sa;return}this.word+=t};et.prototype.keyword=function(t){if(Ys.test(t)){this.word+=t;return}if(t==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=Ct;return}if(Kt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};et.prototype.neutral=function(t){if(Ks.test(t)){this.word=t,this.state=ea;return}if(t==='"'){this.word="",this.state=Vt;return}if(ia.test(t)){this.word=t,this.state=aa;return}if(Kt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};et.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ee)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Zs(t){var e=new et(t);return e.output()}function ra(t,e,a){Array.isArray(e)&&(a.unshift(e),e=null);var i=e?{}:t,s=a.reduce(function(r,n){return Mt(n,r),r},i);e&&(t[e]=s)}function Mt(t,e){if(!Array.isArray(t)){e[t]=!0;return}var a=t.shift();if(a==="PARAMETER"&&(a=t.shift()),t.length===1){if(Array.isArray(t[0])){e[a]={},Mt(t[0],e[a]);return}e[a]=t[0];return}if(!t.length){e[a]=!0;return}if(a==="TOWGS84"){e[a]=t;return}if(a==="AXIS"){a in e||(e[a]=[]),e[a].push(t);return}Array.isArray(a)||(e[a]={});var i;switch(a){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[a]={name:t[0].toLowerCase(),convert:t[1]},t.length===3&&Mt(t[2],e[a]);return;case"SPHEROID":case"ELLIPSOID":e[a]={name:t[0],a:t[1],rf:t[2]},t.length===4&&Mt(t[3],e[a]);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":t[0]=["name",t[0]],ra(e,a,t);return;default:for(i=-1;++i<t.length;)if(!Array.isArray(t[i]))return Mt(t,e[a]);return ra(e,a,t)}}var $s=.017453292519943295;function ti(t,e){var a=e[0],i=e[1];!(a in t)&&i in t&&(t[a]=t[i],e.length===3&&(t[a]=e[2](t[a])))}function $(t){return t*$s}function ei(t){if(t.type==="GEOGCS"?t.projName="longlat":t.type==="LOCAL_CS"?(t.projName="identity",t.local=!0):typeof t.PROJECTION=="object"?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var e="",a=0,i=t.AXIS.length;a<i;++a){var s=[t.AXIS[a][0].toLowerCase(),t.AXIS[a][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?e+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?e+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?e+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(t.axis=e)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.UNIT.convert&&(t.type==="GEOGCS"?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var r=t.GEOGCS;t.type==="GEOGCS"&&(r=t),r&&(r.DATUM?t.datumCode=r.DATUM.name.toLowerCase():t.datumCode=r.name.toLowerCase(),t.datumCode.slice(0,2)==="d_"&&(t.datumCode=t.datumCode.slice(2)),(t.datumCode==="new_zealand_geodetic_datum_1949"||t.datumCode==="new_zealand_1949")&&(t.datumCode="nzgd49"),(t.datumCode==="wgs_1984"||t.datumCode==="world_geodetic_system_1984")&&(t.PROJECTION==="Mercator_Auxiliary_Sphere"&&(t.sphere=!0),t.datumCode="wgs84"),t.datumCode.slice(-6)==="_ferro"&&(t.datumCode=t.datumCode.slice(0,-6)),t.datumCode.slice(-8)==="_jakarta"&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),r.DATUM&&r.DATUM.SPHEROID&&(t.ellps=r.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),t.ellps.toLowerCase().slice(0,13)==="international"&&(t.ellps="intl"),t.a=r.DATUM.SPHEROID.a,t.rf=parseFloat(r.DATUM.SPHEROID.rf,10)),r.DATUM&&r.DATUM.TOWGS84&&(t.datum_params=r.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),t.datumCode==="ch1903+"&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a);function n(l){var u=t.to_meter||1;return l*u}var h=function(l){return ti(t,l)},o=[["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",$],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",$],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",$],["lat0","latitude_of_origin",$],["lat0","standard_parallel_1",$],["lat1","standard_parallel_1",$],["lat2","standard_parallel_2",$],["azimuth","Azimuth"],["alpha","azimuth",$],["srsCode","name"]];o.forEach(h),!t.long0&&t.longc&&(t.projName==="Albers_Conic_Equal_Area"||t.projName==="Lambert_Azimuthal_Equal_Area")&&(t.long0=t.longc),!t.lat_ts&&t.lat1&&(t.projName==="Stereographic_South_Pole"||t.projName==="Polar Stereographic (variant B)")?(t.lat0=$(t.lat1>0?90:-90),t.lat_ts=t.lat1):!t.lat_ts&&t.lat0&&t.projName==="Polar_Stereographic"&&(t.lat_ts=t.lat0,t.lat0=$(t.lat0>0?90:-90))}function Yt(t){var e=ta(t),a=e.shift(),i=e.shift();e.unshift(["name",i]),e.unshift(["type",a]);var s={};return Mt(e,s),ei(s),s}function U(t){var e=this;if(arguments.length===2){var a=arguments[1];typeof a=="string"?a.charAt(0)==="+"?U[t]=wt(arguments[1]):U[t]=Yt(arguments[1]):U[t]=a}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(i){Array.isArray(i)?U.apply(e,i):U(i)});if(typeof t=="string"){if(t in U)return U[t]}else"EPSG"in t?U["EPSG:"+t.EPSG]=t:"ESRI"in t?U["ESRI:"+t.ESRI]=t:"IAU2000"in t?U["IAU2000:"+t.IAU2000]=t:console.log(t);return}}Xe(U);var xt=U;function ai(t){return typeof t=="string"}function si(t){return t in xt}var ii=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function ri(t){return ii.some(function(e){return t.indexOf(e)>-1})}var ni=["3857","900913","3785","102113"];function hi(t){var e=k(t,"authority");if(e){var a=k(e,"epsg");return a&&ni.indexOf(a)>-1}}function oi(t){var e=k(t,"extension");if(e)return k(e,"proj4")}function li(t){return t[0]==="+"}function fi(t){if(ai(t)){if(si(t))return xt[t];if(ri(t)){var e=Yt(t);if(hi(e))return xt["EPSG:3857"];var a=oi(e);return a?wt(a):e}if(li(t))return wt(t)}else return t}var na=fi;function Ie(t,e){t=t||{};var a,i;if(!e)return t;for(i in e)a=e[i],a!==void 0&&(t[i]=a);return t}function B(t,e,a){var i=t*e;return a/Math.sqrt(1-i*i)}function tt(t){return t<0?-1:1}function v(t){return Math.abs(t)<=R?t:t-tt(t)*Rt}function F(t,e,a){var i=t*a,s=.5*t;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(m-e))/i}function at(t,e){for(var a=.5*t,i,s,r=m-2*Math.atan(e),n=0;n<=15;n++)if(i=t*Math.sin(r),s=m-2*Math.atan(e*Math.pow((1-i)/(1+i),a))-r,r+=s,Math.abs(s)<=1e-10)return r;return-9999}function ui(){var t=this.b/this.a;this.es=1-t*t,"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=B(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function ci(t){var e=t.x,a=t.y;if(a*V>90&&a*V<-90&&e*V>180&&e*V<-180)return null;var i,s;if(Math.abs(Math.abs(a)-m)<=p)return null;if(this.sphere)i=this.x0+this.a*this.k0*v(e-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(I+.5*a));else{var r=Math.sin(a),n=F(this.e,a,r);i=this.x0+this.a*this.k0*v(e-this.long0),s=this.y0-this.a*this.k0*Math.log(n)}return t.x=i,t.y=s,t}function mi(t){var e=t.x-this.x0,a=t.y-this.y0,i,s;if(this.sphere)s=m-2*Math.atan(Math.exp(-a/(this.a*this.k0)));else{var r=Math.exp(-a/(this.a*this.k0));if(s=at(this.e,r),s===-9999)return null}return i=v(this.long0+e/(this.a*this.k0)),t.x=i,t.y=s,t}var Mi=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],ha={init:ui,forward:ci,inverse:mi,names:Mi};function di(){}function oa(t){return t}var pi=["longlat","identity"],la={init:di,forward:oa,inverse:oa,names:pi};var vi=[ha,la],Zt={},$t=[];function fa(t,e){var a=$t.length;return t.names?($t[a]=t,t.names.forEach(function(i){Zt[i.toLowerCase()]=a}),this):(console.log(e),!0)}function yi(t){if(!t)return!1;var e=t.toLowerCase();if(typeof Zt[e]<"u"&&$t[Zt[e]])return $t[Zt[e]]}function xi(){vi.forEach(fa)}var ua={start:xi,add:fa,get:yi};var _={};_.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};_.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};_.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};_.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};_.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};_.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};_.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};_.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};_.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};_.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};_.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};_.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};_.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};_.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};_.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};_.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};_.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};_.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};_.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};_.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};_.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};_.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};_.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};_.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};_.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};_.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};_.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};_.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};_.hough={a:6378270,rf:297,ellipseName:"Hough"};_.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};_.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};_.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};_.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};_.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};_.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};_.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};_.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};_.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};_.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};_.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};_.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var ca=_.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};_.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function ma(t,e,a,i){var s=t*t,r=e*e,n=(s-r)/s,h=0;i?(t*=1-n*(Ve+n*(Ke+n*Ye)),s=t*t,n=0):h=Math.sqrt(n);var o=(s-r)/r;return{es:n,e:h,ep2:o}}function Ma(t,e,a,i,s){if(!t){var r=k(_,i);r||(r=ca),t=r.a,e=r.b,a=r.rf}return a&&!e&&(e=(1-1/a)*t),(a===0||Math.abs(t-e)<p)&&(s=!0,e=t),{a:t,b:e,rf:a,sphere:s}}var T={};T.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};T.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};T.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};T.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};T.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};T.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};T.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};T.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};T.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};T.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};T.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};T.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};T.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};T.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};T.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};T.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};T.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function gi(t,e,a,i,s,r){var n={};return t===void 0||t==="none"?n.datum_type=St:n.datum_type=Qe,e&&(n.datum_params=e.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=X),n.datum_params.length>3&&(n.datum_params[3]!==0||n.datum_params[4]!==0||n.datum_params[5]!==0||n.datum_params[6]!==0)&&(n.datum_type=Q,n.datum_params[3]*=mt,n.datum_params[4]*=mt,n.datum_params[5]*=mt,n.datum_params[6]=n.datum_params[6]/1e6+1)),n.a=a,n.b=i,n.es=s,n.ep2=r,n}var da=gi;function gt(t,e){if(!(this instanceof gt))return new gt(t);e=e||function(o){if(o)throw o};var a=na(t);if(typeof a!="object"){e(t);return}var i=gt.projections.get(a.projName);if(!i){e(t);return}if(a.datumCode&&a.datumCode!=="none"){var s=k(T,a.datumCode);s&&(a.datum_params=s.towgs84?s.towgs84.split(","):null,a.ellps=s.ellipse,a.datumName=s.datumName?s.datumName:a.datumCode)}a.k0=a.k0||1,a.axis=a.axis||"enu",a.ellps=a.ellps||"wgs84";var r=Ma(a.a,a.b,a.rf,a.ellps,a.sphere),n=ma(r.a,r.b,r.rf,a.R_A),h=a.datum||da(a.datumCode,a.datum_params,r.a,r.b,n.es,n.ep2);Ie(this,a),Ie(this,i),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=n.es,this.e=n.e,this.ep2=n.ep2,this.datum=h,this.init(),e(null,this)}gt.projections=ua;gt.projections.start();var lt=gt;function pa(t,e){return t.datum_type!==e.datum_type||t.a!==e.a||Math.abs(t.es-e.es)>5e-11?!1:t.datum_type===X?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type===Q?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]:!0}function te(t,e,a){var i=t.x,s=t.y,r=t.z?t.z:0,n,h,o,l;if(s<-m&&s>-1.001*m)s=-m;else if(s>m&&s<1.001*m)s=m;else{if(s<-m)return{x:-1/0,y:-1/0,z:t.z};if(s>m)return{x:1/0,y:1/0,z:t.z}}return i>Math.PI&&(i-=2*Math.PI),h=Math.sin(s),l=Math.cos(s),o=h*h,n=a/Math.sqrt(1-e*o),{x:(n+r)*l*Math.cos(i),y:(n+r)*l*Math.sin(i),z:(n*(1-e)+r)*h}}function ee(t,e,a,i){var s=1e-12,r=s*s,n=30,h,o,l,u,f,c,M,d,y,x,g,b,E,S=t.x,A=t.y,P=t.z?t.z:0,O,C,Z;if(h=Math.sqrt(S*S+A*A),o=Math.sqrt(S*S+A*A+P*P),h/a<s){if(O=0,o/a<s)return C=m,Z=-i,{x:t.x,y:t.y,z:t.z}}else O=Math.atan2(A,S);l=P/o,u=h/o,f=1/Math.sqrt(1-e*(2-e)*u*u),d=u*(1-e)*f,y=l*f,E=0;do E++,M=a/Math.sqrt(1-e*y*y),Z=h*d+P*y-M*(1-e*y*y),c=e*M/(M+Z),f=1/Math.sqrt(1-c*(2-c)*u*u),x=u*(1-c)*f,g=l*f,b=g*d-x*y,d=x,y=g;while(b*b>r&&E<n);return C=Math.atan(g/Math.abs(x)),{x:O,y:C,z:Z}}function va(t,e,a){if(e===X)return{x:t.x+a[0],y:t.y+a[1],z:t.z+a[2]};if(e===Q){var i=a[0],s=a[1],r=a[2],n=a[3],h=a[4],o=a[5],l=a[6];return{x:l*(t.x-o*t.y+h*t.z)+i,y:l*(o*t.x+t.y-n*t.z)+s,z:l*(-h*t.x+n*t.y+t.z)+r}}}function ya(t,e,a){if(e===X)return{x:t.x-a[0],y:t.y-a[1],z:t.z-a[2]};if(e===Q){var i=a[0],s=a[1],r=a[2],n=a[3],h=a[4],o=a[5],l=a[6],u=(t.x-i)/l,f=(t.y-s)/l,c=(t.z-r)/l;return{x:u+o*f-h*c,y:-o*u+f+n*c,z:h*u-n*f+c}}}function ae(t){return t===X||t===Q}function xa(t,e,a){return pa(t,e)||t.datum_type===St||e.datum_type===St||t.es===e.es&&t.a===e.a&&!ae(t.datum_type)&&!ae(e.datum_type)?a:(a=te(a,t.es,t.a),ae(t.datum_type)&&(a=va(a,t.datum_type,t.datum_params)),ae(e.datum_type)&&(a=ya(a,e.datum_type,e.datum_params)),ee(a,e.es,e.a,e.b))}function Ae(t,e,a){var i=a.x,s=a.y,r=a.z||0,n,h,o,l={};for(o=0;o<3;o++)if(!(e&&o===2&&a.z===void 0))switch(o===0?(n=i,"ew".indexOf(t.axis[o])!==-1?h="x":h="y"):o===1?(n=s,"ns".indexOf(t.axis[o])!==-1?h="y":h="x"):(n=r,h="z"),t.axis[o]){case"e":case"w":case"n":case"s":l[h]=n;break;case"u":a[h]!==void 0&&(l.z=n);break;case"d":a[h]!==void 0&&(l.z=-n);break;default:return null}return l}function se(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function _a(t){ga(t.x),ga(t.y)}function ga(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function _i(t,e){return(t.datum.datum_type===X||t.datum.datum_type===Q)&&e.datumCode!=="WGS84"||(e.datum.datum_type===X||e.datum.datum_type===Q)&&t.datumCode!=="WGS84"}function dt(t,e,a){var i;if(Array.isArray(a)&&(a=se(a)),_a(a),t.datum&&e.datum&&_i(t,e)&&(i=new lt("WGS84"),a=dt(t,i,a),t=i),t.axis!=="enu"&&(a=Ae(t,!1,a)),t.projName==="longlat")a={x:a.x*L,y:a.y*L,z:a.z||0};else if(t.to_meter&&(a={x:a.x*t.to_meter,y:a.y*t.to_meter,z:a.z||0}),a=t.inverse(a),!a)return;return t.from_greenwich&&(a.x+=t.from_greenwich),a=xa(t.datum,e.datum,a),e.from_greenwich&&(a={x:a.x-e.from_greenwich,y:a.y,z:a.z||0}),e.projName==="longlat"?a={x:a.x*V,y:a.y*V,z:a.z||0}:(a=e.forward(a),e.to_meter&&(a={x:a.x/e.to_meter,y:a.y/e.to_meter,z:a.z||0})),e.axis!=="enu"?Ae(e,!0,a):a}var ba=lt("WGS84");function Pe(t,e,a){var i,s,r;return Array.isArray(a)?(i=dt(t,e,a)||{x:NaN,y:NaN},a.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(a.splice(3)):[i.x,i.y,a[2]].concat(a.splice(3)):[i.x,i.y].concat(a.splice(2)):[i.x,i.y]):(s=dt(t,e,a),r=Object.keys(a),r.length===2||r.forEach(function(n){if(typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;s[n]=a[n]}),s)}function Ea(t){return t instanceof lt?t:t.oProj?t.oProj:lt(t)}function bi(t,e,a){t=Ea(t);var i=!1,s;return typeof e>"u"?(e=t,t=ba,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(a=e,e=t,t=ba,i=!0),e=Ea(e),a?Pe(t,e,a):(s={forward:function(r){return Pe(t,e,r)},inverse:function(r){return Pe(e,t,r)}},i&&(s.oProj=e),s)}var H=bi;var Ia=6,Pa="AJSAJS",Na="AFAFAF",_t=65,z=73,W=79,Lt=86,Tt=90,Sa={forward:Se,inverse:Ei,toPoint:Re};function Se(t,e){return e=e||5,Pi(Ii({lat:t[1],lon:t[0]}),e)}function Ei(t){var e=we(wa(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function Re(t){var e=we(wa(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Ne(t){return t*(Math.PI/180)}function Aa(t){return 180*(t/Math.PI)}function Ii(t){var e=t.lat,a=t.lon,i=6378137,s=.00669438,r=.9996,n,h,o,l,u,f,c,M=Ne(e),d=Ne(a),y,x;x=Math.floor((a+180)/6)+1,a===180&&(x=60),e>=56&&e<64&&a>=3&&a<12&&(x=32),e>=72&&e<84&&(a>=0&&a<9?x=31:a>=9&&a<21?x=33:a>=21&&a<33?x=35:a>=33&&a<42&&(x=37)),n=(x-1)*6-180+3,y=Ne(n),h=s/(1-s),o=i/Math.sqrt(1-s*Math.sin(M)*Math.sin(M)),l=Math.tan(M)*Math.tan(M),u=h*Math.cos(M)*Math.cos(M),f=Math.cos(M)*(d-y),c=i*((1-s/4-3*s*s/64-5*s*s*s/256)*M-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*M)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*M)-35*s*s*s/3072*Math.sin(6*M));var g=r*o*(f+(1-l+u)*f*f*f/6+(5-18*l+l*l+72*u-58*h)*f*f*f*f*f/120)+5e5,b=r*(c+o*Math.tan(M)*(f*f/2+(5-l+9*u+4*u*u)*f*f*f*f/24+(61-58*l+l*l+600*u-330*h)*f*f*f*f*f*f/720));return e<0&&(b+=1e7),{northing:Math.round(b),easting:Math.round(g),zoneNumber:x,zoneLetter:Ai(e)}}function we(t){var e=t.northing,a=t.easting,i=t.zoneLetter,s=t.zoneNumber;if(s<0||s>60)return null;var r=.9996,n=6378137,h=.00669438,o,l=(1-Math.sqrt(1-h))/(1+Math.sqrt(1-h)),u,f,c,M,d,y,x,g,b,E=a-5e5,S=e;i<"N"&&(S-=1e7),x=(s-1)*6-180+3,o=h/(1-h),y=S/r,g=y/(n*(1-h/4-3*h*h/64-5*h*h*h/256)),b=g+(3*l/2-27*l*l*l/32)*Math.sin(2*g)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*g)+151*l*l*l/96*Math.sin(6*g),u=n/Math.sqrt(1-h*Math.sin(b)*Math.sin(b)),f=Math.tan(b)*Math.tan(b),c=o*Math.cos(b)*Math.cos(b),M=n*(1-h)/Math.pow(1-h*Math.sin(b)*Math.sin(b),1.5),d=E/(u*r);var A=b-u*Math.tan(b)/M*(d*d/2-(5+3*f+10*c-4*c*c-9*o)*d*d*d*d/24+(61+90*f+298*c+45*f*f-252*o-3*c*c)*d*d*d*d*d*d/720);A=Aa(A);var P=(d-(1+2*f+c)*d*d*d/6+(5-2*c+28*f-3*c*c+8*o+24*f*f)*d*d*d*d*d/120)/Math.cos(b);P=x+Aa(P);var O;if(t.accuracy){var C=we({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});O={top:C.lat,right:C.lon,bottom:A,left:P}}else O={lat:A,lon:P};return O}function Ai(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Pi(t,e){var a="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+Ni(t.easting,t.northing,t.zoneNumber)+a.substr(a.length-5,e)+i.substr(i.length-5,e)}function Ni(t,e,a){var i=Ra(a),s=Math.floor(t/1e5),r=Math.floor(e/1e5)%20;return Si(s,r,i)}function Ra(t){var e=t%Ia;return e===0&&(e=Ia),e}function Si(t,e,a){var i=a-1,s=Pa.charCodeAt(i),r=Na.charCodeAt(i),n=s+t-1,h=r+e,o=!1;n>Tt&&(n=n-Tt+_t-1,o=!0),(n===z||s<z&&n>z||(n>z||s<z)&&o)&&n++,(n===W||s<W&&n>W||(n>W||s<W)&&o)&&(n++,n===z&&n++),n>Tt&&(n=n-Tt+_t-1),h>Lt?(h=h-Lt+_t-1,o=!0):o=!1,(h===z||r<z&&h>z||(h>z||r<z)&&o)&&h++,(h===W||r<W&&h>W||(h>W||r<W)&&o)&&(h++,h===z&&h++),h>Lt&&(h=h-Lt+_t-1);var l=String.fromCharCode(n)+String.fromCharCode(h);return l}function wa(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var e=t.length,a=null,i="",s,r=0;!/[A-Z]/.test(s=t.charAt(r));){if(r>=2)throw"MGRSPoint bad conversion from: "+t;i+=s,r++}var n=parseInt(i,10);if(r===0||r+3>e)throw"MGRSPoint bad conversion from: "+t;var h=t.charAt(r++);if(h<="A"||h==="B"||h==="Y"||h>="Z"||h==="I"||h==="O")throw"MGRSPoint zone letter "+h+" not handled: "+t;a=t.substring(r,r+=2);for(var o=Ra(n),l=Ri(a.charAt(0),o),u=wi(a.charAt(1),o);u<Ci(h);)u+=2e6;var f=e-r;if(f%2!==0)throw`MGRSPoint has to have an even number
|
|
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.1",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=`
|
|
8
|
+
switch (x) {${r.map(i=>`
|
|
9
|
+
case ${Vp(i)}:`).join("")}
|
|
10
|
+
return false;
|
|
11
|
+
}`),e.length!==r.length&&(t=`if (x !== x) return false;
|
|
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`[
|
|
14
|
+
${this.toArray().join(`,
|
|
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
|
|
8
17
|
of digits after the zone letter and two 100km letters - front
|
|
9
18
|
half for easting meters, second half for
|
|
10
|
-
northing meters`+t;var c=f/2,M=0,d=0,y,x,g,b,E;return c>0&&(y=1e5/Math.pow(10,c),x=t.substring(r,r+c),M=parseFloat(x)*y,g=t.substring(r+c),d=parseFloat(g)*y),b=M+l,E=d+u,{easting:b,northing:E,zoneLetter:h,zoneNumber:n,accuracy:y}}function Ri(t,e){for(var a=Pa.charCodeAt(e-1),i=1e5,s=!1;a!==t.charCodeAt(0);){if(a++,a===z&&a++,a===W&&a++,a>Tt){if(s)throw"Bad character: "+t;a=_t,s=!0}i+=1e5}return i}function wi(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var a=Na.charCodeAt(e-1),i=0,s=!1;a!==t.charCodeAt(0);){if(a++,a===z&&a++,a===W&&a++,a>Lt){if(s)throw"Bad character: "+t;a=_t,s=!0}i+=1e5}return i}function Ci(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function bt(t,e,a){if(!(this instanceof bt))return new bt(t,e,a);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof e>"u"){var i=t.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=t,this.y=e,this.z=a||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}bt.fromMGRS=function(t){return new bt(Re(t))};bt.prototype.toMGRS=function(t){return Se([this.x,this.y],t)};var Ca=bt;var Li=1,Ti=.25,La=.046875,Ta=.01953125,Da=.01068115234375,Di=.75,Oi=.46875,Bi=.013020833333333334,Gi=.007120768229166667,Fi=.3645833333333333,qi=.005696614583333333,zi=.3076171875;function ie(t){var e=[];e[0]=Li-t*(Ti+t*(La+t*(Ta+t*Da))),e[1]=t*(Di-t*(La+t*(Ta+t*Da)));var a=t*t;return e[2]=a*(Oi-t*(Bi+t*Gi)),a*=t,e[3]=a*(Fi-t*qi),e[4]=a*t*zi,e}function pt(t,e,a,i){return a*=e,e*=e,i[0]*t-a*(i[1]+e*(i[2]+e*(i[3]+e*i[4])))}var ji=20;function re(t,e,a){for(var i=1/(1-e),s=t,r=ji;r;--r){var n=Math.sin(s),h=1-e*n*n;if(h=(pt(s,n,Math.cos(s),a)-t)*(h*Math.sqrt(h))*i,s-=h,Math.abs(h)<p)return s}return s}function ki(){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=ie(this.es),this.ml0=pt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Hi(t){var e=t.x,a=t.y,i=v(e-this.long0),s,r,n,h=Math.sin(a),o=Math.cos(a);if(this.es){var u=o*i,f=Math.pow(u,2),c=this.ep2*Math.pow(o,2),M=Math.pow(c,2),d=Math.abs(o)>p?Math.tan(a):0,y=Math.pow(d,2),x=Math.pow(y,2);s=1-this.es*Math.pow(h,2),u=u/Math.sqrt(s);var g=pt(a,h,o,this.en);r=this.a*(this.k0*u*(1+f/6*(1-y+c+f/20*(5-18*y+x+14*c-58*y*c+f/42*(61+179*x-x*y-479*y)))))+this.x0,n=this.a*(this.k0*(g-this.ml0+h*i*u/2*(1+f/12*(5-y+9*c+4*M+f/30*(61+x-58*y+270*c-330*y*c+f/56*(1385+543*x-x*y-3111*y))))))+this.y0}else{var l=o*Math.sin(i);if(Math.abs(Math.abs(l)-1)<p)return 93;if(r=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,n=o*Math.cos(i)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(n),l>=1){if(l-1>p)return 93;n=0}else n=Math.acos(n);a<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=r,t.y=n,t}function Ui(t){var e,a,i,s,r=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+n/this.k0,a=re(e,this.es,this.en),Math.abs(a)<m){var f=Math.sin(a),c=Math.cos(a),M=Math.abs(c)>p?Math.tan(a):0,d=this.ep2*Math.pow(c,2),y=Math.pow(d,2),x=Math.pow(M,2),g=Math.pow(x,2);e=1-this.es*Math.pow(f,2);var b=r*Math.sqrt(e)/this.k0,E=Math.pow(b,2);e=e*M,i=a-e*E/(1-this.es)*.5*(1-E/12*(5+3*x-9*d*x+d-4*y-E/30*(61+90*x-252*d*x+45*g+46*d-E/56*(1385+3633*x+4095*g+1574*g*x)))),s=v(this.long0+b*(1-E/6*(1+2*x+d-E/20*(5+28*x+24*g+8*d*x+6*d-E/42*(61+662*x+1320*g+720*g*x))))/c)}else i=m*tt(n),s=0;else{var h=Math.exp(r/this.k0),o=.5*(h-1/h),l=this.lat0+n/this.k0,u=Math.cos(l);e=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(o,2))),i=Math.asin(e),n<0&&(i=-i),o===0&&u===0?s=0:s=v(Math.atan2(o,u)+this.long0)}return t.x=s,t.y=i,t}var Wi=["Transverse_Mercator","Transverse Mercator","tmerc"],Oa={init:ki,forward:Hi,inverse:Ui,names:Wi};function ne(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function Dt(t,e){t=Math.abs(t),e=Math.abs(e);var a=Math.max(t,e),i=Math.min(t,e)/(a||1);return a*Math.sqrt(1+Math.pow(i,2))}function Ba(t){var e=1+t,a=e-1;return a===0?t:t*Math.log(e)/a}function Ga(t){var e=Math.abs(t);return e=Ba(e*(1+e/(Dt(1,e)+1))),t<0?-e:e}function he(t,e){for(var a=2*Math.cos(2*e),i=t.length-1,s=t[i],r=0,n;--i>=0;)n=-r+a*s+t[i],r=s,s=n;return e+n*Math.sin(2*e)}function Fa(t,e){for(var a=2*Math.cos(e),i=t.length-1,s=t[i],r=0,n;--i>=0;)n=-r+a*s+t[i],r=s,s=n;return Math.sin(e)*n}function qa(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function Ce(t,e,a){for(var i=Math.sin(e),s=Math.cos(e),r=ne(a),n=qa(a),h=2*s*n,o=-2*i*r,l=t.length-1,u=t[l],f=0,c=0,M=0,d,y;--l>=0;)d=c,y=f,c=u,f=M,u=-d+h*c-o*f+t[l],M=-y+o*c+h*f;return h=i*n,o=s*r,[h*u-o*M,h*M+o*u]}function Ji(){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 t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),a=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),a=a*e,this.cgb[1]=a*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=a*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),a=a*e,this.cgb[2]=a*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=a*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),a=a*e,this.cgb[3]=a*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=a*(1237/630+e*(-12/5+e*(-24832/14175))),a=a*e,this.cgb[4]=a*(4174/315+e*(-144838/6237)),this.cbg[4]=a*(-734/315+e*(109598/31185)),a=a*e,this.cgb[5]=a*(601676/22275),this.cbg[5]=a*(444337/155925),a=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+a*(1/4+a*(1/64+a/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=a*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=a*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),a=a*e,this.utg[2]=a*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=a*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),a=a*e,this.utg[3]=a*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=a*(49561/161280+e*(-179/168+e*(6601661/7257600))),a=a*e,this.utg[4]=a*(-4583/161280+e*(108847/3991680)),this.gtu[4]=a*(34729/80640+e*(-3418889/1995840)),a=a*e,this.utg[5]=a*(-20648693/638668800),this.gtu[5]=a*(212378941/319334400);var i=he(this.cbg,this.lat0);this.Zb=-this.Qn*(i+Fa(this.gtu,2*i))}function Xi(t){var e=v(t.x-this.long0),a=t.y;a=he(this.cbg,a);var i=Math.sin(a),s=Math.cos(a),r=Math.sin(e),n=Math.cos(e);a=Math.atan2(i,n*s),e=Math.atan2(r*s,Dt(i,s*n)),e=Ga(Math.tan(e));var h=Ce(this.gtu,2*a,2*e);a=a+h[0],e=e+h[1];var o,l;return Math.abs(e)<=2.623395162778?(o=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*a+this.Zb)+this.y0):(o=1/0,l=1/0),t.x=o,t.y=l,t}function Qi(t){var e=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);a=(a-this.Zb)/this.Qn,e=e/this.Qn;var i,s;if(Math.abs(e)<=2.623395162778){var r=Ce(this.utg,2*a,2*e);a=a+r[0],e=e+r[1],e=Math.atan(ne(e));var n=Math.sin(a),h=Math.cos(a),o=Math.sin(e),l=Math.cos(e);a=Math.atan2(n*l,Dt(o,l*h)),e=Math.atan2(o,l*h),i=v(e+this.long0),s=he(this.cgb,a)}else i=1/0,s=1/0;return t.x=i,t.y=s,t}var Vi=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Et={init:Ji,forward:Xi,inverse:Qi,names:Vi};function za(t,e){if(t===void 0){if(t=Math.floor((v(e)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var Ki="etmerc";function Yi(){var t=za(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*L,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Et.init.apply(this),this.forward=Et.forward,this.inverse=Et.inverse}var Zi=["Universal Transverse Mercator System","utm"],ja={init:Yi,names:Zi,dependsOn:Ki};function oe(t,e){return Math.pow((1-t)/(1+t),e)}var $i=20;function tr(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+I)/(Math.pow(Math.tan(.5*this.lat0+I),this.C)*oe(this.e*t,this.ratexp))}function er(t){var e=t.x,a=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*a+I),this.C)*oe(this.e*Math.sin(a),this.ratexp))-m,t.x=this.C*e,t}function ar(t){for(var e=1e-14,a=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+I)/this.K,1/this.C),r=$i;r>0&&(i=2*Math.atan(s*oe(this.e*Math.sin(t.y),-.5*this.e))-m,!(Math.abs(i-t.y)<e));--r)t.y=i;return r?(t.x=a,t.y=i,t):null}var sr=["gauss"],le={init:tr,forward:er,inverse:ar,names:sr};function ir(){le.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 rr(t){var e,a,i,s;return t.x=v(t.x-this.long0),le.forward.apply(this,[t]),e=Math.sin(t.y),a=Math.cos(t.y),i=Math.cos(t.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*a*i),t.x=s*a*Math.sin(t.x),t.y=s*(this.cosc0*e-this.sinc0*a*i),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function nr(t){var e,a,i,s,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(r,this.R2);e=Math.sin(n),a=Math.cos(n),s=Math.asin(a*this.sinc0+t.y*e*this.cosc0/r),i=Math.atan2(t.x*e,r*this.cosc0*a-t.y*this.sinc0*e)}else s=this.phic0,i=0;return t.x=i,t.y=s,le.inverse.apply(this,[t]),t.x=v(t.x+this.long0),t}var hr=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],ka={init:ir,forward:rr,inverse:nr,names:hr};function or(t,e,a){return e*=a,Math.tan(.5*(m+t))*Math.pow((1-e)/(1+e),.5*a)}function lr(){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)<=p&&(this.k0=.5*(1+tt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=p&&(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)<=p&&(this.k0=.5*this.cons*B(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/F(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=B(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-m,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function fr(t){var e=t.x,a=t.y,i=Math.sin(a),s=Math.cos(a),r,n,h,o,l,u,f=v(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=p&&Math.abs(a+this.lat0)<=p?(t.x=NaN,t.y=NaN,t):this.sphere?(r=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(f)),t.x=this.a*r*s*Math.sin(f)+this.x0,t.y=this.a*r*(this.coslat0*i-this.sinlat0*s*Math.cos(f))+this.y0,t):(n=2*Math.atan(this.ssfn_(a,i,this.e))-m,o=Math.cos(n),h=Math.sin(n),Math.abs(this.coslat0)<=p?(l=F(this.e,a*this.con,this.con*i),u=2*this.a*this.k0*l/this.cons,t.x=this.x0+u*Math.sin(e-this.long0),t.y=this.y0-this.con*u*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<p?(r=2*this.a*this.k0/(1+o*Math.cos(f)),t.y=r*h):(r=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*h+this.cosX0*o*Math.cos(f))),t.y=r*(this.cosX0*h-this.sinX0*o*Math.cos(f))+this.y0),t.x=r*o*Math.sin(f)+this.x0,t))}function ur(t){t.x-=this.x0,t.y-=this.y0;var e,a,i,s,r,n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var h=2*Math.atan(n/(2*this.a*this.k0));return e=this.long0,a=this.lat0,n<=p?(t.x=e,t.y=a,t):(a=Math.asin(Math.cos(h)*this.sinlat0+t.y*Math.sin(h)*this.coslat0/n),Math.abs(this.coslat0)<p?this.lat0>0?e=v(this.long0+Math.atan2(t.x,-1*t.y)):e=v(this.long0+Math.atan2(t.x,t.y)):e=v(this.long0+Math.atan2(t.x*Math.sin(h),n*this.coslat0*Math.cos(h)-t.y*this.sinlat0*Math.sin(h))),t.x=e,t.y=a,t)}else if(Math.abs(this.coslat0)<=p){if(n<=p)return a=this.lat0,e=this.long0,t.x=e,t.y=a,t;t.x*=this.con,t.y*=this.con,i=n*this.cons/(2*this.a*this.k0),a=this.con*at(this.e,i),e=this.con*v(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else s=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,n<=p?r=this.X0:(r=Math.asin(Math.cos(s)*this.sinX0+t.y*Math.sin(s)*this.cosX0/n),e=v(this.long0+Math.atan2(t.x*Math.sin(s),n*this.cosX0*Math.cos(s)-t.y*this.sinX0*Math.sin(s)))),a=-1*at(this.e,Math.tan(.5*(m+r)));return t.x=e,t.y=a,t}var cr=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Ha={init:lr,forward:fr,inverse:ur,names:cr,ssfn_:or};function mr(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),a=this.a,i=this.rf,s=1/i,r=2*s-Math.pow(s,2),n=this.e=Math.sqrt(r);this.R=this.k0*a*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var h=Math.log(Math.tan(Math.PI/4+this.b0/2)),o=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+n*e)/(1-n*e));this.K=h-this.alpha*o+this.alpha*n/2*l}function Mr(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),a=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),i=-this.alpha*(e+a)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(r))),h=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(h))/(1-Math.sin(h)))+this.y0,t.x=this.R*n+this.x0,t}function dr(t){for(var e=t.x-this.x0,a=t.y-this.y0,i=e/this.R,s=2*(Math.atan(Math.exp(a/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),n=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),h=this.lambda0+n/this.alpha,o=0,l=r,u=-1e3,f=0;Math.abs(l-u)>1e-7;){if(++f>20)return;o=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(o))-Math.PI/2}return t.x=h,t.y=l,t}var pr=["somerc"],Ua={init:mr,forward:Mr,inverse:dr,names:pr};function vr(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),a=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-a*a);var i=F(this.e,this.lat0,t),s=this.bl/e*Math.sqrt((1-this.es)/(1-a*a));s*s<1&&(s=1);var r,n;if(!isNaN(this.longc))this.lat0>=0?r=s+Math.sqrt(s*s-1):r=s-Math.sqrt(s*s-1),this.el=r*Math.pow(i,this.bl),n=.5*(r-1/r),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(n*Math.tan(this.gamma0))/this.bl;else{var h=F(this.e,this.lat1,Math.sin(this.lat1)),o=F(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(h,this.bl),u=Math.pow(o,this.bl);r=this.el/l,n=.5*(r-1/r);var f=(this.el*this.el-u*l)/(this.el*this.el+u*l),c=(u-l)/(u+l),M=v(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(f*Math.tan(.5*this.bl*M)/c)/this.bl,this.long0=v(this.long0);var d=v(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*d)/n),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 yr(t){var e=t.x,a=t.y,i=v(e-this.long0),s,r,n;if(Math.abs(Math.abs(a)-m)<=p)a>0?n=-1:n=1,r=this.al/this.bl*Math.log(Math.tan(I+n*this.gamma0*.5)),s=-1*n*m*this.al/this.bl;else{var h=F(this.e,a,Math.sin(a)),o=this.el/Math.pow(h,this.bl),l=.5*(o-1/o),u=.5*(o+1/o),f=Math.sin(this.bl*i),c=(l*Math.sin(this.gamma0)-f*Math.cos(this.gamma0))/u;Math.abs(Math.abs(c)-1)<=p?r=Number.POSITIVE_INFINITY:r=.5*this.al*Math.log((1-c)/(1+c))/this.bl,Math.abs(Math.cos(this.bl*i))<=p?s=this.al*this.bl*i:s=this.al*Math.atan2(l*Math.cos(this.gamma0)+f*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(t.x=this.x0+s,t.y=this.y0+r):(s-=this.uc,t.x=this.x0+r*Math.cos(this.alpha)+s*Math.sin(this.alpha),t.y=this.y0+s*Math.cos(this.alpha)-r*Math.sin(this.alpha)),t}function xr(t){var e,a;this.no_rot?(a=t.y-this.y0,e=t.x-this.x0):(a=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var i=Math.exp(-1*this.bl*a/this.al),s=.5*(i-1/i),r=.5*(i+1/i),n=Math.sin(this.bl*e/this.al),h=(n*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/r,o=Math.pow(this.el/Math.sqrt((1+h)/(1-h)),1/this.bl);return Math.abs(h-1)<p?(t.x=this.long0,t.y=m):Math.abs(h+1)<p?(t.x=this.long0,t.y=-1*m):(t.y=at(this.e,o),t.x=v(this.long0-Math.atan2(s*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*e/this.al))/this.bl)),t}var gr=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Wa={init:vr,forward:yr,inverse:xr,names:gr};function _r(){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)<p)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),a=Math.cos(this.lat1),i=B(this.e,e,a),s=F(this.e,this.lat1,e),r=Math.sin(this.lat2),n=Math.cos(this.lat2),h=B(this.e,r,n),o=F(this.e,this.lat2,r),l=F(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>p?this.ns=Math.log(i/h)/Math.log(s/o):this.ns=e,isNaN(this.ns)&&(this.ns=e),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 br(t){var e=t.x,a=t.y;Math.abs(2*Math.abs(a)-Math.PI)<=p&&(a=tt(a)*(m-2*p));var i=Math.abs(Math.abs(a)-m),s,r;if(i>p)s=F(this.e,a,Math.sin(a)),r=this.a*this.f0*Math.pow(s,this.ns);else{if(i=a*this.ns,i<=0)return null;r=0}var n=this.ns*v(e-this.long0);return t.x=this.k0*(r*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(n))+this.y0,t}function Er(t){var e,a,i,s,r,n=(t.x-this.x0)/this.k0,h=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(n*n+h*h),a=1):(e=-Math.sqrt(n*n+h*h),a=-1);var o=0;if(e!==0&&(o=Math.atan2(a*n,a*h)),e!==0||this.ns>0){if(a=1/this.ns,i=Math.pow(e/(this.a*this.f0),a),s=at(this.e,i),s===-9999)return null}else s=-m;return r=v(o/this.ns+this.long0),t.x=r,t.y=s,t}var Ir=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Ja={init:_r,forward:br,inverse:Er,names:Ir};function Ar(){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 Pr(t){var e,a,i,s,r,n,h,o=t.x,l=t.y,u=v(o-this.long0);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),a=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),i=-u*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(a)+Math.sin(this.ad)*Math.cos(a)*Math.cos(i)),r=Math.asin(Math.cos(a)*Math.sin(i)/Math.cos(s)),n=this.n*r,h=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),t.y=h*Math.cos(n)/1,t.x=h*Math.sin(n)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Nr(t){var e,a,i,s,r,n,h,o,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),n=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x),s=r/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/n,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),a=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(e)),t.x=this.long0-a/this.alfa,h=e,o=0;var u=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.e/2))-this.s45),Math.abs(h-t.y)<1e-10&&(o=1),h=t.y,u+=1;while(o===0&&u<15);return u>=15?null:t}var Sr=["Krovak","krovak"],Xa={init:Ar,forward:Pr,inverse:Nr,names:Sr};function D(t,e,a,i,s){return t*s-e*Math.sin(2*s)+a*Math.sin(4*s)-i*Math.sin(6*s)}function st(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function it(t){return .375*t*(1+.25*t*(1+.46875*t))}function rt(t){return .05859375*t*t*(1+.75*t)}function nt(t){return t*t*t*(35/3072)}function ht(t,e,a){var i=e*a;return t/Math.sqrt(1-i*i)}function K(t){return Math.abs(t)<m?t:t-tt(t)*Math.PI}function vt(t,e,a,i,s){var r,n;r=t/e;for(var h=0;h<15;h++)if(n=(t-(e*r-a*Math.sin(2*r)+i*Math.sin(4*r)-s*Math.sin(6*r)))/(e-2*a*Math.cos(2*r)+4*i*Math.cos(4*r)-6*s*Math.cos(6*r)),r+=n,Math.abs(n)<=1e-10)return r;return NaN}function Rr(){this.sphere||(this.e0=st(this.es),this.e1=it(this.es),this.e2=rt(this.es),this.e3=nt(this.es),this.ml0=this.a*D(this.e0,this.e1,this.e2,this.e3,this.lat0))}function wr(t){var e,a,i=t.x,s=t.y;if(i=v(i-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(s)*Math.sin(i)),a=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var r=Math.sin(s),n=Math.cos(s),h=ht(this.a,this.e,r),o=Math.tan(s)*Math.tan(s),l=i*Math.cos(s),u=l*l,f=this.es*n*n/(1-this.es),c=this.a*D(this.e0,this.e1,this.e2,this.e3,s);e=h*l*(1-u*o*(1/6-(8-o+8*f)*u/120)),a=c-this.ml0+h*r/n*u*(.5+(5-o+6*f)*u/24)}return t.x=e+this.x0,t.y=a+this.y0,t}function Cr(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,a=t.y/this.a,i,s;if(this.sphere){var r=a+this.lat0;i=Math.asin(Math.sin(r)*Math.cos(e)),s=Math.atan2(Math.tan(e),Math.cos(r))}else{var n=this.ml0/this.a+a,h=vt(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(h)-m)<=p)return t.x=this.long0,t.y=m,a<0&&(t.y*=-1),t;var o=ht(this.a,this.e,Math.sin(h)),l=o*o*o/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(h),2),f=e*this.a/o,c=f*f;i=h-o*Math.tan(h)/l*f*f*(.5-(1+3*u)*f*f/24),s=f*(1-c*(u/3+(1+3*u)*u*c/15))/Math.cos(h)}return t.x=v(s+this.long0),t.y=K(i),t}var Lr=["Cassini","Cassini_Soldner","cass"],Qa={init:Rr,forward:wr,inverse:Cr,names:Lr};function Y(t,e){var a;return t>1e-7?(a=t*e,(1-t*t)*(e/(1-a*a)-.5/t*Math.log((1-a)/(1+a)))):2*e}var Tr=1,Dr=2,Or=3,Br=4;function Gr(){var t=Math.abs(this.lat0);if(Math.abs(t-m)<p?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<p?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=Y(this.e,1),this.mmf=.5/(1-this.es),this.apa=Jr(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),e=Math.sin(this.lat0),this.sinb1=Y(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*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 Fr(t){var e,a,i,s,r,n,h,o,l,u,f=t.x,c=t.y;if(f=v(f-this.long0),this.sphere){if(r=Math.sin(c),u=Math.cos(c),i=Math.cos(f),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(a=this.mode===this.EQUIT?1+u*i:1+this.sinph0*r+this.cosph0*u*i,a<=p)return null;a=Math.sqrt(2/a),e=a*u*Math.sin(f),a*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*u*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(c+this.lat0)<p)return null;a=I-c*.5,a=2*(this.mode===this.S_POLE?Math.cos(a):Math.sin(a)),e=a*Math.sin(f),a*=i}}else{switch(h=0,o=0,l=0,i=Math.cos(f),s=Math.sin(f),r=Math.sin(c),n=Y(this.e,r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(h=n/this.qp,o=Math.sqrt(1-h*h)),this.mode){case this.OBLIQ:l=1+this.sinb1*h+this.cosb1*o*i;break;case this.EQUIT:l=1+o*i;break;case this.N_POLE:l=m+c,n=this.qp-n;break;case this.S_POLE:l=c-m,n=this.qp+n;break}if(Math.abs(l)<p)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),this.mode===this.OBLIQ?a=this.ymf*l*(this.cosb1*h-this.sinb1*o*i):a=(l=Math.sqrt(2/(1+o*i)))*h*this.ymf,e=this.xmf*l*o*s;break;case this.N_POLE:case this.S_POLE:n>=0?(e=(l=Math.sqrt(n))*s,a=i*(this.mode===this.S_POLE?l:-l)):e=a=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*a+this.y0,t}function qr(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,a=t.y/this.a,i,s,r,n,h,o,l;if(this.sphere){var u=0,f,c=0;if(f=Math.sqrt(e*e+a*a),s=f*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(c=Math.sin(s),u=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(f)<=p?0:Math.asin(a*c/f),e*=c,a=u*f;break;case this.OBLIQ:s=Math.abs(f)<=p?this.lat0:Math.asin(u*this.sinph0+a*c*this.cosph0/f),e*=c*this.cosph0,a=(u-Math.sin(s)*this.sinph0)*f;break;case this.N_POLE:a=-a,s=m-s;break;case this.S_POLE:s-=m;break}i=a===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,a)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,a*=this.dd,o=Math.sqrt(e*e+a*a),o<p)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),r=Math.cos(n),e*=n=Math.sin(n),this.mode===this.OBLIQ?(l=r*this.sinb1+a*n*this.cosb1/o,h=this.qp*l,a=o*this.cosb1*r-a*this.sinb1*n):(l=a*n/o,h=this.qp*l,a=o*r)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(a=-a),h=e*e+a*a,!h)return t.x=this.long0,t.y=this.lat0,t;l=1-h/this.qp,this.mode===this.S_POLE&&(l=-l)}i=Math.atan2(e,a),s=Xr(Math.asin(l),this.apa)}return t.x=v(this.long0+i),t.y=s,t}var zr=.3333333333333333,jr=.17222222222222222,kr=.10257936507936508,Hr=.06388888888888888,Ur=.0664021164021164,Wr=.016415012942191543;function Jr(t){var e,a=[];return a[0]=t*zr,e=t*t,a[0]+=e*jr,a[1]=e*Hr,e*=t,a[0]+=e*kr,a[1]+=e*Ur,a[2]=e*Wr,a}function Xr(t,e){var a=t+t;return t+e[0]*Math.sin(a)+e[1]*Math.sin(a+a)+e[2]*Math.sin(a+a+a)}var Qr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Va={init:Gr,forward:Fr,inverse:qr,names:Qr,S_POLE:Tr,N_POLE:Dr,EQUIT:Or,OBLIQ:Br};function j(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function Vr(){Math.abs(this.lat1+this.lat2)<p||(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=B(this.e3,this.sin_po,this.cos_po),this.qs1=Y(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=B(this.e3,this.sin_po,this.cos_po),this.qs2=Y(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=Y(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>p?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 Kr(t){var e=t.x,a=t.y;this.sin_phi=Math.sin(a),this.cos_phi=Math.cos(a);var i=Y(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,r=this.ns0*v(e-this.long0),n=s*Math.sin(r)+this.x0,h=this.rh-s*Math.cos(r)+this.y0;return t.x=n,t.y=h,t}function Yr(t){var e,a,i,s,r,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),s=0,e!==0&&(s=Math.atan2(i*t.x,i*t.y)),i=e*this.ns0/this.a,this.sphere?n=Math.asin((this.c-i*i)/(2*this.ns0)):(a=(this.c-i*i)/this.ns0,n=this.phi1z(this.e3,a)),r=v(s/this.ns0+this.long0),t.x=r,t.y=n,t}function Zr(t,e){var a,i,s,r,n,h=j(.5*e);if(t<p)return h;for(var o=t*t,l=1;l<=25;l++)if(a=Math.sin(h),i=Math.cos(h),s=t*a,r=1-s*s,n=.5*r*r/i*(e/(1-o)-a/r+.5/t*Math.log((1-s)/(1+s))),h=h+n,Math.abs(n)<=1e-7)return h;return null}var $r=["Albers_Conic_Equal_Area","Albers","aea"],Ka={init:Vr,forward:Kr,inverse:Yr,names:$r,phi1z:Zr};function tn(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function en(t){var e,a,i,s,r,n,h,o,l=t.x,u=t.y;return i=v(l-this.long0),e=Math.sin(u),a=Math.cos(u),s=Math.cos(i),n=this.sin_p14*e+this.cos_p14*a*s,r=1,n>0||Math.abs(n)<=p?(h=this.x0+this.a*r*a*Math.sin(i)/n,o=this.y0+this.a*r*(this.cos_p14*e-this.sin_p14*a*s)/n):(h=this.x0+this.infinity_dist*a*Math.sin(i),o=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*a*s)),t.x=h,t.y=o,t}function an(t){var e,a,i,s,r,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(s=Math.atan2(e,this.rc),a=Math.sin(s),i=Math.cos(s),n=j(i*this.sin_p14+t.y*a*this.cos_p14/e),r=Math.atan2(t.x*a,e*this.cos_p14*i-t.y*this.sin_p14*a),r=v(this.long0+r)):(n=this.phic0,r=0),t.x=r,t.y=n,t}var sn=["gnom"],Ya={init:tn,forward:en,inverse:an,names:sn};function Za(t,e){var a=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-a)<1e-6)return e<0?-1*m:m;for(var i=Math.asin(.5*e),s,r,n,h,o=0;o<30;o++)if(r=Math.sin(i),n=Math.cos(i),h=t*r,s=Math.pow(1-h*h,2)/(2*n)*(e/(1-t*t)-r/(1-h*h)+.5/t*Math.log((1-h)/(1+h))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function rn(){this.sphere||(this.k0=B(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function nn(t){var e=t.x,a=t.y,i,s,r=v(e-this.long0);if(this.sphere)i=this.x0+this.a*r*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(a)/Math.cos(this.lat_ts);else{var n=Y(this.e,Math.sin(a));i=this.x0+this.a*this.k0*r,s=this.y0+this.a*n*.5/this.k0}return t.x=i,t.y=s,t}function hn(t){t.x-=this.x0,t.y-=this.y0;var e,a;return this.sphere?(e=v(this.long0+t.x/this.a/Math.cos(this.lat_ts)),a=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(a=Za(this.e,2*t.y*this.k0/this.a),e=v(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=a,t}var on=["cea"],$a={init:rn,forward:nn,inverse:hn,names:on};function ln(){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 fn(t){var e=t.x,a=t.y,i=v(e-this.long0),s=K(a-this.lat0);return t.x=this.x0+this.a*i*this.rc,t.y=this.y0+this.a*s,t}function un(t){var e=t.x,a=t.y;return t.x=v(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=K(this.lat0+(a-this.y0)/this.a),t}var cn=["Equirectangular","Equidistant_Cylindrical","eqc"],ts={init:ln,forward:fn,inverse:un,names:cn};var es=20;function mn(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=st(this.es),this.e1=it(this.es),this.e2=rt(this.es),this.e3=nt(this.es),this.ml0=this.a*D(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Mn(t){var e=t.x,a=t.y,i,s,r,n=v(e-this.long0);if(r=n*Math.sin(a),this.sphere)Math.abs(a)<=p?(i=this.a*n,s=-1*this.a*this.lat0):(i=this.a*Math.sin(r)/Math.tan(a),s=this.a*(K(a-this.lat0)+(1-Math.cos(r))/Math.tan(a)));else if(Math.abs(a)<=p)i=this.a*n,s=-1*this.ml0;else{var h=ht(this.a,this.e,Math.sin(a))/Math.tan(a);i=h*Math.sin(r),s=this.a*D(this.e0,this.e1,this.e2,this.e3,a)-this.ml0+h*(1-Math.cos(r))}return t.x=i+this.x0,t.y=s+this.y0,t}function dn(t){var e,a,i,s,r,n,h,o,l;if(i=t.x-this.x0,s=t.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=p)e=v(i/this.a+this.long0),a=0;else{n=this.lat0+s/this.a,h=i*i/this.a/this.a+n*n,o=n;var u;for(r=es;r;--r)if(u=Math.tan(o),l=-1*(n*(o*u+1)-o-.5*(o*o+h)*u)/((o-n)/u-1),o+=l,Math.abs(l)<=p){a=o;break}e=v(this.long0+Math.asin(i*Math.tan(o)/this.a)/Math.sin(a))}else if(Math.abs(s+this.ml0)<=p)a=0,e=v(this.long0+i/this.a);else{n=(this.ml0+s)/this.a,h=i*i/this.a/this.a+n*n,o=n;var f,c,M,d,y;for(r=es;r;--r)if(y=this.e*Math.sin(o),f=Math.sqrt(1-y*y)*Math.tan(o),c=this.a*D(this.e0,this.e1,this.e2,this.e3,o),M=this.e0-2*this.e1*Math.cos(2*o)+4*this.e2*Math.cos(4*o)-6*this.e3*Math.cos(6*o),d=c/this.a,l=(n*(f*d+1)-d-.5*f*(d*d+h))/(this.es*Math.sin(2*o)*(d*d+h-2*n*d)/(4*f)+(n-d)*(f*M-2/Math.sin(2*o))-M),o-=l,Math.abs(l)<=p){a=o;break}f=Math.sqrt(1-this.es*Math.pow(Math.sin(a),2))*Math.tan(a),e=v(this.long0+Math.asin(i*f/this.a)/Math.sin(a))}return t.x=e,t.y=a,t}var pn=["Polyconic","poly"],as={init:mn,forward:Mn,inverse:dn,names:pn};function vn(){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 yn(t){var e,a=t.x,i=t.y,s=i-this.lat0,r=a-this.long0,n=s/mt*1e-5,h=r,o=1,l=0;for(e=1;e<=10;e++)o=o*n,l=l+this.A[e]*o;var u=l,f=h,c=1,M=0,d,y,x=0,g=0;for(e=1;e<=6;e++)d=c*u-M*f,y=M*u+c*f,c=d,M=y,x=x+this.B_re[e]*c-this.B_im[e]*M,g=g+this.B_im[e]*c+this.B_re[e]*M;return t.x=g*this.a+this.x0,t.y=x*this.a+this.y0,t}function xn(t){var e,a=t.x,i=t.y,s=a-this.x0,r=i-this.y0,n=r/this.a,h=s/this.a,o=1,l=0,u,f,c=0,M=0;for(e=1;e<=6;e++)u=o*n-l*h,f=l*n+o*h,o=u,l=f,c=c+this.C_re[e]*o-this.C_im[e]*l,M=M+this.C_im[e]*o+this.C_re[e]*l;for(var d=0;d<this.iterations;d++){var y=c,x=M,g,b,E=n,S=h;for(e=2;e<=6;e++)g=y*c-x*M,b=x*c+y*M,y=g,x=b,E=E+(e-1)*(this.B_re[e]*y-this.B_im[e]*x),S=S+(e-1)*(this.B_im[e]*y+this.B_re[e]*x);y=1,x=0;var A=this.B_re[1],P=this.B_im[1];for(e=2;e<=6;e++)g=y*c-x*M,b=x*c+y*M,y=g,x=b,A=A+e*(this.B_re[e]*y-this.B_im[e]*x),P=P+e*(this.B_im[e]*y+this.B_re[e]*x);var O=A*A+P*P;c=(E*A+S*P)/O,M=(S*A-E*P)/O}var C=c,Z=M,ft=1,ut=0;for(e=1;e<=9;e++)ft=ft*C,ut=ut+this.D[e]*ft;var zt=this.lat0+ut*mt*1e5,ws=this.long0+Z;return t.x=ws,t.y=zt,t}var gn=["New_Zealand_Map_Grid","nzmg"],ss={init:vn,forward:yn,inverse:xn,names:gn};function _n(){}function bn(t){var e=t.x,a=t.y,i=v(e-this.long0),s=this.x0+this.a*i,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+a/2.5))*1.25;return t.x=s,t.y=r,t}function En(t){t.x-=this.x0,t.y-=this.y0;var e=v(this.long0+t.x/this.a),a=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=a,t}var In=["Miller_Cylindrical","mill"],is={init:_n,forward:bn,inverse:En,names:In};var An=20;function Pn(){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=ie(this.es)}function Nn(t){var e,a,i=t.x,s=t.y;if(i=v(i-this.long0),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var r=this.n*Math.sin(s),n=An;n;--n){var h=(this.m*s+Math.sin(s)-r)/(this.m+Math.cos(s));if(s-=h,Math.abs(h)<p)break}e=this.a*this.C_x*i*(this.m+Math.cos(s)),a=this.a*this.C_y*s}else{var o=Math.sin(s),l=Math.cos(s);a=this.a*pt(s,o,l,this.en),e=this.a*i*l/Math.sqrt(1-this.es*o*o)}return t.x=e,t.y=a,t}function Sn(t){var e,a,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(e))),this.m?e=j((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=j(Math.sin(e)/this.n)),i=v(i+this.long0),e=K(e)):(e=re(t.y/this.a,this.es,this.en),s=Math.abs(e),s<m?(s=Math.sin(e),a=this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),i=v(a)):s-p<m&&(i=this.long0)),t.x=i,t.y=e,t}var Rn=["Sinusoidal","sinu"],rs={init:Pn,forward:Nn,inverse:Sn,names:Rn};function wn(){}function Cn(t){for(var e=t.x,a=t.y,i=v(e-this.long0),s=a,r=Math.PI*Math.sin(a);;){var n=-(s+Math.sin(s)-r)/(1+Math.cos(s));if(s+=n,Math.abs(n)<p)break}s/=2,Math.PI/2-Math.abs(a)<p&&(i=0);var h=.900316316158*this.a*i*Math.cos(s)+this.x0,o=1.4142135623731*this.a*Math.sin(s)+this.y0;return t.x=h,t.y=o,t}function Ln(t){var e,a;t.x-=this.x0,t.y-=this.y0,a=t.y/(1.4142135623731*this.a),Math.abs(a)>.999999999999&&(a=.999999999999),e=Math.asin(a);var i=v(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),a=(2*e+Math.sin(2*e))/Math.PI,Math.abs(a)>1&&(a=1);var s=Math.asin(a);return t.x=i,t.y=s,t}var Tn=["Mollweide","moll"],ns={init:wn,forward:Cn,inverse:Ln,names:Tn};function Dn(){Math.abs(this.lat1+this.lat2)<p||(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=st(this.es),this.e1=it(this.es),this.e2=rt(this.es),this.e3=nt(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=B(this.e,this.sinphi,this.cosphi),this.ml1=D(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<p?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=B(this.e,this.sinphi,this.cosphi),this.ml2=D(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=D(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function On(t){var e=t.x,a=t.y,i;if(this.sphere)i=this.a*(this.g-a);else{var s=D(this.e0,this.e1,this.e2,this.e3,a);i=this.a*(this.g-s)}var r=this.ns*v(e-this.long0),n=this.x0+i*Math.sin(r),h=this.y0+this.rh-i*Math.cos(r);return t.x=n,t.y=h,t}function Bn(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var e,a,i,s;this.ns>=0?(a=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(a=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var r=0;if(a!==0&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere)return s=v(this.long0+r/this.ns),i=K(this.g-a/this.a),t.x=s,t.y=i,t;var n=this.g-a/this.a;return i=vt(n,this.e0,this.e1,this.e2,this.e3),s=v(this.long0+r/this.ns),t.x=s,t.y=i,t}var Gn=["Equidistant_Conic","eqdc"],hs={init:Dn,forward:On,inverse:Bn,names:Gn};function Fn(){this.R=this.a}function qn(t){var e=t.x,a=t.y,i=v(e-this.long0),s,r;Math.abs(a)<=p&&(s=this.x0+this.R*i,r=this.y0);var n=j(2*Math.abs(a/Math.PI));(Math.abs(i)<=p||Math.abs(Math.abs(a)-m)<=p)&&(s=this.x0,a>=0?r=this.y0+Math.PI*this.R*Math.tan(.5*n):r=this.y0+Math.PI*this.R*-Math.tan(.5*n));var h=.5*Math.abs(Math.PI/i-i/Math.PI),o=h*h,l=Math.sin(n),u=Math.cos(n),f=u/(l+u-1),c=f*f,M=f*(2/l-1),d=M*M,y=Math.PI*this.R*(h*(f-d)+Math.sqrt(o*(f-d)*(f-d)-(d+o)*(c-d)))/(d+o);i<0&&(y=-y),s=this.x0+y;var x=o+f;return y=Math.PI*this.R*(M*x-h*Math.sqrt((d+o)*(o+1)-x*x))/(d+o),a>=0?r=this.y0+y:r=this.y0-y,t.x=s,t.y=r,t}function zn(t){var e,a,i,s,r,n,h,o,l,u,f,c,M;return t.x-=this.x0,t.y-=this.y0,f=Math.PI*this.R,i=t.x/f,s=t.y/f,r=i*i+s*s,n=-Math.abs(s)*(1+r),h=n-2*s*s+i*i,o=-2*n+1+2*s*s+r*r,M=s*s/o+(2*h*h*h/o/o/o-9*n*h/o/o)/27,l=(n-h*h/3/o)/o,u=2*Math.sqrt(-l/3),f=3*M/l/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),c=Math.acos(f)/3,t.y>=0?a=(-u*Math.cos(c+Math.PI/3)-h/3/o)*Math.PI:a=-(-u*Math.cos(c+Math.PI/3)-h/3/o)*Math.PI,Math.abs(i)<p?e=this.long0:e=v(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(i*i-s*s)+r*r))/2/i),t.x=e,t.y=a,t}var jn=["Van_der_Grinten_I","VanDerGrinten","vandg"],os={init:Fn,forward:qn,inverse:zn,names:jn};function kn(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Hn(t){var e=t.x,a=t.y,i=Math.sin(t.y),s=Math.cos(t.y),r=v(e-this.long0),n,h,o,l,u,f,c,M,d,y,x,g,b,E,S,A,P,O,C,Z,ft,ut,zt;return this.sphere?Math.abs(this.sin_p12-1)<=p?(t.x=this.x0+this.a*(m-a)*Math.sin(r),t.y=this.y0-this.a*(m-a)*Math.cos(r),t):Math.abs(this.sin_p12+1)<=p?(t.x=this.x0+this.a*(m+a)*Math.sin(r),t.y=this.y0+this.a*(m+a)*Math.cos(r),t):(O=this.sin_p12*i+this.cos_p12*s*Math.cos(r),A=Math.acos(O),P=A?A/Math.sin(A):1,t.x=this.x0+this.a*P*s*Math.sin(r),t.y=this.y0+this.a*P*(this.cos_p12*i-this.sin_p12*s*Math.cos(r)),t):(n=st(this.es),h=it(this.es),o=rt(this.es),l=nt(this.es),Math.abs(this.sin_p12-1)<=p?(u=this.a*D(n,h,o,l,m),f=this.a*D(n,h,o,l,a),t.x=this.x0+(u-f)*Math.sin(r),t.y=this.y0-(u-f)*Math.cos(r),t):Math.abs(this.sin_p12+1)<=p?(u=this.a*D(n,h,o,l,m),f=this.a*D(n,h,o,l,a),t.x=this.x0+(u+f)*Math.sin(r),t.y=this.y0+(u+f)*Math.cos(r),t):(c=i/s,M=ht(this.a,this.e,this.sin_p12),d=ht(this.a,this.e,i),y=Math.atan((1-this.es)*c+this.es*M*this.sin_p12/(d*s)),x=Math.atan2(Math.sin(r),this.cos_p12*Math.tan(y)-this.sin_p12*Math.cos(r)),x===0?C=Math.asin(this.cos_p12*Math.sin(y)-this.sin_p12*Math.cos(y)):Math.abs(Math.abs(x)-Math.PI)<=p?C=-Math.asin(this.cos_p12*Math.sin(y)-this.sin_p12*Math.cos(y)):C=Math.asin(Math.sin(r)*Math.cos(y)/Math.sin(x)),g=this.e*this.sin_p12/Math.sqrt(1-this.es),b=this.e*this.cos_p12*Math.cos(x)/Math.sqrt(1-this.es),E=g*b,S=b*b,Z=C*C,ft=Z*C,ut=ft*C,zt=ut*C,A=M*C*(1-Z*S*(1-S)/6+ft/8*E*(1-2*S)+ut/120*(S*(4-7*S)-3*g*g*(1-7*S))-zt/48*E),t.x=this.x0+A*Math.sin(x),t.y=this.y0+A*Math.cos(x),t))}function Un(t){t.x-=this.x0,t.y-=this.y0;var e,a,i,s,r,n,h,o,l,u,f,c,M,d,y,x,g,b,E,S,A,P,O,C;return this.sphere?(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*m*this.a?void 0:(a=e/this.a,i=Math.sin(a),s=Math.cos(a),r=this.long0,Math.abs(e)<=p?n=this.lat0:(n=j(s*this.sin_p12+t.y*i*this.cos_p12/e),h=Math.abs(this.lat0)-m,Math.abs(h)<=p?this.lat0>=0?r=v(this.long0+Math.atan2(t.x,-t.y)):r=v(this.long0-Math.atan2(-t.x,t.y)):r=v(this.long0+Math.atan2(t.x*i,e*this.cos_p12*s-t.y*this.sin_p12*i))),t.x=r,t.y=n,t)):(o=st(this.es),l=it(this.es),u=rt(this.es),f=nt(this.es),Math.abs(this.sin_p12-1)<=p?(c=this.a*D(o,l,u,f,m),e=Math.sqrt(t.x*t.x+t.y*t.y),M=c-e,n=vt(M/this.a,o,l,u,f),r=v(this.long0+Math.atan2(t.x,-1*t.y)),t.x=r,t.y=n,t):Math.abs(this.sin_p12+1)<=p?(c=this.a*D(o,l,u,f,m),e=Math.sqrt(t.x*t.x+t.y*t.y),M=e-c,n=vt(M/this.a,o,l,u,f),r=v(this.long0+Math.atan2(t.x,t.y)),t.x=r,t.y=n,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),x=Math.atan2(t.x,t.y),d=ht(this.a,this.e,this.sin_p12),g=Math.cos(x),b=this.e*this.cos_p12*g,E=-b*b/(1-this.es),S=3*this.es*(1-E)*this.sin_p12*this.cos_p12*g/(1-this.es),A=e/d,P=A-E*(1+E)*Math.pow(A,3)/6-S*(1+3*E)*Math.pow(A,4)/24,O=1-E*P*P/2-A*P*P*P/6,y=Math.asin(this.sin_p12*Math.cos(P)+this.cos_p12*Math.sin(P)*g),r=v(this.long0+Math.asin(Math.sin(x)*Math.sin(P)/Math.cos(y))),C=Math.sin(y),n=Math.atan2((C-this.es*O*this.sin_p12)*Math.tan(y),C*(1-this.es)),t.x=r,t.y=n,t))}var Wn=["Azimuthal_Equidistant","aeqd"],ls={init:kn,forward:Hn,inverse:Un,names:Wn};function Jn(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Xn(t){var e,a,i,s,r,n,h,o,l=t.x,u=t.y;return i=v(l-this.long0),e=Math.sin(u),a=Math.cos(u),s=Math.cos(i),n=this.sin_p14*e+this.cos_p14*a*s,r=1,(n>0||Math.abs(n)<=p)&&(h=this.a*r*a*Math.sin(i),o=this.y0+this.a*r*(this.cos_p14*e-this.sin_p14*a*s)),t.x=h,t.y=o,t}function Qn(t){var e,a,i,s,r,n,h;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),a=j(e/this.a),i=Math.sin(a),s=Math.cos(a),n=this.long0,Math.abs(e)<=p?(h=this.lat0,t.x=n,t.y=h,t):(h=j(s*this.sin_p14+t.y*i*this.cos_p14/e),r=Math.abs(this.lat0)-m,Math.abs(r)<=p?(this.lat0>=0?n=v(this.long0+Math.atan2(t.x,-t.y)):n=v(this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=h,t):(n=v(this.long0+Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i)),t.x=n,t.y=h,t))}var Vn=["ortho"],fs={init:Jn,forward:Xn,inverse:Qn,names:Vn};var w={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},N={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Kn(){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>=m-I/2?this.face=w.TOP:this.lat0<=-(m-I/2)?this.face=w.BOTTOM:Math.abs(this.long0)<=I?this.face=w.FRONT:Math.abs(this.long0)<=m+I?this.face=this.long0>0?w.RIGHT:w.LEFT:this.face=w.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 Yn(t){var e={x:0,y:0},a,i,s,r,n,h,o={value:0};if(t.x-=this.long0,this.es!==0?a=Math.atan(this.one_minus_f_squared*Math.tan(t.y)):a=t.y,i=t.x,this.face===w.TOP)r=m-a,i>=I&&i<=m+I?(o.value=N.AREA_0,s=i-m):i>m+I||i<=-(m+I)?(o.value=N.AREA_1,s=i>0?i-R:i+R):i>-(m+I)&&i<=-I?(o.value=N.AREA_2,s=i+m):(o.value=N.AREA_3,s=i);else if(this.face===w.BOTTOM)r=m+a,i>=I&&i<=m+I?(o.value=N.AREA_0,s=-i+m):i<I&&i>=-I?(o.value=N.AREA_1,s=-i):i<-I&&i>=-(m+I)?(o.value=N.AREA_2,s=-i-m):(o.value=N.AREA_3,s=i>0?-i+R:-i-R);else{var l,u,f,c,M,d,y;this.face===w.RIGHT?i=It(i,+m):this.face===w.BACK?i=It(i,+R):this.face===w.LEFT&&(i=It(i,-m)),c=Math.sin(a),M=Math.cos(a),d=Math.sin(i),y=Math.cos(i),l=M*y,u=M*d,f=c,this.face===w.FRONT?(r=Math.acos(l),s=fe(r,f,u,o)):this.face===w.RIGHT?(r=Math.acos(u),s=fe(r,f,-l,o)):this.face===w.BACK?(r=Math.acos(-l),s=fe(r,f,-u,o)):this.face===w.LEFT?(r=Math.acos(-u),s=fe(r,f,l,o)):(r=s=0,o.value=N.AREA_0)}return h=Math.atan(12/R*(s+Math.acos(Math.sin(s)*Math.cos(I))-m)),n=Math.sqrt((1-Math.cos(r))/(Math.cos(h)*Math.cos(h))/(1-Math.cos(Math.atan(1/Math.cos(s))))),o.value===N.AREA_1?h+=m:o.value===N.AREA_2?h+=R:o.value===N.AREA_3&&(h+=1.5*R),e.x=n*Math.cos(h),e.y=n*Math.sin(h),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,t.x=e.x,t.y=e.y,t}function Zn(t){var e={lam:0,phi:0},a,i,s,r,n,h,o,l,u,f={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),a=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f.value=N.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f.value=N.AREA_1,a-=m):t.x<0&&-t.x>=Math.abs(t.y)?(f.value=N.AREA_2,a=a<0?a+R:a-R):(f.value=N.AREA_3,a+=m),u=R/12*Math.tan(a),n=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),h=Math.atan(n),s=Math.cos(a),r=Math.tan(i),o=1-s*s*r*r*(1-Math.cos(Math.atan(1/Math.cos(h)))),o<-1?o=-1:o>1&&(o=1),this.face===w.TOP)l=Math.acos(o),e.phi=m-l,f.value===N.AREA_0?e.lam=h+m:f.value===N.AREA_1?e.lam=h<0?h+R:h-R:f.value===N.AREA_2?e.lam=h-m:e.lam=h;else if(this.face===w.BOTTOM)l=Math.acos(o),e.phi=l-m,f.value===N.AREA_0?e.lam=-h+m:f.value===N.AREA_1?e.lam=-h:f.value===N.AREA_2?e.lam=-h-m:e.lam=h<0?-h-R:-h+R;else{var c,M,d;c=o,u=c*c,u>=1?d=0:d=Math.sqrt(1-u)*Math.sin(h),u+=d*d,u>=1?M=0:M=Math.sqrt(1-u),f.value===N.AREA_1?(u=M,M=-d,d=u):f.value===N.AREA_2?(M=-M,d=-d):f.value===N.AREA_3&&(u=M,M=d,d=-u),this.face===w.RIGHT?(u=c,c=-M,M=u):this.face===w.BACK?(c=-c,M=-M):this.face===w.LEFT&&(u=c,c=M,M=-u),e.phi=Math.acos(-d)-m,e.lam=Math.atan2(M,c),this.face===w.RIGHT?e.lam=It(e.lam,-m):this.face===w.BACK?e.lam=It(e.lam,-R):this.face===w.LEFT&&(e.lam=It(e.lam,+m))}if(this.es!==0){var y,x,g;y=e.phi<0?1:0,x=Math.tan(e.phi),g=this.b/Math.sqrt(x*x+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-g*g)/(this.one_minus_f*g)),y&&(e.phi=-e.phi)}return e.lam+=this.long0,t.x=e.lam,t.y=e.phi,t}function fe(t,e,a,i){var s;return t<p?(i.value=N.AREA_0,s=0):(s=Math.atan2(e,a),Math.abs(s)<=I?i.value=N.AREA_0:s>I&&s<=m+I?(i.value=N.AREA_1,s-=m):s>m+I||s<=-(m+I)?(i.value=N.AREA_2,s=s>=0?s-R:s+R):(i.value=N.AREA_3,s+=m)),s}function It(t,e){var a=t+e;return a<-R?a+=Rt:a>+R&&(a-=Rt),a}var $n=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],us={init:Kn,forward:Yn,inverse:Zn,names:$n};var Le=[[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]],Ot=[[-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]],cs=.8487,ms=1.3523,Ms=V/5,th=1/Ms,At=18,ue=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},eh=function(t,e){return t[1]+e*(2*t[2]+e*3*t[3])};function ah(t,e,a,i){for(var s=e;i;--i){var r=t(s);if(s-=r,Math.abs(r)<a)break}return s}function sh(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function ih(t){var e=v(t.x-this.long0),a=Math.abs(t.y),i=Math.floor(a*Ms);i<0?i=0:i>=At&&(i=At-1),a=V*(a-th*i);var s={x:ue(Le[i],a)*e,y:ue(Ot[i],a)};return t.y<0&&(s.y=-s.y),s.x=s.x*this.a*cs+this.x0,s.y=s.y*this.a*ms+this.y0,s}function rh(t){var e={x:(t.x-this.x0)/(this.a*cs),y:Math.abs(t.y-this.y0)/(this.a*ms)};if(e.y>=1)e.x/=Le[At][0],e.y=t.y<0?-m:m;else{var a=Math.floor(e.y*At);for(a<0?a=0:a>=At&&(a=At-1);;)if(Ot[a][0]>e.y)--a;else if(Ot[a+1][0]<=e.y)++a;else break;var i=Ot[a],s=5*(e.y-i[0])/(Ot[a+1][0]-i[0]);s=ah(function(r){return(ue(i,r)-e.y)/eh(i,r)},s,p,100),e.x/=ue(Le[a],s),e.y=(5*a+s)*L,t.y<0&&(e.y=-e.y)}return e.x=v(e.x+this.long0),e}var nh=["Robinson","robin"],ds={init:sh,forward:ih,inverse:rh,names:nh};function hh(){this.name="geocent"}function oh(t){var e=te(t,this.es,this.a);return e}function lh(t){var e=ee(t,this.es,this.a,this.b);return e}var fh=["Geocentric","geocentric","geocent","Geocent"],ps={init:hh,forward:oh,inverse:lh,names:fh};function vs(t){t.Proj.projections.add(Oa),t.Proj.projections.add(Et),t.Proj.projections.add(ja),t.Proj.projections.add(ka),t.Proj.projections.add(Ha),t.Proj.projections.add(Ua),t.Proj.projections.add(Wa),t.Proj.projections.add(Ja),t.Proj.projections.add(Xa),t.Proj.projections.add(Qa),t.Proj.projections.add(Va),t.Proj.projections.add(Ka),t.Proj.projections.add(Ya),t.Proj.projections.add($a),t.Proj.projections.add(ts),t.Proj.projections.add(as),t.Proj.projections.add(ss),t.Proj.projections.add(is),t.Proj.projections.add(rs),t.Proj.projections.add(ns),t.Proj.projections.add(hs),t.Proj.projections.add(os),t.Proj.projections.add(ls),t.Proj.projections.add(fs),t.Proj.projections.add(us),t.Proj.projections.add(ds),t.Proj.projections.add(ps)}H.defaultDatum="WGS84";H.Proj=lt;H.WGS84=new H.Proj("WGS84");H.Point=Ca;H.toPoint=se;H.defs=xt;H.transform=dt;H.mgrs=Sa;H.version="__VERSION__";vs(H);var Te=H;var Bt=class{static defineProjectionAliases(e){let a=[];for(let i in e)a.push([i,e[i]]);Te.defs(a)}constructor({from:e="WGS84",to:a="WGS84"}){if(this._projection=Te(e,a),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(e){return this._projection.forward(e)}unproject(e){return this._projection.inverse(e)}};var De=100,ys=!1;function xs(t){let e=new DataView(t,0,De),i=Ut(e).length-De,s=new DataView(t,De,i),r=new Int32Array(i),n=new Int32Array(i);for(let h=0;h<i/8;h++)r[h]=s.getInt32(h*8,ys),n[h]=s.getInt32(h*8+4,ys);return{offsets:r,lengths:n}}async function*ce(t,e,a){let i=[],s=[],r=!1,n=!1;for(;!r&&!n;){if(i.length===0&&!r){let{value:o,done:l}=await t.next();l?r=!0:i.push(...o)}if(s.length===0&&!n){let{value:o,done:l}=await e.next();l?n=!0:s.push(...o)}let h=uh(i,s);h&&(yield{batchType:"data",shape:a,length:h.length,data:h})}}function uh(t,e){let a=Math.min(t.length,e.length);if(a===0)return null;let i=[t.slice(0,a),e.slice(0,a)];return t.splice(0,a),e.splice(0,a),i}var Oe=!0,gs=32,q;(function(t){t[t.START=0]="START",t[t.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",t[t.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",t[t.END=3]="END",t[t.ERROR=4]="ERROR"})(q||(q={}));var Me=class{binaryReader=new ot;textDecoder;state=q.START;result={data:[]};constructor(e){this.textDecoder=new TextDecoder(e.encoding)}write(e){this.binaryReader.write(e),this.state=_s(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=_s(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==q.END&&(this.state=q.ERROR,this.result.error="DBF incomplete file")}};function Be(t,e={}){let{encoding:a="latin1"}=e.dbf||{},i=new Me({encoding:a});i.write(t),i.end();let{data:s,schema:r}=i.result;switch(e?.dbf?.shape){case"object-row-table":return{shape:"object-row-table",schema:r,data:s};case"table":return{schema:r,rows:s};case"rows":default:return s}}async function*bs(t,e={}){let{encoding:a="latin1"}=e.dbf||{},i=new Me({encoding:a}),s=!1;for await(let r of t)i.write(r),!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 _s(t,e,a,i){for(;;)try{switch(t){case q.ERROR:case q.END:return t;case q.START:let s=a.getDataView(gs);if(!s)return t;e.dbfHeader=ch(s),e.progress={bytesUsed:0,rowsTotal:e.dbfHeader.nRecords,rows:0},t=q.FIELD_DESCRIPTORS;break;case q.FIELD_DESCRIPTORS:let r=a.getDataView(e.dbfHeader.headerLength-gs);if(!r)return t;e.dbfFields=mh(r,i),e.schema={fields:e.dbfFields.map(o=>xh(o)),metadata:{}},t=q.FIELD_PROPERTIES,a.skip(1);break;case q.FIELD_PROPERTIES:let{recordLength:n=0,nRecords:h=0}=e?.dbfHeader||{};for(;e.data.length<h;){let o=a.getDataView(n-1);if(!o)return t;a.skip(1);let l=Mh(o,e.dbfFields,i);e.data.push(l),e.progress.rows=e.data.length}t=q.END;break;default:return t=q.ERROR,e.error=`illegal parser state ${t}`,t}}catch(s){return t=q.ERROR,e.error=`DBF parsing failed: ${s.message}`,t}}function ch(t){return{year:t.getUint8(1)+1900,month:t.getUint8(2),day:t.getUint8(3),nRecords:t.getUint32(4,Oe),headerLength:t.getUint16(8,Oe),recordLength:t.getUint16(10,Oe),languageDriver:t.getUint8(29)}}function mh(t,e){let a=(t.byteLength-1)/32,i=[],s=0;for(let r=0;r<a;r++){let n=e.decode(new Uint8Array(t.buffer,t.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:n,dataType:String.fromCharCode(t.getUint8(s+11)),fieldLength:t.getUint8(s+16),decimal:t.getUint8(s+17)}),s+=32}return i}function Mh(t,e,a){let i={},s=0;for(let r of e){let n=a.decode(new Uint8Array(t.buffer,t.byteOffset+s,r.fieldLength));i[r.name]=dh(n,r.dataType),s+=r.fieldLength}return i}function dh(t,e){switch(e){case"B":return me(t);case"C":return yh(t);case"F":return me(t);case"N":return me(t);case"O":return me(t);case"D":return ph(t);case"L":return vh(t);default:throw new Error("Unsupported data type")}}function ph(t){return Date.UTC(t.slice(0,4),parseInt(t.slice(4,6),10)-1,t.slice(6,8))}function vh(t){return/^[nf]$/i.test(t)?!1:/^[yt]$/i.test(t)?!0:null}function me(t){let e=parseFloat(t);return isNaN(e)?null:e}function yh(t){return t.trim()||null}function xh({name:t,dataType:e,fieldLength:a,decimal:i}){switch(e){case"B":return{name:t,type:"float64",nullable:!0,metadata:{}};case"C":return{name:t,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:t,type:"float64",nullable:!0,metadata:{}};case"N":return{name:t,type:"float64",nullable:!0,metadata:{}};case"O":return{name:t,type:"float64",nullable:!0,metadata:{}};case"D":return{name:t,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:t,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var gh="4.3.1",Ge={name:"DBF",dataType:null,batchType:null,id:"dbf",module:"shapefile",version:gh,worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},Gt={...Ge,parse:async(t,e)=>Be(t,e),parseSync:Be,parseInBatches(t,e){return bs(t,e)}};async function*Es(t,e,a){let{reproject:i=!1,_targetCrs:s="WGS84"}=e?.gis||{},{shx:r,cpg:n,prj:h}=await Ss(e,a),o=await Xt(t,Nt,e,a),l=o[Symbol.asyncIterator]?.()||o[Symbol.iterator]?.(),u=null,f=await a?.fetch(Ft(a?.url||"","dbf"));if(f?.ok){let x=await Xt(f,Gt,{...e,dbf:{encoding:n||"latin1"}},a);u=x[Symbol.asyncIterator]?.()||x[Symbol.iterator]()}let c=(await l.next()).value;c&&c.batchType==="metadata"&&(c=(await l.next()).value);let M={};u&&(M=(await u.next()).value,M&&M.batchType==="metadata"&&(M=(await u.next()).value));let d=u?ce(l,u,"object-row-table"):l,y={[Symbol.asyncIterator](){return d}};for await(let x of y){let g,b;u?[g,b]=x.data:g=x;let E=As(g),S=Ps(E,b);i&&(S=Ns(S,h,s)),yield{encoding:n,prj:h,shx:r,header:c,data:S}}}async function Is(t,e,a){let{reproject:i=!1,_targetCrs:s="WGS84"}=e?.gis||{},{shx:r,cpg:n,prj:h}=await Ss(e,a),{header:o,geometries:l}=await Jt(t,Nt,e,a),u=As(l),f,c=await a?.fetch(Ft(a?.url,"dbf"));c?.ok&&(f=await Jt(c,Gt,{dbf:{shape:"object-row-table",encoding:n||"latin1"}},a));let M=Ps(u,f?.data||[]);switch(i&&(M=Ns(M,h,s)),e?.shapefile?.shape){case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",encoding:n,schema:f?.schema||{metadata:{},fields:[]},prj:h,shx:r,header:o,features:M};default:return{encoding:n,prj:h,shx:r,header:o,data:M}}}function As(t){let e=[];for(let a of t)e.push(_e(a));return e}function Ps(t,e){let a=[];for(let i=0;i<t.length;i++){let r={type:"Feature",geometry:t[i],properties:e&&e[i]||{}};a.push(r)}return a}function Ns(t,e,a){if(!e&&!a)return t;let i=new Bt({from:e||"WGS84",to:a||"WGS84"});return be(t,s=>i.project(s))}async function Ss(t,e){let{url:a,fetch:i}=e,s=i(Ft(a,"shx")),r=i(Ft(a,"cpg")),n=i(Ft(a,"prj"));await Promise.all([s,r,n]);let h,o,l,u=await s;if(u.ok){let M=await u.arrayBuffer();h=xs(M)}let f=await r;f.ok&&(o=await f.text());let c=await n;return c.ok&&(l=await c.text()),{shx:h,cpg:o,prj:l}}function Ft(t,e){let a=_h(t),i=bh(t);return i===i.toUpperCase()&&(e=e.toUpperCase()),`${a}.${e}`}function _h(t){let e=t&&t.lastIndexOf(".");return typeof e=="number"?e>=0?t.substr(0,e):"":e}function bh(t){let e=t&&t.lastIndexOf(".");return typeof e=="number"?e>=0?t.substr(e+1):"":e}var Eh="4.3.1",Rs={name:"Shapefile",id:"shapefile",module:"shapefile",version:Eh,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(xe).buffer],options:{shapefile:{shape:"v3"},shp:{_maxDimensions:4}},parse:Is,parseInBatches:Es};var de=class{offset;arrayBuffer;constructor(e){this.offset=0,this.arrayBuffer=e}hasAvailableBytes(e){return this.arrayBuffer.byteLength-this.offset>=e}getDataView(e){if(e&&!this.hasAvailableBytes(e))throw new Error("binary data exhausted");let a=e?new DataView(this.arrayBuffer,this.offset,e):new DataView(this.arrayBuffer,this.offset);return this.offset+=e,a}skip(e){this.offset+=e}rewind(e){this.offset-=e}};return qs(qt);})();
|
|
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.1",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.1",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.1",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);})();
|
|
11
20
|
return __exports__;
|
|
12
21
|
});
|