@loaders.gl/flatgeobuf 4.4.0-alpha.17 → 4.4.0-alpha.18
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/dist.min.js +1 -1
- package/dist/flatgeobuf-loader.js +1 -1
- package/dist/flatgeobuf-worker.js +1 -1
- package/dist/index.cjs +1 -1
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"use strict";var __exports__=(()=>{var Js=Object.create;var se=Object.defineProperty;var Xs=Object.getOwnPropertyDescriptor;var Ks=Object.getOwnPropertyNames;var $s=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var Qs=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ys=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ta=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},ge=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ks(t))!Zs.call(e,s)&&s!==r&&se(e,s,{get:()=>t[s],enumerable:!(i=Xs(t,s))||i.enumerable});return e},Me=(e,t,r)=>(ge(e,t,"default"),r&&ge(r,t,"default")),ea=(e,t,r)=>(r=e!=null?Js($s(e)):{},ge(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),ra=e=>ge(se({},"__esModule",{value:!0}),e);var Ut=(e,t,r)=>(Qs(e,typeof t!="symbol"?t+"":t,r),r);var Lr=Ys((tf,Cr)=>{Cr.exports=globalThis.loaders});var ve={};ta(ve,{FlatGeobufFormat:()=>zt,FlatGeobufLoader:()=>ee,FlatGeobufWorkerLoader:()=>Or,_FlatGeobufSource:()=>Tr});Me(ve,ea(Lr(),1));var zt={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",extensions:["fgb"],mimeTypes:["application/octet-stream"],category:"geometry"};function Br(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 st=1,at=2,Gr=4,ae=5,Pt=484813681109536e-20,_=Math.PI/2,Ur=.16666666666666666,zr=.04722222222222222,qr=.022156084656084655,y=1e-10,G=.017453292519943295,nt=57.29577951308232,E=Math.PI/4,ne=Math.PI*2,R=3.14159265359;var V={};V.greenwich=0;V.lisbon=-9.131906111111;V.paris=2.337229166667;V.bogota=-74.080916666667;V.madrid=-3.687938888889;V.rome=12.452333333333;V.bern=7.439583333333;V.jakarta=106.807719444444;V.ferro=-17.666666666667;V.brussels=4.367975;V.stockholm=18.058277777778;V.athens=23.7163375;V.oslo=10.722916666667;var Dr={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var kr=/[\s_\-\/\(\)]/g;function Z(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(kr,""),s=-1,a,n;++s<r.length;)if(a=r[s],n=a.toLowerCase().replace(kr,""),n===i)return e[a]}function oe(e){var t={},r=e.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,h){var f=h.split("=");return f.push(!0),o[f[0].toLowerCase()]=f[1],o},{}),i,s,a,n={proj:"projName",datum:"datumCode",rf:function(o){t.rf=parseFloat(o)},lat_0:function(o){t.lat0=o*G},lat_1:function(o){t.lat1=o*G},lat_2:function(o){t.lat2=o*G},lat_ts:function(o){t.lat_ts=o*G},lon_0:function(o){t.long0=o*G},lon_1:function(o){t.long1=o*G},lon_2:function(o){t.long2=o*G},alpha:function(o){t.alpha=parseFloat(o)*G},lonc:function(o){t.longc=o*G},x_0:function(o){t.x0=parseFloat(o)},y_0:function(o){t.y0=parseFloat(o)},k_0:function(o){t.k0=parseFloat(o)},k:function(o){t.k0=parseFloat(o)},a:function(o){t.a=parseFloat(o)},b:function(o){t.b=parseFloat(o)},r_a:function(){t.R_A=!0},zone:function(o){t.zone=parseInt(o,10)},south:function(){t.utmSouth=!0},towgs84:function(o){t.datum_params=o.split(",").map(function(h){return parseFloat(h)})},to_meter:function(o){t.to_meter=parseFloat(o)},units:function(o){t.units=o;var h=Z(Dr,o);h&&(t.to_meter=h.to_meter)},from_greenwich:function(o){t.from_greenwich=o*G},pm:function(o){var h=Z(V,o);t.from_greenwich=(h||parseFloat(o))*G},nadgrids:function(o){o==="@null"?t.datumCode="none":t.nadgrids=o},axis:function(o){var h="ewnsud";o.length===3&&h.indexOf(o.substr(0,1))!==-1&&h.indexOf(o.substr(1,1))!==-1&&h.indexOf(o.substr(2,1))!==-1&&(t.axis=o)}};for(i in r)s=r[i],i in n?(a=n[i],typeof a=="function"?a(s):t[a]=s):t[i]=s;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var ar=class{static getId(t){let r=t.find(i=>Array.isArray(i)&&i[0]==="ID");return r&&r.length>=3?{authority:r[1],code:parseInt(r[2],10)}:null}static convertUnit(t,r="unit"){if(!t||t.length<3)return{type:r,name:"unknown",conversion_factor:null};let i=t[1],s=parseFloat(t[2])||null,a=t.find(o=>Array.isArray(o)&&o[0]==="ID"),n=a?{authority:a[1],code:parseInt(a[2],10)}:null;return{type:r,name:i,conversion_factor:s,id:n}}static convertAxis(t){let r=t[1]||"Unknown",i,s=r.match(/^\((.)\)$/);if(s){let f=s[1].toUpperCase();if(f==="E")i="east";else if(f==="N")i="north";else if(f==="U")i="up";else throw new Error(`Unknown axis abbreviation: ${f}`)}else i=t[2]?t[2].toLowerCase():"unknown";let a=t.find(f=>Array.isArray(f)&&f[0]==="ORDER"),n=a?parseInt(a[1],10):null,o=t.find(f=>Array.isArray(f)&&(f[0]==="LENGTHUNIT"||f[0]==="ANGLEUNIT"||f[0]==="SCALEUNIT")),h=this.convertUnit(o);return{name:r,direction:i,unit:h,order:n}}static extractAxes(t){return t.filter(r=>Array.isArray(r)&&r[0]==="AXIS").map(r=>this.convertAxis(r)).sort((r,i)=>(r.order||0)-(i.order||0))}static convert(t,r={}){switch(t[0]){case"PROJCRS":r.type="ProjectedCRS",r.name=t[1],r.base_crs=t.find(l=>Array.isArray(l)&&l[0]==="BASEGEOGCRS")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="BASEGEOGCRS")):null,r.conversion=t.find(l=>Array.isArray(l)&&l[0]==="CONVERSION")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="CONVERSION")):null;let i=t.find(l=>Array.isArray(l)&&l[0]==="CS");i&&(r.coordinate_system={type:i[1],axis:this.extractAxes(t)});let s=t.find(l=>Array.isArray(l)&&l[0]==="LENGTHUNIT");if(s){let l=this.convertUnit(s);r.coordinate_system.unit=l}r.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":r.type="GeographicCRS",r.name=t[1];let a=t.find(l=>Array.isArray(l)&&(l[0]==="DATUM"||l[0]==="ENSEMBLE"));if(a){let l=this.convert(a);a[0]==="ENSEMBLE"?r.datum_ensemble=l:r.datum=l;let m=t.find(p=>Array.isArray(p)&&p[0]==="PRIMEM");m&&m[1]!=="Greenwich"&&(l.prime_meridian={name:m[1],longitude:parseFloat(m[2])})}r.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},r.id=this.getId(t);break;case"DATUM":r.type="GeodeticReferenceFrame",r.name=t[1],r.ellipsoid=t.find(l=>Array.isArray(l)&&l[0]==="ELLIPSOID")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":r.type="DatumEnsemble",r.name=t[1],r.members=t.filter(l=>Array.isArray(l)&&l[0]==="MEMBER").map(l=>({type:"DatumEnsembleMember",name:l[1],id:this.getId(l)}));let n=t.find(l=>Array.isArray(l)&&l[0]==="ENSEMBLEACCURACY");n&&(r.accuracy=parseFloat(n[1]));let o=t.find(l=>Array.isArray(l)&&l[0]==="ELLIPSOID");o&&(r.ellipsoid=this.convert(o)),r.id=this.getId(t);break;case"ELLIPSOID":r.type="Ellipsoid",r.name=t[1],r.semi_major_axis=parseFloat(t[2]),r.inverse_flattening=parseFloat(t[3]);let h=t.find(l=>Array.isArray(l)&&l[0]==="LENGTHUNIT")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="LENGTHUNIT"),r):null;break;case"CONVERSION":r.type="Conversion",r.name=t[1],r.method=t.find(l=>Array.isArray(l)&&l[0]==="METHOD")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="METHOD")):null,r.parameters=t.filter(l=>Array.isArray(l)&&l[0]==="PARAMETER").map(l=>this.convert(l));break;case"METHOD":r.type="Method",r.name=t[1],r.id=this.getId(t);break;case"PARAMETER":r.type="Parameter",r.name=t[1],r.value=parseFloat(t[2]),r.unit=this.convertUnit(t.find(l=>Array.isArray(l)&&(l[0]==="LENGTHUNIT"||l[0]==="ANGLEUNIT"||l[0]==="SCALEUNIT"))),r.id=this.getId(t);break;case"BOUNDCRS":r.type="BoundCRS";let f=t.find(l=>Array.isArray(l)&&l[0]==="SOURCECRS");if(f){let l=f.find(m=>Array.isArray(m));r.source_crs=l?this.convert(l):null}let u=t.find(l=>Array.isArray(l)&&l[0]==="TARGETCRS");if(u){let l=u.find(m=>Array.isArray(m));r.target_crs=l?this.convert(l):null}let c=t.find(l=>Array.isArray(l)&&l[0]==="ABRIDGEDTRANSFORMATION");c?r.transformation=this.convert(c):r.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(r.type="Transformation",r.name=t[1],r.method=t.find(l=>Array.isArray(l)&&l[0]==="METHOD")?this.convert(t.find(l=>Array.isArray(l)&&l[0]==="METHOD")):null,r.parameters=t.filter(l=>Array.isArray(l)&&(l[0]==="PARAMETER"||l[0]==="PARAMETERFILE")).map(l=>{if(l[0]==="PARAMETER")return this.convert(l);if(l[0]==="PARAMETERFILE")return{name:l[1],value:l[2],id:{authority:"EPSG",code:8656}}}),r.parameters.length===7){let l=r.parameters[6];l.name==="Scale difference"&&(l.value=Math.round((l.value-1)*1e12)/1e6)}r.id=this.getId(t);break;case"AXIS":r.coordinate_system||(r.coordinate_system={type:"unspecified",axis:[]}),r.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let d=this.convertUnit(t,"LinearUnit");r.coordinate_system&&r.coordinate_system.axis&&r.coordinate_system.axis.forEach(l=>{l.unit||(l.unit=d)}),d.conversion_factor&&d.conversion_factor!==1&&r.semi_major_axis&&(r.semi_major_axis={value:r.semi_major_axis,unit:d});break;default:r.keyword=t[0];break}return r}},xe=ar;var nr=class extends xe{static convert(t,r={}){return super.convert(t,r),r.coordinate_system&&r.coordinate_system.subtype==="Cartesian"&&delete r.coordinate_system,r.usage&&delete r.usage,r}},jr=nr;var or=class extends xe{static convert(t,r={}){super.convert(t,r);let i=t.find(a=>Array.isArray(a)&&a[0]==="CS");i&&(r.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});let s=t.find(a=>Array.isArray(a)&&a[0]==="USAGE");if(s){let a=s.find(h=>Array.isArray(h)&&h[0]==="SCOPE"),n=s.find(h=>Array.isArray(h)&&h[0]==="AREA"),o=s.find(h=>Array.isArray(h)&&h[0]==="BBOX");r.usage={},a&&(r.usage.scope=a[1]),n&&(r.usage.area=n[1]),o&&(r.usage.bbox=o.slice(1))}return r}},Vr=or;function ia(e){return e.find(t=>Array.isArray(t)&&t[0]==="USAGE")?"2019":(e.find(t=>Array.isArray(t)&&t[0]==="CS")||e[0]==="BOUNDCRS"||e[0]==="PROJCRS"||e[0]==="GEOGCRS","2015")}function Hr(e){return(ia(e)==="2019"?Vr:jr).convert(e)}function Wr(e){let t=e.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}var Jr=oa,he=1,Xr=2,Kr=3,we=4,$r=5,hr=-1,sa=/\s/,aa=/[A-Za-z]/,na=/[A-Za-z84_]/,Ie=/[,\]]/,Zr=/[\d\.E\-\+]/;function _t(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=he}_t.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==we)for(;sa.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case he:return this.neutral(e);case Xr:return this.keyword(e);case we:return this.quoted(e);case $r:return this.afterquote(e);case Kr:return this.number(e);case hr:return}};_t.prototype.afterquote=function(e){if(e==='"'){this.word+='"',this.state=we;return}if(Ie.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in afterquote yet, index '+this.place)};_t.prototype.afterItem=function(e){if(e===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=he;return}if(e==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=he,this.currentObject=this.stack.pop(),this.currentObject||(this.state=hr);return}};_t.prototype.number=function(e){if(Zr.test(e)){this.word+=e;return}if(Ie.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in number yet, index '+this.place)};_t.prototype.quoted=function(e){if(e==='"'){this.state=$r;return}this.word+=e};_t.prototype.keyword=function(e){if(na.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=he;return}if(Ie.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in keyword yet, index '+this.place)};_t.prototype.neutral=function(e){if(aa.test(e)){this.word=e,this.state=Xr;return}if(e==='"'){this.word="",this.state=we;return}if(Zr.test(e)){this.word=e,this.state=Kr;return}if(Ie.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in neutral yet, index '+this.place)};_t.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===hr)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function oa(e){var t=new _t(e);return t.output()}function fr(e,t,r){Array.isArray(t)&&(r.unshift(t),t=null);var i=t?{}:e,s=r.reduce(function(a,n){return Nt(n,a),a},i);t&&(e[t]=s)}function Nt(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]={},Nt(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&&Nt(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Nt(e[3],t[r]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":e[0]=["name",e[0]],fr(t,r,e);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":e[0]=["name",e[0]],fr(t,r,e),t[r].type=r;return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return Nt(e,t[r]);return fr(t,r,e)}}var ha=.017453292519943295;function tt(e){return e*ha}function Ae(e){let t=(e.projName||"").toLowerCase().replace(/_/g," ");!e.long0&&e.longc&&(t==="albers conic equal area"||t==="lambert azimuthal equal area")&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(t==="stereographic south pole"||t==="polar stereographic (variant b)")?(e.lat0=tt(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t==="polar stereographic"||t==="polar stereographic (variant a)")&&(e.lat_ts=e.lat0,e.lat0=tt(e.lat0>0?90:-90),delete e.lat1)}function Qr(e){let t={units:null,to_meter:void 0};return typeof e=="string"?(t.units=e.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.units==="meter"&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.to_meter=e.conversion_factor),t}function Yr(e){return typeof e=="object"?e.value*e.unit.conversion_factor:e}function ti(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Yr(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening!==void 0?t.rf=e.ellipsoid.inverse_flattening:e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Yr(e.ellipsoid.semi_minor_axis))))}function fe(e,t={}){return!e||typeof e!="object"?e:e.type==="BoundCRS"?(fe(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name==="NTv2"?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(r=>r.value)),t):(Object.keys(e).forEach(r=>{let i=e[r];if(i!==null)switch(r){case"name":if(t.srsCode)break;t.name=i,t.srsCode=i;break;case"type":i==="GeographicCRS"?t.projName="longlat":i==="ProjectedCRS"&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case"datum":case"datum_ensemble":i.ellipsoid&&(t.ellps=i.ellipsoid.name,ti(i,t)),i.prime_meridian&&(t.from_greenwich=i.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":t.ellps=i.name,ti(i,t);break;case"prime_meridian":t.long0=(i.longitude||0)*Math.PI/180;break;case"coordinate_system":if(i.axis){if(t.axis=i.axis.map(s=>{let a=s.direction;if(a==="east")return"e";if(a==="north")return"n";if(a==="west")return"w";if(a==="south")return"s";throw new Error(`Unknown axis direction: ${a}`)}).join("")+"u",i.unit){let{units:s,to_meter:a}=Qr(i.unit);t.units=s,t.to_meter=a}else if(i.axis[0]&&i.axis[0].unit){let{units:s,to_meter:a}=Qr(i.axis[0].unit);t.units=s,t.to_meter=a}}break;case"id":i.authority&&i.code&&(t.title=i.authority+":"+i.code);break;case"conversion":i.method&&i.method.name&&(t.projName=i.method.name),i.parameters&&i.parameters.forEach(s=>{let a=s.name.toLowerCase().replace(/\s+/g,"_"),n=s.value;s.unit&&s.unit.conversion_factor?t[a]=n*s.unit.conversion_factor:s.unit==="degree"?t[a]=n*Math.PI/180:t[a]=n});break;case"unit":i.name&&(t.units=i.name.toLowerCase(),t.units==="metre"&&(t.units="meter")),i.conversion_factor&&(t.to_meter=i.conversion_factor);break;case"base_crs":fe(i,t),t.datumCode=i.id?i.id.authority+"_"+i.id.code:i.name;break;default:break}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),Ae(t),t)}var fa=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function la(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 ei(e){for(var t=Object.keys(e),r=0,i=t.length;r<i;++r){var s=t[r];fa.indexOf(s)!==-1&&ca(e[s]),typeof e[s]=="object"&&ei(e[s])}}function ca(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+":"+e.AUTHORITY[t])}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 r="",i=0,s=e.AXIS.length;i<s;++i){var a=[e.AXIS[i][0].toLowerCase(),e.AXIS[i][1].toLowerCase()];a[0].indexOf("north")!==-1||(a[0]==="y"||a[0]==="lat")&&a[1]==="north"?r+="n":a[0].indexOf("south")!==-1||(a[0]==="y"||a[0]==="lat")&&a[1]==="south"?r+="s":a[0].indexOf("east")!==-1||(a[0]==="x"||a[0]==="lon")&&a[1]==="east"?r+="e":(a[0].indexOf("west")!==-1||(a[0]==="x"||a[0]==="lon")&&a[1]==="west")&&(r+="w")}r.length===2&&(r+="u"),r.length===3&&(e.axis=r)}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_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==="belge_1972"&&(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),e.rectified_grid_angle&&(e.rectified_grid_angle=tt(e.rectified_grid_angle));function o(u){var c=e.to_meter||1;return u*c}var h=function(u){return la(e,u)},f=[["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",tt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",tt],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",tt],["lat0","latitude_of_origin",tt],["lat0","standard_parallel_1",tt],["lat1","standard_parallel_1",tt],["lat2","standard_parallel_2",tt],["azimuth","Azimuth"],["alpha","azimuth",tt],["srsCode","name"]];f.forEach(h),Ae(e)}function Ee(e){if(typeof e=="object")return fe(e);let t=Wr(e);var r=Jr(e);if(t==="WKT2"){let a=Hr(r);return fe(a)}var i=r[0],s={};return Nt(r,s),ei(s),s[i]}function et(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?et[e]=oe(arguments[1]):et[e]=Ee(arguments[1]):et[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?et.apply(t,i):et(i)});if(typeof e=="string"){if(e in et)return et[e]}else"EPSG"in e?et["EPSG:"+e.EPSG]=e:"ESRI"in e?et["ESRI:"+e.ESRI]=e:"IAU2000"in e?et["IAU2000:"+e.IAU2000]=e:console.log(e);return}}Br(et);var qt=et;function ua(e){return typeof e=="string"}function da(e){return e in qt}var ma=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function pa(e){return ma.some(function(t){return e.indexOf(t)>-1})}var _a=["3857","900913","3785","102113"];function ba(e){var t=Z(e,"authority");if(t){var r=Z(t,"epsg");return r&&_a.indexOf(r)>-1}}function ya(e){var t=Z(e,"extension");if(t)return Z(t,"proj4")}function va(e){return e[0]==="+"}function ga(e){if(ua(e)){if(da(e))return qt[e];if(pa(e)){var t=Ee(e);if(ba(t))return qt["EPSG:3857"];var r=ya(t);return r?oe(r):t}if(va(e))return oe(e)}else return e}var ri=ga;function lr(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 j(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function ut(e){return e<0?-1:1}function v(e){return Math.abs(e)<=R?e:e-ut(e)*ne}function H(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(_-t))/i}function bt(e,t){for(var r=.5*e,i,s,a=_-2*Math.atan(t),n=0;n<=15;n++)if(i=e*Math.sin(a),s=_-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-a,a+=s,Math.abs(s)<=1e-10)return a;return-9999}function Ma(){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=j(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function xa(e){var t=e.x,r=e.y;if(r*nt>90&&r*nt<-90&&t*nt>180&&t*nt<-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*v(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(E+.5*r));else{var a=Math.sin(r),n=H(this.e,r,a);i=this.x0+this.a*this.k0*v(t-this.long0),s=this.y0-this.a*this.k0*Math.log(n)}return e.x=i,e.y=s,e}function wa(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=_-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var a=Math.exp(-r/(this.a*this.k0));if(s=bt(this.e,a),s===-9999)return null}return i=v(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var Ia=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],ii={init:Ma,forward:xa,inverse:wa,names:Ia};function Aa(){}function si(e){return e}var Ea=["longlat","identity"],ai={init:Aa,forward:si,inverse:si,names:Ea};var Sa=[ii,ai],Se={},Pe=[];function ni(e,t){var r=Pe.length;return e.names?(Pe[r]=e,e.names.forEach(function(i){Se[i.toLowerCase()]=r}),this):(console.log(t),!0)}function Pa(e){if(!e)return!1;var t=e.toLowerCase();if(typeof Se[t]<"u"&&Pe[Se[t]])return Pe[Se[t]]}function Na(){Sa.forEach(ni)}var oi={start:Na,add:ni,get:Pa};var w={};w.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};w.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};w.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};w.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};w.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};w.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};w.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};w.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};w.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};w.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};w.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};w.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};w.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};w.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};w.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};w.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};w.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};w.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};w.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};w.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};w.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};w.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};w.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};w.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};w.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};w.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};w.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};w.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};w.hough={a:6378270,rf:297,ellipseName:"Hough"};w.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};w.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};w.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};w.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};w.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};w.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};w.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};w.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};w.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};w.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};w.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};w.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var hi=w.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};w.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function fi(e,t,r,i){var s=e*e,a=t*t,n=(s-a)/s,o=0;i?(e*=1-n*(Ur+n*(zr+n*qr)),s=e*e,n=0):o=Math.sqrt(n);var h=(s-a)/a;return{es:n,e:o,ep2:h}}function li(e,t,r,i,s){if(!e){var a=Z(w,i);a||(a=hi),e=a.a,t=a.b,r=a.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)<y)&&(s=!0,t=e),{a:e,b:t,rf:r,sphere:s}}var U={};U.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};U.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};U.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};U.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};U.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};U.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};U.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};U.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};U.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};U.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};U.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};U.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};U.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};U.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};U.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};U.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};U.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function Oa(e,t,r,i,s,a){var n={};return e===void 0||e==="none"?n.datum_type=ae:n.datum_type=Gr,t&&(n.datum_params=t.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=st),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=at,n.datum_params[3]*=Pt,n.datum_params[4]*=Pt,n.datum_params[5]*=Pt,n.datum_params[6]=n.datum_params[6]/1e6+1)),n.a=r,n.b=i,n.es=s,n.ep2=a,n}var ci=Oa;function Dt(e,t){if(!(this instanceof Dt))return new Dt(e);t=t||function(h){if(h)throw h};var r=ri(e);if(typeof r!="object"){t(e);return}var i=Dt.projections.get(r.projName);if(!i){t(e);return}if(r.datumCode&&r.datumCode!=="none"){var s=Z(U,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 a=li(r.a,r.b,r.rf,r.ellps,r.sphere),n=fi(a.a,a.b,a.rf,r.R_A),o=r.datum||ci(r.datumCode,r.datum_params,a.a,a.b,n.es,n.ep2);lr(this,r),lr(this,i),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=n.es,this.e=n.e,this.ep2=n.ep2,this.datum=o,this.init(),t(null,this)}Dt.projections=oi;Dt.projections.start();var wt=Dt;function ui(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===st?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===at?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 Ne(e,t,r){var i=e.x,s=e.y,a=e.z?e.z:0,n,o,h,f;if(s<-_&&s>-1.001*_)s=-_;else if(s>_&&s<1.001*_)s=_;else{if(s<-_)return{x:-1/0,y:-1/0,z:e.z};if(s>_)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),o=Math.sin(s),f=Math.cos(s),h=o*o,n=r/Math.sqrt(1-t*h),{x:(n+a)*f*Math.cos(i),y:(n+a)*f*Math.sin(i),z:(n*(1-t)+a)*o}}function Oe(e,t,r,i){var s=1e-12,a=s*s,n=30,o,h,f,u,c,d,l,m,p,b,g,x,M,S=e.x,I=e.y,A=e.z?e.z:0,B,N,Y;if(o=Math.sqrt(S*S+I*I),h=Math.sqrt(S*S+I*I+A*A),o/r<s){if(B=0,h/r<s)return N=_,Y=-i,{x:e.x,y:e.y,z:e.z}}else B=Math.atan2(I,S);f=A/h,u=o/h,c=1/Math.sqrt(1-t*(2-t)*u*u),m=u*(1-t)*c,p=f*c,M=0;do M++,l=r/Math.sqrt(1-t*p*p),Y=o*m+A*p-l*(1-t*p*p),d=t*l/(l+Y),c=1/Math.sqrt(1-d*(2-d)*u*u),b=u*(1-d)*c,g=f*c,x=g*m-b*p,m=b,p=g;while(x*x>a&&M<n);return N=Math.atan(g/Math.abs(b)),{x:B,y:N,z:Y}}function di(e,t,r){if(t===st)return{x:e.x+r[0],y:e.y+r[1],z:e.z+r[2]};if(t===at){var i=r[0],s=r[1],a=r[2],n=r[3],o=r[4],h=r[5],f=r[6];return{x:f*(e.x-h*e.y+o*e.z)+i,y:f*(h*e.x+e.y-n*e.z)+s,z:f*(-o*e.x+n*e.y+e.z)+a}}}function mi(e,t,r){if(t===st)return{x:e.x-r[0],y:e.y-r[1],z:e.z-r[2]};if(t===at){var i=r[0],s=r[1],a=r[2],n=r[3],o=r[4],h=r[5],f=r[6],u=(e.x-i)/f,c=(e.y-s)/f,d=(e.z-a)/f;return{x:u+h*c-o*d,y:-h*u+c+n*d,z:o*u-n*c+d}}}function Re(e){return e===st||e===at}function pi(e,t,r){return ui(e,t)||e.datum_type===ae||t.datum_type===ae||e.es===t.es&&e.a===t.a&&!Re(e.datum_type)&&!Re(t.datum_type)?r:(r=Ne(r,e.es,e.a),Re(e.datum_type)&&(r=di(r,e.datum_type,e.datum_params)),Re(t.datum_type)&&(r=mi(r,t.datum_type,t.datum_params)),Oe(r,t.es,t.a,t.b))}function cr(e,t,r){var i=r.x,s=r.y,a=r.z||0,n,o,h,f={};for(h=0;h<3;h++)if(!(t&&h===2&&r.z===void 0))switch(h===0?(n=i,"ew".indexOf(e.axis[h])!==-1?o="x":o="y"):h===1?(n=s,"ns".indexOf(e.axis[h])!==-1?o="y":o="x"):(n=a,o="z"),e.axis[h]){case"e":case"w":case"n":case"s":f[o]=n;break;case"u":r[o]!==void 0&&(f.z=n);break;case"d":r[o]!==void 0&&(f.z=-n);break;default:return null}return f}function Fe(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 bi(e){_i(e.x),_i(e.y)}function _i(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 Ra(e,t){return(e.datum.datum_type===st||e.datum.datum_type===at)&&t.datumCode!=="WGS84"||(t.datum.datum_type===st||t.datum.datum_type===at)&&e.datumCode!=="WGS84"}function Ot(e,t,r){var i;if(Array.isArray(r)&&(r=Fe(r)),bi(r),e.datum&&t.datum&&Ra(e,t)&&(i=new wt("WGS84"),r=Ot(e,i,r),e=i),e.axis!=="enu"&&(r=cr(e,!1,r)),e.projName==="longlat")r={x:r.x*G,y:r.y*G,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=pi(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*nt,y:r.y*nt,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"?cr(t,!0,r):r}var yi=wt("WGS84");function ur(e,t,r){var i,s,a;return Array.isArray(r)?(i=Ot(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=Ot(e,t,r),a=Object.keys(r),a.length===2||a.forEach(function(n){if(typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;s[n]=r[n]}),s)}function vi(e){return e instanceof wt?e:e.oProj?e.oProj:wt(e)}function Fa(e,t,r){e=vi(e);var i=!1,s;return typeof t>"u"?(t=e,e=yi,i=!0):(typeof t.x<"u"||Array.isArray(t))&&(r=t,t=e,e=yi,i=!0),t=vi(t),r?ur(e,t,r):(s={forward:function(a){return ur(e,t,a)},inverse:function(a){return ur(t,e,a)}},i&&(s.oProj=t),s)}var Q=Fa;var gi=6,xi="AJSAJS",wi="AFAFAF",kt=65,K=73,rt=79,le=86,ce=90,Ii={forward:mr,inverse:Ta,toPoint:pr};function mr(e,t){return t=t||5,Ba(Ca({lat:e[1],lon:e[0]}),t)}function Ta(e){var t=_r(Ei(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function pr(e){var t=_r(Ei(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function dr(e){return e*(Math.PI/180)}function Mi(e){return 180*(e/Math.PI)}function Ca(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,a=.9996,n,o,h,f,u,c,d,l=dr(t),m=dr(r),p,b;b=Math.floor((r+180)/6)+1,r===180&&(b=60),t>=56&&t<64&&r>=3&&r<12&&(b=32),t>=72&&t<84&&(r>=0&&r<9?b=31:r>=9&&r<21?b=33:r>=21&&r<33?b=35:r>=33&&r<42&&(b=37)),n=(b-1)*6-180+3,p=dr(n),o=s/(1-s),h=i/Math.sqrt(1-s*Math.sin(l)*Math.sin(l)),f=Math.tan(l)*Math.tan(l),u=o*Math.cos(l)*Math.cos(l),c=Math.cos(l)*(m-p),d=i*((1-s/4-3*s*s/64-5*s*s*s/256)*l-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*l)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*l)-35*s*s*s/3072*Math.sin(6*l));var g=a*h*(c+(1-f+u)*c*c*c/6+(5-18*f+f*f+72*u-58*o)*c*c*c*c*c/120)+5e5,x=a*(d+h*Math.tan(l)*(c*c/2+(5-f+9*u+4*u*u)*c*c*c*c/24+(61-58*f+f*f+600*u-330*o)*c*c*c*c*c*c/720));return t<0&&(x+=1e7),{northing:Math.round(x),easting:Math.round(g),zoneNumber:b,zoneLetter:La(t)}}function _r(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var a=.9996,n=6378137,o=.00669438,h,f=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),u,c,d,l,m,p,b,g,x,M=r-5e5,S=t;i<"N"&&(S-=1e7),b=(s-1)*6-180+3,h=o/(1-o),p=S/a,g=p/(n*(1-o/4-3*o*o/64-5*o*o*o/256)),x=g+(3*f/2-27*f*f*f/32)*Math.sin(2*g)+(21*f*f/16-55*f*f*f*f/32)*Math.sin(4*g)+151*f*f*f/96*Math.sin(6*g),u=n/Math.sqrt(1-o*Math.sin(x)*Math.sin(x)),c=Math.tan(x)*Math.tan(x),d=h*Math.cos(x)*Math.cos(x),l=n*(1-o)/Math.pow(1-o*Math.sin(x)*Math.sin(x),1.5),m=M/(u*a);var I=x-u*Math.tan(x)/l*(m*m/2-(5+3*c+10*d-4*d*d-9*h)*m*m*m*m/24+(61+90*c+298*d+45*c*c-252*h-3*d*d)*m*m*m*m*m*m/720);I=Mi(I);var A=(m-(1+2*c+d)*m*m*m/6+(5-2*d+28*c-3*d*d+8*h+24*c*c)*m*m*m*m*m/120)/Math.cos(x);A=b+Mi(A);var B;if(e.accuracy){var N=_r({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});B={top:N.lat,right:N.lon,bottom:I,left:A}}else B={lat:I,lon:A};return B}function La(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 Ba(e,t){var r="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+Ga(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function Ga(e,t,r){var i=Ai(r),s=Math.floor(e/1e5),a=Math.floor(t/1e5)%20;return Ua(s,a,i)}function Ai(e){var t=e%gi;return t===0&&(t=gi),t}function Ua(e,t,r){var i=r-1,s=xi.charCodeAt(i),a=wi.charCodeAt(i),n=s+e-1,o=a+t,h=!1;n>ce&&(n=n-ce+kt-1,h=!0),(n===K||s<K&&n>K||(n>K||s<K)&&h)&&n++,(n===rt||s<rt&&n>rt||(n>rt||s<rt)&&h)&&(n++,n===K&&n++),n>ce&&(n=n-ce+kt-1),o>le?(o=o-le+kt-1,h=!0):h=!1,(o===K||a<K&&o>K||(o>K||a<K)&&h)&&o++,(o===rt||a<rt&&o>rt||(o>rt||a<rt)&&h)&&(o++,o===K&&o++),o>le&&(o=o-le+kt-1);var f=String.fromCharCode(n)+String.fromCharCode(o);return f}function Ei(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";for(var t=e.length,r=null,i="",s,a=0;!/[A-Z]/.test(s=e.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+e;i+=s,a++}var n=parseInt(i,10);if(a===0||a+3>t)throw"MGRSPoint bad conversion from: "+e;var o=e.charAt(a++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+e;r=e.substring(a,a+=2);for(var h=Ai(n),f=za(r.charAt(0),h),u=qa(r.charAt(1),h);u<Da(o);)u+=2e6;var c=t-a;if(c%2!==0)throw`MGRSPoint has to have an even number
|
|
8
8
|
of digits after the zone letter and two 100km letters - front
|
|
9
9
|
half for easting meters, second half for
|
|
10
|
-
northing meters`+e;var d=c/2,l=0,m=0,p,b,g,x,M;return d>0&&(p=1e5/Math.pow(10,d),b=e.substring(a,a+d),l=parseFloat(b)*p,g=e.substring(a+d),m=parseFloat(g)*p),x=l+f,M=m+u,{easting:x,northing:M,zoneLetter:o,zoneNumber:n,accuracy:p}}function za(e,t){for(var r=xi.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===K&&r++,r===rt&&r++,r>ce){if(s)throw"Bad character: "+e;r=kt,s=!0}i+=1e5}return i}function qa(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=wi.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===K&&r++,r===rt&&r++,r>le){if(s)throw"Bad character: "+e;r=kt,s=!0}i+=1e5}return i}function Da(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 jt(e,t,r){if(!(this instanceof jt))return new jt(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")}jt.fromMGRS=function(e){return new jt(pr(e))};jt.prototype.toMGRS=function(e){return mr([this.x,this.y],e)};var Si=jt;var ka=1,ja=.25,Pi=.046875,Ni=.01953125,Oi=.01068115234375,Va=.75,Ha=.46875,Wa=.013020833333333334,Ja=.007120768229166667,Xa=.3645833333333333,Ka=.005696614583333333,$a=.3076171875;function Te(e){var t=[];t[0]=ka-e*(ja+e*(Pi+e*(Ni+e*Oi))),t[1]=e*(Va-e*(Pi+e*(Ni+e*Oi)));var r=e*e;return t[2]=r*(Ha-e*(Wa+e*Ja)),r*=e,t[3]=r*(Xa-e*Ka),t[4]=r*e*$a,t}function Rt(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 Za=20;function Ce(e,t,r){for(var i=1/(1-t),s=e,a=Za;a;--a){var n=Math.sin(s),o=1-t*n*n;if(o=(Rt(s,n,Math.cos(s),r)-e)*(o*Math.sqrt(o))*i,s-=o,Math.abs(o)<y)return s}return s}function Qa(){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=Te(this.es),this.ml0=Rt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Ya(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a,n,o=Math.sin(r),h=Math.cos(r);if(this.es){var u=h*i,c=Math.pow(u,2),d=this.ep2*Math.pow(h,2),l=Math.pow(d,2),m=Math.abs(h)>y?Math.tan(r):0,p=Math.pow(m,2),b=Math.pow(p,2);s=1-this.es*Math.pow(o,2),u=u/Math.sqrt(s);var g=Rt(r,o,h,this.en);a=this.a*(this.k0*u*(1+c/6*(1-p+d+c/20*(5-18*p+b+14*d-58*p*d+c/42*(61+179*b-b*p-479*p)))))+this.x0,n=this.a*(this.k0*(g-this.ml0+o*i*u/2*(1+c/12*(5-p+9*d+4*l+c/30*(61+b-58*p+270*d-330*p*d+c/56*(1385+543*b-b*p-3111*p))))))+this.y0}else{var f=h*Math.sin(i);if(Math.abs(Math.abs(f)-1)<y)return 93;if(a=.5*this.a*this.k0*Math.log((1+f)/(1-f))+this.x0,n=h*Math.cos(i)/Math.sqrt(1-Math.pow(f,2)),f=Math.abs(n),f>=1){if(f-1>y)return 93;n=0}else n=Math.acos(n);r<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return e.x=a,e.y=n,e}function tn(e){var t,r,i,s,a=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+n/this.k0,r=Ce(t,this.es,this.en),Math.abs(r)<_){var c=Math.sin(r),d=Math.cos(r),l=Math.abs(d)>y?Math.tan(r):0,m=this.ep2*Math.pow(d,2),p=Math.pow(m,2),b=Math.pow(l,2),g=Math.pow(b,2);t=1-this.es*Math.pow(c,2);var x=a*Math.sqrt(t)/this.k0,M=Math.pow(x,2);t=t*l,i=r-t*M/(1-this.es)*.5*(1-M/12*(5+3*b-9*m*b+m-4*p-M/30*(61+90*b-252*m*b+45*g+46*m-M/56*(1385+3633*b+4095*g+1574*g*b)))),s=v(this.long0+x*(1-M/6*(1+2*b+m-M/20*(5+28*b+24*g+8*m*b+6*m-M/42*(61+662*b+1320*g+720*g*b))))/d)}else i=_*ut(n),s=0;else{var o=Math.exp(a/this.k0),h=.5*(o-1/o),f=this.lat0+n/this.k0,u=Math.cos(f);t=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(h,2))),i=Math.asin(t),n<0&&(i=-i),h===0&&u===0?s=0:s=v(Math.atan2(h,u)+this.long0)}return e.x=s,e.y=i,e}var en=["Transverse_Mercator","Transverse Mercator","tmerc"],Ri={init:Qa,forward:Ya,inverse:tn,names:en};function Le(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function ue(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 Fi(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function Ti(e){var t=Math.abs(e);return t=Fi(t*(1+t/(ue(1,t)+1))),e<0?-t:t}function Be(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],a=0,n;--i>=0;)n=-a+r*s+e[i],a=s,s=n;return t+n*Math.sin(2*t)}function Ci(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],a=0,n;--i>=0;)n=-a+r*s+e[i],a=s,s=n;return Math.sin(t)*n}function Li(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function br(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),a=Le(r),n=Li(r),o=2*s*n,h=-2*i*a,f=e.length-1,u=e[f],c=0,d=0,l=0,m,p;--f>=0;)m=d,p=c,d=u,c=l,u=-m+o*d-h*c+e[f],l=-p+h*d+o*c;return o=i*n,h=s*a,[o*u-h*l,o*l+h*u]}function rn(){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=Be(this.cbg,this.lat0);this.Zb=-this.Qn*(i+Ci(this.gtu,2*i))}function sn(e){var t=v(e.x-this.long0),r=e.y;r=Be(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),a=Math.sin(t),n=Math.cos(t);r=Math.atan2(i,n*s),t=Math.atan2(a*s,ue(i,s*n)),t=Ti(Math.tan(t));var o=br(this.gtu,2*r,2*t);r=r+o[0],t=t+o[1];var h,f;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,f=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,f=1/0),e.x=h,e.y=f,e}function an(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 a=br(this.utg,2*r,2*t);r=r+a[0],t=t+a[1],t=Math.atan(Le(t));var n=Math.sin(r),o=Math.cos(r),h=Math.sin(t),f=Math.cos(t);r=Math.atan2(n*f,ue(h,f*o)),t=Math.atan2(h,f*o),i=v(t+this.long0),s=Be(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var nn=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Vt={init:rn,forward:sn,inverse:an,names:nn};function Bi(e,t){if(e===void 0){if(e=Math.floor((v(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var on="etmerc";function hn(){var e=Bi(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*G,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Vt.init.apply(this),this.forward=Vt.forward,this.inverse=Vt.inverse}var fn=["Universal Transverse Mercator System","utm"],Gi={init:hn,names:fn,dependsOn:on};function Ge(e,t){return Math.pow((1-e)/(1+e),t)}var ln=20;function cn(){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+E)/(Math.pow(Math.tan(.5*this.lat0+E),this.C)*Ge(this.e*e,this.ratexp))}function un(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+E),this.C)*Ge(this.e*Math.sin(r),this.ratexp))-_,e.x=this.C*t,e}function dn(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+E)/this.K,1/this.C),a=ln;a>0&&(i=2*Math.atan(s*Ge(this.e*Math.sin(e.y),-.5*this.e))-_,!(Math.abs(i-e.y)<t));--a)e.y=i;return a?(e.x=r,e.y=i,e):null}var mn=["gauss"],Ue={init:cn,forward:un,inverse:dn,names:mn};function pn(){Ue.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 _n(e){var t,r,i,s;return e.x=v(e.x-this.long0),Ue.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 bn(e){var t,r,i,s,a;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,a=Math.sqrt(e.x*e.x+e.y*e.y)){var n=2*Math.atan2(a,this.R2);t=Math.sin(n),r=Math.cos(n),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/a),i=Math.atan2(e.x*t,a*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Ue.inverse.apply(this,[e]),e.x=v(e.x+this.long0),e}var yn=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Ui={init:pn,forward:_n,inverse:bn,names:yn};function vn(e,t,r){return t*=r,Math.tan(.5*(_+e))*Math.pow((1-t)/(1+t),.5*r)}function gn(){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)<=y&&(this.k0=.5*(1+ut(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=y&&(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)<=y&&(this.k0=.5*this.cons*j(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/H(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=j(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-_,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Mn(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),a,n,o,h,f,u,c=v(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=y&&Math.abs(r+this.lat0)<=y?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(c)),e.x=this.a*a*s*Math.sin(c)+this.x0,e.y=this.a*a*(this.coslat0*i-this.sinlat0*s*Math.cos(c))+this.y0,e):(n=2*Math.atan(this.ssfn_(r,i,this.e))-_,h=Math.cos(n),o=Math.sin(n),Math.abs(this.coslat0)<=y?(f=H(this.e,r*this.con,this.con*i),u=2*this.a*this.k0*f/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<y?(a=2*this.a*this.k0/(1+h*Math.cos(c)),e.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(c))),e.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(c))+this.y0),e.x=a*h*Math.sin(c)+this.x0,e))}function xn(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,a,n=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var o=2*Math.atan(n/(2*this.a*this.k0));return t=this.long0,r=this.lat0,n<=y?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(o)*this.sinlat0+e.y*Math.sin(o)*this.coslat0/n),Math.abs(this.coslat0)<y?this.lat0>0?t=v(this.long0+Math.atan2(e.x,-1*e.y)):t=v(this.long0+Math.atan2(e.x,e.y)):t=v(this.long0+Math.atan2(e.x*Math.sin(o),n*this.coslat0*Math.cos(o)-e.y*this.sinlat0*Math.sin(o))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=y){if(n<=y)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=n*this.cons/(2*this.a*this.k0),r=this.con*bt(this.e,i),t=this.con*v(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,n<=y?a=this.X0:(a=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/n),t=v(this.long0+Math.atan2(e.x*Math.sin(s),n*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*bt(this.e,Math.tan(.5*(_+a)));return e.x=t,e.y=r,e}var wn=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],zi={init:gn,forward:Mn,inverse:xn,names:wn,ssfn_:vn};function In(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,a=2*s-Math.pow(s,2),n=this.e=Math.sqrt(a);this.R=this.k0*r*Math.sqrt(1-a)/(1-a*Math.pow(t,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),f=Math.log((1+n*t)/(1-n*t));this.K=o-this.alpha*h+this.alpha*n/2*f}function An(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),a=this.alpha*(e.x-this.lambda0),n=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(a))),o=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,e.x=this.R*n+this.x0,e}function En(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),a=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))),o=this.lambda0+n/this.alpha,h=0,f=a,u=-1e3,c=0;Math.abs(f-u)>1e-7;){if(++c>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(f))/2)),u=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=o,e.y=f,e}var Sn=["somerc"],qi={init:In,forward:An,inverse:En,names:Sn};function Pn(){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=H(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var a,n;if(!isNaN(this.longc))this.lat0>=0?a=s+Math.sqrt(s*s-1):a=s-Math.sqrt(s*s-1),this.el=a*Math.pow(i,this.bl),n=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(n*Math.tan(this.gamma0))/this.bl;else{var o=H(this.e,this.lat1,Math.sin(this.lat1)),h=H(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 f=Math.pow(o,this.bl),u=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var c=(this.el*this.el-u*f)/(this.el*this.el+u*f),d=(u-f)/(u+f),l=v(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*l)/d)/this.bl,this.long0=v(this.long0);var m=v(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/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 Nn(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a,n;if(Math.abs(Math.abs(r)-_)<=y)r>0?n=-1:n=1,a=this.al/this.bl*Math.log(Math.tan(E+n*this.gamma0*.5)),s=-1*n*_*this.al/this.bl;else{var o=H(this.e,r,Math.sin(r)),h=this.el/Math.pow(o,this.bl),f=.5*(h-1/h),u=.5*(h+1/h),c=Math.sin(this.bl*i),d=(f*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;Math.abs(Math.abs(d)-1)<=y?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-d)/(1+d))/this.bl,Math.abs(Math.cos(this.bl*i))<=y?s=this.al*this.bl*i:s=this.al*Math.atan2(f*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+a):(s-=this.uc,e.x=this.x0+a*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-a*Math.sin(this.alpha)),e}function On(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),a=.5*(i+1/i),n=Math.sin(this.bl*t/this.al),o=(n*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/a,h=Math.pow(this.el/Math.sqrt((1+o)/(1-o)),1/this.bl);return Math.abs(o-1)<y?(e.x=this.long0,e.y=_):Math.abs(o+1)<y?(e.x=this.long0,e.y=-1*_):(e.y=bt(this.e,h),e.x=v(this.long0-Math.atan2(s*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var Rn=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Di={init:Pn,forward:Nn,inverse:On,names:Rn};function Fn(){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)<y)){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=j(this.e,t,r),s=H(this.e,this.lat1,t),a=Math.sin(this.lat2),n=Math.cos(this.lat2),o=j(this.e,a,n),h=H(this.e,this.lat2,a),f=H(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>y?this.ns=Math.log(i/o)/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(f,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Tn(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=y&&(r=ut(r)*(_-2*y));var i=Math.abs(Math.abs(r)-_),s,a;if(i>y)s=H(this.e,r,Math.sin(r)),a=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;a=0}var n=this.ns*v(t-this.long0);return e.x=this.k0*(a*Math.sin(n))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(n))+this.y0,e}function Cn(e){var t,r,i,s,a,n=(e.x-this.x0)/this.k0,o=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(n*n+o*o),r=1):(t=-Math.sqrt(n*n+o*o),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*n,r*o)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=bt(this.e,i),s===-9999)return null}else s=-_;return a=v(h/this.ns+this.long0),e.x=a,e.y=s,e}var Ln=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],ki={init:Fn,forward:Tn,inverse:Cn,names:Ln};function Bn(){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 Gn(e){var t,r,i,s,a,n,o,h=e.x,f=e.y,u=v(h-this.long0);return t=Math.pow((1+this.e*Math.sin(f))/(1-this.e*Math.sin(f)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(f/2+this.s45),this.alfa)/t)-this.s45),i=-u*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),a=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),n=this.n*a,o=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=o*Math.cos(n)/1,e.x=o*Math.sin(n)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Un(e){var t,r,i,s,a,n,o,h,f=e.x;e.x=e.y,e.y=f,this.czech||(e.y*=-1,e.x*=-1),n=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),s=a/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),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,o=t,h=0;var u=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(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-e.y)<1e-10&&(h=1),o=e.y,u+=1;while(h===0&&u<15);return u>=15?null:e}var zn=["Krovak","krovak"],ji={init:Bn,forward:Gn,inverse:Un,names:zn};function z(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function yt(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function vt(e){return .375*e*(1+.25*e*(1+.46875*e))}function gt(e){return .05859375*e*e*(1+.75*e)}function Mt(e){return e*e*e*(35/3072)}function xt(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function ot(e){return Math.abs(e)<_?e:e-ut(e)*Math.PI}function Ft(e,t,r,i,s){var a,n;a=e/t;for(var o=0;o<15;o++)if(n=(e-(t*a-r*Math.sin(2*a)+i*Math.sin(4*a)-s*Math.sin(6*a)))/(t-2*r*Math.cos(2*a)+4*i*Math.cos(4*a)-6*s*Math.cos(6*a)),a+=n,Math.abs(n)<=1e-10)return a;return NaN}function qn(){this.sphere||(this.e0=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.ml0=this.a*z(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Dn(e){var t,r,i=e.x,s=e.y;if(i=v(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 a=Math.sin(s),n=Math.cos(s),o=xt(this.a,this.e,a),h=Math.tan(s)*Math.tan(s),f=i*Math.cos(s),u=f*f,c=this.es*n*n/(1-this.es),d=this.a*z(this.e0,this.e1,this.e2,this.e3,s);t=o*f*(1-u*h*(1/6-(8-h+8*c)*u/120)),r=d-this.ml0+o*a/n*u*(.5+(5-h+6*c)*u/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function kn(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 a=r+this.lat0;i=Math.asin(Math.sin(a)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(a))}else{var n=this.ml0/this.a+r,o=Ft(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-_)<=y)return e.x=this.long0,e.y=_,r<0&&(e.y*=-1),e;var h=xt(this.a,this.e,Math.sin(o)),f=h*h*h/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(o),2),c=t*this.a/h,d=c*c;i=o-h*Math.tan(o)/f*c*c*(.5-(1+3*u)*c*c/24),s=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(o)}return e.x=v(s+this.long0),e.y=ot(i),e}var jn=["Cassini","Cassini_Soldner","cass"],Vi={init:qn,forward:Dn,inverse:kn,names:jn};function ht(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 Vn=1,Hn=2,Wn=3,Jn=4;function Xn(){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)<y?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=ht(this.e,1),this.mmf=.5/(1-this.es),this.apa=io(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=ht(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 Kn(e){var t,r,i,s,a,n,o,h,f,u,c=e.x,d=e.y;if(c=v(c-this.long0),this.sphere){if(a=Math.sin(d),u=Math.cos(d),i=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+u*i:1+this.sinph0*a+this.cosph0*u*i,r<=y)return null;r=Math.sqrt(2/r),t=r*u*Math.sin(c),r*=this.mode===this.EQUIT?a:this.cosph0*a-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(d+this.lat0)<y)return null;r=E-d*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(c),r*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(c),s=Math.sin(c),a=Math.sin(d),n=ht(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=n/this.qp,h=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:f=1+this.sinb1*o+this.cosb1*h*i;break;case this.EQUIT:f=1+h*i;break;case this.N_POLE:f=_+d,n=this.qp-n;break;case this.S_POLE:f=d-_,n=this.qp+n;break}if(Math.abs(f)<y)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:f=Math.sqrt(2/f),this.mode===this.OBLIQ?r=this.ymf*f*(this.cosb1*o-this.sinb1*h*i):r=(f=Math.sqrt(2/(1+h*i)))*o*this.ymf,t=this.xmf*f*h*s;break;case this.N_POLE:case this.S_POLE:n>=0?(t=(f=Math.sqrt(n))*s,r=i*(this.mode===this.S_POLE?f:-f)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function $n(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,a,n,o,h,f;if(this.sphere){var u=0,c,d=0;if(c=Math.sqrt(t*t+r*r),s=c*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),u=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(c)<=y?0:Math.asin(r*d/c),t*=d,r=u*c;break;case this.OBLIQ:s=Math.abs(c)<=y?this.lat0:Math.asin(u*this.sinph0+r*d*this.cosph0/c),t*=d*this.cosph0,r=(u-Math.sin(s)*this.sinph0)*c;break;case this.N_POLE:r=-r,s=_-s;break;case this.S_POLE:s-=_;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(f=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<y)return e.x=this.long0,e.y=this.lat0,e;n=2*Math.asin(.5*h/this.rq),a=Math.cos(n),t*=n=Math.sin(n),this.mode===this.OBLIQ?(f=a*this.sinb1+r*n*this.cosb1/h,o=this.qp*f,r=h*this.cosb1*a-r*this.sinb1*n):(f=r*n/h,o=this.qp*f,r=h*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),o=t*t+r*r,!o)return e.x=this.long0,e.y=this.lat0,e;f=1-o/this.qp,this.mode===this.S_POLE&&(f=-f)}i=Math.atan2(t,r),s=so(Math.asin(f),this.apa)}return e.x=v(this.long0+i),e.y=s,e}var Zn=.3333333333333333,Qn=.17222222222222222,Yn=.10257936507936508,to=.06388888888888888,eo=.0664021164021164,ro=.016415012942191543;function io(e){var t,r=[];return r[0]=e*Zn,t=e*e,r[0]+=t*Qn,r[1]=t*to,t*=e,r[0]+=t*Yn,r[1]+=t*eo,r[2]=t*ro,r}function so(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 ao=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Hi={init:Xn,forward:Kn,inverse:$n,names:ao,S_POLE:Vn,N_POLE:Hn,EQUIT:Wn,OBLIQ:Jn};function $(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function no(){Math.abs(this.lat1+this.lat2)<y||(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=j(this.e3,this.sin_po,this.cos_po),this.qs1=ht(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=j(this.e3,this.sin_po,this.cos_po),this.qs2=ht(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=ht(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>y?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 oo(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=ht(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,a=this.ns0*v(t-this.long0),n=s*Math.sin(a)+this.x0,o=this.rh-s*Math.cos(a)+this.y0;return e.x=n,e.y=o,e}function ho(e){var t,r,i,s,a,n;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?n=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,n=this.phi1z(this.e3,r)),a=v(s/this.ns0+this.long0),e.x=a,e.y=n,e}function fo(e,t){var r,i,s,a,n,o=$(.5*t);if(e<y)return o;for(var h=e*e,f=1;f<=25;f++)if(r=Math.sin(o),i=Math.cos(o),s=e*r,a=1-s*s,n=.5*a*a/i*(t/(1-h)-r/a+.5/e*Math.log((1-s)/(1+s))),o=o+n,Math.abs(n)<=1e-7)return o;return null}var lo=["Albers_Conic_Equal_Area","Albers","aea"],Wi={init:no,forward:oo,inverse:ho,names:lo,phi1z:fo};function co(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function uo(e){var t,r,i,s,a,n,o,h,f=e.x,u=e.y;return i=v(f-this.long0),t=Math.sin(u),r=Math.cos(u),s=Math.cos(i),n=this.sin_p14*t+this.cos_p14*r*s,a=1,n>0||Math.abs(n)<=y?(o=this.x0+this.a*a*r*Math.sin(i)/n,h=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*r*s)/n):(o=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=o,e.y=h,e}function mo(e){var t,r,i,s,a,n;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),n=$(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),a=v(this.long0+a)):(n=this.phic0,a=0),e.x=a,e.y=n,e}var po=["gnom"],Ji={init:co,forward:uo,inverse:mo,names:po};function Xi(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*_:_;for(var i=Math.asin(.5*t),s,a,n,o,h=0;h<30;h++)if(a=Math.sin(i),n=Math.cos(i),o=e*a,s=Math.pow(1-o*o,2)/(2*n)*(t/(1-e*e)-a/(1-o*o)+.5/e*Math.log((1-o)/(1+o))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function _o(){this.sphere||(this.k0=j(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function bo(e){var t=e.x,r=e.y,i,s,a=v(t-this.long0);if(this.sphere)i=this.x0+this.a*a*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var n=ht(this.e,Math.sin(r));i=this.x0+this.a*this.k0*a,s=this.y0+this.a*n*.5/this.k0}return e.x=i,e.y=s,e}function yo(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=v(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=Xi(this.e,2*e.y*this.k0/this.a),t=v(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var vo=["cea"],Ki={init:_o,forward:bo,inverse:yo,names:vo};function go(){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 Mo(e){var t=e.x,r=e.y,i=v(t-this.long0),s=ot(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function xo(e){var t=e.x,r=e.y;return e.x=v(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=ot(this.lat0+(r-this.y0)/this.a),e}var wo=["Equirectangular","Equidistant_Cylindrical","eqc"],$i={init:go,forward:Mo,inverse:xo,names:wo};var Zi=20;function Io(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.ml0=this.a*z(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Ao(e){var t=e.x,r=e.y,i,s,a,n=v(t-this.long0);if(a=n*Math.sin(r),this.sphere)Math.abs(r)<=y?(i=this.a*n,s=-1*this.a*this.lat0):(i=this.a*Math.sin(a)/Math.tan(r),s=this.a*(ot(r-this.lat0)+(1-Math.cos(a))/Math.tan(r)));else if(Math.abs(r)<=y)i=this.a*n,s=-1*this.ml0;else{var o=xt(this.a,this.e,Math.sin(r))/Math.tan(r);i=o*Math.sin(a),s=this.a*z(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+o*(1-Math.cos(a))}return e.x=i+this.x0,e.y=s+this.y0,e}function Eo(e){var t,r,i,s,a,n,o,h,f;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=y)t=v(i/this.a+this.long0),r=0;else{n=this.lat0+s/this.a,o=i*i/this.a/this.a+n*n,h=n;var u;for(a=Zi;a;--a)if(u=Math.tan(h),f=-1*(n*(h*u+1)-h-.5*(h*h+o)*u)/((h-n)/u-1),h+=f,Math.abs(f)<=y){r=h;break}t=v(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=y)r=0,t=v(this.long0+i/this.a);else{n=(this.ml0+s)/this.a,o=i*i/this.a/this.a+n*n,h=n;var c,d,l,m,p;for(a=Zi;a;--a)if(p=this.e*Math.sin(h),c=Math.sqrt(1-p*p)*Math.tan(h),d=this.a*z(this.e0,this.e1,this.e2,this.e3,h),l=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,f=(n*(c*m+1)-m-.5*c*(m*m+o))/(this.es*Math.sin(2*h)*(m*m+o-2*n*m)/(4*c)+(n-m)*(c*l-2/Math.sin(2*h))-l),h-=f,Math.abs(f)<=y){r=h;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=v(this.long0+Math.asin(i*c/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var So=["Polyconic","poly"],Qi={init:Io,forward:Ao,inverse:Eo,names:So};function Po(){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 No(e){var t,r=e.x,i=e.y,s=i-this.lat0,a=r-this.long0,n=s/Pt*1e-5,o=a,h=1,f=0;for(t=1;t<=10;t++)h=h*n,f=f+this.A[t]*h;var u=f,c=o,d=1,l=0,m,p,b=0,g=0;for(t=1;t<=6;t++)m=d*u-l*c,p=l*u+d*c,d=m,l=p,b=b+this.B_re[t]*d-this.B_im[t]*l,g=g+this.B_im[t]*d+this.B_re[t]*l;return e.x=g*this.a+this.x0,e.y=b*this.a+this.y0,e}function Oo(e){var t,r=e.x,i=e.y,s=r-this.x0,a=i-this.y0,n=a/this.a,o=s/this.a,h=1,f=0,u,c,d=0,l=0;for(t=1;t<=6;t++)u=h*n-f*o,c=f*n+h*o,h=u,f=c,d=d+this.C_re[t]*h-this.C_im[t]*f,l=l+this.C_im[t]*h+this.C_re[t]*f;for(var m=0;m<this.iterations;m++){var p=d,b=l,g,x,M=n,S=o;for(t=2;t<=6;t++)g=p*d-b*l,x=b*d+p*l,p=g,b=x,M=M+(t-1)*(this.B_re[t]*p-this.B_im[t]*b),S=S+(t-1)*(this.B_im[t]*p+this.B_re[t]*b);p=1,b=0;var I=this.B_re[1],A=this.B_im[1];for(t=2;t<=6;t++)g=p*d-b*l,x=b*d+p*l,p=g,b=x,I=I+t*(this.B_re[t]*p-this.B_im[t]*b),A=A+t*(this.B_im[t]*p+this.B_re[t]*b);var B=I*I+A*A;d=(M*I+S*A)/B,l=(S*I-M*A)/B}var N=d,Y=l,q=1,it=0;for(t=1;t<=9;t++)q=q*N,it=it+this.D[t]*q;var pt=this.lat0+it*Pt*1e5,ie=this.long0+Y;return e.x=ie,e.y=pt,e}var Ro=["New_Zealand_Map_Grid","nzmg"],Yi={init:Po,forward:No,inverse:Oo,names:Ro};function Fo(){}function To(e){var t=e.x,r=e.y,i=v(t-this.long0),s=this.x0+this.a*i,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=a,e}function Co(e){e.x-=this.x0,e.y-=this.y0;var t=v(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 Lo=["Miller_Cylindrical","mill"],ts={init:Fo,forward:To,inverse:Co,names:Lo};var Bo=20;function Go(){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=Te(this.es)}function Uo(e){var t,r,i=e.x,s=e.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 a=this.n*Math.sin(s),n=Bo;n;--n){var o=(this.m*s+Math.sin(s)-a)/(this.m+Math.cos(s));if(s-=o,Math.abs(o)<y)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),f=Math.cos(s);r=this.a*Rt(s,h,f,this.en),t=this.a*i*f/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function zo(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=$((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=$(Math.sin(t)/this.n)),i=v(i+this.long0),t=ot(t)):(t=Ce(e.y/this.a,this.es,this.en),s=Math.abs(t),s<_?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=v(r)):s-y<_&&(i=this.long0)),e.x=i,e.y=t,e}var qo=["Sinusoidal","sinu"],es={init:Go,forward:Uo,inverse:zo,names:qo};function Do(){}function ko(e){for(var t=e.x,r=e.y,i=v(t-this.long0),s=r,a=Math.PI*Math.sin(r);;){var n=-(s+Math.sin(s)-a)/(1+Math.cos(s));if(s+=n,Math.abs(n)<y)break}s/=2,Math.PI/2-Math.abs(r)<y&&(i=0);var o=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=o,e.y=h,e}function jo(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=v(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 Vo=["Mollweide","moll"],rs={init:Do,forward:ko,inverse:jo,names:Vo};function Ho(){Math.abs(this.lat1+this.lat2)<y||(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=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=j(this.e,this.sinphi,this.cosphi),this.ml1=z(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<y?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=j(this.e,this.sinphi,this.cosphi),this.ml2=z(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=z(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Wo(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=z(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var a=this.ns*v(t-this.long0),n=this.x0+i*Math.sin(a),o=this.y0+this.rh-i*Math.cos(a);return e.x=n,e.y=o,e}function Jo(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 a=0;if(r!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=v(this.long0+a/this.ns),i=ot(this.g-r/this.a),e.x=s,e.y=i,e;var n=this.g-r/this.a;return i=Ft(n,this.e0,this.e1,this.e2,this.e3),s=v(this.long0+a/this.ns),e.x=s,e.y=i,e}var Xo=["Equidistant_Conic","eqdc"],is={init:Ho,forward:Wo,inverse:Jo,names:Xo};function Ko(){this.R=this.a}function $o(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a;Math.abs(r)<=y&&(s=this.x0+this.R*i,a=this.y0);var n=$(2*Math.abs(r/Math.PI));(Math.abs(i)<=y||Math.abs(Math.abs(r)-_)<=y)&&(s=this.x0,r>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*n):a=this.y0+Math.PI*this.R*-Math.tan(.5*n));var o=.5*Math.abs(Math.PI/i-i/Math.PI),h=o*o,f=Math.sin(n),u=Math.cos(n),c=u/(f+u-1),d=c*c,l=c*(2/f-1),m=l*l,p=Math.PI*this.R*(o*(c-m)+Math.sqrt(h*(c-m)*(c-m)-(m+h)*(d-m)))/(m+h);i<0&&(p=-p),s=this.x0+p;var b=h+c;return p=Math.PI*this.R*(l*b-o*Math.sqrt((m+h)*(h+1)-b*b))/(m+h),r>=0?a=this.y0+p:a=this.y0-p,e.x=s,e.y=a,e}function Zo(e){var t,r,i,s,a,n,o,h,f,u,c,d,l;return e.x-=this.x0,e.y-=this.y0,c=Math.PI*this.R,i=e.x/c,s=e.y/c,a=i*i+s*s,n=-Math.abs(s)*(1+a),o=n-2*s*s+i*i,h=-2*n+1+2*s*s+a*a,l=s*s/h+(2*o*o*o/h/h/h-9*n*o/h/h)/27,f=(n-o*o/3/h)/h,u=2*Math.sqrt(-f/3),c=3*l/f/u,Math.abs(c)>1&&(c>=0?c=1:c=-1),d=Math.acos(c)/3,e.y>=0?r=(-u*Math.cos(d+Math.PI/3)-o/3/h)*Math.PI:r=-(-u*Math.cos(d+Math.PI/3)-o/3/h)*Math.PI,Math.abs(i)<y?t=this.long0:t=v(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(i*i-s*s)+a*a))/2/i),e.x=t,e.y=r,e}var Qo=["Van_der_Grinten_I","VanDerGrinten","vandg"],ss={init:Ko,forward:$o,inverse:Zo,names:Qo};function Yo(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function th(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),a=v(t-this.long0),n,o,h,f,u,c,d,l,m,p,b,g,x,M,S,I,A,B,N,Y,q,it,pt;return this.sphere?Math.abs(this.sin_p12-1)<=y?(e.x=this.x0+this.a*(_-r)*Math.sin(a),e.y=this.y0-this.a*(_-r)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=y?(e.x=this.x0+this.a*(_+r)*Math.sin(a),e.y=this.y0+this.a*(_+r)*Math.cos(a),e):(B=this.sin_p12*i+this.cos_p12*s*Math.cos(a),I=Math.acos(B),A=I?I/Math.sin(I):1,e.x=this.x0+this.a*A*s*Math.sin(a),e.y=this.y0+this.a*A*(this.cos_p12*i-this.sin_p12*s*Math.cos(a)),e):(n=yt(this.es),o=vt(this.es),h=gt(this.es),f=Mt(this.es),Math.abs(this.sin_p12-1)<=y?(u=this.a*z(n,o,h,f,_),c=this.a*z(n,o,h,f,r),e.x=this.x0+(u-c)*Math.sin(a),e.y=this.y0-(u-c)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=y?(u=this.a*z(n,o,h,f,_),c=this.a*z(n,o,h,f,r),e.x=this.x0+(u+c)*Math.sin(a),e.y=this.y0+(u+c)*Math.cos(a),e):(d=i/s,l=xt(this.a,this.e,this.sin_p12),m=xt(this.a,this.e,i),p=Math.atan((1-this.es)*d+this.es*l*this.sin_p12/(m*s)),b=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(p)-this.sin_p12*Math.cos(a)),b===0?N=Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):Math.abs(Math.abs(b)-Math.PI)<=y?N=-Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):N=Math.asin(Math.sin(a)*Math.cos(p)/Math.sin(b)),g=this.e*this.sin_p12/Math.sqrt(1-this.es),x=this.e*this.cos_p12*Math.cos(b)/Math.sqrt(1-this.es),M=g*x,S=x*x,Y=N*N,q=Y*N,it=q*N,pt=it*N,I=l*N*(1-Y*S*(1-S)/6+q/8*M*(1-2*S)+it/120*(S*(4-7*S)-3*g*g*(1-7*S))-pt/48*M),e.x=this.x0+I*Math.sin(b),e.y=this.y0+I*Math.cos(b),e))}function eh(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,a,n,o,h,f,u,c,d,l,m,p,b,g,x,M,S,I,A,B,N;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*_*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),a=this.long0,Math.abs(t)<=y?n=this.lat0:(n=$(s*this.sin_p12+e.y*i*this.cos_p12/t),o=Math.abs(this.lat0)-_,Math.abs(o)<=y?this.lat0>=0?a=v(this.long0+Math.atan2(e.x,-e.y)):a=v(this.long0-Math.atan2(-e.x,e.y)):a=v(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=a,e.y=n,e)):(h=yt(this.es),f=vt(this.es),u=gt(this.es),c=Mt(this.es),Math.abs(this.sin_p12-1)<=y?(d=this.a*z(h,f,u,c,_),t=Math.sqrt(e.x*e.x+e.y*e.y),l=d-t,n=Ft(l/this.a,h,f,u,c),a=v(this.long0+Math.atan2(e.x,-1*e.y)),e.x=a,e.y=n,e):Math.abs(this.sin_p12+1)<=y?(d=this.a*z(h,f,u,c,_),t=Math.sqrt(e.x*e.x+e.y*e.y),l=t-d,n=Ft(l/this.a,h,f,u,c),a=v(this.long0+Math.atan2(e.x,e.y)),e.x=a,e.y=n,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),b=Math.atan2(e.x,e.y),m=xt(this.a,this.e,this.sin_p12),g=Math.cos(b),x=this.e*this.cos_p12*g,M=-x*x/(1-this.es),S=3*this.es*(1-M)*this.sin_p12*this.cos_p12*g/(1-this.es),I=t/m,A=I-M*(1+M)*Math.pow(I,3)/6-S*(1+3*M)*Math.pow(I,4)/24,B=1-M*A*A/2-I*A*A*A/6,p=Math.asin(this.sin_p12*Math.cos(A)+this.cos_p12*Math.sin(A)*g),a=v(this.long0+Math.asin(Math.sin(b)*Math.sin(A)/Math.cos(p))),N=Math.sin(p),n=Math.atan2((N-this.es*B*this.sin_p12)*Math.tan(p),N*(1-this.es)),e.x=a,e.y=n,e))}var rh=["Azimuthal_Equidistant","aeqd"],as={init:Yo,forward:th,inverse:eh,names:rh};function ih(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function sh(e){var t,r,i,s,a,n,o,h,f=e.x,u=e.y;return i=v(f-this.long0),t=Math.sin(u),r=Math.cos(u),s=Math.cos(i),n=this.sin_p14*t+this.cos_p14*r*s,a=1,(n>0||Math.abs(n)<=y)&&(o=this.a*a*r*Math.sin(i),h=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*r*s)),e.x=o,e.y=h,e}function ah(e){var t,r,i,s,a,n,o;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=$(t/this.a),i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=y?(o=this.lat0,e.x=n,e.y=o,e):(o=$(s*this.sin_p14+e.y*i*this.cos_p14/t),a=Math.abs(this.lat0)-_,Math.abs(a)<=y?(this.lat0>=0?n=v(this.long0+Math.atan2(e.x,-e.y)):n=v(this.long0-Math.atan2(-e.x,e.y)),e.x=n,e.y=o,e):(n=v(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=n,e.y=o,e))}var nh=["ortho"],ns={init:ih,forward:sh,inverse:ah,names:nh};var F={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},P={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function oh(){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>=_-E/2?this.face=F.TOP:this.lat0<=-(_-E/2)?this.face=F.BOTTOM:Math.abs(this.long0)<=E?this.face=F.FRONT:Math.abs(this.long0)<=_+E?this.face=this.long0>0?F.RIGHT:F.LEFT:this.face=F.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 hh(e){var t={x:0,y:0},r,i,s,a,n,o,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===F.TOP)a=_-r,i>=E&&i<=_+E?(h.value=P.AREA_0,s=i-_):i>_+E||i<=-(_+E)?(h.value=P.AREA_1,s=i>0?i-R:i+R):i>-(_+E)&&i<=-E?(h.value=P.AREA_2,s=i+_):(h.value=P.AREA_3,s=i);else if(this.face===F.BOTTOM)a=_+r,i>=E&&i<=_+E?(h.value=P.AREA_0,s=-i+_):i<E&&i>=-E?(h.value=P.AREA_1,s=-i):i<-E&&i>=-(_+E)?(h.value=P.AREA_2,s=-i-_):(h.value=P.AREA_3,s=i>0?-i+R:-i-R);else{var f,u,c,d,l,m,p;this.face===F.RIGHT?i=Ht(i,+_):this.face===F.BACK?i=Ht(i,+R):this.face===F.LEFT&&(i=Ht(i,-_)),d=Math.sin(r),l=Math.cos(r),m=Math.sin(i),p=Math.cos(i),f=l*p,u=l*m,c=d,this.face===F.FRONT?(a=Math.acos(f),s=ze(a,c,u,h)):this.face===F.RIGHT?(a=Math.acos(u),s=ze(a,c,-f,h)):this.face===F.BACK?(a=Math.acos(-f),s=ze(a,c,-u,h)):this.face===F.LEFT?(a=Math.acos(-u),s=ze(a,c,f,h)):(a=s=0,h.value=P.AREA_0)}return o=Math.atan(12/R*(s+Math.acos(Math.sin(s)*Math.cos(E))-_)),n=Math.sqrt((1-Math.cos(a))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===P.AREA_1?o+=_:h.value===P.AREA_2?o+=R:h.value===P.AREA_3&&(o+=1.5*R),t.x=n*Math.cos(o),t.y=n*Math.sin(o),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 fh(e){var t={lam:0,phi:0},r,i,s,a,n,o,h,f,u,c={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)?c.value=P.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(c.value=P.AREA_1,r-=_):e.x<0&&-e.x>=Math.abs(e.y)?(c.value=P.AREA_2,r=r<0?r+R:r-R):(c.value=P.AREA_3,r+=_),u=R/12*Math.tan(r),n=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),o=Math.atan(n),s=Math.cos(r),a=Math.tan(i),h=1-s*s*a*a*(1-Math.cos(Math.atan(1/Math.cos(o)))),h<-1?h=-1:h>1&&(h=1),this.face===F.TOP)f=Math.acos(h),t.phi=_-f,c.value===P.AREA_0?t.lam=o+_:c.value===P.AREA_1?t.lam=o<0?o+R:o-R:c.value===P.AREA_2?t.lam=o-_:t.lam=o;else if(this.face===F.BOTTOM)f=Math.acos(h),t.phi=f-_,c.value===P.AREA_0?t.lam=-o+_:c.value===P.AREA_1?t.lam=-o:c.value===P.AREA_2?t.lam=-o-_:t.lam=o<0?-o-R:-o+R;else{var d,l,m;d=h,u=d*d,u>=1?m=0:m=Math.sqrt(1-u)*Math.sin(o),u+=m*m,u>=1?l=0:l=Math.sqrt(1-u),c.value===P.AREA_1?(u=l,l=-m,m=u):c.value===P.AREA_2?(l=-l,m=-m):c.value===P.AREA_3&&(u=l,l=m,m=-u),this.face===F.RIGHT?(u=d,d=-l,l=u):this.face===F.BACK?(d=-d,l=-l):this.face===F.LEFT&&(u=d,d=l,l=-u),t.phi=Math.acos(-m)-_,t.lam=Math.atan2(l,d),this.face===F.RIGHT?t.lam=Ht(t.lam,-_):this.face===F.BACK?t.lam=Ht(t.lam,-R):this.face===F.LEFT&&(t.lam=Ht(t.lam,+_))}if(this.es!==0){var p,b,g;p=t.phi<0?1:0,b=Math.tan(t.phi),g=this.b/Math.sqrt(b*b+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-g*g)/(this.one_minus_f*g)),p&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function ze(e,t,r,i){var s;return e<y?(i.value=P.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=E?i.value=P.AREA_0:s>E&&s<=_+E?(i.value=P.AREA_1,s-=_):s>_+E||s<=-(_+E)?(i.value=P.AREA_2,s=s>=0?s-R:s+R):(i.value=P.AREA_3,s+=_)),s}function Ht(e,t){var r=e+t;return r<-R?r+=ne:r>+R&&(r-=ne),r}var lh=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],os={init:oh,forward:hh,inverse:fh,names:lh};var yr=[[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]],de=[[-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]],hs=.8487,fs=1.3523,ls=nt/5,ch=1/ls,Wt=18,qe=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},uh=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function dh(e,t,r,i){for(var s=t;i;--i){var a=e(s);if(s-=a,Math.abs(a)<r)break}return s}function mh(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function ph(e){var t=v(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*ls);i<0?i=0:i>=Wt&&(i=Wt-1),r=nt*(r-ch*i);var s={x:qe(yr[i],r)*t,y:qe(de[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*hs+this.x0,s.y=s.y*this.a*fs+this.y0,s}function _h(e){var t={x:(e.x-this.x0)/(this.a*hs),y:Math.abs(e.y-this.y0)/(this.a*fs)};if(t.y>=1)t.x/=yr[Wt][0],t.y=e.y<0?-_:_;else{var r=Math.floor(t.y*Wt);for(r<0?r=0:r>=Wt&&(r=Wt-1);;)if(de[r][0]>t.y)--r;else if(de[r+1][0]<=t.y)++r;else break;var i=de[r],s=5*(t.y-i[0])/(de[r+1][0]-i[0]);s=dh(function(a){return(qe(i,a)-t.y)/uh(i,a)},s,y,100),t.x/=qe(yr[r],s),t.y=(5*r+s)*G,e.y<0&&(t.y=-t.y)}return t.x=v(t.x+this.long0),t}var bh=["Robinson","robin"],cs={init:mh,forward:ph,inverse:_h,names:bh};function yh(){this.name="geocent"}function vh(e){var t=Ne(e,this.es,this.a);return t}function gh(e){var t=Oe(e,this.es,this.a,this.b);return t}var Mh=["Geocentric","geocentric","geocent","Geocent"],us={init:yh,forward:vh,inverse:gh,names:Mh};function ds(e){e.Proj.projections.add(Ri),e.Proj.projections.add(Vt),e.Proj.projections.add(Gi),e.Proj.projections.add(Ui),e.Proj.projections.add(zi),e.Proj.projections.add(qi),e.Proj.projections.add(Di),e.Proj.projections.add(ki),e.Proj.projections.add(ji),e.Proj.projections.add(Vi),e.Proj.projections.add(Hi),e.Proj.projections.add(Wi),e.Proj.projections.add(Ji),e.Proj.projections.add(Ki),e.Proj.projections.add($i),e.Proj.projections.add(Qi),e.Proj.projections.add(Yi),e.Proj.projections.add(ts),e.Proj.projections.add(es),e.Proj.projections.add(rs),e.Proj.projections.add(is),e.Proj.projections.add(ss),e.Proj.projections.add(as),e.Proj.projections.add(ns),e.Proj.projections.add(os),e.Proj.projections.add(cs),e.Proj.projections.add(us)}Q.defaultDatum="WGS84";Q.Proj=wt;Q.WGS84=new Q.Proj("WGS84");Q.Point=Si;Q.toPoint=Fe;Q.defs=qt;Q.transform=Ot;Q.mgrs=Ii;Q.version="__VERSION__";ds(Q);var vr=Q;var Jt=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);vr.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=vr(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)}};function De(e,t){for(let r of e)r.geometry.coordinates=ms(r.geometry.coordinates,t);return e}function ms(e,t){return xh(e)?t(e):e.map(r=>ms(r,t))}function xh(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var dt=new Int32Array(2),ke=new Float32Array(dt.buffer),je=new Float64Array(dt.buffer),Xt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var me;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(me||(me={}));var W=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new W(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 dt[0]=this.readInt32(t),ke[0]}readFloat64(t){return dt[Xt?0:1]=this.readInt32(t),dt[Xt?1:0]=this.readInt32(t+4),je[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){ke[0]=r,this.writeInt32(t,dt[0])}writeFloat64(t,r){je[0]=r,this.writeInt32(t,dt[Xt?0:1]),this.writeInt32(t+4,dt[Xt?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===me.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 a=t(s);a!==null&&i.push(a)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let a=t(s);a!==null&&i.push(a.unpack())}return i}};function gr(e,t){if(e===null)return null;switch(t){case GeometryType.Point:case GeometryType.MultiPoint:return Ih(e);case GeometryType.LineString:case GeometryType.MultiLineString:return Ah(e);case GeometryType.Polygon:return _s(e);case GeometryType.MultiPolygon:return Eh(e);default:throw new Error(`Unimplemented geometry type: ${t}`)}}function Ih(e){let t=e.xyArray(),r=e.zArray();return{positions:Mr(t,r)}}function Ah(e){let t=e.xyArray(),r=e.zArray(),i=Mr(t,r),s=e.endsArray()&&Array.from(e.endsArray())||[t.length/2];s.unshift(0);let a={value:new Uint16Array(s),size:1};return{positions:i,pathIndices:a}}function _s(e){let t=e.xyArray(),r=e.zArray(),i=Mr(t,r),s=e.endsArray()&&Array.from(e.endsArray())||[t.length/2];s.unshift(0);let a={value:new Uint16Array(s),size:1},n={value:new Uint16Array([0,t.length/2]),size:1};return{positions:i,primitivePolygonIndices:a,polygonIndices:n}}function Eh(e){let t=[],r=0,i=1,s=1;for(let d=0;d<e.partsLength();d++){let l=e.parts(d),m=_s(l);r+=m.positions.value.length,i+=m.primitivePolygonIndices.value.length-1,s+=m.polygonIndices.value.length-1,t.push(m)}let a=new Float64Array(r),n=new Uint32Array(i),o=new Uint32Array(s),h=0,f=1,u=1,c=t[0].positions.size;for(let d of t)a.set(d.positions.value,h*c),n.set(d.primitivePolygonIndices.value.subarray(1).map(l=>l+h),f),o.set(d.polygonIndices.value.subarray(1).map(l=>l+h),u),h+=d.positions.value.length/c,f+=d.primitivePolygonIndices.value.length-1,u+=d.polygonIndices.value.length-1;return{positions:{value:a,size:c},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function Mr(e,t){if(!t)return{value:e,size:2};if(t.length*2!==e.length)throw new Error("Z array must be half XY array's length");let r=e.length+t.length,i=new Float64Array(r);for(let s=0;s<e.length/2;s++)i[s*3+0]=e[s*2+0],i[s*3+1]=e[s*2+1],i[s*3+2]=t[s];return{value:i,size:3}}function bs(e){let t={title:e.title||"",description:e.description||"",crs:JSON.stringify(e.crs)||"",metadata:e.metadata||"",geometryType:String(e.geometryType),indexNodeSize:String(e.indexNodeSize),featureCount:String(e.featuresCount),bounds:e.envelope?.join(",")||""},r=e.columns?.map(i=>Sh(i))||[];return{metadata:t,fields:r}}function Sh(e){let t={title:e.title||"",description:e.description||"",width:String(e.width),precision:String(e.precision),scale:String(e.scale),unique:String(e.unique),primary_key:String(e.primary_key)};return{name:e.name,type:Ph(e.type),nullable:e.nullable,metadata:t}}var k;(function(e){e[e.Byte=0]="Byte",e[e.UByte=1]="UByte",e[e.Bool=2]="Bool",e[e.Short=3]="Short",e[e.UShort=4]="UShort",e[e.Int=5]="Int",e[e.UInt=6]="UInt",e[e.Long=7]="Long",e[e.ULong=8]="ULong",e[e.Float=9]="Float",e[e.Double=10]="Double",e[e.String=11]="String",e[e.Json=12]="Json",e[e.DateTime=13]="DateTime",e[e.Binary=14]="Binary"})(k||(k={}));function Ph(e){switch(e){case k.Byte:return"int8";case k.UByte:return"uint8";case k.Bool:return"bool";case k.Short:return"int16";case k.UShort:return"uint16";case k.Int:return"int32";case k.UInt:return"uint32";case k.Long:return"int64";case k.ULong:return"uint64";case k.Float:return"float32";case k.Double:return"float64";case k.String:return"utf8";case k.Json:return"null";case k.DateTime:return"date-millisecond";case k.Binary:return"binary";default:return"null"}}var C;(function(e){e[e.Unknown=0]="Unknown",e[e.Point=1]="Point",e[e.LineString=2]="LineString",e[e.Polygon=3]="Polygon",e[e.MultiPoint=4]="MultiPoint",e[e.MultiLineString=5]="MultiLineString",e[e.MultiPolygon=6]="MultiPolygon",e[e.GeometryCollection=7]="GeometryCollection",e[e.CircularString=8]="CircularString",e[e.CompoundCurve=9]="CompoundCurve",e[e.CurvePolygon=10]="CurvePolygon",e[e.MultiCurve=11]="MultiCurve",e[e.MultiSurface=12]="MultiSurface",e[e.Curve=13]="Curve",e[e.Surface=14]="Surface",e[e.PolyhedralSurface=15]="PolyhedralSurface",e[e.TIN=16]="TIN",e[e.Triangle=17]="Triangle"})(C||(C={}));var D=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsGeometry(t,r){return(r||new D).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGeometry(t,r){return t.setPosition(t.position()+4),(r||new D).__init(t.readInt32(t.position())+t.position(),t)}ends(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.readUint32(this.bb.__vector(this.bb_pos+r)+t*4):0}endsLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}xyLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}zLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){let t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}mLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){let t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}tLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.readUint64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}tmLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):C.Unknown}parts(t,r){let i=this.bb.__offset(this.bb_pos,18);return i?(r||new D).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}partsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGeometry(t){t.startObject(8)}static addEnds(t,r){t.addFieldOffset(0,r,0)}static createEndsVector(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 startEndsVector(t,r){t.startVector(4,r,4)}static addXy(t,r){t.addFieldOffset(1,r,0)}static createXyVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startXyVector(t,r){t.startVector(8,r,8)}static addZ(t,r){t.addFieldOffset(2,r,0)}static createZVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startZVector(t,r){t.startVector(8,r,8)}static addM(t,r){t.addFieldOffset(3,r,0)}static createMVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startMVector(t,r){t.startVector(8,r,8)}static addT(t,r){t.addFieldOffset(4,r,0)}static createTVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startTVector(t,r){t.startVector(8,r,8)}static addTm(t,r){t.addFieldOffset(5,r,0)}static createTmVector(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 startTmVector(t,r){t.startVector(8,r,8)}static addType(t,r){t.addFieldInt8(6,r,C.Unknown)}static addParts(t,r){t.addFieldOffset(7,r,0)}static createPartsVector(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 startPartsVector(t,r){t.startVector(4,r,4)}static endGeometry(t){return t.endObject()}static createGeometry(t,r,i,s,a,n,o,h,f){return D.startGeometry(t),D.addEnds(t,r),D.addXy(t,i),D.addZ(t,s),D.addM(t,a),D.addT(t,n),D.addTm(t,o),D.addType(t,h),D.addParts(t,f),D.endGeometry(t)}};function Ve(e,t){let r=[];for(let i=0;i<e.length;i+=2){let s=[e[i],e[i+1]];t&&s.push(t[i>>1]),r.push(s)}return r}function ys(e,t,r){if(!r||r.length===0)return[Ve(e,t)];let i=0,s=Array.from(r).map(n=>e.slice(i,i=n<<1)),a;return t&&(i=0,a=Array.from(r).map(n=>t.slice(i,i=n))),s.map((n,o)=>Ve(n,a?a[o]:void 0))}function Nh(e,t){let r=e.xyArray(),i=e.zArray();switch(t){case C.Point:{let s=Array.from(r);return i&&s.push(i[0]),s}case C.MultiPoint:case C.LineString:return Ve(r,i);case C.MultiLineString:return ys(r,i,e.endsArray());case C.Polygon:return ys(r,i,e.endsArray())}}function He(e,t){let r=t;if(r===C.Unknown&&(r=e.type()),r===C.GeometryCollection){let s=[];for(let a=0;a<e.partsLength();a++){let n=e.parts(a),o=n.type();s.push(He(n,o))}return{type:C[r],geometries:s}}else if(r===C.MultiPolygon){let s=[];for(let a=0;a<e.partsLength();a++)s.push(He(e.parts(a),C.Polygon));return{type:C[r],coordinates:s.map(a=>a.coordinates)}}let i=Nh(e,r);return{type:C[r],coordinates:i}}var L;(function(e){e[e.Byte=0]="Byte",e[e.UByte=1]="UByte",e[e.Bool=2]="Bool",e[e.Short=3]="Short",e[e.UShort=4]="UShort",e[e.Int=5]="Int",e[e.UInt=6]="UInt",e[e.Long=7]="Long",e[e.ULong=8]="ULong",e[e.Float=9]="Float",e[e.Double=10]="Double",e[e.String=11]="String",e[e.Json=12]="Json",e[e.DateTime=13]="DateTime",e[e.Binary=14]="Binary"})(L||(L={}));var T=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsColumn(t,r){return(r||new T).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsColumn(t,r){return t.setPosition(t.position()+4),(r||new T).__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}type(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):L.Byte}title(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__string(this.bb_pos+r,t):null}width(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){let t=this.bb.__offset(this.bb_pos,18);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!0}unique(){let t=this.bb.__offset(this.bb_pos,20);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}primaryKey(){let t=this.bb.__offset(this.bb_pos,22);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}metadata(t){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb_pos+r,t):null}static startColumn(t){t.startObject(11)}static addName(t,r){t.addFieldOffset(0,r,0)}static addType(t,r){t.addFieldInt8(1,r,L.Byte)}static addTitle(t,r){t.addFieldOffset(2,r,0)}static addDescription(t,r){t.addFieldOffset(3,r,0)}static addWidth(t,r){t.addFieldInt32(4,r,-1)}static addPrecision(t,r){t.addFieldInt32(5,r,-1)}static addScale(t,r){t.addFieldInt32(6,r,-1)}static addNullable(t,r){t.addFieldInt8(7,Number(r),Number(!0))}static addUnique(t,r){t.addFieldInt8(8,Number(r),Number(!1))}static addPrimaryKey(t,r){t.addFieldInt8(9,Number(r),Number(!1))}static addMetadata(t,r){t.addFieldOffset(10,r,0)}static endColumn(t){let r=t.endObject();return t.requiredField(r,4),r}static createColumn(t,r,i,s,a,n,o,h,f,u,c,d){return T.startColumn(t),T.addName(t,r),T.addType(t,i),T.addTitle(t,s),T.addDescription(t,a),T.addWidth(t,n),T.addPrecision(t,o),T.addScale(t,h),T.addNullable(t,f),T.addUnique(t,u),T.addPrimaryKey(t,c),T.addMetadata(t,d),T.endColumn(t)}};var J=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFeature(t,r){return(r||new J).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFeature(t,r){return t.setPosition(t.position()+4),(r||new J).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){let r=this.bb.__offset(this.bb_pos,4);return r?(t||new D).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}properties(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readUint8(this.bb.__vector(this.bb_pos+r)+t):0}propertiesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFeature(t){t.startObject(3)}static addGeometry(t,r){t.addFieldOffset(0,r,0)}static addProperties(t,r){t.addFieldOffset(1,r,0)}static createPropertiesVector(t,r){t.startVector(1,r.length,1);for(let i=r.length-1;i>=0;i--)t.addInt8(r[i]);return t.endVector()}static startPropertiesVector(t,r){t.startVector(1,r,1)}static addColumns(t,r){t.addFieldOffset(2,r,0)}static createColumnsVector(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 startColumnsVector(t,r){t.startVector(4,r,4)}static endFeature(t){return t.endObject()}static finishFeatureBuffer(t,r){t.finish(r)}static finishSizePrefixedFeatureBuffer(t,r){t.finish(r,void 0,!0)}static createFeature(t,r,i,s){return J.startFeature(t),J.addGeometry(t,r),J.addProperties(t,i),J.addColumns(t,s),J.endFeature(t)}};var Om=new TextEncoder,vs=new TextDecoder;function We(e,t){let r={};if(!t||t.length===0)return r;let i=e.propertiesArray();if(!i)return r;let s=new DataView(i.buffer,i.byteOffset),a=e.propertiesLength(),n=0;for(;n<a;){let o=s.getUint16(n,!0);n+=2;let h=t[o],f=h.name;switch(h.type){case L.Bool:{r[f]=Boolean(s.getUint8(n)),n+=1;break}case L.Byte:{r[f]=s.getInt8(n),n+=1;break}case L.UByte:{r[f]=s.getUint8(n),n+=1;break}case L.Short:{r[f]=s.getInt16(n,!0),n+=2;break}case L.UShort:{r[f]=s.getUint16(n,!0),n+=2;break}case L.Int:{r[f]=s.getInt32(n,!0),n+=4;break}case L.UInt:{r[f]=s.getUint32(n,!0),n+=4;break}case L.Long:{r[f]=Number(s.getBigInt64(n,!0)),n+=8;break}case L.ULong:{r[f]=Number(s.getBigUint64(n,!0)),n+=8;break}case L.Float:{r[f]=s.getFloat32(n,!0),n+=4;break}case L.Double:{r[f]=s.getFloat64(n,!0),n+=8;break}case L.DateTime:case L.String:{let u=s.getUint32(n,!0);n+=4,r[f]=vs.decode(i.subarray(n,n+u)),n+=u;break}case L.Json:{let u=s.getUint32(n,!0);n+=4;let c=vs.decode(i.subarray(n,n+u));r[f]=JSON.parse(c),n+=u;break}default:throw new Error(`Unknown type ${h.type}`)}}return r}function Je(e,t){let r=t.columns;return{type:"Feature",geometry:He(e.geometry(),t.geometryType),properties:We(e,r)}}var Kt=new Uint8Array(0);function gs(){return this._source.cancel()}function xr(e,t){if(!e.length)return t;if(!t.length)return e;var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Ms(){var e=this,t=e._array.subarray(e._index);return e._source.read().then(function(r){return e._array=Kt,e._index=0,r.done?t.length>0?{done:!1,value:t}:{done:!0,value:void 0}:{done:!1,value:xr(t,r.value)}})}function xs(e){if((e|=0)<0)throw new Error("invalid length");var t=this,r=this._array.length-this._index;if(this._index+e<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=e));var i=new Uint8Array(e);return i.set(this._array.subarray(this._index)),function s(){return t._source.read().then(function(a){return a.done?(t._array=Kt,t._index=0,r>0?i.subarray(0,r):null):r+a.value.length>=e?(t._array=a.value,t._index=e-r,i.set(a.value.subarray(0,e-r),r),i):(i.set(a.value,r),r+=a.value.length,s())})}()}function wr(e){return typeof e.slice=="function"?e:new Xe(typeof e.read=="function"?e:e.getReader())}function Xe(e){this._source=e,this._array=Kt,this._index=0}Xe.prototype.read=Ms;Xe.prototype.slice=xs;Xe.prototype.cancel=gs;var X=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsCrs(t,r){return(r||new X).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsCrs(t,r){return t.setPosition(t.position()+4),(r||new X).__init(t.readInt32(t.position())+t.position(),t)}org(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}code(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__string(this.bb_pos+r,t):null}wkt(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.__string(this.bb_pos+r,t):null}codeString(t){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb_pos+r,t):null}static startCrs(t){t.startObject(6)}static addOrg(t,r){t.addFieldOffset(0,r,0)}static addCode(t,r){t.addFieldInt32(1,r,0)}static addName(t,r){t.addFieldOffset(2,r,0)}static addDescription(t,r){t.addFieldOffset(3,r,0)}static addWkt(t,r){t.addFieldOffset(4,r,0)}static addCodeString(t,r){t.addFieldOffset(5,r,0)}static endCrs(t){return t.endObject()}static createCrs(t,r,i,s,a,n,o){return X.startCrs(t),X.addOrg(t,r),X.addCode(t,i),X.addName(t,s),X.addDescription(t,a),X.addWkt(t,n),X.addCodeString(t,o),X.endCrs(t)}};var Lt=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsHeader(t,r){return(r||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsHeader(t,r){return t.setPosition(t.position()+4),(r||new Lt).__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}envelope(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}envelopeLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):C.Unknown}hasZ(){let t=this.bb.__offset(this.bb_pos,10);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasM(){let t=this.bb.__offset(this.bb_pos,12);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasT(){let t=this.bb.__offset(this.bb_pos,14);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasTm(){let t=this.bb.__offset(this.bb_pos,16);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}columns(t,r){let i=this.bb.__offset(this.bb_pos,18);return i?(r||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt("0")}indexNodeSize(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){let r=this.bb.__offset(this.bb_pos,24);return r?(t||new X).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}title(t){let r=this.bb.__offset(this.bb_pos,26);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb_pos+r,t):null}metadata(t){let r=this.bb.__offset(this.bb_pos,30);return r?this.bb.__string(this.bb_pos+r,t):null}static startHeader(t){t.startObject(14)}static addName(t,r){t.addFieldOffset(0,r,0)}static addEnvelope(t,r){t.addFieldOffset(1,r,0)}static createEnvelopeVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startEnvelopeVector(t,r){t.startVector(8,r,8)}static addGeometryType(t,r){t.addFieldInt8(2,r,C.Unknown)}static addHasZ(t,r){t.addFieldInt8(3,Number(r),Number(!1))}static addHasM(t,r){t.addFieldInt8(4,Number(r),Number(!1))}static addHasT(t,r){t.addFieldInt8(5,Number(r),Number(!1))}static addHasTm(t,r){t.addFieldInt8(6,Number(r),Number(!1))}static addColumns(t,r){t.addFieldOffset(7,r,0)}static createColumnsVector(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 startColumnsVector(t,r){t.startVector(4,r,4)}static addFeaturesCount(t,r){t.addFieldInt64(8,r,BigInt("0"))}static addIndexNodeSize(t,r){t.addFieldInt16(9,r,16)}static addCrs(t,r){t.addFieldOffset(10,r,0)}static addTitle(t,r){t.addFieldOffset(11,r,0)}static addDescription(t,r){t.addFieldOffset(12,r,0)}static addMetadata(t,r){t.addFieldOffset(13,r,0)}static endHeader(t){return t.endObject()}static finishHeaderBuffer(t,r){t.finish(r)}static finishSizePrefixedHeaderBuffer(t,r){t.finish(r,void 0,!0)}};function pe(e){let t=Lt.getRootAsHeader(e),r=t.featuresCount(),i=t.indexNodeSize(),s=[];for(let h=0;h<t.columnsLength();h++){let f=t.columns(h);if(!f)throw new Error("Column unexpectedly missing");if(!f.name())throw new Error("Column name unexpectedly missing");s.push({name:f.name(),type:f.type(),title:f.title(),description:f.description(),width:f.width(),precision:f.precision(),scale:f.scale(),nullable:f.nullable(),unique:f.unique(),primary_key:f.primaryKey()})}let a=t.crs(),n=a?{org:a.org(),code:a.code(),name:a.name(),description:a.description(),wkt:a.wkt(),code_string:a.codeString()}:null;return{geometryType:t.geometryType(),columns:s,envelope:null,featuresCount:Number(r),indexNodeSize:i,crs:n,title:t.title(),description:t.description(),metadata:t.metadata()}}var Ar=function(e,t){return Ar=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},Ar(e,t)};function Oh(e,t){Ar(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Zt(e,t,r,i){function s(a){return a instanceof r?a:new r(function(n){n(a)})}return new(r||(r=Promise))(function(a,n){function o(u){try{f(i.next(u))}catch(c){n(c)}}function h(u){try{f(i.throw(u))}catch(c){n(c)}}function f(u){u.done?a(u.value):s(u.value).then(o,h)}f((i=i.apply(e,t||[])).next())})}function At(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,s,a,n;return n={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function o(f){return function(u){return h([f,u])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,s&&(a=f[0]&2?s.return:f[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,f[1])).done)return a;switch(s=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(u){f=[6,u],s=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Qt(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 be(e){return this instanceof be?(this.v=e,this):new be(e)}function Rh(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,a=[];return s={},n("next"),n("throw"),n("return"),s[Symbol.asyncIterator]=function(){return this},s;function n(d){i[d]&&(s[d]=function(l){return new Promise(function(m,p){a.push([d,l,m,p])>1||o(d,l)})})}function o(d,l){try{h(i[d](l))}catch(m){c(a[0][3],m)}}function h(d){d.value instanceof be?Promise.resolve(d.value.v).then(f,u):c(a[0][2],d)}function f(d){o("next",d)}function u(d){o("throw",d)}function c(d,l){d(l),a.shift(),a.length&&o(a[0][0],a[0][1])}}var As=function(e){Oh(t,e);function t(r){var i=e.call(this,r)||this;return Object.defineProperty(i,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(i,i.constructor.prototype):i.__proto__=i.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(i,i.constructor),i}return t}(Error),ep=function(){function e(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),e.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}(),rp=function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}(),ip=function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){this._q.length<this._c&&this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}();function Er(e){e!=null&&typeof e.then=="function"&&e.then(Qe,Qe)}var Ir=0,ws=1,Gt=2,$e=3,Sr=4,Ze=1024,Qe=function(){};function $t(e){var t=e.err,r=Promise.resolve(e.execution).then(function(i){if(t!=null)throw t;return i});return e.err=void 0,e.execution=r.then(function(){},function(){}),e.pending===void 0?r:e.pending.then(function(){return r})}function Bt(e,t){var r=e.state>=$e;return Promise.resolve(t).then(function(i){return!r&&e.state>=Sr?$t(e).then(function(s){return{value:s,done:!0}}):{value:i,done:r}})}function Pr(e,t){var r,i;if(!(e.state>=Gt))if(e.state=Gt,e.onnext(),e.onstop(),e.err==null&&(e.err=t),e.pushes.length===0&&(typeof e.buffer>"u"||e.buffer.empty))_e(e);else try{for(var s=Qt(e.pushes),a=s.next();!a.done;a=s.next()){var n=a.value;n.resolve()}}catch(o){r={error:o}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}function _e(e){var t,r;if(!(e.state>=$e)){e.state<Gt&&Pr(e),e.state=$e,e.buffer=void 0;try{for(var i=Qt(e.nexts),s=i.next();!s.done;s=i.next()){var a=s.value,n=e.pending===void 0?$t(e):e.pending.then(function(){return $t(e)});a.resolve(Bt(e,n))}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.pushes=[],e.nexts=[]}}function Is(e){e.state>=Sr||(e.state<$e&&_e(e),e.state=Sr)}function Fh(e,t){if(Er(t),e.pushes.length>=Ze)throw new As("No more than "+Ze+" pending calls to push are allowed on a single repeater.");if(e.state>=Gt)return Promise.resolve(void 0);var r=e.pending===void 0?Promise.resolve(t):e.pending.then(function(){return t});r=r.catch(function(h){e.state<Gt&&(e.err=h),Is(e)});var i;if(e.nexts.length){var s=e.nexts.shift();s.resolve(Bt(e,r)),e.nexts.length?i=Promise.resolve(e.nexts[0].value):i=new Promise(function(h){return e.onnext=h})}else typeof e.buffer<"u"&&!e.buffer.full?(e.buffer.add(r),i=Promise.resolve(void 0)):i=new Promise(function(h){return e.pushes.push({resolve:h,value:r})});var a=!0,n={},o=i.catch(function(h){if(a)throw h});return n.then=function(h,f){return a=!1,Promise.prototype.then.call(i,h,f)},n.catch=function(h){return a=!1,Promise.prototype.catch.call(i,h)},n.finally=i.finally.bind(i),e.pending=r.then(function(){return o}).catch(function(h){e.err=h,Is(e)}),n}function Th(e){var t=Pr.bind(null,e),r=new Promise(function(i){return e.onstop=i});return t.then=r.then.bind(r),t.catch=r.catch.bind(r),t.finally=r.finally.bind(r),t}function Ch(e){if(!(e.state>=ws)){e.state=ws;var t=Fh.bind(null,e),r=Th(e);e.execution=new Promise(function(i){return i(e.executor(t,r))}),e.execution.catch(function(){return Pr(e)})}}var Ke=new WeakMap,Yt=function(){function e(t,r){Ke.set(this,{executor:t,buffer:r,err:void 0,state:Ir,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:Qe,onstop:Qe})}return e.prototype.next=function(t){Er(t);var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=Ze)throw new As("No more than "+Ze+" pending calls to next are allowed on a single repeater.");if(r.state<=Ir&&Ch(r),r.onnext(t),typeof r.buffer<"u"&&!r.buffer.empty){var i=Bt(r,r.buffer.remove());if(r.pushes.length){var s=r.pushes.shift();r.buffer.add(s.value),r.onnext=s.resolve}return i}else if(r.pushes.length){var a=r.pushes.shift();return r.onnext=a.resolve,Bt(r,a.value)}else if(r.state>=Gt)return _e(r),Bt(r,$t(r));return new Promise(function(n){return r.nexts.push({resolve:n,value:t})})},e.prototype.return=function(t){Er(t);var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");return _e(r),r.execution=Promise.resolve(r.execution).then(function(){return t}),Bt(r,$t(r))},e.prototype.throw=function(t){var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=Ir||r.state>=Gt||typeof r.buffer<"u"&&!r.buffer.empty?(_e(r),r.err==null&&(r.err=t),Bt(r,$t(r))):this.next(Promise.reject(t))},e.prototype[Symbol.asyncIterator]=function(){return this},e.race=Lh,e.merge=Bh,e.zip=Gh,e.latest=Uh,e}();function Ye(e,t){var r,i,s=[],a=function(f){f!=null&&typeof f[Symbol.asyncIterator]=="function"?s.push(f[Symbol.asyncIterator]()):f!=null&&typeof f[Symbol.iterator]=="function"?s.push(f[Symbol.iterator]()):s.push(function(){return Rh(this,arguments,function(){return At(this,function(d){switch(d.label){case 0:return t.yieldValues?[4,be(f)]:[3,3];case 1:return[4,d.sent()];case 2:d.sent(),d.label=3;case 3:return t.returnValues?[4,be(f)]:[3,5];case 4:return[2,d.sent()];case 5:return[2]}})})}())};try{for(var n=Qt(e),o=n.next();!o.done;o=n.next()){var h=o.value;a(h)}}catch(f){r={error:f}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return s}function Lh(e){var t=this,r=Ye(e,{returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h,f,u;return At(this,function(c){switch(c.label){case 0:if(!r.length)return s(),[2];n=!1,s.then(function(){a(),n=!0}),c.label=1;case 1:c.trys.push([1,,5,7]),h=void 0,f=0,u=function(){var d,l,m,p,b,g;return At(this,function(x){switch(x.label){case 0:d=f;try{for(l=(b=void 0,Qt(r)),m=l.next();!m.done;m=l.next())p=m.value,Promise.resolve(p.next()).then(function(M){M.done?(s(),o===void 0&&(o=M)):f===d&&(f++,a(M))},function(M){return s(M)})}catch(M){b={error:M}}finally{try{m&&!m.done&&(g=l.return)&&g.call(l)}finally{if(b)throw b.error}}return[4,new Promise(function(M){return a=M})];case 1:return h=x.sent(),h===void 0?[3,3]:[4,i(h.value)];case 2:x.sent(),x.label=3;case 3:return[2]}})},c.label=2;case 2:return n?[3,4]:[5,u()];case 3:return c.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return s(),[4,Promise.race(r.map(function(d){return d.return&&d.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}function Bh(e){var t=this,r=Ye(e,{yieldValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h=this;return At(this,function(f){switch(f.label){case 0:if(!r.length)return s(),[2];a=[],n=!1,s.then(function(){var u,c;n=!0;try{for(var d=Qt(a),l=d.next();!l.done;l=d.next()){var m=l.value;m()}}catch(p){u={error:p}}finally{try{l&&!l.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(r.map(function(u,c){return Zt(h,void 0,void 0,function(){var d,l;return At(this,function(m){switch(m.label){case 0:m.trys.push([0,,6,9]),m.label=1;case 1:return n?[3,5]:(Promise.resolve(u.next()).then(function(p){return a[c](p)},function(p){return s(p)}),[4,new Promise(function(p){a[c]=p})]);case 2:return d=m.sent(),d===void 0?[3,4]:d.done?(o=d,[2]):[4,i(d.value)];case 3:m.sent(),m.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return l=u.return,l?[4,u.return()]:[3,8];case 7:l=m.sent(),m.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return f.sent(),[2,o&&o.value];case 3:return s(),[7];case 4:return[2]}})})})}function Gh(e){var t=this,r=Ye(e,{returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h;return At(this,function(f){switch(f.label){case 0:if(!r.length)return s(),[2,[]];n=!1,s.then(function(){a(),n=!0}),f.label=1;case 1:f.trys.push([1,,6,8]),f.label=2;case 2:return n?[3,5]:(Promise.all(r.map(function(u){return u.next()})).then(function(u){return a(u)},function(u){return s(u)}),[4,new Promise(function(u){return a=u})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(u){return u.value}),o.some(function(u){return u.done})?[2,h]:[4,i(h)]);case 4:return f.sent(),[3,2];case 5:return[3,8];case 6:return s(),[4,Promise.all(r.map(function(u){return u.return&&u.return()}))];case 7:return f.sent(),[7];case 8:return[2]}})})})}function Uh(e){var t=this,r=Ye(e,{yieldValues:!0,returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h,f,u=this;return At(this,function(c){switch(c.label){case 0:if(!r.length)return s(),[2,[]];n=[],o=!1,s.then(function(){var d,l;a();try{for(var m=Qt(n),p=m.next();!p.done;p=m.next()){var b=p.value;b()}}catch(g){d={error:g}}finally{try{p&&!p.done&&(l=m.return)&&l.call(m)}finally{if(d)throw d.error}}o=!0}),c.label=1;case 1:return c.trys.push([1,,5,7]),Promise.all(r.map(function(d){return d.next()})).then(function(d){return a(d)},function(d){return s(d)}),[4,new Promise(function(d){return a=d})];case 2:return h=c.sent(),h===void 0?[2]:(f=h.map(function(d){return d.value}),h.every(function(d){return d.done})?[2,f]:[4,i(f.slice())]);case 3:return c.sent(),[4,Promise.all(r.map(function(d,l){return Zt(u,void 0,void 0,function(){var m;return At(this,function(p){switch(p.label){case 0:if(h[l].done)return[2,h[l].value];p.label=1;case 1:return o?[3,4]:(Promise.resolve(d.next()).then(function(b){return n[l](b)},function(b){return s(b)}),[4,new Promise(function(b){return n[l]=b})]);case 2:return m=p.sent(),m===void 0?[2,h[l].value]:m.done?[2,m.value]:(f[l]=m.value,[4,i(f.slice())]);case 3:return p.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,c.sent()];case 5:return s(),[4,Promise.all(r.map(function(d){return d.return&&d.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}var Nr=class{_extraRequestThreshold=256*1024;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(t){if(t<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=t}},Et=Nr;Ut(Et,"global",new Nr);var lt;(function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error"})(lt||(lt={}));var O=class{static debug(...t){this.log(lt.Debug,...t)}static info(...t){this.log(lt.Info,...t)}static warn(...t){this.log(lt.Warn,...t)}static error(...t){this.log(lt.Error,...t)}static log(t,...r){if(!(this.logLevel>t))switch(t){case lt.Debug:{console.debug(...r);break}case lt.Info:{console.info(...r);break}case lt.Warn:{console.warn(...r);break}case lt.Error:{console.error(...r);break}}}};Ut(O,"logLevel",lt.Warn);var St=8*4+8;var Es=16;function ye(e,t){t=Math.min(Math.max(Number(t),2),65535);let r=e,i=r;do r=Math.ceil(r/t),i+=r;while(r!==1);return i*St}function zh(e,t){if(t<2)throw new Error("Node size must be at least 2");if(e===0)throw new Error("Number of items must be greater than 0");let r=e,i=r,s=[r];do r=Math.ceil(r/t),i+=r,s.push(r);while(r!==1);let a=[];r=i;for(let o of s)a.push(r-o),r-=o;let n=[];for(let o=0;o<s.length;o++)n.push([a[o],a[o]+s[o]]);return n}async function*Ss(e,t,r,i){class s{_level;nodes;constructor(m,p){this._level=p,this.nodes=m}level(){return this._level}startNodeIdx(){return this.nodes[0]}endNodeIdx(){return this.nodes[1]}extendEndNodeIdx(m){console.assert(m>this.nodes[1]),this.nodes[1]=m}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}let{minX:a,minY:n,maxX:o,maxY:h}=r;O.info(`tree items: ${e}, nodeSize: ${t}`);let f=zh(e,t),u=f[0][0],d=[(()=>{let l=[0,1],m=f.length-1;return new s(l,m)})()];for(O.debug(`starting stream search with queue: ${d}, numItems: ${e}, nodeSize: ${t}, levelBounds: ${f}`);d.length!=0;){let l=d.shift();O.debug(`popped node: ${l}, queueLength: ${d.length}`);let m=l.startNodeIdx(),p=m>=u,b=(()=>{let[,S]=f[l.level()],I=Math.min(l.endNodeIdx()+t,S);return p&&I<S?I+1:I})(),g=b-m,x=await i(m*St,g*St),M=new DataView(x);for(let S=m;S<b;S++){let I=S-m,A=I*St;if(o<M.getFloat64(A+0,!0)||h<M.getFloat64(A+8,!0)||a>M.getFloat64(A+16,!0)||n>M.getFloat64(A+24,!0))continue;let B=M.getBigUint64(A+32,!0);if(p){let pt=B,ie=(()=>{if(S<e-1){let Ws=(I+1)*St;return M.getBigUint64(Ws+32,!0)-pt}return null})(),Hs=S-u;yield[Number(pt),Hs,Number(ie)];continue}let N=B,Y=Et.global.extraRequestThreshold()/St,q=d[d.length-1];if(q!==void 0&&q.level()==l.level()-1&&N<q.endNodeIdx()+Y){O.debug(`Merging "nodeRange" request into existing range: ${q}, newEndNodeIdx: ${q.endNodeIdx()} -> ${N}`),q.extendEndNodeIdx(Number(N));continue}let it=(()=>{let pt=l.level()-1,ie=[Number(N),Number(N)+1];return new s(ie,pt)})();q!==void 0&&q.level()==it.level()?O.info(`Same level, but too far away. Pushing new request for nodeIdx: ${N} rather than merging with distant ${q}`):O.info(`Pushing new level for ${it} onto queue with nearestNodeRange: ${q} since there's not already a range for this level.`),d.push(it)}}}var mt=new Uint8Array([102,103,98,3,102,103,98,0]),ct=4;var te=class{headerClient;header;headerLength;indexLength;constructor(t,r,i,s){this.headerClient=t,this.header=r,this.headerLength=i,this.indexLength=s}static async open(t){let i=new tr(t),s=(()=>{let c=Es,d=3,l=0,m;for(m=0;m<d;m++){let p=c**m*St;l+=p}return l})(),a=2024+s;O.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${s})`);{let c=new Uint8Array(await i.getRange(0,8,a,"header"));if(!c.subarray(0,3).every((d,l)=>mt[l]===d))throw O.error(`bytes: ${c} != ${mt}`),new Error("Not a FlatGeobuf file");O.debug("magic bytes look good")}let n;{let c=await i.getRange(8,4,a,"header");n=new DataView(c).getUint32(0,!0);let d=1048576*10;if(n>d||n<8)throw new Error("Invalid header size");O.debug(`headerLength: ${n}`)}let o=await i.getRange(12,n,a,"header"),h=new W(new Uint8Array(o)),f=pe(h),u=ye(f.featuresCount,f.indexNodeSize);return O.debug("completed: opening http reader"),new te(i,f,n,u)}async*selectBbox(t){let r=this.lengthBeforeTree(),i=this.headerClient,s=async function(h,f){return i.getRange(r+h,f,0,"index")},a=[],n=[];for await(let h of Ss(this.header.featuresCount,this.header.indexNodeSize,t,s)){let[f,,]=h,[,,u]=h;if(u||(O.info("final feature"),u=4),n.length==0){n.push([f,u]);continue}let c=n[n.length-1],d=f-(c[0]+c[1]);d>Et.global.extraRequestThreshold()&&(O.info(`Pushing new feature batch, since gap ${d} was too large`),a.push(n),n=[]),n.push([f,u])}this.headerClient.logUsage("header+index"),n.length>0&&a.push(n);let o=a.flatMap(h=>this.readFeatureBatch(h));yield*Yt.merge(o)}lengthBeforeTree(){return mt.length+ct+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new tr(this.headerClient.httpClient)}async*readFeatureBatch(t){let[r]=t[0],[i,s]=t[t.length-1],a=r,o=i+s-a,h=this.buildFeatureClient(),f=o;for(let[u]of t)yield await this.readFeature(h,u,f),f=0;h.logUsage("feature")}async readFeature(t,r,i){let s=r+this.lengthBeforeFeatures(),a;{let u=await t.getRange(s,4,i,"feature length");a=new DataView(u).getUint32(0,!0)}let n=await t.getRange(s+4,a,i,"feature data"),o=new Uint8Array(n),h=new Uint8Array(a+ct);h.set(o,ct);let f=new W(h);return f.setPosition(ct),J.getRootAsFeature(f)}},tr=class{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(t){if(typeof t=="string")this.httpClient=new er(t);else if(t instanceof er)this.httpClient=t;else throw new Error("Unknown source ")}async getRange(t,r,i,s){this.bytesEverUsed+=r;let a=t-this.head,n=a+r;if(a>=0&&n<=this.buffer.byteLength)return this.buffer.slice(a,n);let o=Math.max(r,i);return this.bytesEverFetched+=o,O.debug(`requesting for new Range: ${t}-${t+o-1}`),this.buffer=await this.httpClient.getRange(t,o,s),this.head=t,this.buffer.slice(0,r)}logUsage(t){let r=t.split(" ")[0],i=this.bytesEverUsed,s=this.bytesEverFetched,a=(100*i/s).toFixed(2);O.info(`${r} bytes used/requested: ${i} / ${s} = ${a}%`)}},er=class{url;requestsEverMade=0;bytesEverRequested=0;constructor(t){this.url=t}async getRange(t,r,i){this.requestsEverMade+=1,this.bytesEverRequested+=r;let s=`bytes=${t}-${t+r-1}`;return O.info(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${r}, ever: ${this.bytesEverRequested}), Range: ${s}`),(await fetch(this.url,{headers:{Range:s}})).arrayBuffer()}};function rr(e,t,r){if(!e.subarray(0,3).every((u,c)=>mt[c]===u))throw new Error("Not a FlatGeobuf file");let i=new W(e),s=i.readUint32(mt.length);i.setPosition(mt.length+ct);let a=pe(i);r&&r(a);let n=mt.length+ct+s,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=ye(h,o));let f=[];for(;n<i.capacity();){let u=i.readUint32(n);i.setPosition(n+ct);let c=J.getRootAsFeature(i);f.push(t(c,a)),n+=ct+u}return f}async function*ir(e,t,r){let i=wr(e),s=async d=>await i.slice(d),a=new Uint8Array(await s(8,"magic bytes"));if(!a.subarray(0,3).every((d,l)=>mt[l]===d))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await s(4,"header length"));let n=new W(a),o=n.readUint32(0);a=new Uint8Array(await s(o,"header data")),n=new W(a);let h=pe(n);r&&r(h);let{indexNodeSize:f,featuresCount:u}=h;if(f>0){let d=ye(u,f);await s(d,"entire index, w/o rect")}let c;for(;c=await qh(s,h,t);)yield c}async function*sr(e,t,r,i){let s=await te.open(e);O.debug("opened reader"),i&&i(s.header);for await(let a of s.selectBbox(t))yield r(a,s.header)}async function qh(e,t,r){let i=new Uint8Array(await e(4,"feature length"));if(i.byteLength===0)return;let s=new W(i),a=s.readUint32(0);i=new Uint8Array(await e(a,"feature data"));let n=new Uint8Array(a+4);n.set(i,4),s=new W(n),s.setPosition(ct);let o=J.getRootAsFeature(s);return r(o,t)}function Ps(e,t){return{type:"FeatureCollection",features:rr(e,Je,t)}}function Ns(e,t){return ir(e,Je,t)}function Os(e,t,r){return sr(e,t,Je,r)}function Rs(e,t,r){return e instanceof Uint8Array?Ps(e,r):e instanceof ReadableStream?Ns(e,r):Os(e,t,r)}function Fs(e,t,r){return e instanceof Uint8Array?rr(e,t):e instanceof ReadableStream?ir(e,t):sr(e,r,t)}var Cs=Rs,Ls=Fs;function Bs(e,t){let r=t.shape;switch(r){case"geojson-table":return jh(e,t);case"columnar-table":return{shape:"columnar-table",data:Ts(e,t)};case"binary":return Ts(e,t);default:throw new Error(r)}}function Ts(e,t={}){let r=new Uint8Array(e);return Ls(r,gr)}function jh(e,t){if(e.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:r=!1,crs:i="WGS84"}=t,s=new Uint8Array(e),a,n,o=t.boundingBox&&Us(t.boundingBox),{features:h}=Cs(s,o,c=>{a=c,n=bs(a)}),f=a?.crs?.wkt,u;if(r&&f)try{u=new Jt({from:f,to:i})}catch{}return u&&(h=De(h,c=>u.project(c))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:h}}function Gs(e,t){let r=t.shape;switch(r){case"binary":return Vh(e,t);case"geojson-table":return Hh(e,t);default:throw new Error(r)}}function Vh(e,t){let r=t.boundingBox&&Us(t.boundingBox);return Ls(e,Wh,r)}async function*Hh(e,t){let{reproject:r=!1,crs:i="WGS84"}=t||{},s,a=Cs(e,void 0,h=>{s=h}),n,o=!0;for await(let h of a){if(o){let f=s?.crs?.wkt;r&&f&&(n=new Jt({from:f,to:i})),o=!1}r&&n?yield De([h],f=>n.project(f)):yield h}}function Us(e){return{minX:e[0][0],minY:e[0][1],maxX:e[1][0],maxY:e[1][1]}}function Wh(e,t){let r=e.geometry(),i=t.geometryType||r?.type(),s=gr(r,i);return s.properties=We(e,t.columns),s}var Jh="4.4.0-alpha.17",Xh=[102,103,98,3,102,103,98,1],Or={...zt,dataType:null,batchType:null,version:Jh,worker:!0,tests:[new Uint8Array(Xh).buffer],options:{flatgeobuf:{shape:"geojson-table"},gis:{reproject:!1}}},ee={...Or,parse:async(e,t={})=>zs(e,t),parseSync:zs,parseInBatchesFromStream:Kh,binary:!0};function zs(e,t={}){return Bs(e,qs(t))}function Kh(e,t){return Gs(e,qs(t))}function qs(e){return e={...e,flatgeobuf:{...ee.options.flatgeobuf,...e?.flatgeobuf},gis:{...ee.options.gis,...e?.gis}},{shape:e?.flatgeobuf?.shape??"geojson-table",boundingBox:e?.flatgeobuf?.boundingBox,crs:e?.gis?._targetCrs||"WGS84",reproject:e?.gis?.reproject||!1}}function Ds(e,t){return ks(e||{},t)}function ks(e,t,r=0){if(r>3)return t;let i={...e};for(let[s,a]of Object.entries(t))a&&typeof a=="object"&&!Array.isArray(a)?i[s]=ks(i[s]||{},t[s],r+1):i[s]=t[s];return i}var $h="",js={};function Vs(e){for(let t in js)if(e.startsWith(t)){let r=js[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${$h}${e}`),e}var Rr=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(t,r,i){i?this.options=Ds({...i,core:Rr.defaultOptions},r):this.options={...r},this.data=t,this.url=typeof t=="string"?Vs(t):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=Zh(this.loadOptions)}setProps(t){this.options=Object.assign(this.options,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}},re=Rr;Ut(re,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function Zh(e){let t=e?.core?.fetch;if(t&&typeof t=="function")return(i,s)=>t(i,s);let r=e?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Tr={...zt,version:"0.0.0",type:"flatgeobuf-server",fromUrl:!0,fromBlob:!1,defaultOptions:{flatgeobuf:{}},testURL:e=>e.toLowerCase().includes("FeatureServer"),createDataSource:(e,t)=>new Fr(e,t)},Fr=class extends re{formatSpecificMetadata=null;constructor(t,r){super(t,r,Tr.defaultOptions)}async getSchema(){return await this.getMetadata({formatSpecificMetadata:!0}),{metadata:{},fields:[]}}async getMetadata(t){return this.formatSpecificMetadata,t.formatSpecificMetadata,{}}async getFeatures(t){let i=await(await this.fetch(this.url)).arrayBuffer();return await ee.parse(i,{})}};return ra(ve);})();
|
|
10
|
+
northing meters`+e;var d=c/2,l=0,m=0,p,b,g,x,M;return d>0&&(p=1e5/Math.pow(10,d),b=e.substring(a,a+d),l=parseFloat(b)*p,g=e.substring(a+d),m=parseFloat(g)*p),x=l+f,M=m+u,{easting:x,northing:M,zoneLetter:o,zoneNumber:n,accuracy:p}}function za(e,t){for(var r=xi.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===K&&r++,r===rt&&r++,r>ce){if(s)throw"Bad character: "+e;r=kt,s=!0}i+=1e5}return i}function qa(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=wi.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===K&&r++,r===rt&&r++,r>le){if(s)throw"Bad character: "+e;r=kt,s=!0}i+=1e5}return i}function Da(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 jt(e,t,r){if(!(this instanceof jt))return new jt(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")}jt.fromMGRS=function(e){return new jt(pr(e))};jt.prototype.toMGRS=function(e){return mr([this.x,this.y],e)};var Si=jt;var ka=1,ja=.25,Pi=.046875,Ni=.01953125,Oi=.01068115234375,Va=.75,Ha=.46875,Wa=.013020833333333334,Ja=.007120768229166667,Xa=.3645833333333333,Ka=.005696614583333333,$a=.3076171875;function Te(e){var t=[];t[0]=ka-e*(ja+e*(Pi+e*(Ni+e*Oi))),t[1]=e*(Va-e*(Pi+e*(Ni+e*Oi)));var r=e*e;return t[2]=r*(Ha-e*(Wa+e*Ja)),r*=e,t[3]=r*(Xa-e*Ka),t[4]=r*e*$a,t}function Rt(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 Za=20;function Ce(e,t,r){for(var i=1/(1-t),s=e,a=Za;a;--a){var n=Math.sin(s),o=1-t*n*n;if(o=(Rt(s,n,Math.cos(s),r)-e)*(o*Math.sqrt(o))*i,s-=o,Math.abs(o)<y)return s}return s}function Qa(){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=Te(this.es),this.ml0=Rt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Ya(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a,n,o=Math.sin(r),h=Math.cos(r);if(this.es){var u=h*i,c=Math.pow(u,2),d=this.ep2*Math.pow(h,2),l=Math.pow(d,2),m=Math.abs(h)>y?Math.tan(r):0,p=Math.pow(m,2),b=Math.pow(p,2);s=1-this.es*Math.pow(o,2),u=u/Math.sqrt(s);var g=Rt(r,o,h,this.en);a=this.a*(this.k0*u*(1+c/6*(1-p+d+c/20*(5-18*p+b+14*d-58*p*d+c/42*(61+179*b-b*p-479*p)))))+this.x0,n=this.a*(this.k0*(g-this.ml0+o*i*u/2*(1+c/12*(5-p+9*d+4*l+c/30*(61+b-58*p+270*d-330*p*d+c/56*(1385+543*b-b*p-3111*p))))))+this.y0}else{var f=h*Math.sin(i);if(Math.abs(Math.abs(f)-1)<y)return 93;if(a=.5*this.a*this.k0*Math.log((1+f)/(1-f))+this.x0,n=h*Math.cos(i)/Math.sqrt(1-Math.pow(f,2)),f=Math.abs(n),f>=1){if(f-1>y)return 93;n=0}else n=Math.acos(n);r<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return e.x=a,e.y=n,e}function tn(e){var t,r,i,s,a=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+n/this.k0,r=Ce(t,this.es,this.en),Math.abs(r)<_){var c=Math.sin(r),d=Math.cos(r),l=Math.abs(d)>y?Math.tan(r):0,m=this.ep2*Math.pow(d,2),p=Math.pow(m,2),b=Math.pow(l,2),g=Math.pow(b,2);t=1-this.es*Math.pow(c,2);var x=a*Math.sqrt(t)/this.k0,M=Math.pow(x,2);t=t*l,i=r-t*M/(1-this.es)*.5*(1-M/12*(5+3*b-9*m*b+m-4*p-M/30*(61+90*b-252*m*b+45*g+46*m-M/56*(1385+3633*b+4095*g+1574*g*b)))),s=v(this.long0+x*(1-M/6*(1+2*b+m-M/20*(5+28*b+24*g+8*m*b+6*m-M/42*(61+662*b+1320*g+720*g*b))))/d)}else i=_*ut(n),s=0;else{var o=Math.exp(a/this.k0),h=.5*(o-1/o),f=this.lat0+n/this.k0,u=Math.cos(f);t=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(h,2))),i=Math.asin(t),n<0&&(i=-i),h===0&&u===0?s=0:s=v(Math.atan2(h,u)+this.long0)}return e.x=s,e.y=i,e}var en=["Transverse_Mercator","Transverse Mercator","tmerc"],Ri={init:Qa,forward:Ya,inverse:tn,names:en};function Le(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function ue(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 Fi(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function Ti(e){var t=Math.abs(e);return t=Fi(t*(1+t/(ue(1,t)+1))),e<0?-t:t}function Be(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],a=0,n;--i>=0;)n=-a+r*s+e[i],a=s,s=n;return t+n*Math.sin(2*t)}function Ci(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],a=0,n;--i>=0;)n=-a+r*s+e[i],a=s,s=n;return Math.sin(t)*n}function Li(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function br(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),a=Le(r),n=Li(r),o=2*s*n,h=-2*i*a,f=e.length-1,u=e[f],c=0,d=0,l=0,m,p;--f>=0;)m=d,p=c,d=u,c=l,u=-m+o*d-h*c+e[f],l=-p+h*d+o*c;return o=i*n,h=s*a,[o*u-h*l,o*l+h*u]}function rn(){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=Be(this.cbg,this.lat0);this.Zb=-this.Qn*(i+Ci(this.gtu,2*i))}function sn(e){var t=v(e.x-this.long0),r=e.y;r=Be(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),a=Math.sin(t),n=Math.cos(t);r=Math.atan2(i,n*s),t=Math.atan2(a*s,ue(i,s*n)),t=Ti(Math.tan(t));var o=br(this.gtu,2*r,2*t);r=r+o[0],t=t+o[1];var h,f;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,f=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,f=1/0),e.x=h,e.y=f,e}function an(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 a=br(this.utg,2*r,2*t);r=r+a[0],t=t+a[1],t=Math.atan(Le(t));var n=Math.sin(r),o=Math.cos(r),h=Math.sin(t),f=Math.cos(t);r=Math.atan2(n*f,ue(h,f*o)),t=Math.atan2(h,f*o),i=v(t+this.long0),s=Be(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var nn=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Vt={init:rn,forward:sn,inverse:an,names:nn};function Bi(e,t){if(e===void 0){if(e=Math.floor((v(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var on="etmerc";function hn(){var e=Bi(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*G,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Vt.init.apply(this),this.forward=Vt.forward,this.inverse=Vt.inverse}var fn=["Universal Transverse Mercator System","utm"],Gi={init:hn,names:fn,dependsOn:on};function Ge(e,t){return Math.pow((1-e)/(1+e),t)}var ln=20;function cn(){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+E)/(Math.pow(Math.tan(.5*this.lat0+E),this.C)*Ge(this.e*e,this.ratexp))}function un(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+E),this.C)*Ge(this.e*Math.sin(r),this.ratexp))-_,e.x=this.C*t,e}function dn(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+E)/this.K,1/this.C),a=ln;a>0&&(i=2*Math.atan(s*Ge(this.e*Math.sin(e.y),-.5*this.e))-_,!(Math.abs(i-e.y)<t));--a)e.y=i;return a?(e.x=r,e.y=i,e):null}var mn=["gauss"],Ue={init:cn,forward:un,inverse:dn,names:mn};function pn(){Ue.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 _n(e){var t,r,i,s;return e.x=v(e.x-this.long0),Ue.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 bn(e){var t,r,i,s,a;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,a=Math.sqrt(e.x*e.x+e.y*e.y)){var n=2*Math.atan2(a,this.R2);t=Math.sin(n),r=Math.cos(n),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/a),i=Math.atan2(e.x*t,a*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Ue.inverse.apply(this,[e]),e.x=v(e.x+this.long0),e}var yn=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Ui={init:pn,forward:_n,inverse:bn,names:yn};function vn(e,t,r){return t*=r,Math.tan(.5*(_+e))*Math.pow((1-t)/(1+t),.5*r)}function gn(){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)<=y&&(this.k0=.5*(1+ut(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=y&&(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)<=y&&(this.k0=.5*this.cons*j(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/H(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=j(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-_,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Mn(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),a,n,o,h,f,u,c=v(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=y&&Math.abs(r+this.lat0)<=y?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(c)),e.x=this.a*a*s*Math.sin(c)+this.x0,e.y=this.a*a*(this.coslat0*i-this.sinlat0*s*Math.cos(c))+this.y0,e):(n=2*Math.atan(this.ssfn_(r,i,this.e))-_,h=Math.cos(n),o=Math.sin(n),Math.abs(this.coslat0)<=y?(f=H(this.e,r*this.con,this.con*i),u=2*this.a*this.k0*f/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<y?(a=2*this.a*this.k0/(1+h*Math.cos(c)),e.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(c))),e.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(c))+this.y0),e.x=a*h*Math.sin(c)+this.x0,e))}function xn(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,a,n=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var o=2*Math.atan(n/(2*this.a*this.k0));return t=this.long0,r=this.lat0,n<=y?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(o)*this.sinlat0+e.y*Math.sin(o)*this.coslat0/n),Math.abs(this.coslat0)<y?this.lat0>0?t=v(this.long0+Math.atan2(e.x,-1*e.y)):t=v(this.long0+Math.atan2(e.x,e.y)):t=v(this.long0+Math.atan2(e.x*Math.sin(o),n*this.coslat0*Math.cos(o)-e.y*this.sinlat0*Math.sin(o))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=y){if(n<=y)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=n*this.cons/(2*this.a*this.k0),r=this.con*bt(this.e,i),t=this.con*v(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,n<=y?a=this.X0:(a=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/n),t=v(this.long0+Math.atan2(e.x*Math.sin(s),n*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*bt(this.e,Math.tan(.5*(_+a)));return e.x=t,e.y=r,e}var wn=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],zi={init:gn,forward:Mn,inverse:xn,names:wn,ssfn_:vn};function In(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,a=2*s-Math.pow(s,2),n=this.e=Math.sqrt(a);this.R=this.k0*r*Math.sqrt(1-a)/(1-a*Math.pow(t,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),f=Math.log((1+n*t)/(1-n*t));this.K=o-this.alpha*h+this.alpha*n/2*f}function An(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),a=this.alpha*(e.x-this.lambda0),n=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(a))),o=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,e.x=this.R*n+this.x0,e}function En(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),a=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))),o=this.lambda0+n/this.alpha,h=0,f=a,u=-1e3,c=0;Math.abs(f-u)>1e-7;){if(++c>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(f))/2)),u=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=o,e.y=f,e}var Sn=["somerc"],qi={init:In,forward:An,inverse:En,names:Sn};function Pn(){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=H(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var a,n;if(!isNaN(this.longc))this.lat0>=0?a=s+Math.sqrt(s*s-1):a=s-Math.sqrt(s*s-1),this.el=a*Math.pow(i,this.bl),n=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(n*Math.tan(this.gamma0))/this.bl;else{var o=H(this.e,this.lat1,Math.sin(this.lat1)),h=H(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 f=Math.pow(o,this.bl),u=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var c=(this.el*this.el-u*f)/(this.el*this.el+u*f),d=(u-f)/(u+f),l=v(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*l)/d)/this.bl,this.long0=v(this.long0);var m=v(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/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 Nn(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a,n;if(Math.abs(Math.abs(r)-_)<=y)r>0?n=-1:n=1,a=this.al/this.bl*Math.log(Math.tan(E+n*this.gamma0*.5)),s=-1*n*_*this.al/this.bl;else{var o=H(this.e,r,Math.sin(r)),h=this.el/Math.pow(o,this.bl),f=.5*(h-1/h),u=.5*(h+1/h),c=Math.sin(this.bl*i),d=(f*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;Math.abs(Math.abs(d)-1)<=y?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-d)/(1+d))/this.bl,Math.abs(Math.cos(this.bl*i))<=y?s=this.al*this.bl*i:s=this.al*Math.atan2(f*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+a):(s-=this.uc,e.x=this.x0+a*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-a*Math.sin(this.alpha)),e}function On(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),a=.5*(i+1/i),n=Math.sin(this.bl*t/this.al),o=(n*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/a,h=Math.pow(this.el/Math.sqrt((1+o)/(1-o)),1/this.bl);return Math.abs(o-1)<y?(e.x=this.long0,e.y=_):Math.abs(o+1)<y?(e.x=this.long0,e.y=-1*_):(e.y=bt(this.e,h),e.x=v(this.long0-Math.atan2(s*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var Rn=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Di={init:Pn,forward:Nn,inverse:On,names:Rn};function Fn(){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)<y)){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=j(this.e,t,r),s=H(this.e,this.lat1,t),a=Math.sin(this.lat2),n=Math.cos(this.lat2),o=j(this.e,a,n),h=H(this.e,this.lat2,a),f=H(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>y?this.ns=Math.log(i/o)/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(f,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Tn(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=y&&(r=ut(r)*(_-2*y));var i=Math.abs(Math.abs(r)-_),s,a;if(i>y)s=H(this.e,r,Math.sin(r)),a=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;a=0}var n=this.ns*v(t-this.long0);return e.x=this.k0*(a*Math.sin(n))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(n))+this.y0,e}function Cn(e){var t,r,i,s,a,n=(e.x-this.x0)/this.k0,o=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(n*n+o*o),r=1):(t=-Math.sqrt(n*n+o*o),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*n,r*o)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=bt(this.e,i),s===-9999)return null}else s=-_;return a=v(h/this.ns+this.long0),e.x=a,e.y=s,e}var Ln=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],ki={init:Fn,forward:Tn,inverse:Cn,names:Ln};function Bn(){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 Gn(e){var t,r,i,s,a,n,o,h=e.x,f=e.y,u=v(h-this.long0);return t=Math.pow((1+this.e*Math.sin(f))/(1-this.e*Math.sin(f)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(f/2+this.s45),this.alfa)/t)-this.s45),i=-u*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),a=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),n=this.n*a,o=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=o*Math.cos(n)/1,e.x=o*Math.sin(n)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Un(e){var t,r,i,s,a,n,o,h,f=e.x;e.x=e.y,e.y=f,this.czech||(e.y*=-1,e.x*=-1),n=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),s=a/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),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,o=t,h=0;var u=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(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-e.y)<1e-10&&(h=1),o=e.y,u+=1;while(h===0&&u<15);return u>=15?null:e}var zn=["Krovak","krovak"],ji={init:Bn,forward:Gn,inverse:Un,names:zn};function z(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function yt(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function vt(e){return .375*e*(1+.25*e*(1+.46875*e))}function gt(e){return .05859375*e*e*(1+.75*e)}function Mt(e){return e*e*e*(35/3072)}function xt(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function ot(e){return Math.abs(e)<_?e:e-ut(e)*Math.PI}function Ft(e,t,r,i,s){var a,n;a=e/t;for(var o=0;o<15;o++)if(n=(e-(t*a-r*Math.sin(2*a)+i*Math.sin(4*a)-s*Math.sin(6*a)))/(t-2*r*Math.cos(2*a)+4*i*Math.cos(4*a)-6*s*Math.cos(6*a)),a+=n,Math.abs(n)<=1e-10)return a;return NaN}function qn(){this.sphere||(this.e0=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.ml0=this.a*z(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Dn(e){var t,r,i=e.x,s=e.y;if(i=v(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 a=Math.sin(s),n=Math.cos(s),o=xt(this.a,this.e,a),h=Math.tan(s)*Math.tan(s),f=i*Math.cos(s),u=f*f,c=this.es*n*n/(1-this.es),d=this.a*z(this.e0,this.e1,this.e2,this.e3,s);t=o*f*(1-u*h*(1/6-(8-h+8*c)*u/120)),r=d-this.ml0+o*a/n*u*(.5+(5-h+6*c)*u/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function kn(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 a=r+this.lat0;i=Math.asin(Math.sin(a)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(a))}else{var n=this.ml0/this.a+r,o=Ft(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-_)<=y)return e.x=this.long0,e.y=_,r<0&&(e.y*=-1),e;var h=xt(this.a,this.e,Math.sin(o)),f=h*h*h/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(o),2),c=t*this.a/h,d=c*c;i=o-h*Math.tan(o)/f*c*c*(.5-(1+3*u)*c*c/24),s=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(o)}return e.x=v(s+this.long0),e.y=ot(i),e}var jn=["Cassini","Cassini_Soldner","cass"],Vi={init:qn,forward:Dn,inverse:kn,names:jn};function ht(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 Vn=1,Hn=2,Wn=3,Jn=4;function Xn(){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)<y?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=ht(this.e,1),this.mmf=.5/(1-this.es),this.apa=io(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=ht(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 Kn(e){var t,r,i,s,a,n,o,h,f,u,c=e.x,d=e.y;if(c=v(c-this.long0),this.sphere){if(a=Math.sin(d),u=Math.cos(d),i=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+u*i:1+this.sinph0*a+this.cosph0*u*i,r<=y)return null;r=Math.sqrt(2/r),t=r*u*Math.sin(c),r*=this.mode===this.EQUIT?a:this.cosph0*a-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(d+this.lat0)<y)return null;r=E-d*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(c),r*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(c),s=Math.sin(c),a=Math.sin(d),n=ht(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=n/this.qp,h=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:f=1+this.sinb1*o+this.cosb1*h*i;break;case this.EQUIT:f=1+h*i;break;case this.N_POLE:f=_+d,n=this.qp-n;break;case this.S_POLE:f=d-_,n=this.qp+n;break}if(Math.abs(f)<y)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:f=Math.sqrt(2/f),this.mode===this.OBLIQ?r=this.ymf*f*(this.cosb1*o-this.sinb1*h*i):r=(f=Math.sqrt(2/(1+h*i)))*o*this.ymf,t=this.xmf*f*h*s;break;case this.N_POLE:case this.S_POLE:n>=0?(t=(f=Math.sqrt(n))*s,r=i*(this.mode===this.S_POLE?f:-f)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function $n(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,a,n,o,h,f;if(this.sphere){var u=0,c,d=0;if(c=Math.sqrt(t*t+r*r),s=c*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),u=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(c)<=y?0:Math.asin(r*d/c),t*=d,r=u*c;break;case this.OBLIQ:s=Math.abs(c)<=y?this.lat0:Math.asin(u*this.sinph0+r*d*this.cosph0/c),t*=d*this.cosph0,r=(u-Math.sin(s)*this.sinph0)*c;break;case this.N_POLE:r=-r,s=_-s;break;case this.S_POLE:s-=_;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(f=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<y)return e.x=this.long0,e.y=this.lat0,e;n=2*Math.asin(.5*h/this.rq),a=Math.cos(n),t*=n=Math.sin(n),this.mode===this.OBLIQ?(f=a*this.sinb1+r*n*this.cosb1/h,o=this.qp*f,r=h*this.cosb1*a-r*this.sinb1*n):(f=r*n/h,o=this.qp*f,r=h*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),o=t*t+r*r,!o)return e.x=this.long0,e.y=this.lat0,e;f=1-o/this.qp,this.mode===this.S_POLE&&(f=-f)}i=Math.atan2(t,r),s=so(Math.asin(f),this.apa)}return e.x=v(this.long0+i),e.y=s,e}var Zn=.3333333333333333,Qn=.17222222222222222,Yn=.10257936507936508,to=.06388888888888888,eo=.0664021164021164,ro=.016415012942191543;function io(e){var t,r=[];return r[0]=e*Zn,t=e*e,r[0]+=t*Qn,r[1]=t*to,t*=e,r[0]+=t*Yn,r[1]+=t*eo,r[2]=t*ro,r}function so(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 ao=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Hi={init:Xn,forward:Kn,inverse:$n,names:ao,S_POLE:Vn,N_POLE:Hn,EQUIT:Wn,OBLIQ:Jn};function $(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function no(){Math.abs(this.lat1+this.lat2)<y||(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=j(this.e3,this.sin_po,this.cos_po),this.qs1=ht(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=j(this.e3,this.sin_po,this.cos_po),this.qs2=ht(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=ht(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>y?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 oo(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=ht(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,a=this.ns0*v(t-this.long0),n=s*Math.sin(a)+this.x0,o=this.rh-s*Math.cos(a)+this.y0;return e.x=n,e.y=o,e}function ho(e){var t,r,i,s,a,n;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?n=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,n=this.phi1z(this.e3,r)),a=v(s/this.ns0+this.long0),e.x=a,e.y=n,e}function fo(e,t){var r,i,s,a,n,o=$(.5*t);if(e<y)return o;for(var h=e*e,f=1;f<=25;f++)if(r=Math.sin(o),i=Math.cos(o),s=e*r,a=1-s*s,n=.5*a*a/i*(t/(1-h)-r/a+.5/e*Math.log((1-s)/(1+s))),o=o+n,Math.abs(n)<=1e-7)return o;return null}var lo=["Albers_Conic_Equal_Area","Albers","aea"],Wi={init:no,forward:oo,inverse:ho,names:lo,phi1z:fo};function co(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function uo(e){var t,r,i,s,a,n,o,h,f=e.x,u=e.y;return i=v(f-this.long0),t=Math.sin(u),r=Math.cos(u),s=Math.cos(i),n=this.sin_p14*t+this.cos_p14*r*s,a=1,n>0||Math.abs(n)<=y?(o=this.x0+this.a*a*r*Math.sin(i)/n,h=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*r*s)/n):(o=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=o,e.y=h,e}function mo(e){var t,r,i,s,a,n;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),n=$(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),a=v(this.long0+a)):(n=this.phic0,a=0),e.x=a,e.y=n,e}var po=["gnom"],Ji={init:co,forward:uo,inverse:mo,names:po};function Xi(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*_:_;for(var i=Math.asin(.5*t),s,a,n,o,h=0;h<30;h++)if(a=Math.sin(i),n=Math.cos(i),o=e*a,s=Math.pow(1-o*o,2)/(2*n)*(t/(1-e*e)-a/(1-o*o)+.5/e*Math.log((1-o)/(1+o))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function _o(){this.sphere||(this.k0=j(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function bo(e){var t=e.x,r=e.y,i,s,a=v(t-this.long0);if(this.sphere)i=this.x0+this.a*a*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var n=ht(this.e,Math.sin(r));i=this.x0+this.a*this.k0*a,s=this.y0+this.a*n*.5/this.k0}return e.x=i,e.y=s,e}function yo(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=v(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=Xi(this.e,2*e.y*this.k0/this.a),t=v(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var vo=["cea"],Ki={init:_o,forward:bo,inverse:yo,names:vo};function go(){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 Mo(e){var t=e.x,r=e.y,i=v(t-this.long0),s=ot(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function xo(e){var t=e.x,r=e.y;return e.x=v(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=ot(this.lat0+(r-this.y0)/this.a),e}var wo=["Equirectangular","Equidistant_Cylindrical","eqc"],$i={init:go,forward:Mo,inverse:xo,names:wo};var Zi=20;function Io(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.ml0=this.a*z(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Ao(e){var t=e.x,r=e.y,i,s,a,n=v(t-this.long0);if(a=n*Math.sin(r),this.sphere)Math.abs(r)<=y?(i=this.a*n,s=-1*this.a*this.lat0):(i=this.a*Math.sin(a)/Math.tan(r),s=this.a*(ot(r-this.lat0)+(1-Math.cos(a))/Math.tan(r)));else if(Math.abs(r)<=y)i=this.a*n,s=-1*this.ml0;else{var o=xt(this.a,this.e,Math.sin(r))/Math.tan(r);i=o*Math.sin(a),s=this.a*z(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+o*(1-Math.cos(a))}return e.x=i+this.x0,e.y=s+this.y0,e}function Eo(e){var t,r,i,s,a,n,o,h,f;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=y)t=v(i/this.a+this.long0),r=0;else{n=this.lat0+s/this.a,o=i*i/this.a/this.a+n*n,h=n;var u;for(a=Zi;a;--a)if(u=Math.tan(h),f=-1*(n*(h*u+1)-h-.5*(h*h+o)*u)/((h-n)/u-1),h+=f,Math.abs(f)<=y){r=h;break}t=v(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=y)r=0,t=v(this.long0+i/this.a);else{n=(this.ml0+s)/this.a,o=i*i/this.a/this.a+n*n,h=n;var c,d,l,m,p;for(a=Zi;a;--a)if(p=this.e*Math.sin(h),c=Math.sqrt(1-p*p)*Math.tan(h),d=this.a*z(this.e0,this.e1,this.e2,this.e3,h),l=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,f=(n*(c*m+1)-m-.5*c*(m*m+o))/(this.es*Math.sin(2*h)*(m*m+o-2*n*m)/(4*c)+(n-m)*(c*l-2/Math.sin(2*h))-l),h-=f,Math.abs(f)<=y){r=h;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=v(this.long0+Math.asin(i*c/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var So=["Polyconic","poly"],Qi={init:Io,forward:Ao,inverse:Eo,names:So};function Po(){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 No(e){var t,r=e.x,i=e.y,s=i-this.lat0,a=r-this.long0,n=s/Pt*1e-5,o=a,h=1,f=0;for(t=1;t<=10;t++)h=h*n,f=f+this.A[t]*h;var u=f,c=o,d=1,l=0,m,p,b=0,g=0;for(t=1;t<=6;t++)m=d*u-l*c,p=l*u+d*c,d=m,l=p,b=b+this.B_re[t]*d-this.B_im[t]*l,g=g+this.B_im[t]*d+this.B_re[t]*l;return e.x=g*this.a+this.x0,e.y=b*this.a+this.y0,e}function Oo(e){var t,r=e.x,i=e.y,s=r-this.x0,a=i-this.y0,n=a/this.a,o=s/this.a,h=1,f=0,u,c,d=0,l=0;for(t=1;t<=6;t++)u=h*n-f*o,c=f*n+h*o,h=u,f=c,d=d+this.C_re[t]*h-this.C_im[t]*f,l=l+this.C_im[t]*h+this.C_re[t]*f;for(var m=0;m<this.iterations;m++){var p=d,b=l,g,x,M=n,S=o;for(t=2;t<=6;t++)g=p*d-b*l,x=b*d+p*l,p=g,b=x,M=M+(t-1)*(this.B_re[t]*p-this.B_im[t]*b),S=S+(t-1)*(this.B_im[t]*p+this.B_re[t]*b);p=1,b=0;var I=this.B_re[1],A=this.B_im[1];for(t=2;t<=6;t++)g=p*d-b*l,x=b*d+p*l,p=g,b=x,I=I+t*(this.B_re[t]*p-this.B_im[t]*b),A=A+t*(this.B_im[t]*p+this.B_re[t]*b);var B=I*I+A*A;d=(M*I+S*A)/B,l=(S*I-M*A)/B}var N=d,Y=l,q=1,it=0;for(t=1;t<=9;t++)q=q*N,it=it+this.D[t]*q;var pt=this.lat0+it*Pt*1e5,ie=this.long0+Y;return e.x=ie,e.y=pt,e}var Ro=["New_Zealand_Map_Grid","nzmg"],Yi={init:Po,forward:No,inverse:Oo,names:Ro};function Fo(){}function To(e){var t=e.x,r=e.y,i=v(t-this.long0),s=this.x0+this.a*i,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=a,e}function Co(e){e.x-=this.x0,e.y-=this.y0;var t=v(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 Lo=["Miller_Cylindrical","mill"],ts={init:Fo,forward:To,inverse:Co,names:Lo};var Bo=20;function Go(){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=Te(this.es)}function Uo(e){var t,r,i=e.x,s=e.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 a=this.n*Math.sin(s),n=Bo;n;--n){var o=(this.m*s+Math.sin(s)-a)/(this.m+Math.cos(s));if(s-=o,Math.abs(o)<y)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),f=Math.cos(s);r=this.a*Rt(s,h,f,this.en),t=this.a*i*f/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function zo(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=$((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=$(Math.sin(t)/this.n)),i=v(i+this.long0),t=ot(t)):(t=Ce(e.y/this.a,this.es,this.en),s=Math.abs(t),s<_?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=v(r)):s-y<_&&(i=this.long0)),e.x=i,e.y=t,e}var qo=["Sinusoidal","sinu"],es={init:Go,forward:Uo,inverse:zo,names:qo};function Do(){}function ko(e){for(var t=e.x,r=e.y,i=v(t-this.long0),s=r,a=Math.PI*Math.sin(r);;){var n=-(s+Math.sin(s)-a)/(1+Math.cos(s));if(s+=n,Math.abs(n)<y)break}s/=2,Math.PI/2-Math.abs(r)<y&&(i=0);var o=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=o,e.y=h,e}function jo(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=v(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 Vo=["Mollweide","moll"],rs={init:Do,forward:ko,inverse:jo,names:Vo};function Ho(){Math.abs(this.lat1+this.lat2)<y||(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=yt(this.es),this.e1=vt(this.es),this.e2=gt(this.es),this.e3=Mt(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=j(this.e,this.sinphi,this.cosphi),this.ml1=z(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<y?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=j(this.e,this.sinphi,this.cosphi),this.ml2=z(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=z(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Wo(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=z(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var a=this.ns*v(t-this.long0),n=this.x0+i*Math.sin(a),o=this.y0+this.rh-i*Math.cos(a);return e.x=n,e.y=o,e}function Jo(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 a=0;if(r!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=v(this.long0+a/this.ns),i=ot(this.g-r/this.a),e.x=s,e.y=i,e;var n=this.g-r/this.a;return i=Ft(n,this.e0,this.e1,this.e2,this.e3),s=v(this.long0+a/this.ns),e.x=s,e.y=i,e}var Xo=["Equidistant_Conic","eqdc"],is={init:Ho,forward:Wo,inverse:Jo,names:Xo};function Ko(){this.R=this.a}function $o(e){var t=e.x,r=e.y,i=v(t-this.long0),s,a;Math.abs(r)<=y&&(s=this.x0+this.R*i,a=this.y0);var n=$(2*Math.abs(r/Math.PI));(Math.abs(i)<=y||Math.abs(Math.abs(r)-_)<=y)&&(s=this.x0,r>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*n):a=this.y0+Math.PI*this.R*-Math.tan(.5*n));var o=.5*Math.abs(Math.PI/i-i/Math.PI),h=o*o,f=Math.sin(n),u=Math.cos(n),c=u/(f+u-1),d=c*c,l=c*(2/f-1),m=l*l,p=Math.PI*this.R*(o*(c-m)+Math.sqrt(h*(c-m)*(c-m)-(m+h)*(d-m)))/(m+h);i<0&&(p=-p),s=this.x0+p;var b=h+c;return p=Math.PI*this.R*(l*b-o*Math.sqrt((m+h)*(h+1)-b*b))/(m+h),r>=0?a=this.y0+p:a=this.y0-p,e.x=s,e.y=a,e}function Zo(e){var t,r,i,s,a,n,o,h,f,u,c,d,l;return e.x-=this.x0,e.y-=this.y0,c=Math.PI*this.R,i=e.x/c,s=e.y/c,a=i*i+s*s,n=-Math.abs(s)*(1+a),o=n-2*s*s+i*i,h=-2*n+1+2*s*s+a*a,l=s*s/h+(2*o*o*o/h/h/h-9*n*o/h/h)/27,f=(n-o*o/3/h)/h,u=2*Math.sqrt(-f/3),c=3*l/f/u,Math.abs(c)>1&&(c>=0?c=1:c=-1),d=Math.acos(c)/3,e.y>=0?r=(-u*Math.cos(d+Math.PI/3)-o/3/h)*Math.PI:r=-(-u*Math.cos(d+Math.PI/3)-o/3/h)*Math.PI,Math.abs(i)<y?t=this.long0:t=v(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(i*i-s*s)+a*a))/2/i),e.x=t,e.y=r,e}var Qo=["Van_der_Grinten_I","VanDerGrinten","vandg"],ss={init:Ko,forward:$o,inverse:Zo,names:Qo};function Yo(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function th(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),a=v(t-this.long0),n,o,h,f,u,c,d,l,m,p,b,g,x,M,S,I,A,B,N,Y,q,it,pt;return this.sphere?Math.abs(this.sin_p12-1)<=y?(e.x=this.x0+this.a*(_-r)*Math.sin(a),e.y=this.y0-this.a*(_-r)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=y?(e.x=this.x0+this.a*(_+r)*Math.sin(a),e.y=this.y0+this.a*(_+r)*Math.cos(a),e):(B=this.sin_p12*i+this.cos_p12*s*Math.cos(a),I=Math.acos(B),A=I?I/Math.sin(I):1,e.x=this.x0+this.a*A*s*Math.sin(a),e.y=this.y0+this.a*A*(this.cos_p12*i-this.sin_p12*s*Math.cos(a)),e):(n=yt(this.es),o=vt(this.es),h=gt(this.es),f=Mt(this.es),Math.abs(this.sin_p12-1)<=y?(u=this.a*z(n,o,h,f,_),c=this.a*z(n,o,h,f,r),e.x=this.x0+(u-c)*Math.sin(a),e.y=this.y0-(u-c)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=y?(u=this.a*z(n,o,h,f,_),c=this.a*z(n,o,h,f,r),e.x=this.x0+(u+c)*Math.sin(a),e.y=this.y0+(u+c)*Math.cos(a),e):(d=i/s,l=xt(this.a,this.e,this.sin_p12),m=xt(this.a,this.e,i),p=Math.atan((1-this.es)*d+this.es*l*this.sin_p12/(m*s)),b=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(p)-this.sin_p12*Math.cos(a)),b===0?N=Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):Math.abs(Math.abs(b)-Math.PI)<=y?N=-Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):N=Math.asin(Math.sin(a)*Math.cos(p)/Math.sin(b)),g=this.e*this.sin_p12/Math.sqrt(1-this.es),x=this.e*this.cos_p12*Math.cos(b)/Math.sqrt(1-this.es),M=g*x,S=x*x,Y=N*N,q=Y*N,it=q*N,pt=it*N,I=l*N*(1-Y*S*(1-S)/6+q/8*M*(1-2*S)+it/120*(S*(4-7*S)-3*g*g*(1-7*S))-pt/48*M),e.x=this.x0+I*Math.sin(b),e.y=this.y0+I*Math.cos(b),e))}function eh(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,a,n,o,h,f,u,c,d,l,m,p,b,g,x,M,S,I,A,B,N;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*_*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),a=this.long0,Math.abs(t)<=y?n=this.lat0:(n=$(s*this.sin_p12+e.y*i*this.cos_p12/t),o=Math.abs(this.lat0)-_,Math.abs(o)<=y?this.lat0>=0?a=v(this.long0+Math.atan2(e.x,-e.y)):a=v(this.long0-Math.atan2(-e.x,e.y)):a=v(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=a,e.y=n,e)):(h=yt(this.es),f=vt(this.es),u=gt(this.es),c=Mt(this.es),Math.abs(this.sin_p12-1)<=y?(d=this.a*z(h,f,u,c,_),t=Math.sqrt(e.x*e.x+e.y*e.y),l=d-t,n=Ft(l/this.a,h,f,u,c),a=v(this.long0+Math.atan2(e.x,-1*e.y)),e.x=a,e.y=n,e):Math.abs(this.sin_p12+1)<=y?(d=this.a*z(h,f,u,c,_),t=Math.sqrt(e.x*e.x+e.y*e.y),l=t-d,n=Ft(l/this.a,h,f,u,c),a=v(this.long0+Math.atan2(e.x,e.y)),e.x=a,e.y=n,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),b=Math.atan2(e.x,e.y),m=xt(this.a,this.e,this.sin_p12),g=Math.cos(b),x=this.e*this.cos_p12*g,M=-x*x/(1-this.es),S=3*this.es*(1-M)*this.sin_p12*this.cos_p12*g/(1-this.es),I=t/m,A=I-M*(1+M)*Math.pow(I,3)/6-S*(1+3*M)*Math.pow(I,4)/24,B=1-M*A*A/2-I*A*A*A/6,p=Math.asin(this.sin_p12*Math.cos(A)+this.cos_p12*Math.sin(A)*g),a=v(this.long0+Math.asin(Math.sin(b)*Math.sin(A)/Math.cos(p))),N=Math.sin(p),n=Math.atan2((N-this.es*B*this.sin_p12)*Math.tan(p),N*(1-this.es)),e.x=a,e.y=n,e))}var rh=["Azimuthal_Equidistant","aeqd"],as={init:Yo,forward:th,inverse:eh,names:rh};function ih(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function sh(e){var t,r,i,s,a,n,o,h,f=e.x,u=e.y;return i=v(f-this.long0),t=Math.sin(u),r=Math.cos(u),s=Math.cos(i),n=this.sin_p14*t+this.cos_p14*r*s,a=1,(n>0||Math.abs(n)<=y)&&(o=this.a*a*r*Math.sin(i),h=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*r*s)),e.x=o,e.y=h,e}function ah(e){var t,r,i,s,a,n,o;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=$(t/this.a),i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=y?(o=this.lat0,e.x=n,e.y=o,e):(o=$(s*this.sin_p14+e.y*i*this.cos_p14/t),a=Math.abs(this.lat0)-_,Math.abs(a)<=y?(this.lat0>=0?n=v(this.long0+Math.atan2(e.x,-e.y)):n=v(this.long0-Math.atan2(-e.x,e.y)),e.x=n,e.y=o,e):(n=v(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=n,e.y=o,e))}var nh=["ortho"],ns={init:ih,forward:sh,inverse:ah,names:nh};var F={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},P={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function oh(){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>=_-E/2?this.face=F.TOP:this.lat0<=-(_-E/2)?this.face=F.BOTTOM:Math.abs(this.long0)<=E?this.face=F.FRONT:Math.abs(this.long0)<=_+E?this.face=this.long0>0?F.RIGHT:F.LEFT:this.face=F.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 hh(e){var t={x:0,y:0},r,i,s,a,n,o,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===F.TOP)a=_-r,i>=E&&i<=_+E?(h.value=P.AREA_0,s=i-_):i>_+E||i<=-(_+E)?(h.value=P.AREA_1,s=i>0?i-R:i+R):i>-(_+E)&&i<=-E?(h.value=P.AREA_2,s=i+_):(h.value=P.AREA_3,s=i);else if(this.face===F.BOTTOM)a=_+r,i>=E&&i<=_+E?(h.value=P.AREA_0,s=-i+_):i<E&&i>=-E?(h.value=P.AREA_1,s=-i):i<-E&&i>=-(_+E)?(h.value=P.AREA_2,s=-i-_):(h.value=P.AREA_3,s=i>0?-i+R:-i-R);else{var f,u,c,d,l,m,p;this.face===F.RIGHT?i=Ht(i,+_):this.face===F.BACK?i=Ht(i,+R):this.face===F.LEFT&&(i=Ht(i,-_)),d=Math.sin(r),l=Math.cos(r),m=Math.sin(i),p=Math.cos(i),f=l*p,u=l*m,c=d,this.face===F.FRONT?(a=Math.acos(f),s=ze(a,c,u,h)):this.face===F.RIGHT?(a=Math.acos(u),s=ze(a,c,-f,h)):this.face===F.BACK?(a=Math.acos(-f),s=ze(a,c,-u,h)):this.face===F.LEFT?(a=Math.acos(-u),s=ze(a,c,f,h)):(a=s=0,h.value=P.AREA_0)}return o=Math.atan(12/R*(s+Math.acos(Math.sin(s)*Math.cos(E))-_)),n=Math.sqrt((1-Math.cos(a))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===P.AREA_1?o+=_:h.value===P.AREA_2?o+=R:h.value===P.AREA_3&&(o+=1.5*R),t.x=n*Math.cos(o),t.y=n*Math.sin(o),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 fh(e){var t={lam:0,phi:0},r,i,s,a,n,o,h,f,u,c={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)?c.value=P.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(c.value=P.AREA_1,r-=_):e.x<0&&-e.x>=Math.abs(e.y)?(c.value=P.AREA_2,r=r<0?r+R:r-R):(c.value=P.AREA_3,r+=_),u=R/12*Math.tan(r),n=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),o=Math.atan(n),s=Math.cos(r),a=Math.tan(i),h=1-s*s*a*a*(1-Math.cos(Math.atan(1/Math.cos(o)))),h<-1?h=-1:h>1&&(h=1),this.face===F.TOP)f=Math.acos(h),t.phi=_-f,c.value===P.AREA_0?t.lam=o+_:c.value===P.AREA_1?t.lam=o<0?o+R:o-R:c.value===P.AREA_2?t.lam=o-_:t.lam=o;else if(this.face===F.BOTTOM)f=Math.acos(h),t.phi=f-_,c.value===P.AREA_0?t.lam=-o+_:c.value===P.AREA_1?t.lam=-o:c.value===P.AREA_2?t.lam=-o-_:t.lam=o<0?-o-R:-o+R;else{var d,l,m;d=h,u=d*d,u>=1?m=0:m=Math.sqrt(1-u)*Math.sin(o),u+=m*m,u>=1?l=0:l=Math.sqrt(1-u),c.value===P.AREA_1?(u=l,l=-m,m=u):c.value===P.AREA_2?(l=-l,m=-m):c.value===P.AREA_3&&(u=l,l=m,m=-u),this.face===F.RIGHT?(u=d,d=-l,l=u):this.face===F.BACK?(d=-d,l=-l):this.face===F.LEFT&&(u=d,d=l,l=-u),t.phi=Math.acos(-m)-_,t.lam=Math.atan2(l,d),this.face===F.RIGHT?t.lam=Ht(t.lam,-_):this.face===F.BACK?t.lam=Ht(t.lam,-R):this.face===F.LEFT&&(t.lam=Ht(t.lam,+_))}if(this.es!==0){var p,b,g;p=t.phi<0?1:0,b=Math.tan(t.phi),g=this.b/Math.sqrt(b*b+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-g*g)/(this.one_minus_f*g)),p&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function ze(e,t,r,i){var s;return e<y?(i.value=P.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=E?i.value=P.AREA_0:s>E&&s<=_+E?(i.value=P.AREA_1,s-=_):s>_+E||s<=-(_+E)?(i.value=P.AREA_2,s=s>=0?s-R:s+R):(i.value=P.AREA_3,s+=_)),s}function Ht(e,t){var r=e+t;return r<-R?r+=ne:r>+R&&(r-=ne),r}var lh=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],os={init:oh,forward:hh,inverse:fh,names:lh};var yr=[[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]],de=[[-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]],hs=.8487,fs=1.3523,ls=nt/5,ch=1/ls,Wt=18,qe=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},uh=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function dh(e,t,r,i){for(var s=t;i;--i){var a=e(s);if(s-=a,Math.abs(a)<r)break}return s}function mh(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function ph(e){var t=v(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*ls);i<0?i=0:i>=Wt&&(i=Wt-1),r=nt*(r-ch*i);var s={x:qe(yr[i],r)*t,y:qe(de[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*hs+this.x0,s.y=s.y*this.a*fs+this.y0,s}function _h(e){var t={x:(e.x-this.x0)/(this.a*hs),y:Math.abs(e.y-this.y0)/(this.a*fs)};if(t.y>=1)t.x/=yr[Wt][0],t.y=e.y<0?-_:_;else{var r=Math.floor(t.y*Wt);for(r<0?r=0:r>=Wt&&(r=Wt-1);;)if(de[r][0]>t.y)--r;else if(de[r+1][0]<=t.y)++r;else break;var i=de[r],s=5*(t.y-i[0])/(de[r+1][0]-i[0]);s=dh(function(a){return(qe(i,a)-t.y)/uh(i,a)},s,y,100),t.x/=qe(yr[r],s),t.y=(5*r+s)*G,e.y<0&&(t.y=-t.y)}return t.x=v(t.x+this.long0),t}var bh=["Robinson","robin"],cs={init:mh,forward:ph,inverse:_h,names:bh};function yh(){this.name="geocent"}function vh(e){var t=Ne(e,this.es,this.a);return t}function gh(e){var t=Oe(e,this.es,this.a,this.b);return t}var Mh=["Geocentric","geocentric","geocent","Geocent"],us={init:yh,forward:vh,inverse:gh,names:Mh};function ds(e){e.Proj.projections.add(Ri),e.Proj.projections.add(Vt),e.Proj.projections.add(Gi),e.Proj.projections.add(Ui),e.Proj.projections.add(zi),e.Proj.projections.add(qi),e.Proj.projections.add(Di),e.Proj.projections.add(ki),e.Proj.projections.add(ji),e.Proj.projections.add(Vi),e.Proj.projections.add(Hi),e.Proj.projections.add(Wi),e.Proj.projections.add(Ji),e.Proj.projections.add(Ki),e.Proj.projections.add($i),e.Proj.projections.add(Qi),e.Proj.projections.add(Yi),e.Proj.projections.add(ts),e.Proj.projections.add(es),e.Proj.projections.add(rs),e.Proj.projections.add(is),e.Proj.projections.add(ss),e.Proj.projections.add(as),e.Proj.projections.add(ns),e.Proj.projections.add(os),e.Proj.projections.add(cs),e.Proj.projections.add(us)}Q.defaultDatum="WGS84";Q.Proj=wt;Q.WGS84=new Q.Proj("WGS84");Q.Point=Si;Q.toPoint=Fe;Q.defs=qt;Q.transform=Ot;Q.mgrs=Ii;Q.version="__VERSION__";ds(Q);var vr=Q;var Jt=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);vr.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=vr(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)}};function De(e,t){for(let r of e)r.geometry.coordinates=ms(r.geometry.coordinates,t);return e}function ms(e,t){return xh(e)?t(e):e.map(r=>ms(r,t))}function xh(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}var dt=new Int32Array(2),ke=new Float32Array(dt.buffer),je=new Float64Array(dt.buffer),Xt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var me;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(me||(me={}));var W=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new W(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 dt[0]=this.readInt32(t),ke[0]}readFloat64(t){return dt[Xt?0:1]=this.readInt32(t),dt[Xt?1:0]=this.readInt32(t+4),je[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){ke[0]=r,this.writeInt32(t,dt[0])}writeFloat64(t,r){je[0]=r,this.writeInt32(t,dt[Xt?0:1]),this.writeInt32(t+4,dt[Xt?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===me.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 a=t(s);a!==null&&i.push(a)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let a=t(s);a!==null&&i.push(a.unpack())}return i}};function gr(e,t){if(e===null)return null;switch(t){case GeometryType.Point:case GeometryType.MultiPoint:return Ih(e);case GeometryType.LineString:case GeometryType.MultiLineString:return Ah(e);case GeometryType.Polygon:return _s(e);case GeometryType.MultiPolygon:return Eh(e);default:throw new Error(`Unimplemented geometry type: ${t}`)}}function Ih(e){let t=e.xyArray(),r=e.zArray();return{positions:Mr(t,r)}}function Ah(e){let t=e.xyArray(),r=e.zArray(),i=Mr(t,r),s=e.endsArray()&&Array.from(e.endsArray())||[t.length/2];s.unshift(0);let a={value:new Uint16Array(s),size:1};return{positions:i,pathIndices:a}}function _s(e){let t=e.xyArray(),r=e.zArray(),i=Mr(t,r),s=e.endsArray()&&Array.from(e.endsArray())||[t.length/2];s.unshift(0);let a={value:new Uint16Array(s),size:1},n={value:new Uint16Array([0,t.length/2]),size:1};return{positions:i,primitivePolygonIndices:a,polygonIndices:n}}function Eh(e){let t=[],r=0,i=1,s=1;for(let d=0;d<e.partsLength();d++){let l=e.parts(d),m=_s(l);r+=m.positions.value.length,i+=m.primitivePolygonIndices.value.length-1,s+=m.polygonIndices.value.length-1,t.push(m)}let a=new Float64Array(r),n=new Uint32Array(i),o=new Uint32Array(s),h=0,f=1,u=1,c=t[0].positions.size;for(let d of t)a.set(d.positions.value,h*c),n.set(d.primitivePolygonIndices.value.subarray(1).map(l=>l+h),f),o.set(d.polygonIndices.value.subarray(1).map(l=>l+h),u),h+=d.positions.value.length/c,f+=d.primitivePolygonIndices.value.length-1,u+=d.polygonIndices.value.length-1;return{positions:{value:a,size:c},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function Mr(e,t){if(!t)return{value:e,size:2};if(t.length*2!==e.length)throw new Error("Z array must be half XY array's length");let r=e.length+t.length,i=new Float64Array(r);for(let s=0;s<e.length/2;s++)i[s*3+0]=e[s*2+0],i[s*3+1]=e[s*2+1],i[s*3+2]=t[s];return{value:i,size:3}}function bs(e){let t={title:e.title||"",description:e.description||"",crs:JSON.stringify(e.crs)||"",metadata:e.metadata||"",geometryType:String(e.geometryType),indexNodeSize:String(e.indexNodeSize),featureCount:String(e.featuresCount),bounds:e.envelope?.join(",")||""},r=e.columns?.map(i=>Sh(i))||[];return{metadata:t,fields:r}}function Sh(e){let t={title:e.title||"",description:e.description||"",width:String(e.width),precision:String(e.precision),scale:String(e.scale),unique:String(e.unique),primary_key:String(e.primary_key)};return{name:e.name,type:Ph(e.type),nullable:e.nullable,metadata:t}}var k;(function(e){e[e.Byte=0]="Byte",e[e.UByte=1]="UByte",e[e.Bool=2]="Bool",e[e.Short=3]="Short",e[e.UShort=4]="UShort",e[e.Int=5]="Int",e[e.UInt=6]="UInt",e[e.Long=7]="Long",e[e.ULong=8]="ULong",e[e.Float=9]="Float",e[e.Double=10]="Double",e[e.String=11]="String",e[e.Json=12]="Json",e[e.DateTime=13]="DateTime",e[e.Binary=14]="Binary"})(k||(k={}));function Ph(e){switch(e){case k.Byte:return"int8";case k.UByte:return"uint8";case k.Bool:return"bool";case k.Short:return"int16";case k.UShort:return"uint16";case k.Int:return"int32";case k.UInt:return"uint32";case k.Long:return"int64";case k.ULong:return"uint64";case k.Float:return"float32";case k.Double:return"float64";case k.String:return"utf8";case k.Json:return"null";case k.DateTime:return"date-millisecond";case k.Binary:return"binary";default:return"null"}}var C;(function(e){e[e.Unknown=0]="Unknown",e[e.Point=1]="Point",e[e.LineString=2]="LineString",e[e.Polygon=3]="Polygon",e[e.MultiPoint=4]="MultiPoint",e[e.MultiLineString=5]="MultiLineString",e[e.MultiPolygon=6]="MultiPolygon",e[e.GeometryCollection=7]="GeometryCollection",e[e.CircularString=8]="CircularString",e[e.CompoundCurve=9]="CompoundCurve",e[e.CurvePolygon=10]="CurvePolygon",e[e.MultiCurve=11]="MultiCurve",e[e.MultiSurface=12]="MultiSurface",e[e.Curve=13]="Curve",e[e.Surface=14]="Surface",e[e.PolyhedralSurface=15]="PolyhedralSurface",e[e.TIN=16]="TIN",e[e.Triangle=17]="Triangle"})(C||(C={}));var D=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsGeometry(t,r){return(r||new D).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGeometry(t,r){return t.setPosition(t.position()+4),(r||new D).__init(t.readInt32(t.position())+t.position(),t)}ends(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.readUint32(this.bb.__vector(this.bb_pos+r)+t*4):0}endsLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}xy(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}xyLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}z(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}zLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){let t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}m(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}mLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){let t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}t(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}tLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}tm(t){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.readUint64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}tmLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):C.Unknown}parts(t,r){let i=this.bb.__offset(this.bb_pos,18);return i?(r||new D).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}partsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGeometry(t){t.startObject(8)}static addEnds(t,r){t.addFieldOffset(0,r,0)}static createEndsVector(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 startEndsVector(t,r){t.startVector(4,r,4)}static addXy(t,r){t.addFieldOffset(1,r,0)}static createXyVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startXyVector(t,r){t.startVector(8,r,8)}static addZ(t,r){t.addFieldOffset(2,r,0)}static createZVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startZVector(t,r){t.startVector(8,r,8)}static addM(t,r){t.addFieldOffset(3,r,0)}static createMVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startMVector(t,r){t.startVector(8,r,8)}static addT(t,r){t.addFieldOffset(4,r,0)}static createTVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startTVector(t,r){t.startVector(8,r,8)}static addTm(t,r){t.addFieldOffset(5,r,0)}static createTmVector(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 startTmVector(t,r){t.startVector(8,r,8)}static addType(t,r){t.addFieldInt8(6,r,C.Unknown)}static addParts(t,r){t.addFieldOffset(7,r,0)}static createPartsVector(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 startPartsVector(t,r){t.startVector(4,r,4)}static endGeometry(t){return t.endObject()}static createGeometry(t,r,i,s,a,n,o,h,f){return D.startGeometry(t),D.addEnds(t,r),D.addXy(t,i),D.addZ(t,s),D.addM(t,a),D.addT(t,n),D.addTm(t,o),D.addType(t,h),D.addParts(t,f),D.endGeometry(t)}};function Ve(e,t){let r=[];for(let i=0;i<e.length;i+=2){let s=[e[i],e[i+1]];t&&s.push(t[i>>1]),r.push(s)}return r}function ys(e,t,r){if(!r||r.length===0)return[Ve(e,t)];let i=0,s=Array.from(r).map(n=>e.slice(i,i=n<<1)),a;return t&&(i=0,a=Array.from(r).map(n=>t.slice(i,i=n))),s.map((n,o)=>Ve(n,a?a[o]:void 0))}function Nh(e,t){let r=e.xyArray(),i=e.zArray();switch(t){case C.Point:{let s=Array.from(r);return i&&s.push(i[0]),s}case C.MultiPoint:case C.LineString:return Ve(r,i);case C.MultiLineString:return ys(r,i,e.endsArray());case C.Polygon:return ys(r,i,e.endsArray())}}function He(e,t){let r=t;if(r===C.Unknown&&(r=e.type()),r===C.GeometryCollection){let s=[];for(let a=0;a<e.partsLength();a++){let n=e.parts(a),o=n.type();s.push(He(n,o))}return{type:C[r],geometries:s}}else if(r===C.MultiPolygon){let s=[];for(let a=0;a<e.partsLength();a++)s.push(He(e.parts(a),C.Polygon));return{type:C[r],coordinates:s.map(a=>a.coordinates)}}let i=Nh(e,r);return{type:C[r],coordinates:i}}var L;(function(e){e[e.Byte=0]="Byte",e[e.UByte=1]="UByte",e[e.Bool=2]="Bool",e[e.Short=3]="Short",e[e.UShort=4]="UShort",e[e.Int=5]="Int",e[e.UInt=6]="UInt",e[e.Long=7]="Long",e[e.ULong=8]="ULong",e[e.Float=9]="Float",e[e.Double=10]="Double",e[e.String=11]="String",e[e.Json=12]="Json",e[e.DateTime=13]="DateTime",e[e.Binary=14]="Binary"})(L||(L={}));var T=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsColumn(t,r){return(r||new T).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsColumn(t,r){return t.setPosition(t.position()+4),(r||new T).__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}type(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):L.Byte}title(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__string(this.bb_pos+r,t):null}width(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){let t=this.bb.__offset(this.bb_pos,18);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!0}unique(){let t=this.bb.__offset(this.bb_pos,20);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}primaryKey(){let t=this.bb.__offset(this.bb_pos,22);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}metadata(t){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb_pos+r,t):null}static startColumn(t){t.startObject(11)}static addName(t,r){t.addFieldOffset(0,r,0)}static addType(t,r){t.addFieldInt8(1,r,L.Byte)}static addTitle(t,r){t.addFieldOffset(2,r,0)}static addDescription(t,r){t.addFieldOffset(3,r,0)}static addWidth(t,r){t.addFieldInt32(4,r,-1)}static addPrecision(t,r){t.addFieldInt32(5,r,-1)}static addScale(t,r){t.addFieldInt32(6,r,-1)}static addNullable(t,r){t.addFieldInt8(7,Number(r),Number(!0))}static addUnique(t,r){t.addFieldInt8(8,Number(r),Number(!1))}static addPrimaryKey(t,r){t.addFieldInt8(9,Number(r),Number(!1))}static addMetadata(t,r){t.addFieldOffset(10,r,0)}static endColumn(t){let r=t.endObject();return t.requiredField(r,4),r}static createColumn(t,r,i,s,a,n,o,h,f,u,c,d){return T.startColumn(t),T.addName(t,r),T.addType(t,i),T.addTitle(t,s),T.addDescription(t,a),T.addWidth(t,n),T.addPrecision(t,o),T.addScale(t,h),T.addNullable(t,f),T.addUnique(t,u),T.addPrimaryKey(t,c),T.addMetadata(t,d),T.endColumn(t)}};var J=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFeature(t,r){return(r||new J).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFeature(t,r){return t.setPosition(t.position()+4),(r||new J).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){let r=this.bb.__offset(this.bb_pos,4);return r?(t||new D).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}properties(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readUint8(this.bb.__vector(this.bb_pos+r)+t):0}propertiesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}columns(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFeature(t){t.startObject(3)}static addGeometry(t,r){t.addFieldOffset(0,r,0)}static addProperties(t,r){t.addFieldOffset(1,r,0)}static createPropertiesVector(t,r){t.startVector(1,r.length,1);for(let i=r.length-1;i>=0;i--)t.addInt8(r[i]);return t.endVector()}static startPropertiesVector(t,r){t.startVector(1,r,1)}static addColumns(t,r){t.addFieldOffset(2,r,0)}static createColumnsVector(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 startColumnsVector(t,r){t.startVector(4,r,4)}static endFeature(t){return t.endObject()}static finishFeatureBuffer(t,r){t.finish(r)}static finishSizePrefixedFeatureBuffer(t,r){t.finish(r,void 0,!0)}static createFeature(t,r,i,s){return J.startFeature(t),J.addGeometry(t,r),J.addProperties(t,i),J.addColumns(t,s),J.endFeature(t)}};var Om=new TextEncoder,vs=new TextDecoder;function We(e,t){let r={};if(!t||t.length===0)return r;let i=e.propertiesArray();if(!i)return r;let s=new DataView(i.buffer,i.byteOffset),a=e.propertiesLength(),n=0;for(;n<a;){let o=s.getUint16(n,!0);n+=2;let h=t[o],f=h.name;switch(h.type){case L.Bool:{r[f]=Boolean(s.getUint8(n)),n+=1;break}case L.Byte:{r[f]=s.getInt8(n),n+=1;break}case L.UByte:{r[f]=s.getUint8(n),n+=1;break}case L.Short:{r[f]=s.getInt16(n,!0),n+=2;break}case L.UShort:{r[f]=s.getUint16(n,!0),n+=2;break}case L.Int:{r[f]=s.getInt32(n,!0),n+=4;break}case L.UInt:{r[f]=s.getUint32(n,!0),n+=4;break}case L.Long:{r[f]=Number(s.getBigInt64(n,!0)),n+=8;break}case L.ULong:{r[f]=Number(s.getBigUint64(n,!0)),n+=8;break}case L.Float:{r[f]=s.getFloat32(n,!0),n+=4;break}case L.Double:{r[f]=s.getFloat64(n,!0),n+=8;break}case L.DateTime:case L.String:{let u=s.getUint32(n,!0);n+=4,r[f]=vs.decode(i.subarray(n,n+u)),n+=u;break}case L.Json:{let u=s.getUint32(n,!0);n+=4;let c=vs.decode(i.subarray(n,n+u));r[f]=JSON.parse(c),n+=u;break}default:throw new Error(`Unknown type ${h.type}`)}}return r}function Je(e,t){let r=t.columns;return{type:"Feature",geometry:He(e.geometry(),t.geometryType),properties:We(e,r)}}var Kt=new Uint8Array(0);function gs(){return this._source.cancel()}function xr(e,t){if(!e.length)return t;if(!t.length)return e;var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Ms(){var e=this,t=e._array.subarray(e._index);return e._source.read().then(function(r){return e._array=Kt,e._index=0,r.done?t.length>0?{done:!1,value:t}:{done:!0,value:void 0}:{done:!1,value:xr(t,r.value)}})}function xs(e){if((e|=0)<0)throw new Error("invalid length");var t=this,r=this._array.length-this._index;if(this._index+e<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=e));var i=new Uint8Array(e);return i.set(this._array.subarray(this._index)),function s(){return t._source.read().then(function(a){return a.done?(t._array=Kt,t._index=0,r>0?i.subarray(0,r):null):r+a.value.length>=e?(t._array=a.value,t._index=e-r,i.set(a.value.subarray(0,e-r),r),i):(i.set(a.value,r),r+=a.value.length,s())})}()}function wr(e){return typeof e.slice=="function"?e:new Xe(typeof e.read=="function"?e:e.getReader())}function Xe(e){this._source=e,this._array=Kt,this._index=0}Xe.prototype.read=Ms;Xe.prototype.slice=xs;Xe.prototype.cancel=gs;var X=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsCrs(t,r){return(r||new X).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsCrs(t,r){return t.setPosition(t.position()+4),(r||new X).__init(t.readInt32(t.position())+t.position(),t)}org(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}code(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__string(this.bb_pos+r,t):null}wkt(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.__string(this.bb_pos+r,t):null}codeString(t){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb_pos+r,t):null}static startCrs(t){t.startObject(6)}static addOrg(t,r){t.addFieldOffset(0,r,0)}static addCode(t,r){t.addFieldInt32(1,r,0)}static addName(t,r){t.addFieldOffset(2,r,0)}static addDescription(t,r){t.addFieldOffset(3,r,0)}static addWkt(t,r){t.addFieldOffset(4,r,0)}static addCodeString(t,r){t.addFieldOffset(5,r,0)}static endCrs(t){return t.endObject()}static createCrs(t,r,i,s,a,n,o){return X.startCrs(t),X.addOrg(t,r),X.addCode(t,i),X.addName(t,s),X.addDescription(t,a),X.addWkt(t,n),X.addCodeString(t,o),X.endCrs(t)}};var Lt=class{bb=null;bb_pos=0;__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsHeader(t,r){return(r||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsHeader(t,r){return t.setPosition(t.position()+4),(r||new Lt).__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}envelope(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readFloat64(this.bb.__vector(this.bb_pos+r)+t*8):0}envelopeLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}geometryType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):C.Unknown}hasZ(){let t=this.bb.__offset(this.bb_pos,10);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasM(){let t=this.bb.__offset(this.bb_pos,12);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasT(){let t=this.bb.__offset(this.bb_pos,14);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}hasTm(){let t=this.bb.__offset(this.bb_pos,16);return t?Boolean(this.bb.readInt8(this.bb_pos+t)):!1}columns(t,r){let i=this.bb.__offset(this.bb_pos,18);return i?(r||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt("0")}indexNodeSize(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){let r=this.bb.__offset(this.bb_pos,24);return r?(t||new X).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}title(t){let r=this.bb.__offset(this.bb_pos,26);return r?this.bb.__string(this.bb_pos+r,t):null}description(t){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb_pos+r,t):null}metadata(t){let r=this.bb.__offset(this.bb_pos,30);return r?this.bb.__string(this.bb_pos+r,t):null}static startHeader(t){t.startObject(14)}static addName(t,r){t.addFieldOffset(0,r,0)}static addEnvelope(t,r){t.addFieldOffset(1,r,0)}static createEnvelopeVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addFloat64(r[i]);return t.endVector()}static startEnvelopeVector(t,r){t.startVector(8,r,8)}static addGeometryType(t,r){t.addFieldInt8(2,r,C.Unknown)}static addHasZ(t,r){t.addFieldInt8(3,Number(r),Number(!1))}static addHasM(t,r){t.addFieldInt8(4,Number(r),Number(!1))}static addHasT(t,r){t.addFieldInt8(5,Number(r),Number(!1))}static addHasTm(t,r){t.addFieldInt8(6,Number(r),Number(!1))}static addColumns(t,r){t.addFieldOffset(7,r,0)}static createColumnsVector(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 startColumnsVector(t,r){t.startVector(4,r,4)}static addFeaturesCount(t,r){t.addFieldInt64(8,r,BigInt("0"))}static addIndexNodeSize(t,r){t.addFieldInt16(9,r,16)}static addCrs(t,r){t.addFieldOffset(10,r,0)}static addTitle(t,r){t.addFieldOffset(11,r,0)}static addDescription(t,r){t.addFieldOffset(12,r,0)}static addMetadata(t,r){t.addFieldOffset(13,r,0)}static endHeader(t){return t.endObject()}static finishHeaderBuffer(t,r){t.finish(r)}static finishSizePrefixedHeaderBuffer(t,r){t.finish(r,void 0,!0)}};function pe(e){let t=Lt.getRootAsHeader(e),r=t.featuresCount(),i=t.indexNodeSize(),s=[];for(let h=0;h<t.columnsLength();h++){let f=t.columns(h);if(!f)throw new Error("Column unexpectedly missing");if(!f.name())throw new Error("Column name unexpectedly missing");s.push({name:f.name(),type:f.type(),title:f.title(),description:f.description(),width:f.width(),precision:f.precision(),scale:f.scale(),nullable:f.nullable(),unique:f.unique(),primary_key:f.primaryKey()})}let a=t.crs(),n=a?{org:a.org(),code:a.code(),name:a.name(),description:a.description(),wkt:a.wkt(),code_string:a.codeString()}:null;return{geometryType:t.geometryType(),columns:s,envelope:null,featuresCount:Number(r),indexNodeSize:i,crs:n,title:t.title(),description:t.description(),metadata:t.metadata()}}var Ar=function(e,t){return Ar=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},Ar(e,t)};function Oh(e,t){Ar(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Zt(e,t,r,i){function s(a){return a instanceof r?a:new r(function(n){n(a)})}return new(r||(r=Promise))(function(a,n){function o(u){try{f(i.next(u))}catch(c){n(c)}}function h(u){try{f(i.throw(u))}catch(c){n(c)}}function f(u){u.done?a(u.value):s(u.value).then(o,h)}f((i=i.apply(e,t||[])).next())})}function At(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,s,a,n;return n={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function o(f){return function(u){return h([f,u])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,s&&(a=f[0]&2?s.return:f[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,f[1])).done)return a;switch(s=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(u){f=[6,u],s=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Qt(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 be(e){return this instanceof be?(this.v=e,this):new be(e)}function Rh(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,a=[];return s={},n("next"),n("throw"),n("return"),s[Symbol.asyncIterator]=function(){return this},s;function n(d){i[d]&&(s[d]=function(l){return new Promise(function(m,p){a.push([d,l,m,p])>1||o(d,l)})})}function o(d,l){try{h(i[d](l))}catch(m){c(a[0][3],m)}}function h(d){d.value instanceof be?Promise.resolve(d.value.v).then(f,u):c(a[0][2],d)}function f(d){o("next",d)}function u(d){o("throw",d)}function c(d,l){d(l),a.shift(),a.length&&o(a[0][0],a[0][1])}}var As=function(e){Oh(t,e);function t(r){var i=e.call(this,r)||this;return Object.defineProperty(i,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(i,i.constructor.prototype):i.__proto__=i.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(i,i.constructor),i}return t}(Error),ep=function(){function e(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),e.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}(),rp=function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}(),ip=function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){this._q.length<this._c&&this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e}();function Er(e){e!=null&&typeof e.then=="function"&&e.then(Qe,Qe)}var Ir=0,ws=1,Gt=2,$e=3,Sr=4,Ze=1024,Qe=function(){};function $t(e){var t=e.err,r=Promise.resolve(e.execution).then(function(i){if(t!=null)throw t;return i});return e.err=void 0,e.execution=r.then(function(){},function(){}),e.pending===void 0?r:e.pending.then(function(){return r})}function Bt(e,t){var r=e.state>=$e;return Promise.resolve(t).then(function(i){return!r&&e.state>=Sr?$t(e).then(function(s){return{value:s,done:!0}}):{value:i,done:r}})}function Pr(e,t){var r,i;if(!(e.state>=Gt))if(e.state=Gt,e.onnext(),e.onstop(),e.err==null&&(e.err=t),e.pushes.length===0&&(typeof e.buffer>"u"||e.buffer.empty))_e(e);else try{for(var s=Qt(e.pushes),a=s.next();!a.done;a=s.next()){var n=a.value;n.resolve()}}catch(o){r={error:o}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}function _e(e){var t,r;if(!(e.state>=$e)){e.state<Gt&&Pr(e),e.state=$e,e.buffer=void 0;try{for(var i=Qt(e.nexts),s=i.next();!s.done;s=i.next()){var a=s.value,n=e.pending===void 0?$t(e):e.pending.then(function(){return $t(e)});a.resolve(Bt(e,n))}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.pushes=[],e.nexts=[]}}function Is(e){e.state>=Sr||(e.state<$e&&_e(e),e.state=Sr)}function Fh(e,t){if(Er(t),e.pushes.length>=Ze)throw new As("No more than "+Ze+" pending calls to push are allowed on a single repeater.");if(e.state>=Gt)return Promise.resolve(void 0);var r=e.pending===void 0?Promise.resolve(t):e.pending.then(function(){return t});r=r.catch(function(h){e.state<Gt&&(e.err=h),Is(e)});var i;if(e.nexts.length){var s=e.nexts.shift();s.resolve(Bt(e,r)),e.nexts.length?i=Promise.resolve(e.nexts[0].value):i=new Promise(function(h){return e.onnext=h})}else typeof e.buffer<"u"&&!e.buffer.full?(e.buffer.add(r),i=Promise.resolve(void 0)):i=new Promise(function(h){return e.pushes.push({resolve:h,value:r})});var a=!0,n={},o=i.catch(function(h){if(a)throw h});return n.then=function(h,f){return a=!1,Promise.prototype.then.call(i,h,f)},n.catch=function(h){return a=!1,Promise.prototype.catch.call(i,h)},n.finally=i.finally.bind(i),e.pending=r.then(function(){return o}).catch(function(h){e.err=h,Is(e)}),n}function Th(e){var t=Pr.bind(null,e),r=new Promise(function(i){return e.onstop=i});return t.then=r.then.bind(r),t.catch=r.catch.bind(r),t.finally=r.finally.bind(r),t}function Ch(e){if(!(e.state>=ws)){e.state=ws;var t=Fh.bind(null,e),r=Th(e);e.execution=new Promise(function(i){return i(e.executor(t,r))}),e.execution.catch(function(){return Pr(e)})}}var Ke=new WeakMap,Yt=function(){function e(t,r){Ke.set(this,{executor:t,buffer:r,err:void 0,state:Ir,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:Qe,onstop:Qe})}return e.prototype.next=function(t){Er(t);var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=Ze)throw new As("No more than "+Ze+" pending calls to next are allowed on a single repeater.");if(r.state<=Ir&&Ch(r),r.onnext(t),typeof r.buffer<"u"&&!r.buffer.empty){var i=Bt(r,r.buffer.remove());if(r.pushes.length){var s=r.pushes.shift();r.buffer.add(s.value),r.onnext=s.resolve}return i}else if(r.pushes.length){var a=r.pushes.shift();return r.onnext=a.resolve,Bt(r,a.value)}else if(r.state>=Gt)return _e(r),Bt(r,$t(r));return new Promise(function(n){return r.nexts.push({resolve:n,value:t})})},e.prototype.return=function(t){Er(t);var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");return _e(r),r.execution=Promise.resolve(r.execution).then(function(){return t}),Bt(r,$t(r))},e.prototype.throw=function(t){var r=Ke.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=Ir||r.state>=Gt||typeof r.buffer<"u"&&!r.buffer.empty?(_e(r),r.err==null&&(r.err=t),Bt(r,$t(r))):this.next(Promise.reject(t))},e.prototype[Symbol.asyncIterator]=function(){return this},e.race=Lh,e.merge=Bh,e.zip=Gh,e.latest=Uh,e}();function Ye(e,t){var r,i,s=[],a=function(f){f!=null&&typeof f[Symbol.asyncIterator]=="function"?s.push(f[Symbol.asyncIterator]()):f!=null&&typeof f[Symbol.iterator]=="function"?s.push(f[Symbol.iterator]()):s.push(function(){return Rh(this,arguments,function(){return At(this,function(d){switch(d.label){case 0:return t.yieldValues?[4,be(f)]:[3,3];case 1:return[4,d.sent()];case 2:d.sent(),d.label=3;case 3:return t.returnValues?[4,be(f)]:[3,5];case 4:return[2,d.sent()];case 5:return[2]}})})}())};try{for(var n=Qt(e),o=n.next();!o.done;o=n.next()){var h=o.value;a(h)}}catch(f){r={error:f}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return s}function Lh(e){var t=this,r=Ye(e,{returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h,f,u;return At(this,function(c){switch(c.label){case 0:if(!r.length)return s(),[2];n=!1,s.then(function(){a(),n=!0}),c.label=1;case 1:c.trys.push([1,,5,7]),h=void 0,f=0,u=function(){var d,l,m,p,b,g;return At(this,function(x){switch(x.label){case 0:d=f;try{for(l=(b=void 0,Qt(r)),m=l.next();!m.done;m=l.next())p=m.value,Promise.resolve(p.next()).then(function(M){M.done?(s(),o===void 0&&(o=M)):f===d&&(f++,a(M))},function(M){return s(M)})}catch(M){b={error:M}}finally{try{m&&!m.done&&(g=l.return)&&g.call(l)}finally{if(b)throw b.error}}return[4,new Promise(function(M){return a=M})];case 1:return h=x.sent(),h===void 0?[3,3]:[4,i(h.value)];case 2:x.sent(),x.label=3;case 3:return[2]}})},c.label=2;case 2:return n?[3,4]:[5,u()];case 3:return c.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return s(),[4,Promise.race(r.map(function(d){return d.return&&d.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}function Bh(e){var t=this,r=Ye(e,{yieldValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h=this;return At(this,function(f){switch(f.label){case 0:if(!r.length)return s(),[2];a=[],n=!1,s.then(function(){var u,c;n=!0;try{for(var d=Qt(a),l=d.next();!l.done;l=d.next()){var m=l.value;m()}}catch(p){u={error:p}}finally{try{l&&!l.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(r.map(function(u,c){return Zt(h,void 0,void 0,function(){var d,l;return At(this,function(m){switch(m.label){case 0:m.trys.push([0,,6,9]),m.label=1;case 1:return n?[3,5]:(Promise.resolve(u.next()).then(function(p){return a[c](p)},function(p){return s(p)}),[4,new Promise(function(p){a[c]=p})]);case 2:return d=m.sent(),d===void 0?[3,4]:d.done?(o=d,[2]):[4,i(d.value)];case 3:m.sent(),m.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return l=u.return,l?[4,u.return()]:[3,8];case 7:l=m.sent(),m.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return f.sent(),[2,o&&o.value];case 3:return s(),[7];case 4:return[2]}})})})}function Gh(e){var t=this,r=Ye(e,{returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h;return At(this,function(f){switch(f.label){case 0:if(!r.length)return s(),[2,[]];n=!1,s.then(function(){a(),n=!0}),f.label=1;case 1:f.trys.push([1,,6,8]),f.label=2;case 2:return n?[3,5]:(Promise.all(r.map(function(u){return u.next()})).then(function(u){return a(u)},function(u){return s(u)}),[4,new Promise(function(u){return a=u})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(u){return u.value}),o.some(function(u){return u.done})?[2,h]:[4,i(h)]);case 4:return f.sent(),[3,2];case 5:return[3,8];case 6:return s(),[4,Promise.all(r.map(function(u){return u.return&&u.return()}))];case 7:return f.sent(),[7];case 8:return[2]}})})})}function Uh(e){var t=this,r=Ye(e,{yieldValues:!0,returnValues:!0});return new Yt(function(i,s){return Zt(t,void 0,void 0,function(){var a,n,o,h,f,u=this;return At(this,function(c){switch(c.label){case 0:if(!r.length)return s(),[2,[]];n=[],o=!1,s.then(function(){var d,l;a();try{for(var m=Qt(n),p=m.next();!p.done;p=m.next()){var b=p.value;b()}}catch(g){d={error:g}}finally{try{p&&!p.done&&(l=m.return)&&l.call(m)}finally{if(d)throw d.error}}o=!0}),c.label=1;case 1:return c.trys.push([1,,5,7]),Promise.all(r.map(function(d){return d.next()})).then(function(d){return a(d)},function(d){return s(d)}),[4,new Promise(function(d){return a=d})];case 2:return h=c.sent(),h===void 0?[2]:(f=h.map(function(d){return d.value}),h.every(function(d){return d.done})?[2,f]:[4,i(f.slice())]);case 3:return c.sent(),[4,Promise.all(r.map(function(d,l){return Zt(u,void 0,void 0,function(){var m;return At(this,function(p){switch(p.label){case 0:if(h[l].done)return[2,h[l].value];p.label=1;case 1:return o?[3,4]:(Promise.resolve(d.next()).then(function(b){return n[l](b)},function(b){return s(b)}),[4,new Promise(function(b){return n[l]=b})]);case 2:return m=p.sent(),m===void 0?[2,h[l].value]:m.done?[2,m.value]:(f[l]=m.value,[4,i(f.slice())]);case 3:return p.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,c.sent()];case 5:return s(),[4,Promise.all(r.map(function(d){return d.return&&d.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}var Nr=class{_extraRequestThreshold=256*1024;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(t){if(t<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=t}},Et=Nr;Ut(Et,"global",new Nr);var lt;(function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error"})(lt||(lt={}));var O=class{static debug(...t){this.log(lt.Debug,...t)}static info(...t){this.log(lt.Info,...t)}static warn(...t){this.log(lt.Warn,...t)}static error(...t){this.log(lt.Error,...t)}static log(t,...r){if(!(this.logLevel>t))switch(t){case lt.Debug:{console.debug(...r);break}case lt.Info:{console.info(...r);break}case lt.Warn:{console.warn(...r);break}case lt.Error:{console.error(...r);break}}}};Ut(O,"logLevel",lt.Warn);var St=8*4+8;var Es=16;function ye(e,t){t=Math.min(Math.max(Number(t),2),65535);let r=e,i=r;do r=Math.ceil(r/t),i+=r;while(r!==1);return i*St}function zh(e,t){if(t<2)throw new Error("Node size must be at least 2");if(e===0)throw new Error("Number of items must be greater than 0");let r=e,i=r,s=[r];do r=Math.ceil(r/t),i+=r,s.push(r);while(r!==1);let a=[];r=i;for(let o of s)a.push(r-o),r-=o;let n=[];for(let o=0;o<s.length;o++)n.push([a[o],a[o]+s[o]]);return n}async function*Ss(e,t,r,i){class s{_level;nodes;constructor(m,p){this._level=p,this.nodes=m}level(){return this._level}startNodeIdx(){return this.nodes[0]}endNodeIdx(){return this.nodes[1]}extendEndNodeIdx(m){console.assert(m>this.nodes[1]),this.nodes[1]=m}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}let{minX:a,minY:n,maxX:o,maxY:h}=r;O.info(`tree items: ${e}, nodeSize: ${t}`);let f=zh(e,t),u=f[0][0],d=[(()=>{let l=[0,1],m=f.length-1;return new s(l,m)})()];for(O.debug(`starting stream search with queue: ${d}, numItems: ${e}, nodeSize: ${t}, levelBounds: ${f}`);d.length!=0;){let l=d.shift();O.debug(`popped node: ${l}, queueLength: ${d.length}`);let m=l.startNodeIdx(),p=m>=u,b=(()=>{let[,S]=f[l.level()],I=Math.min(l.endNodeIdx()+t,S);return p&&I<S?I+1:I})(),g=b-m,x=await i(m*St,g*St),M=new DataView(x);for(let S=m;S<b;S++){let I=S-m,A=I*St;if(o<M.getFloat64(A+0,!0)||h<M.getFloat64(A+8,!0)||a>M.getFloat64(A+16,!0)||n>M.getFloat64(A+24,!0))continue;let B=M.getBigUint64(A+32,!0);if(p){let pt=B,ie=(()=>{if(S<e-1){let Ws=(I+1)*St;return M.getBigUint64(Ws+32,!0)-pt}return null})(),Hs=S-u;yield[Number(pt),Hs,Number(ie)];continue}let N=B,Y=Et.global.extraRequestThreshold()/St,q=d[d.length-1];if(q!==void 0&&q.level()==l.level()-1&&N<q.endNodeIdx()+Y){O.debug(`Merging "nodeRange" request into existing range: ${q}, newEndNodeIdx: ${q.endNodeIdx()} -> ${N}`),q.extendEndNodeIdx(Number(N));continue}let it=(()=>{let pt=l.level()-1,ie=[Number(N),Number(N)+1];return new s(ie,pt)})();q!==void 0&&q.level()==it.level()?O.info(`Same level, but too far away. Pushing new request for nodeIdx: ${N} rather than merging with distant ${q}`):O.info(`Pushing new level for ${it} onto queue with nearestNodeRange: ${q} since there's not already a range for this level.`),d.push(it)}}}var mt=new Uint8Array([102,103,98,3,102,103,98,0]),ct=4;var te=class{headerClient;header;headerLength;indexLength;constructor(t,r,i,s){this.headerClient=t,this.header=r,this.headerLength=i,this.indexLength=s}static async open(t){let i=new tr(t),s=(()=>{let c=Es,d=3,l=0,m;for(m=0;m<d;m++){let p=c**m*St;l+=p}return l})(),a=2024+s;O.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${s})`);{let c=new Uint8Array(await i.getRange(0,8,a,"header"));if(!c.subarray(0,3).every((d,l)=>mt[l]===d))throw O.error(`bytes: ${c} != ${mt}`),new Error("Not a FlatGeobuf file");O.debug("magic bytes look good")}let n;{let c=await i.getRange(8,4,a,"header");n=new DataView(c).getUint32(0,!0);let d=1048576*10;if(n>d||n<8)throw new Error("Invalid header size");O.debug(`headerLength: ${n}`)}let o=await i.getRange(12,n,a,"header"),h=new W(new Uint8Array(o)),f=pe(h),u=ye(f.featuresCount,f.indexNodeSize);return O.debug("completed: opening http reader"),new te(i,f,n,u)}async*selectBbox(t){let r=this.lengthBeforeTree(),i=this.headerClient,s=async function(h,f){return i.getRange(r+h,f,0,"index")},a=[],n=[];for await(let h of Ss(this.header.featuresCount,this.header.indexNodeSize,t,s)){let[f,,]=h,[,,u]=h;if(u||(O.info("final feature"),u=4),n.length==0){n.push([f,u]);continue}let c=n[n.length-1],d=f-(c[0]+c[1]);d>Et.global.extraRequestThreshold()&&(O.info(`Pushing new feature batch, since gap ${d} was too large`),a.push(n),n=[]),n.push([f,u])}this.headerClient.logUsage("header+index"),n.length>0&&a.push(n);let o=a.flatMap(h=>this.readFeatureBatch(h));yield*Yt.merge(o)}lengthBeforeTree(){return mt.length+ct+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new tr(this.headerClient.httpClient)}async*readFeatureBatch(t){let[r]=t[0],[i,s]=t[t.length-1],a=r,o=i+s-a,h=this.buildFeatureClient(),f=o;for(let[u]of t)yield await this.readFeature(h,u,f),f=0;h.logUsage("feature")}async readFeature(t,r,i){let s=r+this.lengthBeforeFeatures(),a;{let u=await t.getRange(s,4,i,"feature length");a=new DataView(u).getUint32(0,!0)}let n=await t.getRange(s+4,a,i,"feature data"),o=new Uint8Array(n),h=new Uint8Array(a+ct);h.set(o,ct);let f=new W(h);return f.setPosition(ct),J.getRootAsFeature(f)}},tr=class{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(t){if(typeof t=="string")this.httpClient=new er(t);else if(t instanceof er)this.httpClient=t;else throw new Error("Unknown source ")}async getRange(t,r,i,s){this.bytesEverUsed+=r;let a=t-this.head,n=a+r;if(a>=0&&n<=this.buffer.byteLength)return this.buffer.slice(a,n);let o=Math.max(r,i);return this.bytesEverFetched+=o,O.debug(`requesting for new Range: ${t}-${t+o-1}`),this.buffer=await this.httpClient.getRange(t,o,s),this.head=t,this.buffer.slice(0,r)}logUsage(t){let r=t.split(" ")[0],i=this.bytesEverUsed,s=this.bytesEverFetched,a=(100*i/s).toFixed(2);O.info(`${r} bytes used/requested: ${i} / ${s} = ${a}%`)}},er=class{url;requestsEverMade=0;bytesEverRequested=0;constructor(t){this.url=t}async getRange(t,r,i){this.requestsEverMade+=1,this.bytesEverRequested+=r;let s=`bytes=${t}-${t+r-1}`;return O.info(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${r}, ever: ${this.bytesEverRequested}), Range: ${s}`),(await fetch(this.url,{headers:{Range:s}})).arrayBuffer()}};function rr(e,t,r){if(!e.subarray(0,3).every((u,c)=>mt[c]===u))throw new Error("Not a FlatGeobuf file");let i=new W(e),s=i.readUint32(mt.length);i.setPosition(mt.length+ct);let a=pe(i);r&&r(a);let n=mt.length+ct+s,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=ye(h,o));let f=[];for(;n<i.capacity();){let u=i.readUint32(n);i.setPosition(n+ct);let c=J.getRootAsFeature(i);f.push(t(c,a)),n+=ct+u}return f}async function*ir(e,t,r){let i=wr(e),s=async d=>await i.slice(d),a=new Uint8Array(await s(8,"magic bytes"));if(!a.subarray(0,3).every((d,l)=>mt[l]===d))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await s(4,"header length"));let n=new W(a),o=n.readUint32(0);a=new Uint8Array(await s(o,"header data")),n=new W(a);let h=pe(n);r&&r(h);let{indexNodeSize:f,featuresCount:u}=h;if(f>0){let d=ye(u,f);await s(d,"entire index, w/o rect")}let c;for(;c=await qh(s,h,t);)yield c}async function*sr(e,t,r,i){let s=await te.open(e);O.debug("opened reader"),i&&i(s.header);for await(let a of s.selectBbox(t))yield r(a,s.header)}async function qh(e,t,r){let i=new Uint8Array(await e(4,"feature length"));if(i.byteLength===0)return;let s=new W(i),a=s.readUint32(0);i=new Uint8Array(await e(a,"feature data"));let n=new Uint8Array(a+4);n.set(i,4),s=new W(n),s.setPosition(ct);let o=J.getRootAsFeature(s);return r(o,t)}function Ps(e,t){return{type:"FeatureCollection",features:rr(e,Je,t)}}function Ns(e,t){return ir(e,Je,t)}function Os(e,t,r){return sr(e,t,Je,r)}function Rs(e,t,r){return e instanceof Uint8Array?Ps(e,r):e instanceof ReadableStream?Ns(e,r):Os(e,t,r)}function Fs(e,t,r){return e instanceof Uint8Array?rr(e,t):e instanceof ReadableStream?ir(e,t):sr(e,r,t)}var Cs=Rs,Ls=Fs;function Bs(e,t){let r=t.shape;switch(r){case"geojson-table":return jh(e,t);case"columnar-table":return{shape:"columnar-table",data:Ts(e,t)};case"binary":return Ts(e,t);default:throw new Error(r)}}function Ts(e,t={}){let r=new Uint8Array(e);return Ls(r,gr)}function jh(e,t){if(e.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:r=!1,crs:i="WGS84"}=t,s=new Uint8Array(e),a,n,o=t.boundingBox&&Us(t.boundingBox),{features:h}=Cs(s,o,c=>{a=c,n=bs(a)}),f=a?.crs?.wkt,u;if(r&&f)try{u=new Jt({from:f,to:i})}catch{}return u&&(h=De(h,c=>u.project(c))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:h}}function Gs(e,t){let r=t.shape;switch(r){case"binary":return Vh(e,t);case"geojson-table":return Hh(e,t);default:throw new Error(r)}}function Vh(e,t){let r=t.boundingBox&&Us(t.boundingBox);return Ls(e,Wh,r)}async function*Hh(e,t){let{reproject:r=!1,crs:i="WGS84"}=t||{},s,a=Cs(e,void 0,h=>{s=h}),n,o=!0;for await(let h of a){if(o){let f=s?.crs?.wkt;r&&f&&(n=new Jt({from:f,to:i})),o=!1}r&&n?yield De([h],f=>n.project(f)):yield h}}function Us(e){return{minX:e[0][0],minY:e[0][1],maxX:e[1][0],maxY:e[1][1]}}function Wh(e,t){let r=e.geometry(),i=t.geometryType||r?.type(),s=gr(r,i);return s.properties=We(e,t.columns),s}var Jh="4.4.0-alpha.18",Xh=[102,103,98,3,102,103,98,1],Or={...zt,dataType:null,batchType:null,version:Jh,worker:!0,tests:[new Uint8Array(Xh).buffer],options:{flatgeobuf:{shape:"geojson-table"},gis:{reproject:!1}}},ee={...Or,parse:async(e,t={})=>zs(e,t),parseSync:zs,parseInBatchesFromStream:Kh,binary:!0};function zs(e,t={}){return Bs(e,qs(t))}function Kh(e,t){return Gs(e,qs(t))}function qs(e){return e={...e,flatgeobuf:{...ee.options.flatgeobuf,...e?.flatgeobuf},gis:{...ee.options.gis,...e?.gis}},{shape:e?.flatgeobuf?.shape??"geojson-table",boundingBox:e?.flatgeobuf?.boundingBox,crs:e?.gis?._targetCrs||"WGS84",reproject:e?.gis?.reproject||!1}}function Ds(e,t){return ks(e||{},t)}function ks(e,t,r=0){if(r>3)return t;let i={...e};for(let[s,a]of Object.entries(t))a&&typeof a=="object"&&!Array.isArray(a)?i[s]=ks(i[s]||{},t[s],r+1):i[s]=t[s];return i}var $h="",js={};function Vs(e){for(let t in js)if(e.startsWith(t)){let r=js[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${$h}${e}`),e}var Rr=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(t,r,i){i?this.options=Ds({...i,core:Rr.defaultOptions},r):this.options={...r},this.data=t,this.url=typeof t=="string"?Vs(t):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=Zh(this.loadOptions)}setProps(t){this.options=Object.assign(this.options,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}},re=Rr;Ut(re,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function Zh(e){let t=e?.core?.fetch;if(t&&typeof t=="function")return(i,s)=>t(i,s);let r=e?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Tr={...zt,version:"0.0.0",type:"flatgeobuf-server",fromUrl:!0,fromBlob:!1,defaultOptions:{flatgeobuf:{}},testURL:e=>e.toLowerCase().includes("FeatureServer"),createDataSource:(e,t)=>new Fr(e,t)},Fr=class extends re{formatSpecificMetadata=null;constructor(t,r){super(t,r,Tr.defaultOptions)}async getSchema(){return await this.getMetadata({formatSpecificMetadata:!0}),{metadata:{},fields:[]}}async getMetadata(t){return this.formatSpecificMetadata,t.formatSpecificMetadata,{}}async getFeatures(t){let i=await(await this.fetch(this.url)).arrayBuffer();return await ee.parse(i,{})}};return ra(ve);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
@repeaterjs/repeater/repeater.js:
|
|
@@ -5,7 +5,7 @@ import { parseFlatGeobuf, parseFlatGeobufInBatches } from "./lib/parse-flatgeobu
|
|
|
5
5
|
import { FlatGeobufFormat } from "./flatgeobuf-format.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.18" !== 'undefined' ? "4.4.0-alpha.18" : 'latest';
|
|
9
9
|
// FGB\3FGB\1
|
|
10
10
|
const FGB_MAGIC_NUMBER = [0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x01];
|
|
11
11
|
/** Load flatgeobuf on a worker */
|
|
@@ -9441,7 +9441,7 @@
|
|
|
9441
9441
|
}
|
|
9442
9442
|
|
|
9443
9443
|
// src/flatgeobuf-loader.ts
|
|
9444
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
9444
|
+
var VERSION = true ? "4.4.0-alpha.18" : "latest";
|
|
9445
9445
|
var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
|
|
9446
9446
|
var FlatGeobufWorkerLoader = {
|
|
9447
9447
|
...FlatGeobufFormat,
|
package/dist/index.cjs
CHANGED
|
@@ -1859,7 +1859,7 @@ function binaryFromFeature(feature, header) {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
1861
1861
|
// dist/flatgeobuf-loader.js
|
|
1862
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
1862
|
+
var VERSION = true ? "4.4.0-alpha.18" : "latest";
|
|
1863
1863
|
var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
|
|
1864
1864
|
var FlatGeobufWorkerLoader = {
|
|
1865
1865
|
...FlatGeobufFormat,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/flatgeobuf",
|
|
3
3
|
"description": "Loader for FlatGeobuf",
|
|
4
|
-
"version": "4.4.0-alpha.
|
|
4
|
+
"version": "4.4.0-alpha.18",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"build-worker": "esbuild src/workers/flatgeobuf-worker.ts --bundle --outfile=dist/flatgeobuf-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@loaders.gl/gis": "4.4.0-alpha.
|
|
51
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
52
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
50
|
+
"@loaders.gl/gis": "4.4.0-alpha.18",
|
|
51
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.18",
|
|
52
|
+
"@loaders.gl/schema": "4.4.0-alpha.18",
|
|
53
53
|
"@math.gl/proj4": "^4.1.0",
|
|
54
54
|
"flatgeobuf": "3.27.2"
|
|
55
55
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6f37278ba24a83a68a1a081389eaef2ffac1ff09"
|
|
63
63
|
}
|