@loaders.gl/flatgeobuf 4.2.0-alpha.5 → 4.2.0-alpha.6
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.dev.js +34 -33
- package/dist/dist.min.js +2 -2
- package/dist/flatgeobuf/3.27.2/config.js +3 -6
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js +2 -4
- package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js +2 -4
- package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js +2 -4
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js +2 -4
- package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js +2 -4
- package/dist/flatgeobuf/3.27.2/http-reader.js +14 -8
- package/dist/flatgeobuf/3.27.2/logger.js +2 -3
- package/dist/flatgeobuf/3.27.2/packedrtree.js +2 -0
- package/dist/flatgeobuf-loader.js +1 -1
- package/dist/flatgeobuf-worker.js +40 -35
- package/dist/index.cjs +56 -54
- package/dist/index.cjs.map +2 -2
- package/package.json +5 -4
- package/src/flatgeobuf/3.27.2/.DS_Store +0 -0
package/dist/dist.min.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Pr=Object.create;var be=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var Ar=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Or=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fr=(t,e)=>{for(var s in e)be(t,s,{get:e[s],enumerable:!0})},pe=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sr(e))!Nr.call(t,r)&&r!==s&&be(t,r,{get:()=>e[r],enumerable:!(i=Er(e,r))||i.enumerable});return t},_e=(t,e,s)=>(pe(t,e,"default"),s&&pe(s,e,"default")),Lr=(t,e,s)=>(s=t!=null?Pr(Ar(t)):{},pe(e||!t||!t.__esModule?be(s,"default",{value:t,enumerable:!0}):s,t)),Rr=t=>pe(be({},"__esModule",{value:!0}),t);var Ss=Or((Eh,Es)=>{Es.exports=globalThis.loaders});var me={};Fr(me,{FlatGeobufLoader:()=>xr,FlatGeobufWorkerLoader:()=>Ps});_e(me,Lr(Ss(),1));function wt(t){return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(t)}function es(t,e){if(wt(t)!=="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var i=s.call(t,e||"default");if(wt(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ss(t){var e=es(t,"string");return wt(e)==="symbol"?e:String(e)}function is(t,e,s){return e=ss(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function As(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var it=1,rt=2,Ns=4,te=5,At=484813681109536e-20,b=Math.PI/2,Os=.16666666666666666,Fs=.04722222222222222,Ls=.022156084656084655,v=1e-10,U=.017453292519943295,at=57.29577951308232,E=Math.PI/4,ee=Math.PI*2,O=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 Rs={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var Cs=/[\s_\-\/\(\)]/g;function $(t,e){if(t[e])return t[e];for(var s=Object.keys(t),i=e.toLowerCase().replace(Cs,""),r=-1,a,n;++r<s.length;)if(a=s[r],n=a.toLowerCase().replace(Cs,""),n===i)return t[a]}function se(t){var e={},s=t.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,r,a,n={proj:"projName",datum:"datumCode",rf:function(o){e.rf=parseFloat(o)},lat_0:function(o){e.lat0=o*U},lat_1:function(o){e.lat1=o*U},lat_2:function(o){e.lat2=o*U},lat_ts:function(o){e.lat_ts=o*U},lon_0:function(o){e.long0=o*U},lon_1:function(o){e.long1=o*U},lon_2:function(o){e.long2=o*U},alpha:function(o){e.alpha=parseFloat(o)*U},lonc:function(o){e.longc=o*U},x_0:function(o){e.x0=parseFloat(o)},y_0:function(o){e.y0=parseFloat(o)},k_0:function(o){e.k0=parseFloat(o)},k:function(o){e.k0=parseFloat(o)},a:function(o){e.a=parseFloat(o)},b:function(o){e.b=parseFloat(o)},r_a:function(){e.R_A=!0},zone:function(o){e.zone=parseInt(o,10)},south:function(){e.utmSouth=!0},towgs84:function(o){e.datum_params=o.split(",").map(function(h){return parseFloat(h)})},to_meter:function(o){e.to_meter=parseFloat(o)},units:function(o){e.units=o;var h=$(Rs,o);h&&(e.to_meter=h.to_meter)},from_greenwich:function(o){e.from_greenwich=o*U},pm:function(o){var h=$(V,o);e.from_greenwich=(h||parseFloat(o))*U},nadgrids:function(o){o==="@null"?e.datumCode="none":e.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&&(e.axis=o)}};for(i in s)r=s[i],i in n?(a=n[i],typeof a=="function"?a(r):e[a]=r):e[i]=r;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}var Ts=Ur,ie=1,Bs=2,Us=3,ve=4,zs=5,rs=-1,Cr=/\s/,Tr=/[A-Za-z]/,Br=/[A-Za-z84_]/,ye=/[,\]]/,qs=/[\d\.E\-\+]/;function pt(t){if(typeof t!="string")throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=ie}pt.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==ve)for(;Cr.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case ie:return this.neutral(t);case Bs:return this.keyword(t);case ve:return this.quoted(t);case zs:return this.afterquote(t);case Us:return this.number(t);case rs:return}};pt.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=ve;return}if(ye.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};pt.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=ie;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=ie,this.currentObject=this.stack.pop(),this.currentObject||(this.state=rs);return}};pt.prototype.number=function(t){if(qs.test(t)){this.word+=t;return}if(ye.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};pt.prototype.quoted=function(t){if(t==='"'){this.state=zs;return}this.word+=t};pt.prototype.keyword=function(t){if(Br.test(t)){this.word+=t;return}if(t==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=ie;return}if(ye.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};pt.prototype.neutral=function(t){if(Tr.test(t)){this.word=t,this.state=Bs;return}if(t==='"'){this.word="",this.state=ve;return}if(qs.test(t)){this.word=t,this.state=Us;return}if(ye.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};pt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===rs)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Ur(t){var e=new pt(t);return e.output()}function Gs(t,e,s){Array.isArray(e)&&(s.unshift(e),e=null);var i=e?{}:t,r=s.reduce(function(a,n){return Nt(n,a),a},i);e&&(t[e]=r)}function Nt(t,e){if(!Array.isArray(t)){e[t]=!0;return}var s=t.shift();if(s==="PARAMETER"&&(s=t.shift()),t.length===1){if(Array.isArray(t[0])){e[s]={},Nt(t[0],e[s]);return}e[s]=t[0];return}if(!t.length){e[s]=!0;return}if(s==="TOWGS84"){e[s]=t;return}if(s==="AXIS"){s in e||(e[s]=[]),e[s].push(t);return}Array.isArray(s)||(e[s]={});var i;switch(s){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[s]={name:t[0].toLowerCase(),convert:t[1]},t.length===3&&Nt(t[2],e[s]);return;case"SPHEROID":case"ELLIPSOID":e[s]={name:t[0],a:t[1],rf:t[2]},t.length===4&&Nt(t[3],e[s]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":t[0]=["name",t[0]],Gs(e,s,t);return;default:for(i=-1;++i<t.length;)if(!Array.isArray(t[i]))return Nt(t,e[s]);return Gs(e,s,t)}}var zr=.017453292519943295;function qr(t,e){var s=e[0],i=e[1];!(s in t)&&i in t&&(t[s]=t[i],e.length===3&&(t[s]=e[2](t[s])))}function bt(t){return t*zr}function Gr(t){if(t.type==="GEOGCS"?t.projName="longlat":t.type==="LOCAL_CS"?(t.projName="identity",t.local=!0):typeof t.PROJECTION=="object"?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var e="",s=0,i=t.AXIS.length;s<i;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?e+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?e+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?e+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(t.axis=e)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.UNIT.convert&&(t.type==="GEOGCS"?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var a=t.GEOGCS;t.type==="GEOGCS"&&(a=t),a&&(a.DATUM?t.datumCode=a.DATUM.name.toLowerCase():t.datumCode=a.name.toLowerCase(),t.datumCode.slice(0,2)==="d_"&&(t.datumCode=t.datumCode.slice(2)),(t.datumCode==="new_zealand_geodetic_datum_1949"||t.datumCode==="new_zealand_1949")&&(t.datumCode="nzgd49"),(t.datumCode==="wgs_1984"||t.datumCode==="world_geodetic_system_1984")&&(t.PROJECTION==="Mercator_Auxiliary_Sphere"&&(t.sphere=!0),t.datumCode="wgs84"),t.datumCode.slice(-6)==="_ferro"&&(t.datumCode=t.datumCode.slice(0,-6)),t.datumCode.slice(-8)==="_jakarta"&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(t.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),t.ellps.toLowerCase().slice(0,13)==="international"&&(t.ellps="intl"),t.a=a.DATUM.SPHEROID.a,t.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(t.datum_params=a.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),t.datumCode==="ch1903+"&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a);function n(f){var l=t.to_meter||1;return f*l}var o=function(f){return qr(t,f)},h=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",bt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",bt],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",bt],["lat0","latitude_of_origin",bt],["lat0","standard_parallel_1",bt],["lat1","standard_parallel_1",bt],["lat2","standard_parallel_2",bt],["azimuth","Azimuth"],["alpha","azimuth",bt],["srsCode","name"]];h.forEach(o),!t.long0&&t.longc&&(t.projName==="Albers_Conic_Equal_Area"||t.projName==="Lambert_Azimuthal_Equal_Area")&&(t.long0=t.longc),!t.lat_ts&&t.lat1&&(t.projName==="Stereographic_South_Pole"||t.projName==="Polar Stereographic (variant B)")&&(t.lat0=bt(t.lat1>0?90:-90),t.lat_ts=t.lat1)}function Me(t){var e=Ts(t),s=e.shift(),i=e.shift();e.unshift(["name",i]),e.unshift(["type",s]);var r={};return Nt(e,r),Gr(r),r}function tt(t){var e=this;if(arguments.length===2){var s=arguments[1];typeof s=="string"?s.charAt(0)==="+"?tt[t]=se(arguments[1]):tt[t]=Me(arguments[1]):tt[t]=s}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(i){Array.isArray(i)?tt.apply(e,i):tt(i)});if(typeof t=="string"){if(t in tt)return tt[t]}else"EPSG"in t?tt["EPSG:"+t.EPSG]=t:"ESRI"in t?tt["ESRI:"+t.ESRI]=t:"IAU2000"in t?tt["IAU2000:"+t.IAU2000]=t:console.log(t);return}}As(tt);var zt=tt;function Dr(t){return typeof t=="string"}function jr(t){return t in zt}var kr=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Vr(t){return kr.some(function(e){return t.indexOf(e)>-1})}var Hr=["3857","900913","3785","102113"];function Wr(t){var e=$(t,"authority");if(e){var s=$(e,"epsg");return s&&Hr.indexOf(s)>-1}}function Xr(t){var e=$(t,"extension");if(e)return $(e,"proj4")}function Jr(t){return t[0]==="+"}function Zr(t){if(Dr(t)){if(jr(t))return zt[t];if(Vr(t)){var e=Me(t);if(Wr(e))return zt["EPSG:3857"];var s=Xr(e);return s?se(s):e}if(Jr(t))return se(t)}else return t}var Ds=Zr;function as(t,e){t=t||{};var s,i;if(!e)return t;for(i in e)s=e[i],s!==void 0&&(t[i]=s);return t}function k(t,e,s){var i=t*e;return s/Math.sqrt(1-i*i)}function ut(t){return t<0?-1:1}function y(t){return Math.abs(t)<=O?t:t-ut(t)*ee}function H(t,e,s){var i=t*s,r=.5*t;return i=Math.pow((1-i)/(1+i),r),Math.tan(.5*(b-e))/i}function _t(t,e){for(var s=.5*t,i,r,a=b-2*Math.atan(e),n=0;n<=15;n++)if(i=t*Math.sin(a),r=b-2*Math.atan(e*Math.pow((1-i)/(1+i),s))-a,a+=r,Math.abs(r)<=1e-10)return a;return-9999}function Qr(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=k(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function $r(t){var e=t.x,s=t.y;if(s*at>90&&s*at<-90&&e*at>180&&e*at<-180)return null;var i,r;if(Math.abs(Math.abs(s)-b)<=v)return null;if(this.sphere)i=this.x0+this.a*this.k0*y(e-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(E+.5*s));else{var a=Math.sin(s),n=H(this.e,s,a);i=this.x0+this.a*this.k0*y(e-this.long0),r=this.y0-this.a*this.k0*Math.log(n)}return t.x=i,t.y=r,t}function Kr(t){var e=t.x-this.x0,s=t.y-this.y0,i,r;if(this.sphere)r=b-2*Math.atan(Math.exp(-s/(this.a*this.k0)));else{var a=Math.exp(-s/(this.a*this.k0));if(r=_t(this.e,a),r===-9999)return null}return i=y(this.long0+e/(this.a*this.k0)),t.x=i,t.y=r,t}var Yr=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],js={init:Qr,forward:$r,inverse:Kr,names:Yr};function ta(){}function ks(t){return t}var ea=["longlat","identity"],Vs={init:ta,forward:ks,inverse:ks,names:ea};var sa=[js,Vs],ge={},xe=[];function Hs(t,e){var s=xe.length;return t.names?(xe[s]=t,t.names.forEach(function(i){ge[i.toLowerCase()]=s}),this):(console.log(e),!0)}function ia(t){if(!t)return!1;var e=t.toLowerCase();if(typeof ge[e]<"u"&&xe[ge[e]])return xe[ge[e]]}function ra(){sa.forEach(Hs)}var Ws={start:ra,add:Hs,get:ia};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 Xs=w.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};w.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Js(t,e,s,i){var r=t*t,a=e*e,n=(r-a)/r,o=0;i?(t*=1-n*(Os+n*(Fs+n*Ls)),r=t*t,n=0):o=Math.sqrt(n);var h=(r-a)/a;return{es:n,e:o,ep2:h}}function Zs(t,e,s,i,r){if(!t){var a=$(w,i);a||(a=Xs),t=a.a,e=a.b,s=a.rf}return s&&!e&&(e=(1-1/s)*t),(s===0||Math.abs(t-e)<v)&&(r=!0,e=t),{a:t,b:e,rf:s,sphere:r}}var z={};z.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};z.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};z.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};z.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};z.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};z.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};z.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};z.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};z.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};z.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};z.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};z.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};z.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};z.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};z.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};z.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};z.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function aa(t,e,s,i,r,a){var n={};return t===void 0||t==="none"?n.datum_type=te:n.datum_type=Ns,e&&(n.datum_params=e.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=it),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=rt,n.datum_params[3]*=At,n.datum_params[4]*=At,n.datum_params[5]*=At,n.datum_params[6]=n.datum_params[6]/1e6+1)),n.a=s,n.b=i,n.es=r,n.ep2=a,n}var Qs=aa;function qt(t,e){if(!(this instanceof qt))return new qt(t);e=e||function(h){if(h)throw h};var s=Ds(t);if(typeof s!="object"){e(t);return}var i=qt.projections.get(s.projName);if(!i){e(t);return}if(s.datumCode&&s.datumCode!=="none"){var r=$(z,s.datumCode);r&&(s.datum_params=r.towgs84?r.towgs84.split(","):null,s.ellps=r.ellipse,s.datumName=r.datumName?r.datumName:s.datumCode)}s.k0=s.k0||1,s.axis=s.axis||"enu",s.ellps=s.ellps||"wgs84";var a=Zs(s.a,s.b,s.rf,s.ellps,s.sphere),n=Js(a.a,a.b,a.rf,s.R_A),o=s.datum||Qs(s.datumCode,s.datum_params,a.a,a.b,n.es,n.ep2);as(this,s),as(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(),e(null,this)}qt.projections=Ws;qt.projections.start();var It=qt;function $s(t,e){return t.datum_type!==e.datum_type||t.a!==e.a||Math.abs(t.es-e.es)>5e-11?!1:t.datum_type===it?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type===rt?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]:!0}function we(t,e,s){var i=t.x,r=t.y,a=t.z?t.z:0,n,o,h,f;if(r<-b&&r>-1.001*b)r=-b;else if(r>b&&r<1.001*b)r=b;else{if(r<-b)return{x:-1/0,y:-1/0,z:t.z};if(r>b)return{x:1/0,y:1/0,z:t.z}}return i>Math.PI&&(i-=2*Math.PI),o=Math.sin(r),f=Math.cos(r),h=o*o,n=s/Math.sqrt(1-e*h),{x:(n+a)*f*Math.cos(i),y:(n+a)*f*Math.sin(i),z:(n*(1-e)+a)*o}}function Ie(t,e,s,i){var r=1e-12,a=r*r,n=30,o,h,f,l,u,c,m,d,p,_,M,x,g,S=t.x,I=t.y,P=t.z?t.z:0,B,N,Y;if(o=Math.sqrt(S*S+I*I),h=Math.sqrt(S*S+I*I+P*P),o/s<r){if(B=0,h/s<r)return N=b,Y=-i,{x:t.x,y:t.y,z:t.z}}else B=Math.atan2(I,S);f=P/h,l=o/h,u=1/Math.sqrt(1-e*(2-e)*l*l),d=l*(1-e)*u,p=f*u,g=0;do g++,m=s/Math.sqrt(1-e*p*p),Y=o*d+P*p-m*(1-e*p*p),c=e*m/(m+Y),u=1/Math.sqrt(1-c*(2-c)*l*l),_=l*(1-c)*u,M=f*u,x=M*d-_*p,d=_,p=M;while(x*x>a&&g<n);return N=Math.atan(M/Math.abs(_)),{x:B,y:N,z:Y}}function Ks(t,e,s){if(e===it)return{x:t.x+s[0],y:t.y+s[1],z:t.z+s[2]};if(e===rt){var i=s[0],r=s[1],a=s[2],n=s[3],o=s[4],h=s[5],f=s[6];return{x:f*(t.x-h*t.y+o*t.z)+i,y:f*(h*t.x+t.y-n*t.z)+r,z:f*(-o*t.x+n*t.y+t.z)+a}}}function Ys(t,e,s){if(e===it)return{x:t.x-s[0],y:t.y-s[1],z:t.z-s[2]};if(e===rt){var i=s[0],r=s[1],a=s[2],n=s[3],o=s[4],h=s[5],f=s[6],l=(t.x-i)/f,u=(t.y-r)/f,c=(t.z-a)/f;return{x:l+h*u-o*c,y:-h*l+u+n*c,z:o*l-n*u+c}}}function Pe(t){return t===it||t===rt}function ti(t,e,s){return $s(t,e)||t.datum_type===te||e.datum_type===te||t.es===e.es&&t.a===e.a&&!Pe(t.datum_type)&&!Pe(e.datum_type)?s:(s=we(s,t.es,t.a),Pe(t.datum_type)&&(s=Ks(s,t.datum_type,t.datum_params)),Pe(e.datum_type)&&(s=Ys(s,e.datum_type,e.datum_params)),Ie(s,e.es,e.a,e.b))}function ns(t,e,s){var i=s.x,r=s.y,a=s.z||0,n,o,h,f={};for(h=0;h<3;h++)if(!(e&&h===2&&s.z===void 0))switch(h===0?(n=i,"ew".indexOf(t.axis[h])!==-1?o="x":o="y"):h===1?(n=r,"ns".indexOf(t.axis[h])!==-1?o="y":o="x"):(n=a,o="z"),t.axis[h]){case"e":case"w":case"n":case"s":f[o]=n;break;case"u":s[o]!==void 0&&(f.z=n);break;case"d":s[o]!==void 0&&(f.z=-n);break;default:return null}return f}function Ee(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function si(t){ei(t.x),ei(t.y)}function ei(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function na(t,e){return(t.datum.datum_type===it||t.datum.datum_type===rt)&&e.datumCode!=="WGS84"||(e.datum.datum_type===it||e.datum.datum_type===rt)&&t.datumCode!=="WGS84"}function Ot(t,e,s){var i;if(Array.isArray(s)&&(s=Ee(s)),si(s),t.datum&&e.datum&&na(t,e)&&(i=new It("WGS84"),s=Ot(t,i,s),t=i),t.axis!=="enu"&&(s=ns(t,!1,s)),t.projName==="longlat")s={x:s.x*U,y:s.y*U,z:s.z||0};else if(t.to_meter&&(s={x:s.x*t.to_meter,y:s.y*t.to_meter,z:s.z||0}),s=t.inverse(s),!s)return;return t.from_greenwich&&(s.x+=t.from_greenwich),s=ti(t.datum,e.datum,s),e.from_greenwich&&(s={x:s.x-e.from_greenwich,y:s.y,z:s.z||0}),e.projName==="longlat"?s={x:s.x*at,y:s.y*at,z:s.z||0}:(s=e.forward(s),e.to_meter&&(s={x:s.x/e.to_meter,y:s.y/e.to_meter,z:s.z||0})),e.axis!=="enu"?ns(e,!0,s):s}var ii=It("WGS84");function os(t,e,s){var i,r,a;return Array.isArray(s)?(i=Ot(t,e,s)||{x:NaN,y:NaN},s.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(s.splice(3)):[i.x,i.y,s[2]].concat(s.splice(3)):[i.x,i.y].concat(s.splice(2)):[i.x,i.y]):(r=Ot(t,e,s),a=Object.keys(s),a.length===2||a.forEach(function(n){if(typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;r[n]=s[n]}),r)}function ri(t){return t instanceof It?t:t.oProj?t.oProj:It(t)}function oa(t,e,s){t=ri(t);var i=!1,r;return typeof e>"u"?(e=t,t=ii,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(s=e,e=t,t=ii,i=!0),e=ri(e),s?os(t,e,s):(r={forward:function(a){return os(t,e,a)},inverse:function(a){return os(e,t,a)}},i&&(r.oProj=e),r)}var K=oa;var ai=6,oi="AJSAJS",hi="AFAFAF",Gt=65,Z=73,et=79,re=86,ae=90,fi={forward:fs,inverse:ha,toPoint:ls};function fs(t,e){return e=e||5,ua(fa({lat:t[1],lon:t[0]}),e)}function ha(t){var e=us(ui(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function ls(t){var e=us(ui(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function hs(t){return t*(Math.PI/180)}function ni(t){return 180*(t/Math.PI)}function fa(t){var e=t.lat,s=t.lon,i=6378137,r=.00669438,a=.9996,n,o,h,f,l,u,c,m=hs(e),d=hs(s),p,_;_=Math.floor((s+180)/6)+1,s===180&&(_=60),e>=56&&e<64&&s>=3&&s<12&&(_=32),e>=72&&e<84&&(s>=0&&s<9?_=31:s>=9&&s<21?_=33:s>=21&&s<33?_=35:s>=33&&s<42&&(_=37)),n=(_-1)*6-180+3,p=hs(n),o=r/(1-r),h=i/Math.sqrt(1-r*Math.sin(m)*Math.sin(m)),f=Math.tan(m)*Math.tan(m),l=o*Math.cos(m)*Math.cos(m),u=Math.cos(m)*(d-p),c=i*((1-r/4-3*r*r/64-5*r*r*r/256)*m-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*m)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*m)-35*r*r*r/3072*Math.sin(6*m));var M=a*h*(u+(1-f+l)*u*u*u/6+(5-18*f+f*f+72*l-58*o)*u*u*u*u*u/120)+5e5,x=a*(c+h*Math.tan(m)*(u*u/2+(5-f+9*l+4*l*l)*u*u*u*u/24+(61-58*f+f*f+600*l-330*o)*u*u*u*u*u*u/720));return e<0&&(x+=1e7),{northing:Math.round(x),easting:Math.round(M),zoneNumber:_,zoneLetter:la(e)}}function us(t){var e=t.northing,s=t.easting,i=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var a=.9996,n=6378137,o=.00669438,h,f=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),l,u,c,m,d,p,_,M,x,g=s-5e5,S=e;i<"N"&&(S-=1e7),_=(r-1)*6-180+3,h=o/(1-o),p=S/a,M=p/(n*(1-o/4-3*o*o/64-5*o*o*o/256)),x=M+(3*f/2-27*f*f*f/32)*Math.sin(2*M)+(21*f*f/16-55*f*f*f*f/32)*Math.sin(4*M)+151*f*f*f/96*Math.sin(6*M),l=n/Math.sqrt(1-o*Math.sin(x)*Math.sin(x)),u=Math.tan(x)*Math.tan(x),c=h*Math.cos(x)*Math.cos(x),m=n*(1-o)/Math.pow(1-o*Math.sin(x)*Math.sin(x),1.5),d=g/(l*a);var I=x-l*Math.tan(x)/m*(d*d/2-(5+3*u+10*c-4*c*c-9*h)*d*d*d*d/24+(61+90*u+298*c+45*u*u-252*h-3*c*c)*d*d*d*d*d*d/720);I=ni(I);var P=(d-(1+2*u+c)*d*d*d/6+(5-2*c+28*u-3*c*c+8*h+24*u*u)*d*d*d*d*d/120)/Math.cos(x);P=_+ni(P);var B;if(t.accuracy){var N=us({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});B={top:N.lat,right:N.lon,bottom:I,left:P}}else B={lat:I,lon:P};return B}function la(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function ua(t,e){var s="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+ca(t.easting,t.northing,t.zoneNumber)+s.substr(s.length-5,e)+i.substr(i.length-5,e)}function ca(t,e,s){var i=li(s),r=Math.floor(t/1e5),a=Math.floor(e/1e5)%20;return da(r,a,i)}function li(t){var e=t%ai;return e===0&&(e=ai),e}function da(t,e,s){var i=s-1,r=oi.charCodeAt(i),a=hi.charCodeAt(i),n=r+t-1,o=a+e,h=!1;n>ae&&(n=n-ae+Gt-1,h=!0),(n===Z||r<Z&&n>Z||(n>Z||r<Z)&&h)&&n++,(n===et||r<et&&n>et||(n>et||r<et)&&h)&&(n++,n===Z&&n++),n>ae&&(n=n-ae+Gt-1),o>re?(o=o-re+Gt-1,h=!0):h=!1,(o===Z||a<Z&&o>Z||(o>Z||a<Z)&&h)&&o++,(o===et||a<et&&o>et||(o>et||a<et)&&h)&&(o++,o===Z&&o++),o>re&&(o=o-re+Gt-1);var f=String.fromCharCode(n)+String.fromCharCode(o);return f}function ui(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var e=t.length,s=null,i="",r,a=0;!/[A-Z]/.test(r=t.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+t;i+=r,a++}var n=parseInt(i,10);if(a===0||a+3>e)throw"MGRSPoint bad conversion from: "+t;var o=t.charAt(a++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+t;s=t.substring(a,a+=2);for(var h=li(n),f=ma(s.charAt(0),h),l=pa(s.charAt(1),h);l<ba(o);)l+=2e6;var u=e-a;if(u%2!==0)throw`MGRSPoint has to have an even number
|
|
7
|
+
"use strict";var __exports__=(()=>{var Pr=Object.create;var ee=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var Ar=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Or=(t,e,s)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Fr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Lr=(t,e)=>{for(var s in e)ee(t,s,{get:e[s],enumerable:!0})},be=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sr(e))!Nr.call(t,r)&&r!==s&&ee(t,r,{get:()=>e[r],enumerable:!(i=Er(e,r))||i.enumerable});return t},_e=(t,e,s)=>(be(t,e,"default"),s&&be(s,e,"default")),Rr=(t,e,s)=>(s=t!=null?Pr(Ar(t)):{},be(e||!t||!t.__esModule?ee(s,"default",{value:t,enumerable:!0}):s,t)),Cr=t=>be(ee({},"__esModule",{value:!0}),t);var ve=(t,e,s)=>(Or(t,typeof e!="symbol"?e+"":e,s),s);var Ss=Fr((Sh,Es)=>{Es.exports=globalThis.loaders});var pe={};Lr(pe,{FlatGeobufLoader:()=>xr,FlatGeobufWorkerLoader:()=>Ps});_e(pe,Rr(Ss(),1));function wt(t){return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(t)}function ts(t,e){if(wt(t)!=="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var i=s.call(t,e||"default");if(wt(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function es(t){var e=ts(t,"string");return wt(e)==="symbol"?e:String(e)}function ss(t,e,s){return e=es(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function As(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var it=1,rt=2,Ns=4,se=5,Nt=484813681109536e-20,b=Math.PI/2,Os=.16666666666666666,Fs=.04722222222222222,Ls=.022156084656084655,v=1e-10,U=.017453292519943295,at=57.29577951308232,E=Math.PI/4,ie=Math.PI*2,F=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 Rs={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var Cs=/[\s_\-\/\(\)]/g;function $(t,e){if(t[e])return t[e];for(var s=Object.keys(t),i=e.toLowerCase().replace(Cs,""),r=-1,a,n;++r<s.length;)if(a=s[r],n=a.toLowerCase().replace(Cs,""),n===i)return t[a]}function re(t){var e={},s=t.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,r,a,n={proj:"projName",datum:"datumCode",rf:function(o){e.rf=parseFloat(o)},lat_0:function(o){e.lat0=o*U},lat_1:function(o){e.lat1=o*U},lat_2:function(o){e.lat2=o*U},lat_ts:function(o){e.lat_ts=o*U},lon_0:function(o){e.long0=o*U},lon_1:function(o){e.long1=o*U},lon_2:function(o){e.long2=o*U},alpha:function(o){e.alpha=parseFloat(o)*U},lonc:function(o){e.longc=o*U},x_0:function(o){e.x0=parseFloat(o)},y_0:function(o){e.y0=parseFloat(o)},k_0:function(o){e.k0=parseFloat(o)},k:function(o){e.k0=parseFloat(o)},a:function(o){e.a=parseFloat(o)},b:function(o){e.b=parseFloat(o)},r_a:function(){e.R_A=!0},zone:function(o){e.zone=parseInt(o,10)},south:function(){e.utmSouth=!0},towgs84:function(o){e.datum_params=o.split(",").map(function(h){return parseFloat(h)})},to_meter:function(o){e.to_meter=parseFloat(o)},units:function(o){e.units=o;var h=$(Rs,o);h&&(e.to_meter=h.to_meter)},from_greenwich:function(o){e.from_greenwich=o*U},pm:function(o){var h=$(V,o);e.from_greenwich=(h||parseFloat(o))*U},nadgrids:function(o){o==="@null"?e.datumCode="none":e.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&&(e.axis=o)}};for(i in s)r=s[i],i in n?(a=n[i],typeof a=="function"?a(r):e[a]=r):e[i]=r;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}var Ts=zr,ae=1,Bs=2,Us=3,ye=4,zs=5,is=-1,Tr=/\s/,Br=/[A-Za-z]/,Ur=/[A-Za-z84_]/,Me=/[,\]]/,qs=/[\d\.E\-\+]/;function pt(t){if(typeof t!="string")throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=ae}pt.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==ye)for(;Tr.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case ae:return this.neutral(t);case Bs:return this.keyword(t);case ye:return this.quoted(t);case zs:return this.afterquote(t);case Us:return this.number(t);case is:return}};pt.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=ye;return}if(Me.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};pt.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=ae;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=ae,this.currentObject=this.stack.pop(),this.currentObject||(this.state=is);return}};pt.prototype.number=function(t){if(qs.test(t)){this.word+=t;return}if(Me.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};pt.prototype.quoted=function(t){if(t==='"'){this.state=zs;return}this.word+=t};pt.prototype.keyword=function(t){if(Ur.test(t)){this.word+=t;return}if(t==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=ae;return}if(Me.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};pt.prototype.neutral=function(t){if(Br.test(t)){this.word=t,this.state=Bs;return}if(t==='"'){this.word="",this.state=ye;return}if(qs.test(t)){this.word=t,this.state=Us;return}if(Me.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};pt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===is)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function zr(t){var e=new pt(t);return e.output()}function Gs(t,e,s){Array.isArray(e)&&(s.unshift(e),e=null);var i=e?{}:t,r=s.reduce(function(a,n){return Ot(n,a),a},i);e&&(t[e]=r)}function Ot(t,e){if(!Array.isArray(t)){e[t]=!0;return}var s=t.shift();if(s==="PARAMETER"&&(s=t.shift()),t.length===1){if(Array.isArray(t[0])){e[s]={},Ot(t[0],e[s]);return}e[s]=t[0];return}if(!t.length){e[s]=!0;return}if(s==="TOWGS84"){e[s]=t;return}if(s==="AXIS"){s in e||(e[s]=[]),e[s].push(t);return}Array.isArray(s)||(e[s]={});var i;switch(s){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[s]={name:t[0].toLowerCase(),convert:t[1]},t.length===3&&Ot(t[2],e[s]);return;case"SPHEROID":case"ELLIPSOID":e[s]={name:t[0],a:t[1],rf:t[2]},t.length===4&&Ot(t[3],e[s]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":t[0]=["name",t[0]],Gs(e,s,t);return;default:for(i=-1;++i<t.length;)if(!Array.isArray(t[i]))return Ot(t,e[s]);return Gs(e,s,t)}}var qr=.017453292519943295;function Gr(t,e){var s=e[0],i=e[1];!(s in t)&&i in t&&(t[s]=t[i],e.length===3&&(t[s]=e[2](t[s])))}function bt(t){return t*qr}function Dr(t){if(t.type==="GEOGCS"?t.projName="longlat":t.type==="LOCAL_CS"?(t.projName="identity",t.local=!0):typeof t.PROJECTION=="object"?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var e="",s=0,i=t.AXIS.length;s<i;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?e+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?e+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?e+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(t.axis=e)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.UNIT.convert&&(t.type==="GEOGCS"?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var a=t.GEOGCS;t.type==="GEOGCS"&&(a=t),a&&(a.DATUM?t.datumCode=a.DATUM.name.toLowerCase():t.datumCode=a.name.toLowerCase(),t.datumCode.slice(0,2)==="d_"&&(t.datumCode=t.datumCode.slice(2)),(t.datumCode==="new_zealand_geodetic_datum_1949"||t.datumCode==="new_zealand_1949")&&(t.datumCode="nzgd49"),(t.datumCode==="wgs_1984"||t.datumCode==="world_geodetic_system_1984")&&(t.PROJECTION==="Mercator_Auxiliary_Sphere"&&(t.sphere=!0),t.datumCode="wgs84"),t.datumCode.slice(-6)==="_ferro"&&(t.datumCode=t.datumCode.slice(0,-6)),t.datumCode.slice(-8)==="_jakarta"&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(t.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),t.ellps.toLowerCase().slice(0,13)==="international"&&(t.ellps="intl"),t.a=a.DATUM.SPHEROID.a,t.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(t.datum_params=a.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),t.datumCode==="ch1903+"&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a);function n(f){var l=t.to_meter||1;return f*l}var o=function(f){return Gr(t,f)},h=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",bt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",bt],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",bt],["lat0","latitude_of_origin",bt],["lat0","standard_parallel_1",bt],["lat1","standard_parallel_1",bt],["lat2","standard_parallel_2",bt],["azimuth","Azimuth"],["alpha","azimuth",bt],["srsCode","name"]];h.forEach(o),!t.long0&&t.longc&&(t.projName==="Albers_Conic_Equal_Area"||t.projName==="Lambert_Azimuthal_Equal_Area")&&(t.long0=t.longc),!t.lat_ts&&t.lat1&&(t.projName==="Stereographic_South_Pole"||t.projName==="Polar Stereographic (variant B)")&&(t.lat0=bt(t.lat1>0?90:-90),t.lat_ts=t.lat1)}function ge(t){var e=Ts(t),s=e.shift(),i=e.shift();e.unshift(["name",i]),e.unshift(["type",s]);var r={};return Ot(e,r),Dr(r),r}function tt(t){var e=this;if(arguments.length===2){var s=arguments[1];typeof s=="string"?s.charAt(0)==="+"?tt[t]=re(arguments[1]):tt[t]=ge(arguments[1]):tt[t]=s}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(i){Array.isArray(i)?tt.apply(e,i):tt(i)});if(typeof t=="string"){if(t in tt)return tt[t]}else"EPSG"in t?tt["EPSG:"+t.EPSG]=t:"ESRI"in t?tt["ESRI:"+t.ESRI]=t:"IAU2000"in t?tt["IAU2000:"+t.IAU2000]=t:console.log(t);return}}As(tt);var qt=tt;function jr(t){return typeof t=="string"}function kr(t){return t in qt}var Vr=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Hr(t){return Vr.some(function(e){return t.indexOf(e)>-1})}var Wr=["3857","900913","3785","102113"];function Xr(t){var e=$(t,"authority");if(e){var s=$(e,"epsg");return s&&Wr.indexOf(s)>-1}}function Jr(t){var e=$(t,"extension");if(e)return $(e,"proj4")}function Zr(t){return t[0]==="+"}function Qr(t){if(jr(t)){if(kr(t))return qt[t];if(Hr(t)){var e=ge(t);if(Xr(e))return qt["EPSG:3857"];var s=Jr(e);return s?re(s):e}if(Zr(t))return re(t)}else return t}var Ds=Qr;function rs(t,e){t=t||{};var s,i;if(!e)return t;for(i in e)s=e[i],s!==void 0&&(t[i]=s);return t}function k(t,e,s){var i=t*e;return s/Math.sqrt(1-i*i)}function ut(t){return t<0?-1:1}function y(t){return Math.abs(t)<=F?t:t-ut(t)*ie}function H(t,e,s){var i=t*s,r=.5*t;return i=Math.pow((1-i)/(1+i),r),Math.tan(.5*(b-e))/i}function _t(t,e){for(var s=.5*t,i,r,a=b-2*Math.atan(e),n=0;n<=15;n++)if(i=t*Math.sin(a),r=b-2*Math.atan(e*Math.pow((1-i)/(1+i),s))-a,a+=r,Math.abs(r)<=1e-10)return a;return-9999}function $r(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=k(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Kr(t){var e=t.x,s=t.y;if(s*at>90&&s*at<-90&&e*at>180&&e*at<-180)return null;var i,r;if(Math.abs(Math.abs(s)-b)<=v)return null;if(this.sphere)i=this.x0+this.a*this.k0*y(e-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(E+.5*s));else{var a=Math.sin(s),n=H(this.e,s,a);i=this.x0+this.a*this.k0*y(e-this.long0),r=this.y0-this.a*this.k0*Math.log(n)}return t.x=i,t.y=r,t}function Yr(t){var e=t.x-this.x0,s=t.y-this.y0,i,r;if(this.sphere)r=b-2*Math.atan(Math.exp(-s/(this.a*this.k0)));else{var a=Math.exp(-s/(this.a*this.k0));if(r=_t(this.e,a),r===-9999)return null}return i=y(this.long0+e/(this.a*this.k0)),t.x=i,t.y=r,t}var ta=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],js={init:$r,forward:Kr,inverse:Yr,names:ta};function ea(){}function ks(t){return t}var sa=["longlat","identity"],Vs={init:ea,forward:ks,inverse:ks,names:sa};var ia=[js,Vs],xe={},we=[];function Hs(t,e){var s=we.length;return t.names?(we[s]=t,t.names.forEach(function(i){xe[i.toLowerCase()]=s}),this):(console.log(e),!0)}function ra(t){if(!t)return!1;var e=t.toLowerCase();if(typeof xe[e]<"u"&&we[xe[e]])return we[xe[e]]}function aa(){ia.forEach(Hs)}var Ws={start:aa,add:Hs,get:ra};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 Xs=w.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};w.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Js(t,e,s,i){var r=t*t,a=e*e,n=(r-a)/r,o=0;i?(t*=1-n*(Os+n*(Fs+n*Ls)),r=t*t,n=0):o=Math.sqrt(n);var h=(r-a)/a;return{es:n,e:o,ep2:h}}function Zs(t,e,s,i,r){if(!t){var a=$(w,i);a||(a=Xs),t=a.a,e=a.b,s=a.rf}return s&&!e&&(e=(1-1/s)*t),(s===0||Math.abs(t-e)<v)&&(r=!0,e=t),{a:t,b:e,rf:s,sphere:r}}var z={};z.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};z.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};z.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};z.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};z.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};z.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};z.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};z.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};z.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};z.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};z.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};z.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};z.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};z.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};z.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};z.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};z.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function na(t,e,s,i,r,a){var n={};return t===void 0||t==="none"?n.datum_type=se:n.datum_type=Ns,e&&(n.datum_params=e.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=it),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=rt,n.datum_params[3]*=Nt,n.datum_params[4]*=Nt,n.datum_params[5]*=Nt,n.datum_params[6]=n.datum_params[6]/1e6+1)),n.a=s,n.b=i,n.es=r,n.ep2=a,n}var Qs=na;function Gt(t,e){if(!(this instanceof Gt))return new Gt(t);e=e||function(h){if(h)throw h};var s=Ds(t);if(typeof s!="object"){e(t);return}var i=Gt.projections.get(s.projName);if(!i){e(t);return}if(s.datumCode&&s.datumCode!=="none"){var r=$(z,s.datumCode);r&&(s.datum_params=r.towgs84?r.towgs84.split(","):null,s.ellps=r.ellipse,s.datumName=r.datumName?r.datumName:s.datumCode)}s.k0=s.k0||1,s.axis=s.axis||"enu",s.ellps=s.ellps||"wgs84";var a=Zs(s.a,s.b,s.rf,s.ellps,s.sphere),n=Js(a.a,a.b,a.rf,s.R_A),o=s.datum||Qs(s.datumCode,s.datum_params,a.a,a.b,n.es,n.ep2);rs(this,s),rs(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(),e(null,this)}Gt.projections=Ws;Gt.projections.start();var It=Gt;function $s(t,e){return t.datum_type!==e.datum_type||t.a!==e.a||Math.abs(t.es-e.es)>5e-11?!1:t.datum_type===it?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type===rt?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]:!0}function Ie(t,e,s){var i=t.x,r=t.y,a=t.z?t.z:0,n,o,h,f;if(r<-b&&r>-1.001*b)r=-b;else if(r>b&&r<1.001*b)r=b;else{if(r<-b)return{x:-1/0,y:-1/0,z:t.z};if(r>b)return{x:1/0,y:1/0,z:t.z}}return i>Math.PI&&(i-=2*Math.PI),o=Math.sin(r),f=Math.cos(r),h=o*o,n=s/Math.sqrt(1-e*h),{x:(n+a)*f*Math.cos(i),y:(n+a)*f*Math.sin(i),z:(n*(1-e)+a)*o}}function Pe(t,e,s,i){var r=1e-12,a=r*r,n=30,o,h,f,l,u,c,m,d,p,_,M,x,g,S=t.x,I=t.y,P=t.z?t.z:0,B,N,Y;if(o=Math.sqrt(S*S+I*I),h=Math.sqrt(S*S+I*I+P*P),o/s<r){if(B=0,h/s<r)return N=b,Y=-i,{x:t.x,y:t.y,z:t.z}}else B=Math.atan2(I,S);f=P/h,l=o/h,u=1/Math.sqrt(1-e*(2-e)*l*l),d=l*(1-e)*u,p=f*u,g=0;do g++,m=s/Math.sqrt(1-e*p*p),Y=o*d+P*p-m*(1-e*p*p),c=e*m/(m+Y),u=1/Math.sqrt(1-c*(2-c)*l*l),_=l*(1-c)*u,M=f*u,x=M*d-_*p,d=_,p=M;while(x*x>a&&g<n);return N=Math.atan(M/Math.abs(_)),{x:B,y:N,z:Y}}function Ks(t,e,s){if(e===it)return{x:t.x+s[0],y:t.y+s[1],z:t.z+s[2]};if(e===rt){var i=s[0],r=s[1],a=s[2],n=s[3],o=s[4],h=s[5],f=s[6];return{x:f*(t.x-h*t.y+o*t.z)+i,y:f*(h*t.x+t.y-n*t.z)+r,z:f*(-o*t.x+n*t.y+t.z)+a}}}function Ys(t,e,s){if(e===it)return{x:t.x-s[0],y:t.y-s[1],z:t.z-s[2]};if(e===rt){var i=s[0],r=s[1],a=s[2],n=s[3],o=s[4],h=s[5],f=s[6],l=(t.x-i)/f,u=(t.y-r)/f,c=(t.z-a)/f;return{x:l+h*u-o*c,y:-h*l+u+n*c,z:o*l-n*u+c}}}function Ee(t){return t===it||t===rt}function ti(t,e,s){return $s(t,e)||t.datum_type===se||e.datum_type===se||t.es===e.es&&t.a===e.a&&!Ee(t.datum_type)&&!Ee(e.datum_type)?s:(s=Ie(s,t.es,t.a),Ee(t.datum_type)&&(s=Ks(s,t.datum_type,t.datum_params)),Ee(e.datum_type)&&(s=Ys(s,e.datum_type,e.datum_params)),Pe(s,e.es,e.a,e.b))}function as(t,e,s){var i=s.x,r=s.y,a=s.z||0,n,o,h,f={};for(h=0;h<3;h++)if(!(e&&h===2&&s.z===void 0))switch(h===0?(n=i,"ew".indexOf(t.axis[h])!==-1?o="x":o="y"):h===1?(n=r,"ns".indexOf(t.axis[h])!==-1?o="y":o="x"):(n=a,o="z"),t.axis[h]){case"e":case"w":case"n":case"s":f[o]=n;break;case"u":s[o]!==void 0&&(f.z=n);break;case"d":s[o]!==void 0&&(f.z=-n);break;default:return null}return f}function Se(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function si(t){ei(t.x),ei(t.y)}function ei(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function oa(t,e){return(t.datum.datum_type===it||t.datum.datum_type===rt)&&e.datumCode!=="WGS84"||(e.datum.datum_type===it||e.datum.datum_type===rt)&&t.datumCode!=="WGS84"}function Ft(t,e,s){var i;if(Array.isArray(s)&&(s=Se(s)),si(s),t.datum&&e.datum&&oa(t,e)&&(i=new It("WGS84"),s=Ft(t,i,s),t=i),t.axis!=="enu"&&(s=as(t,!1,s)),t.projName==="longlat")s={x:s.x*U,y:s.y*U,z:s.z||0};else if(t.to_meter&&(s={x:s.x*t.to_meter,y:s.y*t.to_meter,z:s.z||0}),s=t.inverse(s),!s)return;return t.from_greenwich&&(s.x+=t.from_greenwich),s=ti(t.datum,e.datum,s),e.from_greenwich&&(s={x:s.x-e.from_greenwich,y:s.y,z:s.z||0}),e.projName==="longlat"?s={x:s.x*at,y:s.y*at,z:s.z||0}:(s=e.forward(s),e.to_meter&&(s={x:s.x/e.to_meter,y:s.y/e.to_meter,z:s.z||0})),e.axis!=="enu"?as(e,!0,s):s}var ii=It("WGS84");function ns(t,e,s){var i,r,a;return Array.isArray(s)?(i=Ft(t,e,s)||{x:NaN,y:NaN},s.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(s.splice(3)):[i.x,i.y,s[2]].concat(s.splice(3)):[i.x,i.y].concat(s.splice(2)):[i.x,i.y]):(r=Ft(t,e,s),a=Object.keys(s),a.length===2||a.forEach(function(n){if(typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;r[n]=s[n]}),r)}function ri(t){return t instanceof It?t:t.oProj?t.oProj:It(t)}function ha(t,e,s){t=ri(t);var i=!1,r;return typeof e>"u"?(e=t,t=ii,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(s=e,e=t,t=ii,i=!0),e=ri(e),s?ns(t,e,s):(r={forward:function(a){return ns(t,e,a)},inverse:function(a){return ns(e,t,a)}},i&&(r.oProj=e),r)}var K=ha;var ai=6,oi="AJSAJS",hi="AFAFAF",Dt=65,Z=73,et=79,ne=86,oe=90,fi={forward:hs,inverse:fa,toPoint:fs};function hs(t,e){return e=e||5,ca(la({lat:t[1],lon:t[0]}),e)}function fa(t){var e=ls(ui(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function fs(t){var e=ls(ui(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function os(t){return t*(Math.PI/180)}function ni(t){return 180*(t/Math.PI)}function la(t){var e=t.lat,s=t.lon,i=6378137,r=.00669438,a=.9996,n,o,h,f,l,u,c,m=os(e),d=os(s),p,_;_=Math.floor((s+180)/6)+1,s===180&&(_=60),e>=56&&e<64&&s>=3&&s<12&&(_=32),e>=72&&e<84&&(s>=0&&s<9?_=31:s>=9&&s<21?_=33:s>=21&&s<33?_=35:s>=33&&s<42&&(_=37)),n=(_-1)*6-180+3,p=os(n),o=r/(1-r),h=i/Math.sqrt(1-r*Math.sin(m)*Math.sin(m)),f=Math.tan(m)*Math.tan(m),l=o*Math.cos(m)*Math.cos(m),u=Math.cos(m)*(d-p),c=i*((1-r/4-3*r*r/64-5*r*r*r/256)*m-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*m)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*m)-35*r*r*r/3072*Math.sin(6*m));var M=a*h*(u+(1-f+l)*u*u*u/6+(5-18*f+f*f+72*l-58*o)*u*u*u*u*u/120)+5e5,x=a*(c+h*Math.tan(m)*(u*u/2+(5-f+9*l+4*l*l)*u*u*u*u/24+(61-58*f+f*f+600*l-330*o)*u*u*u*u*u*u/720));return e<0&&(x+=1e7),{northing:Math.round(x),easting:Math.round(M),zoneNumber:_,zoneLetter:ua(e)}}function ls(t){var e=t.northing,s=t.easting,i=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var a=.9996,n=6378137,o=.00669438,h,f=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),l,u,c,m,d,p,_,M,x,g=s-5e5,S=e;i<"N"&&(S-=1e7),_=(r-1)*6-180+3,h=o/(1-o),p=S/a,M=p/(n*(1-o/4-3*o*o/64-5*o*o*o/256)),x=M+(3*f/2-27*f*f*f/32)*Math.sin(2*M)+(21*f*f/16-55*f*f*f*f/32)*Math.sin(4*M)+151*f*f*f/96*Math.sin(6*M),l=n/Math.sqrt(1-o*Math.sin(x)*Math.sin(x)),u=Math.tan(x)*Math.tan(x),c=h*Math.cos(x)*Math.cos(x),m=n*(1-o)/Math.pow(1-o*Math.sin(x)*Math.sin(x),1.5),d=g/(l*a);var I=x-l*Math.tan(x)/m*(d*d/2-(5+3*u+10*c-4*c*c-9*h)*d*d*d*d/24+(61+90*u+298*c+45*u*u-252*h-3*c*c)*d*d*d*d*d*d/720);I=ni(I);var P=(d-(1+2*u+c)*d*d*d/6+(5-2*c+28*u-3*c*c+8*h+24*u*u)*d*d*d*d*d/120)/Math.cos(x);P=_+ni(P);var B;if(t.accuracy){var N=ls({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});B={top:N.lat,right:N.lon,bottom:I,left:P}}else B={lat:I,lon:P};return B}function ua(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function ca(t,e){var s="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+da(t.easting,t.northing,t.zoneNumber)+s.substr(s.length-5,e)+i.substr(i.length-5,e)}function da(t,e,s){var i=li(s),r=Math.floor(t/1e5),a=Math.floor(e/1e5)%20;return ma(r,a,i)}function li(t){var e=t%ai;return e===0&&(e=ai),e}function ma(t,e,s){var i=s-1,r=oi.charCodeAt(i),a=hi.charCodeAt(i),n=r+t-1,o=a+e,h=!1;n>oe&&(n=n-oe+Dt-1,h=!0),(n===Z||r<Z&&n>Z||(n>Z||r<Z)&&h)&&n++,(n===et||r<et&&n>et||(n>et||r<et)&&h)&&(n++,n===Z&&n++),n>oe&&(n=n-oe+Dt-1),o>ne?(o=o-ne+Dt-1,h=!0):h=!1,(o===Z||a<Z&&o>Z||(o>Z||a<Z)&&h)&&o++,(o===et||a<et&&o>et||(o>et||a<et)&&h)&&(o++,o===Z&&o++),o>ne&&(o=o-ne+Dt-1);var f=String.fromCharCode(n)+String.fromCharCode(o);return f}function ui(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var e=t.length,s=null,i="",r,a=0;!/[A-Z]/.test(r=t.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+t;i+=r,a++}var n=parseInt(i,10);if(a===0||a+3>e)throw"MGRSPoint bad conversion from: "+t;var o=t.charAt(a++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+t;s=t.substring(a,a+=2);for(var h=li(n),f=pa(s.charAt(0),h),l=ba(s.charAt(1),h);l<_a(o);)l+=2e6;var u=e-a;if(u%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`+t;var c=u/2,m=0,d=0,p,_,M,x,g;return c>0&&(p=1e5/Math.pow(10,c),_=t.substring(a,a+c),m=parseFloat(_)*p,M=t.substring(a+c),d=parseFloat(M)*p),x=m+f,g=d+l,{easting:x,northing:g,zoneLetter:o,zoneNumber:n,accuracy:p}}function ma(t,e){for(var s=oi.charCodeAt(e-1),i=1e5,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>ae){if(r)throw"Bad character: "+t;s=Gt,r=!0}i+=1e5}return i}function pa(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var s=hi.charCodeAt(e-1),i=0,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>re){if(r)throw"Bad character: "+t;s=Gt,r=!0}i+=1e5}return i}function ba(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Dt(t,e,s){if(!(this instanceof Dt))return new Dt(t,e,s);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof e>"u"){var i=t.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=t,this.y=e,this.z=s||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Dt.fromMGRS=function(t){return new Dt(ls(t))};Dt.prototype.toMGRS=function(t){return fs([this.x,this.y],t)};var ci=Dt;var _a=1,va=.25,di=.046875,mi=.01953125,pi=.01068115234375,ya=.75,Ma=.46875,ga=.013020833333333334,xa=.007120768229166667,wa=.3645833333333333,Ia=.005696614583333333,Pa=.3076171875;function Se(t){var e=[];e[0]=_a-t*(va+t*(di+t*(mi+t*pi))),e[1]=t*(ya-t*(di+t*(mi+t*pi)));var s=t*t;return e[2]=s*(Ma-t*(ga+t*xa)),s*=t,e[3]=s*(wa-t*Ia),e[4]=s*t*Pa,e}function Ft(t,e,s,i){return s*=e,e*=e,i[0]*t-s*(i[1]+e*(i[2]+e*(i[3]+e*i[4])))}var Ea=20;function Ae(t,e,s){for(var i=1/(1-e),r=t,a=Ea;a;--a){var n=Math.sin(r),o=1-e*n*n;if(o=(Ft(r,n,Math.cos(r),s)-t)*(o*Math.sqrt(o))*i,r-=o,Math.abs(o)<v)return r}return r}function Sa(){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=Se(this.es),this.ml0=Ft(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Aa(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a,n,o=Math.sin(s),h=Math.cos(s);if(this.es){var l=h*i,u=Math.pow(l,2),c=this.ep2*Math.pow(h,2),m=Math.pow(c,2),d=Math.abs(h)>v?Math.tan(s):0,p=Math.pow(d,2),_=Math.pow(p,2);r=1-this.es*Math.pow(o,2),l=l/Math.sqrt(r);var M=Ft(s,o,h,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+c+u/20*(5-18*p+_+14*c-58*p*c+u/42*(61+179*_-_*p-479*p)))))+this.x0,n=this.a*(this.k0*(M-this.ml0+o*i*l/2*(1+u/12*(5-p+9*c+4*m+u/30*(61+_-58*p+270*c-330*p*c+u/56*(1385+543*_-_*p-3111*p))))))+this.y0}else{var f=h*Math.sin(i);if(Math.abs(Math.abs(f)-1)<v)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>v)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=a,t.y=n,t}function Na(t){var e,s,i,r,a=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+n/this.k0,s=Ae(e,this.es,this.en),Math.abs(s)<b){var u=Math.sin(s),c=Math.cos(s),m=Math.abs(c)>v?Math.tan(s):0,d=this.ep2*Math.pow(c,2),p=Math.pow(d,2),_=Math.pow(m,2),M=Math.pow(_,2);e=1-this.es*Math.pow(u,2);var x=a*Math.sqrt(e)/this.k0,g=Math.pow(x,2);e=e*m,i=s-e*g/(1-this.es)*.5*(1-g/12*(5+3*_-9*d*_+d-4*p-g/30*(61+90*_-252*d*_+45*M+46*d-g/56*(1385+3633*_+4095*M+1574*M*_)))),r=y(this.long0+x*(1-g/6*(1+2*_+d-g/20*(5+28*_+24*M+8*d*_+6*d-g/42*(61+662*_+1320*M+720*M*_))))/c)}else i=b*ut(n),r=0;else{var o=Math.exp(a/this.k0),h=.5*(o-1/o),f=this.lat0+n/this.k0,l=Math.cos(f);e=Math.sqrt((1-Math.pow(l,2))/(1+Math.pow(h,2))),i=Math.asin(e),n<0&&(i=-i),h===0&&l===0?r=0:r=y(Math.atan2(h,l)+this.long0)}return t.x=r,t.y=i,t}var Oa=["Transverse_Mercator","Transverse Mercator","tmerc"],bi={init:Sa,forward:Aa,inverse:Na,names:Oa};function Ne(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function ne(t,e){t=Math.abs(t),e=Math.abs(e);var s=Math.max(t,e),i=Math.min(t,e)/(s||1);return s*Math.sqrt(1+Math.pow(i,2))}function _i(t){var e=1+t,s=e-1;return s===0?t:t*Math.log(e)/s}function vi(t){var e=Math.abs(t);return e=_i(e*(1+e/(ne(1,e)+1))),t<0?-e:e}function Oe(t,e){for(var s=2*Math.cos(2*e),i=t.length-1,r=t[i],a=0,n;--i>=0;)n=-a+s*r+t[i],a=r,r=n;return e+n*Math.sin(2*e)}function yi(t,e){for(var s=2*Math.cos(e),i=t.length-1,r=t[i],a=0,n;--i>=0;)n=-a+s*r+t[i],a=r,r=n;return Math.sin(e)*n}function Mi(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function cs(t,e,s){for(var i=Math.sin(e),r=Math.cos(e),a=Ne(s),n=Mi(s),o=2*r*n,h=-2*i*a,f=t.length-1,l=t[f],u=0,c=0,m=0,d,p;--f>=0;)d=c,p=u,c=l,u=m,l=-d+o*c-h*u+t[f],m=-p+h*c+o*u;return o=i*n,h=r*a,[o*l-h*m,o*m+h*l]}function Fa(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),s=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),s=s*e,this.cgb[1]=s*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=s*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),s=s*e,this.cgb[2]=s*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=s*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),s=s*e,this.cgb[3]=s*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=s*(1237/630+e*(-12/5+e*(-24832/14175))),s=s*e,this.cgb[4]=s*(4174/315+e*(-144838/6237)),this.cbg[4]=s*(-734/315+e*(109598/31185)),s=s*e,this.cgb[5]=s*(601676/22275),this.cbg[5]=s*(444337/155925),s=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+s*(1/4+s*(1/64+s/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=s*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=s*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),s=s*e,this.utg[2]=s*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=s*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),s=s*e,this.utg[3]=s*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=s*(49561/161280+e*(-179/168+e*(6601661/7257600))),s=s*e,this.utg[4]=s*(-4583/161280+e*(108847/3991680)),this.gtu[4]=s*(34729/80640+e*(-3418889/1995840)),s=s*e,this.utg[5]=s*(-20648693/638668800),this.gtu[5]=s*(212378941/319334400);var i=Oe(this.cbg,this.lat0);this.Zb=-this.Qn*(i+yi(this.gtu,2*i))}function La(t){var e=y(t.x-this.long0),s=t.y;s=Oe(this.cbg,s);var i=Math.sin(s),r=Math.cos(s),a=Math.sin(e),n=Math.cos(e);s=Math.atan2(i,n*r),e=Math.atan2(a*r,ne(i,r*n)),e=vi(Math.tan(e));var o=cs(this.gtu,2*s,2*e);s=s+o[0],e=e+o[1];var h,f;return Math.abs(e)<=2.623395162778?(h=this.a*(this.Qn*e)+this.x0,f=this.a*(this.Qn*s+this.Zb)+this.y0):(h=1/0,f=1/0),t.x=h,t.y=f,t}function Ra(t){var e=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);s=(s-this.Zb)/this.Qn,e=e/this.Qn;var i,r;if(Math.abs(e)<=2.623395162778){var a=cs(this.utg,2*s,2*e);s=s+a[0],e=e+a[1],e=Math.atan(Ne(e));var n=Math.sin(s),o=Math.cos(s),h=Math.sin(e),f=Math.cos(e);s=Math.atan2(n*f,ne(h,f*o)),e=Math.atan2(h,f*o),i=y(e+this.long0),r=Oe(this.cgb,s)}else i=1/0,r=1/0;return t.x=i,t.y=r,t}var Ca=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],jt={init:Fa,forward:La,inverse:Ra,names:Ca};function gi(t,e){if(t===void 0){if(t=Math.floor((y(e)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var Ta="etmerc";function Ba(){var t=gi(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*U,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,jt.init.apply(this),this.forward=jt.forward,this.inverse=jt.inverse}var Ua=["Universal Transverse Mercator System","utm"],xi={init:Ba,names:Ua,dependsOn:Ta};function Fe(t,e){return Math.pow((1-t)/(1+t),e)}var za=20;function qa(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+E)/(Math.pow(Math.tan(.5*this.lat0+E),this.C)*Fe(this.e*t,this.ratexp))}function Ga(t){var e=t.x,s=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*s+E),this.C)*Fe(this.e*Math.sin(s),this.ratexp))-b,t.x=this.C*e,t}function Da(t){for(var e=1e-14,s=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+E)/this.K,1/this.C),a=za;a>0&&(i=2*Math.atan(r*Fe(this.e*Math.sin(t.y),-.5*this.e))-b,!(Math.abs(i-t.y)<e));--a)t.y=i;return a?(t.x=s,t.y=i,t):null}var ja=["gauss"],Le={init:qa,forward:Ga,inverse:Da,names:ja};function ka(){Le.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Va(t){var e,s,i,r;return t.x=y(t.x-this.long0),Le.forward.apply(this,[t]),e=Math.sin(t.y),s=Math.cos(t.y),i=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*s*i),t.x=r*s*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*s*i),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function Ha(t){var e,s,i,r,a;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,a=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(a,this.R2);e=Math.sin(n),s=Math.cos(n),r=Math.asin(s*this.sinc0+t.y*e*this.cosc0/a),i=Math.atan2(t.x*e,a*this.cosc0*s-t.y*this.sinc0*e)}else r=this.phic0,i=0;return t.x=i,t.y=r,Le.inverse.apply(this,[t]),t.x=y(t.x+this.long0),t}var Wa=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],wi={init:ka,forward:Va,inverse:Ha,names:Wa};function Xa(t,e,s){return e*=s,Math.tan(.5*(b+t))*Math.pow((1-e)/(1+e),.5*s)}function Ja(){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)<=v&&(this.k0=.5*(1+ut(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=v&&(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)<=v&&(this.k0=.5*this.cons*k(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=k(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-b,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Za(t){var e=t.x,s=t.y,i=Math.sin(s),r=Math.cos(s),a,n,o,h,f,l,u=y(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=v&&Math.abs(s+this.lat0)<=v?(t.x=NaN,t.y=NaN,t):this.sphere?(a=2*this.k0/(1+this.sinlat0*i+this.coslat0*r*Math.cos(u)),t.x=this.a*a*r*Math.sin(u)+this.x0,t.y=this.a*a*(this.coslat0*i-this.sinlat0*r*Math.cos(u))+this.y0,t):(n=2*Math.atan(this.ssfn_(s,i,this.e))-b,h=Math.cos(n),o=Math.sin(n),Math.abs(this.coslat0)<=v?(f=H(this.e,s*this.con,this.con*i),l=2*this.a*this.k0*f/this.cons,t.x=this.x0+l*Math.sin(e-this.long0),t.y=this.y0-this.con*l*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<v?(a=2*this.a*this.k0/(1+h*Math.cos(u)),t.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(u))),t.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(u))+this.y0),t.x=a*h*Math.sin(u)+this.x0,t))}function Qa(t){t.x-=this.x0,t.y-=this.y0;var e,s,i,r,a,n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var o=2*Math.atan(n/(2*this.a*this.k0));return e=this.long0,s=this.lat0,n<=v?(t.x=e,t.y=s,t):(s=Math.asin(Math.cos(o)*this.sinlat0+t.y*Math.sin(o)*this.coslat0/n),Math.abs(this.coslat0)<v?this.lat0>0?e=y(this.long0+Math.atan2(t.x,-1*t.y)):e=y(this.long0+Math.atan2(t.x,t.y)):e=y(this.long0+Math.atan2(t.x*Math.sin(o),n*this.coslat0*Math.cos(o)-t.y*this.sinlat0*Math.sin(o))),t.x=e,t.y=s,t)}else if(Math.abs(this.coslat0)<=v){if(n<=v)return s=this.lat0,e=this.long0,t.x=e,t.y=s,t;t.x*=this.con,t.y*=this.con,i=n*this.cons/(2*this.a*this.k0),s=this.con*_t(this.e,i),e=this.con*y(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else r=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,n<=v?a=this.X0:(a=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/n),e=y(this.long0+Math.atan2(t.x*Math.sin(r),n*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)))),s=-1*_t(this.e,Math.tan(.5*(b+a)));return t.x=e,t.y=s,t}var $a=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Ii={init:Ja,forward:Za,inverse:Qa,names:$a,ssfn_:Xa};function Ka(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),s=this.a,i=this.rf,r=1/i,a=2*r-Math.pow(r,2),n=this.e=Math.sqrt(a);this.R=this.k0*s*Math.sqrt(1-a)/(1-a*Math.pow(e,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+t/2)),f=Math.log((1+n*e)/(1-n*e));this.K=o-this.alpha*h+this.alpha*n/2*f}function Ya(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),s=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),i=-this.alpha*(e+s)+this.K,r=2*(Math.atan(Math.exp(i))-Math.PI/4),a=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(a))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(a));return t.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,t.x=this.R*n+this.x0,t}function tn(t){for(var e=t.x-this.x0,s=t.y-this.y0,i=e/this.R,r=2*(Math.atan(Math.exp(s/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(i)),n=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+n/this.alpha,h=0,f=a,l=-1e3,u=0;Math.abs(f-l)>1e-7;){if(++u>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)),l=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=o,t.y=f,t}var en=["somerc"],Pi={init:Ka,forward:Ya,inverse:tn,names:en};function sn(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),s=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-s*s);var i=H(this.e,this.lat0,t),r=this.bl/e*Math.sqrt((1-this.es)/(1-s*s));r*r<1&&(r=1);var a,n;if(!isNaN(this.longc))this.lat0>=0?a=r+Math.sqrt(r*r-1):a=r-Math.sqrt(r*r-1),this.el=a*Math.pow(i,this.bl),n=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/r),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=(r+Math.sqrt(r*r-1))*Math.pow(i,this.bl):this.el=(r-Math.sqrt(r*r-1))*Math.pow(i,this.bl);var f=Math.pow(o,this.bl),l=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var u=(this.el*this.el-l*f)/(this.el*this.el+l*f),c=(l-f)/(l+f),m=y(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*m)/c)/this.bl,this.long0=y(this.long0);var d=y(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*d)/n),this.alpha=Math.asin(r*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(r*r-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(r*r-1),Math.cos(this.alpha))}function rn(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a,n;if(Math.abs(Math.abs(s)-b)<=v)s>0?n=-1:n=1,a=this.al/this.bl*Math.log(Math.tan(E+n*this.gamma0*.5)),r=-1*n*b*this.al/this.bl;else{var o=H(this.e,s,Math.sin(s)),h=this.el/Math.pow(o,this.bl),f=.5*(h-1/h),l=.5*(h+1/h),u=Math.sin(this.bl*i),c=(f*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/l;Math.abs(Math.abs(c)-1)<=v?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-c)/(1+c))/this.bl,Math.abs(Math.cos(this.bl*i))<=v?r=this.al*this.bl*i:r=this.al*Math.atan2(f*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(t.x=this.x0+r,t.y=this.y0+a):(r-=this.uc,t.x=this.x0+a*Math.cos(this.alpha)+r*Math.sin(this.alpha),t.y=this.y0+r*Math.cos(this.alpha)-a*Math.sin(this.alpha)),t}function an(t){var e,s;this.no_rot?(s=t.y-this.y0,e=t.x-this.x0):(s=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var i=Math.exp(-1*this.bl*s/this.al),r=.5*(i-1/i),a=.5*(i+1/i),n=Math.sin(this.bl*e/this.al),o=(n*Math.cos(this.gamma0)+r*Math.sin(this.gamma0))/a,h=Math.pow(this.el/Math.sqrt((1+o)/(1-o)),1/this.bl);return Math.abs(o-1)<v?(t.x=this.long0,t.y=b):Math.abs(o+1)<v?(t.x=this.long0,t.y=-1*b):(t.y=_t(this.e,h),t.x=y(this.long0-Math.atan2(r*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*e/this.al))/this.bl)),t}var nn=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Ei={init:sn,forward:rn,inverse:an,names:nn};function on(){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)<v)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),s=Math.cos(this.lat1),i=k(this.e,e,s),r=H(this.e,this.lat1,e),a=Math.sin(this.lat2),n=Math.cos(this.lat2),o=k(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)>v?this.ns=Math.log(i/o)/Math.log(r/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=i/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(f,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function hn(t){var e=t.x,s=t.y;Math.abs(2*Math.abs(s)-Math.PI)<=v&&(s=ut(s)*(b-2*v));var i=Math.abs(Math.abs(s)-b),r,a;if(i>v)r=H(this.e,s,Math.sin(s)),a=this.a*this.f0*Math.pow(r,this.ns);else{if(i=s*this.ns,i<=0)return null;a=0}var n=this.ns*y(e-this.long0);return t.x=this.k0*(a*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-a*Math.cos(n))+this.y0,t}function fn(t){var e,s,i,r,a,n=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(n*n+o*o),s=1):(e=-Math.sqrt(n*n+o*o),s=-1);var h=0;if(e!==0&&(h=Math.atan2(s*n,s*o)),e!==0||this.ns>0){if(s=1/this.ns,i=Math.pow(e/(this.a*this.f0),s),r=_t(this.e,i),r===-9999)return null}else r=-b;return a=y(h/this.ns+this.long0),t.x=a,t.y=r,t}var ln=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Si={init:on,forward:hn,inverse:fn,names:ln};function un(){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 cn(t){var e,s,i,r,a,n,o,h=t.x,f=t.y,l=y(h-this.long0);return e=Math.pow((1+this.e*Math.sin(f))/(1-this.e*Math.sin(f)),this.alfa*this.e/2),s=2*(Math.atan(this.k*Math.pow(Math.tan(f/2+this.s45),this.alfa)/e)-this.s45),i=-l*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(s)+Math.sin(this.ad)*Math.cos(s)*Math.cos(i)),a=Math.asin(Math.cos(s)*Math.sin(i)/Math.cos(r)),n=this.n*a,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=o*Math.cos(n)/1,t.x=o*Math.sin(n)/1,this.czech||(t.y*=-1,t.x*=-1),t}function dn(t){var e,s,i,r,a,n,o,h,f=t.x;t.x=t.y,t.y=f,this.czech||(t.y*=-1,t.x*=-1),n=Math.sqrt(t.x*t.x+t.y*t.y),a=Math.atan2(t.y,t.x),r=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),e=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),s=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(e)),t.x=this.long0-s/this.alfa,o=e,h=0;var l=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(h=1),o=t.y,l+=1;while(h===0&&l<15);return l>=15?null:t}var mn=["Krovak","krovak"],Ai={init:un,forward:cn,inverse:dn,names:mn};function q(t,e,s,i,r){return t*r-e*Math.sin(2*r)+s*Math.sin(4*r)-i*Math.sin(6*r)}function vt(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function yt(t){return .375*t*(1+.25*t*(1+.46875*t))}function Mt(t){return .05859375*t*t*(1+.75*t)}function gt(t){return t*t*t*(35/3072)}function xt(t,e,s){var i=e*s;return t/Math.sqrt(1-i*i)}function nt(t){return Math.abs(t)<b?t:t-ut(t)*Math.PI}function Lt(t,e,s,i,r){var a,n;a=t/e;for(var o=0;o<15;o++)if(n=(t-(e*a-s*Math.sin(2*a)+i*Math.sin(4*a)-r*Math.sin(6*a)))/(e-2*s*Math.cos(2*a)+4*i*Math.cos(4*a)-6*r*Math.cos(6*a)),a+=n,Math.abs(n)<=1e-10)return a;return NaN}function pn(){this.sphere||(this.e0=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.ml0=this.a*q(this.e0,this.e1,this.e2,this.e3,this.lat0))}function bn(t){var e,s,i=t.x,r=t.y;if(i=y(i-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(i)),s=this.a*(Math.atan2(Math.tan(r),Math.cos(i))-this.lat0);else{var a=Math.sin(r),n=Math.cos(r),o=xt(this.a,this.e,a),h=Math.tan(r)*Math.tan(r),f=i*Math.cos(r),l=f*f,u=this.es*n*n/(1-this.es),c=this.a*q(this.e0,this.e1,this.e2,this.e3,r);e=o*f*(1-l*h*(1/6-(8-h+8*u)*l/120)),s=c-this.ml0+o*a/n*l*(.5+(5-h+6*u)*l/24)}return t.x=e+this.x0,t.y=s+this.y0,t}function _n(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,s=t.y/this.a,i,r;if(this.sphere){var a=s+this.lat0;i=Math.asin(Math.sin(a)*Math.cos(e)),r=Math.atan2(Math.tan(e),Math.cos(a))}else{var n=this.ml0/this.a+s,o=Lt(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-b)<=v)return t.x=this.long0,t.y=b,s<0&&(t.y*=-1),t;var h=xt(this.a,this.e,Math.sin(o)),f=h*h*h/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(o),2),u=e*this.a/h,c=u*u;i=o-h*Math.tan(o)/f*u*u*(.5-(1+3*l)*u*u/24),r=u*(1-c*(l/3+(1+3*l)*l*c/15))/Math.cos(o)}return t.x=y(r+this.long0),t.y=nt(i),t}var vn=["Cassini","Cassini_Soldner","cass"],Ni={init:pn,forward:bn,inverse:_n,names:vn};function ot(t,e){var s;return t>1e-7?(s=t*e,(1-t*t)*(e/(1-s*s)-.5/t*Math.log((1-s)/(1+s)))):2*e}var yn=1,Mn=2,gn=3,xn=4;function wn(){var t=Math.abs(this.lat0);if(Math.abs(t-b)<v?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<v?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=ot(this.e,1),this.mmf=.5/(1-this.es),this.apa=Ln(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=ot(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function In(t){var e,s,i,r,a,n,o,h,f,l,u=t.x,c=t.y;if(u=y(u-this.long0),this.sphere){if(a=Math.sin(c),l=Math.cos(c),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+l*i:1+this.sinph0*a+this.cosph0*l*i,s<=v)return null;s=Math.sqrt(2/s),e=s*l*Math.sin(u),s*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*l*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(c+this.lat0)<v)return null;s=E-c*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),e=s*Math.sin(u),s*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(u),r=Math.sin(u),a=Math.sin(c),n=ot(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=b+c,n=this.qp-n;break;case this.S_POLE:f=c-b,n=this.qp+n;break}if(Math.abs(f)<v)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:f=Math.sqrt(2/f),this.mode===this.OBLIQ?s=this.ymf*f*(this.cosb1*o-this.sinb1*h*i):s=(f=Math.sqrt(2/(1+h*i)))*o*this.ymf,e=this.xmf*f*h*r;break;case this.N_POLE:case this.S_POLE:n>=0?(e=(f=Math.sqrt(n))*r,s=i*(this.mode===this.S_POLE?f:-f)):e=s=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*s+this.y0,t}function Pn(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,s=t.y/this.a,i,r,a,n,o,h,f;if(this.sphere){var l=0,u,c=0;if(u=Math.sqrt(e*e+s*s),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(c=Math.sin(r),l=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=v?0:Math.asin(s*c/u),e*=c,s=l*u;break;case this.OBLIQ:r=Math.abs(u)<=v?this.lat0:Math.asin(l*this.sinph0+s*c*this.cosph0/u),e*=c*this.cosph0,s=(l-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:s=-s,r=b-r;break;case this.S_POLE:r-=b;break}i=s===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,s)}else{if(f=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,s*=this.dd,h=Math.sqrt(e*e+s*s),h<v)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*h/this.rq),a=Math.cos(n),e*=n=Math.sin(n),this.mode===this.OBLIQ?(f=a*this.sinb1+s*n*this.cosb1/h,o=this.qp*f,s=h*this.cosb1*a-s*this.sinb1*n):(f=s*n/h,o=this.qp*f,s=h*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),o=e*e+s*s,!o)return t.x=this.long0,t.y=this.lat0,t;f=1-o/this.qp,this.mode===this.S_POLE&&(f=-f)}i=Math.atan2(e,s),r=Rn(Math.asin(f),this.apa)}return t.x=y(this.long0+i),t.y=r,t}var En=.3333333333333333,Sn=.17222222222222222,An=.10257936507936508,Nn=.06388888888888888,On=.0664021164021164,Fn=.016415012942191543;function Ln(t){var e,s=[];return s[0]=t*En,e=t*t,s[0]+=e*Sn,s[1]=e*Nn,e*=t,s[0]+=e*An,s[1]+=e*On,s[2]=e*Fn,s}function Rn(t,e){var s=t+t;return t+e[0]*Math.sin(s)+e[1]*Math.sin(s+s)+e[2]*Math.sin(s+s+s)}var Cn=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Oi={init:wn,forward:In,inverse:Pn,names:Cn,S_POLE:yn,N_POLE:Mn,EQUIT:gn,OBLIQ:xn};function Q(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function Tn(){Math.abs(this.lat1+this.lat2)<v||(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=k(this.e3,this.sin_po,this.cos_po),this.qs1=ot(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=k(this.e3,this.sin_po,this.cos_po),this.qs2=ot(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=ot(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>v?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 Bn(t){var e=t.x,s=t.y;this.sin_phi=Math.sin(s),this.cos_phi=Math.cos(s);var i=ot(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,a=this.ns0*y(e-this.long0),n=r*Math.sin(a)+this.x0,o=this.rh-r*Math.cos(a)+this.y0;return t.x=n,t.y=o,t}function Un(t){var e,s,i,r,a,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),r=0,e!==0&&(r=Math.atan2(i*t.x,i*t.y)),i=e*this.ns0/this.a,this.sphere?n=Math.asin((this.c-i*i)/(2*this.ns0)):(s=(this.c-i*i)/this.ns0,n=this.phi1z(this.e3,s)),a=y(r/this.ns0+this.long0),t.x=a,t.y=n,t}function zn(t,e){var s,i,r,a,n,o=Q(.5*e);if(t<v)return o;for(var h=t*t,f=1;f<=25;f++)if(s=Math.sin(o),i=Math.cos(o),r=t*s,a=1-r*r,n=.5*a*a/i*(e/(1-h)-s/a+.5/t*Math.log((1-r)/(1+r))),o=o+n,Math.abs(n)<=1e-7)return o;return null}var qn=["Albers_Conic_Equal_Area","Albers","aea"],Fi={init:Tn,forward:Bn,inverse:Un,names:qn,phi1z:zn};function Gn(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Dn(t){var e,s,i,r,a,n,o,h,f=t.x,l=t.y;return i=y(f-this.long0),e=Math.sin(l),s=Math.cos(l),r=Math.cos(i),n=this.sin_p14*e+this.cos_p14*s*r,a=1,n>0||Math.abs(n)<=v?(o=this.x0+this.a*a*s*Math.sin(i)/n,h=this.y0+this.a*a*(this.cos_p14*e-this.sin_p14*s*r)/n):(o=this.x0+this.infinity_dist*s*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*s*r)),t.x=o,t.y=h,t}function jn(t){var e,s,i,r,a,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),s=Math.sin(r),i=Math.cos(r),n=Q(i*this.sin_p14+t.y*s*this.cos_p14/e),a=Math.atan2(t.x*s,e*this.cos_p14*i-t.y*this.sin_p14*s),a=y(this.long0+a)):(n=this.phic0,a=0),t.x=a,t.y=n,t}var kn=["gnom"],Li={init:Gn,forward:Dn,inverse:jn,names:kn};function Ri(t,e){var s=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-s)<1e-6)return e<0?-1*b:b;for(var i=Math.asin(.5*e),r,a,n,o,h=0;h<30;h++)if(a=Math.sin(i),n=Math.cos(i),o=t*a,r=Math.pow(1-o*o,2)/(2*n)*(e/(1-t*t)-a/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),i+=r,Math.abs(r)<=1e-10)return i;return NaN}function Vn(){this.sphere||(this.k0=k(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Hn(t){var e=t.x,s=t.y,i,r,a=y(e-this.long0);if(this.sphere)i=this.x0+this.a*a*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var n=ot(this.e,Math.sin(s));i=this.x0+this.a*this.k0*a,r=this.y0+this.a*n*.5/this.k0}return t.x=i,t.y=r,t}function Wn(t){t.x-=this.x0,t.y-=this.y0;var e,s;return this.sphere?(e=y(this.long0+t.x/this.a/Math.cos(this.lat_ts)),s=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(s=Ri(this.e,2*t.y*this.k0/this.a),e=y(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=s,t}var Xn=["cea"],Ci={init:Vn,forward:Hn,inverse:Wn,names:Xn};function Jn(){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 Zn(t){var e=t.x,s=t.y,i=y(e-this.long0),r=nt(s-this.lat0);return t.x=this.x0+this.a*i*this.rc,t.y=this.y0+this.a*r,t}function Qn(t){var e=t.x,s=t.y;return t.x=y(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=nt(this.lat0+(s-this.y0)/this.a),t}var $n=["Equirectangular","Equidistant_Cylindrical","eqc"],Ti={init:Jn,forward:Zn,inverse:Qn,names:$n};var Bi=20;function Kn(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.ml0=this.a*q(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Yn(t){var e=t.x,s=t.y,i,r,a,n=y(e-this.long0);if(a=n*Math.sin(s),this.sphere)Math.abs(s)<=v?(i=this.a*n,r=-1*this.a*this.lat0):(i=this.a*Math.sin(a)/Math.tan(s),r=this.a*(nt(s-this.lat0)+(1-Math.cos(a))/Math.tan(s)));else if(Math.abs(s)<=v)i=this.a*n,r=-1*this.ml0;else{var o=xt(this.a,this.e,Math.sin(s))/Math.tan(s);i=o*Math.sin(a),r=this.a*q(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+o*(1-Math.cos(a))}return t.x=i+this.x0,t.y=r+this.y0,t}function to(t){var e,s,i,r,a,n,o,h,f;if(i=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=v)e=y(i/this.a+this.long0),s=0;else{n=this.lat0+r/this.a,o=i*i/this.a/this.a+n*n,h=n;var l;for(a=Bi;a;--a)if(l=Math.tan(h),f=-1*(n*(h*l+1)-h-.5*(h*h+o)*l)/((h-n)/l-1),h+=f,Math.abs(f)<=v){s=h;break}e=y(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(s))}else if(Math.abs(r+this.ml0)<=v)s=0,e=y(this.long0+i/this.a);else{n=(this.ml0+r)/this.a,o=i*i/this.a/this.a+n*n,h=n;var u,c,m,d,p;for(a=Bi;a;--a)if(p=this.e*Math.sin(h),u=Math.sqrt(1-p*p)*Math.tan(h),c=this.a*q(this.e0,this.e1,this.e2,this.e3,h),m=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),d=c/this.a,f=(n*(u*d+1)-d-.5*u*(d*d+o))/(this.es*Math.sin(2*h)*(d*d+o-2*n*d)/(4*u)+(n-d)*(u*m-2/Math.sin(2*h))-m),h-=f,Math.abs(f)<=v){s=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),e=y(this.long0+Math.asin(i*u/this.a)/Math.sin(s))}return t.x=e,t.y=s,t}var eo=["Polyconic","poly"],Ui={init:Kn,forward:Yn,inverse:to,names:eo};function so(){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 io(t){var e,s=t.x,i=t.y,r=i-this.lat0,a=s-this.long0,n=r/At*1e-5,o=a,h=1,f=0;for(e=1;e<=10;e++)h=h*n,f=f+this.A[e]*h;var l=f,u=o,c=1,m=0,d,p,_=0,M=0;for(e=1;e<=6;e++)d=c*l-m*u,p=m*l+c*u,c=d,m=p,_=_+this.B_re[e]*c-this.B_im[e]*m,M=M+this.B_im[e]*c+this.B_re[e]*m;return t.x=M*this.a+this.x0,t.y=_*this.a+this.y0,t}function ro(t){var e,s=t.x,i=t.y,r=s-this.x0,a=i-this.y0,n=a/this.a,o=r/this.a,h=1,f=0,l,u,c=0,m=0;for(e=1;e<=6;e++)l=h*n-f*o,u=f*n+h*o,h=l,f=u,c=c+this.C_re[e]*h-this.C_im[e]*f,m=m+this.C_im[e]*h+this.C_re[e]*f;for(var d=0;d<this.iterations;d++){var p=c,_=m,M,x,g=n,S=o;for(e=2;e<=6;e++)M=p*c-_*m,x=_*c+p*m,p=M,_=x,g=g+(e-1)*(this.B_re[e]*p-this.B_im[e]*_),S=S+(e-1)*(this.B_im[e]*p+this.B_re[e]*_);p=1,_=0;var I=this.B_re[1],P=this.B_im[1];for(e=2;e<=6;e++)M=p*c-_*m,x=_*c+p*m,p=M,_=x,I=I+e*(this.B_re[e]*p-this.B_im[e]*_),P=P+e*(this.B_im[e]*p+this.B_re[e]*_);var B=I*I+P*P;c=(g*I+S*P)/B,m=(S*I-g*P)/B}var N=c,Y=m,G=1,st=0;for(e=1;e<=9;e++)G=G*N,st=st+this.D[e]*G;var mt=this.lat0+st*At*1e5,Yt=this.long0+Y;return t.x=Yt,t.y=mt,t}var ao=["New_Zealand_Map_Grid","nzmg"],zi={init:so,forward:io,inverse:ro,names:ao};function no(){}function oo(t){var e=t.x,s=t.y,i=y(e-this.long0),r=this.x0+this.a*i,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+s/2.5))*1.25;return t.x=r,t.y=a,t}function ho(t){t.x-=this.x0,t.y-=this.y0;var e=y(this.long0+t.x/this.a),s=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=s,t}var fo=["Miller_Cylindrical","mill"],qi={init:no,forward:oo,inverse:ho,names:fo};var lo=20;function uo(){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=Se(this.es)}function co(t){var e,s,i=t.x,r=t.y;if(i=y(i-this.long0),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var a=this.n*Math.sin(r),n=lo;n;--n){var o=(this.m*r+Math.sin(r)-a)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<v)break}e=this.a*this.C_x*i*(this.m+Math.cos(r)),s=this.a*this.C_y*r}else{var h=Math.sin(r),f=Math.cos(r);s=this.a*Ft(r,h,f,this.en),e=this.a*i*f/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=s,t}function mo(t){var e,s,i,r;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(e))),this.m?e=Q((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=Q(Math.sin(e)/this.n)),i=y(i+this.long0),e=nt(e)):(e=Ae(t.y/this.a,this.es,this.en),r=Math.abs(e),r<b?(r=Math.sin(e),s=this.long0+t.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(e)),i=y(s)):r-v<b&&(i=this.long0)),t.x=i,t.y=e,t}var po=["Sinusoidal","sinu"],Gi={init:uo,forward:co,inverse:mo,names:po};function bo(){}function _o(t){for(var e=t.x,s=t.y,i=y(e-this.long0),r=s,a=Math.PI*Math.sin(s);;){var n=-(r+Math.sin(r)-a)/(1+Math.cos(r));if(r+=n,Math.abs(n)<v)break}r/=2,Math.PI/2-Math.abs(s)<v&&(i=0);var o=.900316316158*this.a*i*Math.cos(r)+this.x0,h=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=o,t.y=h,t}function vo(t){var e,s;t.x-=this.x0,t.y-=this.y0,s=t.y/(1.4142135623731*this.a),Math.abs(s)>.999999999999&&(s=.999999999999),e=Math.asin(s);var i=y(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),s=(2*e+Math.sin(2*e))/Math.PI,Math.abs(s)>1&&(s=1);var r=Math.asin(s);return t.x=i,t.y=r,t}var yo=["Mollweide","moll"],Di={init:bo,forward:_o,inverse:vo,names:yo};function Mo(){Math.abs(this.lat1+this.lat2)<v||(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=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=k(this.e,this.sinphi,this.cosphi),this.ml1=q(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<v?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=k(this.e,this.sinphi,this.cosphi),this.ml2=q(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=q(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function go(t){var e=t.x,s=t.y,i;if(this.sphere)i=this.a*(this.g-s);else{var r=q(this.e0,this.e1,this.e2,this.e3,s);i=this.a*(this.g-r)}var a=this.ns*y(e-this.long0),n=this.x0+i*Math.sin(a),o=this.y0+this.rh-i*Math.cos(a);return t.x=n,t.y=o,t}function xo(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var e,s,i,r;this.ns>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var a=0;if(s!==0&&(a=Math.atan2(e*t.x,e*t.y)),this.sphere)return r=y(this.long0+a/this.ns),i=nt(this.g-s/this.a),t.x=r,t.y=i,t;var n=this.g-s/this.a;return i=Lt(n,this.e0,this.e1,this.e2,this.e3),r=y(this.long0+a/this.ns),t.x=r,t.y=i,t}var wo=["Equidistant_Conic","eqdc"],ji={init:Mo,forward:go,inverse:xo,names:wo};function Io(){this.R=this.a}function Po(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a;Math.abs(s)<=v&&(r=this.x0+this.R*i,a=this.y0);var n=Q(2*Math.abs(s/Math.PI));(Math.abs(i)<=v||Math.abs(Math.abs(s)-b)<=v)&&(r=this.x0,s>=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),l=Math.cos(n),u=l/(f+l-1),c=u*u,m=u*(2/f-1),d=m*m,p=Math.PI*this.R*(o*(u-d)+Math.sqrt(h*(u-d)*(u-d)-(d+h)*(c-d)))/(d+h);i<0&&(p=-p),r=this.x0+p;var _=h+u;return p=Math.PI*this.R*(m*_-o*Math.sqrt((d+h)*(h+1)-_*_))/(d+h),s>=0?a=this.y0+p:a=this.y0-p,t.x=r,t.y=a,t}function Eo(t){var e,s,i,r,a,n,o,h,f,l,u,c,m;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,i=t.x/u,r=t.y/u,a=i*i+r*r,n=-Math.abs(r)*(1+a),o=n-2*r*r+i*i,h=-2*n+1+2*r*r+a*a,m=r*r/h+(2*o*o*o/h/h/h-9*n*o/h/h)/27,f=(n-o*o/3/h)/h,l=2*Math.sqrt(-f/3),u=3*m/f/l,Math.abs(u)>1&&(u>=0?u=1:u=-1),c=Math.acos(u)/3,t.y>=0?s=(-l*Math.cos(c+Math.PI/3)-o/3/h)*Math.PI:s=-(-l*Math.cos(c+Math.PI/3)-o/3/h)*Math.PI,Math.abs(i)<v?e=this.long0:e=y(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(i*i-r*r)+a*a))/2/i),t.x=e,t.y=s,t}var So=["Van_der_Grinten_I","VanDerGrinten","vandg"],ki={init:Io,forward:Po,inverse:Eo,names:So};function Ao(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function No(t){var e=t.x,s=t.y,i=Math.sin(t.y),r=Math.cos(t.y),a=y(e-this.long0),n,o,h,f,l,u,c,m,d,p,_,M,x,g,S,I,P,B,N,Y,G,st,mt;return this.sphere?Math.abs(this.sin_p12-1)<=v?(t.x=this.x0+this.a*(b-s)*Math.sin(a),t.y=this.y0-this.a*(b-s)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(t.x=this.x0+this.a*(b+s)*Math.sin(a),t.y=this.y0+this.a*(b+s)*Math.cos(a),t):(B=this.sin_p12*i+this.cos_p12*r*Math.cos(a),I=Math.acos(B),P=I?I/Math.sin(I):1,t.x=this.x0+this.a*P*r*Math.sin(a),t.y=this.y0+this.a*P*(this.cos_p12*i-this.sin_p12*r*Math.cos(a)),t):(n=vt(this.es),o=yt(this.es),h=Mt(this.es),f=gt(this.es),Math.abs(this.sin_p12-1)<=v?(l=this.a*q(n,o,h,f,b),u=this.a*q(n,o,h,f,s),t.x=this.x0+(l-u)*Math.sin(a),t.y=this.y0-(l-u)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(l=this.a*q(n,o,h,f,b),u=this.a*q(n,o,h,f,s),t.x=this.x0+(l+u)*Math.sin(a),t.y=this.y0+(l+u)*Math.cos(a),t):(c=i/r,m=xt(this.a,this.e,this.sin_p12),d=xt(this.a,this.e,i),p=Math.atan((1-this.es)*c+this.es*m*this.sin_p12/(d*r)),_=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(p)-this.sin_p12*Math.cos(a)),_===0?N=Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):Math.abs(Math.abs(_)-Math.PI)<=v?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(_)),M=this.e*this.sin_p12/Math.sqrt(1-this.es),x=this.e*this.cos_p12*Math.cos(_)/Math.sqrt(1-this.es),g=M*x,S=x*x,Y=N*N,G=Y*N,st=G*N,mt=st*N,I=m*N*(1-Y*S*(1-S)/6+G/8*g*(1-2*S)+st/120*(S*(4-7*S)-3*M*M*(1-7*S))-mt/48*g),t.x=this.x0+I*Math.sin(_),t.y=this.y0+I*Math.cos(_),t))}function Oo(t){t.x-=this.x0,t.y-=this.y0;var e,s,i,r,a,n,o,h,f,l,u,c,m,d,p,_,M,x,g,S,I,P,B,N;return this.sphere?(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*b*this.a?void 0:(s=e/this.a,i=Math.sin(s),r=Math.cos(s),a=this.long0,Math.abs(e)<=v?n=this.lat0:(n=Q(r*this.sin_p12+t.y*i*this.cos_p12/e),o=Math.abs(this.lat0)-b,Math.abs(o)<=v?this.lat0>=0?a=y(this.long0+Math.atan2(t.x,-t.y)):a=y(this.long0-Math.atan2(-t.x,t.y)):a=y(this.long0+Math.atan2(t.x*i,e*this.cos_p12*r-t.y*this.sin_p12*i))),t.x=a,t.y=n,t)):(h=vt(this.es),f=yt(this.es),l=Mt(this.es),u=gt(this.es),Math.abs(this.sin_p12-1)<=v?(c=this.a*q(h,f,l,u,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=c-e,n=Lt(m/this.a,h,f,l,u),a=y(this.long0+Math.atan2(t.x,-1*t.y)),t.x=a,t.y=n,t):Math.abs(this.sin_p12+1)<=v?(c=this.a*q(h,f,l,u,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=e-c,n=Lt(m/this.a,h,f,l,u),a=y(this.long0+Math.atan2(t.x,t.y)),t.x=a,t.y=n,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),_=Math.atan2(t.x,t.y),d=xt(this.a,this.e,this.sin_p12),M=Math.cos(_),x=this.e*this.cos_p12*M,g=-x*x/(1-this.es),S=3*this.es*(1-g)*this.sin_p12*this.cos_p12*M/(1-this.es),I=e/d,P=I-g*(1+g)*Math.pow(I,3)/6-S*(1+3*g)*Math.pow(I,4)/24,B=1-g*P*P/2-I*P*P*P/6,p=Math.asin(this.sin_p12*Math.cos(P)+this.cos_p12*Math.sin(P)*M),a=y(this.long0+Math.asin(Math.sin(_)*Math.sin(P)/Math.cos(p))),N=Math.sin(p),n=Math.atan2((N-this.es*B*this.sin_p12)*Math.tan(p),N*(1-this.es)),t.x=a,t.y=n,t))}var Fo=["Azimuthal_Equidistant","aeqd"],Vi={init:Ao,forward:No,inverse:Oo,names:Fo};function Lo(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Ro(t){var e,s,i,r,a,n,o,h,f=t.x,l=t.y;return i=y(f-this.long0),e=Math.sin(l),s=Math.cos(l),r=Math.cos(i),n=this.sin_p14*e+this.cos_p14*s*r,a=1,(n>0||Math.abs(n)<=v)&&(o=this.a*a*s*Math.sin(i),h=this.y0+this.a*a*(this.cos_p14*e-this.sin_p14*s*r)),t.x=o,t.y=h,t}function Co(t){var e,s,i,r,a,n,o;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),s=Q(e/this.a),i=Math.sin(s),r=Math.cos(s),n=this.long0,Math.abs(e)<=v?(o=this.lat0,t.x=n,t.y=o,t):(o=Q(r*this.sin_p14+t.y*i*this.cos_p14/e),a=Math.abs(this.lat0)-b,Math.abs(a)<=v?(this.lat0>=0?n=y(this.long0+Math.atan2(t.x,-t.y)):n=y(this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=o,t):(n=y(this.long0+Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i)),t.x=n,t.y=o,t))}var To=["ortho"],Hi={init:Lo,forward:Ro,inverse:Co,names:To};var F={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},A={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Bo(){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>=b-E/2?this.face=F.TOP:this.lat0<=-(b-E/2)?this.face=F.BOTTOM:Math.abs(this.long0)<=E?this.face=F.FRONT:Math.abs(this.long0)<=b+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 Uo(t){var e={x:0,y:0},s,i,r,a,n,o,h={value:0};if(t.x-=this.long0,this.es!==0?s=Math.atan(this.one_minus_f_squared*Math.tan(t.y)):s=t.y,i=t.x,this.face===F.TOP)a=b-s,i>=E&&i<=b+E?(h.value=A.AREA_0,r=i-b):i>b+E||i<=-(b+E)?(h.value=A.AREA_1,r=i>0?i-O:i+O):i>-(b+E)&&i<=-E?(h.value=A.AREA_2,r=i+b):(h.value=A.AREA_3,r=i);else if(this.face===F.BOTTOM)a=b+s,i>=E&&i<=b+E?(h.value=A.AREA_0,r=-i+b):i<E&&i>=-E?(h.value=A.AREA_1,r=-i):i<-E&&i>=-(b+E)?(h.value=A.AREA_2,r=-i-b):(h.value=A.AREA_3,r=i>0?-i+O:-i-O);else{var f,l,u,c,m,d,p;this.face===F.RIGHT?i=kt(i,+b):this.face===F.BACK?i=kt(i,+O):this.face===F.LEFT&&(i=kt(i,-b)),c=Math.sin(s),m=Math.cos(s),d=Math.sin(i),p=Math.cos(i),f=m*p,l=m*d,u=c,this.face===F.FRONT?(a=Math.acos(f),r=Re(a,u,l,h)):this.face===F.RIGHT?(a=Math.acos(l),r=Re(a,u,-f,h)):this.face===F.BACK?(a=Math.acos(-f),r=Re(a,u,-l,h)):this.face===F.LEFT?(a=Math.acos(-l),r=Re(a,u,f,h)):(a=r=0,h.value=A.AREA_0)}return o=Math.atan(12/O*(r+Math.acos(Math.sin(r)*Math.cos(E))-b)),n=Math.sqrt((1-Math.cos(a))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),h.value===A.AREA_1?o+=b:h.value===A.AREA_2?o+=O:h.value===A.AREA_3&&(o+=1.5*O),e.x=n*Math.cos(o),e.y=n*Math.sin(o),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,t.x=e.x,t.y=e.y,t}function zo(t){var e={lam:0,phi:0},s,i,r,a,n,o,h,f,l,u={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),s=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?u.value=A.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(u.value=A.AREA_1,s-=b):t.x<0&&-t.x>=Math.abs(t.y)?(u.value=A.AREA_2,s=s<0?s+O:s-O):(u.value=A.AREA_3,s+=b),l=O/12*Math.tan(s),n=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(n),r=Math.cos(s),a=Math.tan(i),h=1-r*r*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),e.phi=b-f,u.value===A.AREA_0?e.lam=o+b:u.value===A.AREA_1?e.lam=o<0?o+O:o-O:u.value===A.AREA_2?e.lam=o-b:e.lam=o;else if(this.face===F.BOTTOM)f=Math.acos(h),e.phi=f-b,u.value===A.AREA_0?e.lam=-o+b:u.value===A.AREA_1?e.lam=-o:u.value===A.AREA_2?e.lam=-o-b:e.lam=o<0?-o-O:-o+O;else{var c,m,d;c=h,l=c*c,l>=1?d=0:d=Math.sqrt(1-l)*Math.sin(o),l+=d*d,l>=1?m=0:m=Math.sqrt(1-l),u.value===A.AREA_1?(l=m,m=-d,d=l):u.value===A.AREA_2?(m=-m,d=-d):u.value===A.AREA_3&&(l=m,m=d,d=-l),this.face===F.RIGHT?(l=c,c=-m,m=l):this.face===F.BACK?(c=-c,m=-m):this.face===F.LEFT&&(l=c,c=m,m=-l),e.phi=Math.acos(-d)-b,e.lam=Math.atan2(m,c),this.face===F.RIGHT?e.lam=kt(e.lam,-b):this.face===F.BACK?e.lam=kt(e.lam,-O):this.face===F.LEFT&&(e.lam=kt(e.lam,+b))}if(this.es!==0){var p,_,M;p=e.phi<0?1:0,_=Math.tan(e.phi),M=this.b/Math.sqrt(_*_+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-M*M)/(this.one_minus_f*M)),p&&(e.phi=-e.phi)}return e.lam+=this.long0,t.x=e.lam,t.y=e.phi,t}function Re(t,e,s,i){var r;return t<v?(i.value=A.AREA_0,r=0):(r=Math.atan2(e,s),Math.abs(r)<=E?i.value=A.AREA_0:r>E&&r<=b+E?(i.value=A.AREA_1,r-=b):r>b+E||r<=-(b+E)?(i.value=A.AREA_2,r=r>=0?r-O:r+O):(i.value=A.AREA_3,r+=b)),r}function kt(t,e){var s=t+e;return s<-O?s+=ee:s>+O&&(s-=ee),s}var qo=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Wi={init:Bo,forward:Uo,inverse:zo,names:qo};var ds=[[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]],oe=[[-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]],Xi=.8487,Ji=1.3523,Zi=at/5,Go=1/Zi,Vt=18,Ce=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},Do=function(t,e){return t[1]+e*(2*t[2]+e*3*t[3])};function jo(t,e,s,i){for(var r=e;i;--i){var a=t(r);if(r-=a,Math.abs(a)<s)break}return r}function ko(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Vo(t){var e=y(t.x-this.long0),s=Math.abs(t.y),i=Math.floor(s*Zi);i<0?i=0:i>=Vt&&(i=Vt-1),s=at*(s-Go*i);var r={x:Ce(ds[i],s)*e,y:Ce(oe[i],s)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Xi+this.x0,r.y=r.y*this.a*Ji+this.y0,r}function Ho(t){var e={x:(t.x-this.x0)/(this.a*Xi),y:Math.abs(t.y-this.y0)/(this.a*Ji)};if(e.y>=1)e.x/=ds[Vt][0],e.y=t.y<0?-b:b;else{var s=Math.floor(e.y*Vt);for(s<0?s=0:s>=Vt&&(s=Vt-1);;)if(oe[s][0]>e.y)--s;else if(oe[s+1][0]<=e.y)++s;else break;var i=oe[s],r=5*(e.y-i[0])/(oe[s+1][0]-i[0]);r=jo(function(a){return(Ce(i,a)-e.y)/Do(i,a)},r,v,100),e.x/=Ce(ds[s],r),e.y=(5*s+r)*U,t.y<0&&(e.y=-e.y)}return e.x=y(e.x+this.long0),e}var Wo=["Robinson","robin"],Qi={init:ko,forward:Vo,inverse:Ho,names:Wo};function Xo(){this.name="geocent"}function Jo(t){var e=we(t,this.es,this.a);return e}function Zo(t){var e=Ie(t,this.es,this.a,this.b);return e}var Qo=["Geocentric","geocentric","geocent","Geocent"],$i={init:Xo,forward:Jo,inverse:Zo,names:Qo};function Ki(t){t.Proj.projections.add(bi),t.Proj.projections.add(jt),t.Proj.projections.add(xi),t.Proj.projections.add(wi),t.Proj.projections.add(Ii),t.Proj.projections.add(Pi),t.Proj.projections.add(Ei),t.Proj.projections.add(Si),t.Proj.projections.add(Ai),t.Proj.projections.add(Ni),t.Proj.projections.add(Oi),t.Proj.projections.add(Fi),t.Proj.projections.add(Li),t.Proj.projections.add(Ci),t.Proj.projections.add(Ti),t.Proj.projections.add(Ui),t.Proj.projections.add(zi),t.Proj.projections.add(qi),t.Proj.projections.add(Gi),t.Proj.projections.add(Di),t.Proj.projections.add(ji),t.Proj.projections.add(ki),t.Proj.projections.add(Vi),t.Proj.projections.add(Hi),t.Proj.projections.add(Wi),t.Proj.projections.add(Qi),t.Proj.projections.add($i)}K.defaultDatum="WGS84";K.Proj=It;K.WGS84=new K.Proj("WGS84");K.Point=ci;K.toPoint=Ee;K.defs=zt;K.transform=Ot;K.mgrs=fi;K.version="__VERSION__";Ki(K);var ms=K;var Ht=class{static defineProjectionAliases(e){let s=[];for(let i in e)s.push([i,e[i]]);ms.defs(s)}constructor({from:e="WGS84",to:s="WGS84"}){if(is(this,"_projection",void 0),this._projection=ms(e,s),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(e){return this._projection.forward(e)}unproject(e){return this._projection.inverse(e)}};function Te(t,e){for(let s of t)s.geometry.coordinates=Yi(s.geometry.coordinates,e);return t}function Yi(t,e){return $o(t)?e(t):t.map(s=>Yi(s,e))}function $o(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function ps(t,e){if(t===null)return null;switch(e){case GeometryType.Point:case GeometryType.MultiPoint:return Ko(t);case GeometryType.LineString:case GeometryType.MultiLineString:return Yo(t);case GeometryType.Polygon:return tr(t);case GeometryType.MultiPolygon:return th(t);default:throw new Error(`Unimplemented geometry type: ${e}`)}}function Ko(t){let e=t.xyArray(),s=t.zArray();return{positions:bs(e,s)}}function Yo(t){let e=t.xyArray(),s=t.zArray(),i=bs(e,s),r=t.endsArray()&&Array.from(t.endsArray())||[e.length/2];r.unshift(0);let a={value:new Uint16Array(r),size:1};return{positions:i,pathIndices:a}}function tr(t){let e=t.xyArray(),s=t.zArray(),i=bs(e,s),r=t.endsArray()&&Array.from(t.endsArray())||[e.length/2];r.unshift(0);let a={value:new Uint16Array(r),size:1},n={value:new Uint16Array([0,e.length/2]),size:1};return{positions:i,primitivePolygonIndices:a,polygonIndices:n}}function th(t){let e=[],s=0,i=1,r=1;for(let c=0;c<t.partsLength();c++){let m=t.parts(c),d=tr(m);s+=d.positions.value.length,i+=d.primitivePolygonIndices.value.length-1,r+=d.polygonIndices.value.length-1,e.push(d)}let a=new Float64Array(s),n=new Uint32Array(i),o=new Uint32Array(r),h=0,f=1,l=1,u=e[0].positions.size;for(let c of e)a.set(c.positions.value,h*u),n.set(c.primitivePolygonIndices.value.subarray(1).map(m=>m+h),f),o.set(c.polygonIndices.value.subarray(1).map(m=>m+h),l),h+=c.positions.value.length/u,f+=c.primitivePolygonIndices.value.length-1,l+=c.polygonIndices.value.length-1;return{positions:{value:a,size:u},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function bs(t,e){if(!e)return{value:t,size:2};if(e.length*2!==t.length)throw new Error("Z array must be half XY array's length");let s=t.length+e.length,i=new Float64Array(s);for(let r=0;r<t.length/2;r++)i[r*3+0]=t[r*2+0],i[r*3+1]=t[r*2+1],i[r*3+2]=e[r];return{value:i,size:3}}function er(t){let e={title:t.title||"",description:t.description||"",crs:JSON.stringify(t.crs)||"",metadata:t.metadata||"",geometryType:String(t.geometryType),indexNodeSize:String(t.indexNodeSize),featureCount:String(t.featuresCount),bounds:t.envelope?.join(",")||""},s=t.columns?.map(i=>eh(i))||[];return{metadata:e,fields:s}}function eh(t){let e={title:t.title||"",description:t.description||"",width:String(t.width),precision:String(t.precision),scale:String(t.scale),unique:String(t.unique),primary_key:String(t.primary_key)};return{name:t.name,type:sh(t.type),nullable:t.nullable,metadata:e}}var j;(function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"})(j||(j={}));function sh(t){switch(t){case j.Byte:return"int8";case j.UByte:return"uint8";case j.Bool:return"bool";case j.Short:return"int16";case j.UShort:return"uint16";case j.Int:return"int32";case j.UInt:return"uint32";case j.Long:return"int64";case j.ULong:return"uint64";case j.Float:return"float32";case j.Double:return"float64";case j.String:return"utf8";case j.Json:return"null";case j.DateTime:return"date-millisecond";case j.Binary:return"binary";default:return"null"}}var R;(function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"})(R||(R={}));var ct=new Int32Array(2),Be=new Float32Array(ct.buffer),Ue=new Float64Array(ct.buffer),Wt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var he;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(he||(he={}));var W=class{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new W(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return ct[0]=this.readInt32(e),Be[0]}readFloat64(e){return ct[Wt?0:1]=this.readInt32(e),ct[Wt?1:0]=this.readInt32(e+4),Ue[0]}writeInt8(e,s){this.bytes_[e]=s}writeUint8(e,s){this.bytes_[e]=s}writeInt16(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8}writeUint16(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8}writeInt32(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8,this.bytes_[e+2]=s>>16,this.bytes_[e+3]=s>>24}writeUint32(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8,this.bytes_[e+2]=s>>16,this.bytes_[e+3]=s>>24}writeInt64(e,s){this.writeInt32(e,Number(BigInt.asIntN(32,s))),this.writeInt32(e+4,Number(BigInt.asIntN(32,s>>BigInt(32))))}writeUint64(e,s){this.writeUint32(e,Number(BigInt.asUintN(32,s))),this.writeUint32(e+4,Number(BigInt.asUintN(32,s>>BigInt(32))))}writeFloat32(e,s){Be[0]=s,this.writeInt32(e,ct[0])}writeFloat64(e,s){Ue[0]=s,this.writeInt32(e,ct[Wt?0:1]),this.writeInt32(e+4,ct[Wt?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let s=0;s<4;s++)e+=String.fromCharCode(this.readInt8(this.position_+4+s));return e}__offset(e,s){let i=e-this.readInt32(e);return s<this.readInt16(i)?this.readInt16(i+s):0}__union(e,s){return e.bb_pos=s+this.readInt32(s),e.bb=this,e}__string(e,s){e+=this.readInt32(e);let i=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+i);return s===he.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,s){return typeof e=="string"?this.__string(s):this.__union(e,s)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let s=0;s<4;s++)if(e.charCodeAt(s)!=this.readInt8(this.position()+4+s))return!1;return!0}createScalarList(e,s){let i=[];for(let r=0;r<s;++r){let a=e(r);a!==null&&i.push(a)}return i}createObjList(e,s){let i=[];for(let r=0;r<s;++r){let a=e(r);a!==null&&i.push(a.unpack())}return i}};var D=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsGeometry(e,s){return(s||new D).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsGeometry(e,s){return e.setPosition(e.position()+4),(s||new D).__init(e.readInt32(e.position())+e.position(),e)}ends(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readUint32(this.bb.__vector(this.bb_pos+s)+e*4):0}endsLength(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__vector_len(this.bb_pos+e):0}endsArray(){let e=this.bb.__offset(this.bb_pos,4);return e?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}xy(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}xyLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}xyArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}z(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}zLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}zArray(){let e=this.bb.__offset(this.bb_pos,8);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}m(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}mLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}mArray(){let e=this.bb.__offset(this.bb_pos,10);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}t(e){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}tLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}tArray(){let e=this.bb.__offset(this.bb_pos,12);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}tm(e){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.readUint64(this.bb.__vector(this.bb_pos+s)+e*8):BigInt(0)}tmLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}type(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readUint8(this.bb_pos+e):R.Unknown}parts(e,s){let i=this.bb.__offset(this.bb_pos,18);return i?(s||new D).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}partsLength(){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__vector_len(this.bb_pos+e):0}static startGeometry(e){e.startObject(8)}static addEnds(e,s){e.addFieldOffset(0,s,0)}static createEndsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addInt32(s[i]);return e.endVector()}static startEndsVector(e,s){e.startVector(4,s,4)}static addXy(e,s){e.addFieldOffset(1,s,0)}static createXyVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startXyVector(e,s){e.startVector(8,s,8)}static addZ(e,s){e.addFieldOffset(2,s,0)}static createZVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startZVector(e,s){e.startVector(8,s,8)}static addM(e,s){e.addFieldOffset(3,s,0)}static createMVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startMVector(e,s){e.startVector(8,s,8)}static addT(e,s){e.addFieldOffset(4,s,0)}static createTVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startTVector(e,s){e.startVector(8,s,8)}static addTm(e,s){e.addFieldOffset(5,s,0)}static createTmVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addInt64(s[i]);return e.endVector()}static startTmVector(e,s){e.startVector(8,s,8)}static addType(e,s){e.addFieldInt8(6,s,R.Unknown)}static addParts(e,s){e.addFieldOffset(7,s,0)}static createPartsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startPartsVector(e,s){e.startVector(4,s,4)}static endGeometry(e){return e.endObject()}static createGeometry(e,s,i,r,a,n,o,h,f){return D.startGeometry(e),D.addEnds(e,s),D.addXy(e,i),D.addZ(e,r),D.addM(e,a),D.addT(e,n),D.addTm(e,o),D.addType(e,h),D.addParts(e,f),D.endGeometry(e)}};function ze(t,e){let s=[];for(let i=0;i<t.length;i+=2){let r=[t[i],t[i+1]];e&&r.push(e[i>>1]),s.push(r)}return s}function ir(t,e,s){if(!s||s.length===0)return[ze(t,e)];let i=0,r=Array.from(s).map(n=>t.slice(i,i=n<<1)),a;return e&&(i=0,a=Array.from(s).map(n=>e.slice(i,i=n))),r.map((n,o)=>ze(n,a?a[o]:void 0))}function rh(t,e){let s=t.xyArray(),i=t.zArray();switch(e){case R.Point:{let r=Array.from(s);return i&&r.push(i[0]),r}case R.MultiPoint:case R.LineString:return ze(s,i);case R.MultiLineString:return ir(s,i,t.endsArray());case R.Polygon:return ir(s,i,t.endsArray())}}function qe(t,e){let s=e;if(s===R.Unknown&&(s=t.type()),s===R.GeometryCollection){let r=[];for(let a=0;a<t.partsLength();a++){let n=t.parts(a),o=n.type();r.push(qe(n,o))}return{type:R[s],geometries:r}}else if(s===R.MultiPolygon){let r=[];for(let a=0;a<t.partsLength();a++)r.push(qe(t.parts(a),R.Polygon));return{type:R[s],coordinates:r.map(a=>a.coordinates)}}let i=rh(t,s);return{type:R[s],coordinates:i}}var C;(function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"})(C||(C={}));var L=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsColumn(e,s){return(s||new L).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsColumn(e,s){return e.setPosition(e.position()+4),(s||new L).__init(e.readInt32(e.position())+e.position(),e)}name(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}type(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):C.Byte}title(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__string(this.bb_pos+s,e):null}width(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readInt32(this.bb_pos+e):-1}precision(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readInt32(this.bb_pos+e):-1}scale(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readInt32(this.bb_pos+e):-1}nullable(){let e=this.bb.__offset(this.bb_pos,18);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!0}unique(){let e=this.bb.__offset(this.bb_pos,20);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}primaryKey(){let e=this.bb.__offset(this.bb_pos,22);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}metadata(e){let s=this.bb.__offset(this.bb_pos,24);return s?this.bb.__string(this.bb_pos+s,e):null}static startColumn(e){e.startObject(11)}static addName(e,s){e.addFieldOffset(0,s,0)}static addType(e,s){e.addFieldInt8(1,s,C.Byte)}static addTitle(e,s){e.addFieldOffset(2,s,0)}static addDescription(e,s){e.addFieldOffset(3,s,0)}static addWidth(e,s){e.addFieldInt32(4,s,-1)}static addPrecision(e,s){e.addFieldInt32(5,s,-1)}static addScale(e,s){e.addFieldInt32(6,s,-1)}static addNullable(e,s){e.addFieldInt8(7,Number(s),Number(!0))}static addUnique(e,s){e.addFieldInt8(8,Number(s),Number(!1))}static addPrimaryKey(e,s){e.addFieldInt8(9,Number(s),Number(!1))}static addMetadata(e,s){e.addFieldOffset(10,s,0)}static endColumn(e){let s=e.endObject();return e.requiredField(s,4),s}static createColumn(e,s,i,r,a,n,o,h,f,l,u,c){return L.startColumn(e),L.addName(e,s),L.addType(e,i),L.addTitle(e,r),L.addDescription(e,a),L.addWidth(e,n),L.addPrecision(e,o),L.addScale(e,h),L.addNullable(e,f),L.addUnique(e,l),L.addPrimaryKey(e,u),L.addMetadata(e,c),L.endColumn(e)}};var X=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsFeature(e,s){return(s||new X).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFeature(e,s){return e.setPosition(e.position()+4),(s||new X).__init(e.readInt32(e.position())+e.position(),e)}geometry(e){let s=this.bb.__offset(this.bb_pos,4);return s?(e||new D).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}properties(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readUint8(this.bb.__vector(this.bb_pos+s)+e):0}propertiesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}propertiesArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}columns(e,s){let i=this.bb.__offset(this.bb_pos,8);return i?(s||new L).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}columnsLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFeature(e){e.startObject(3)}static addGeometry(e,s){e.addFieldOffset(0,s,0)}static addProperties(e,s){e.addFieldOffset(1,s,0)}static createPropertiesVector(e,s){e.startVector(1,s.length,1);for(let i=s.length-1;i>=0;i--)e.addInt8(s[i]);return e.endVector()}static startPropertiesVector(e,s){e.startVector(1,s,1)}static addColumns(e,s){e.addFieldOffset(2,s,0)}static createColumnsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startColumnsVector(e,s){e.startVector(4,s,4)}static endFeature(e){return e.endObject()}static finishFeatureBuffer(e,s){e.finish(s)}static finishSizePrefixedFeatureBuffer(e,s){e.finish(s,void 0,!0)}static createFeature(e,s,i,r){return X.startFeature(e),X.addGeometry(e,s),X.addProperties(e,i),X.addColumns(e,r),X.endFeature(e)}};var $d=new TextEncoder,rr=new TextDecoder;function Ge(t,e){let s={};if(!e||e.length===0)return s;let i=t.propertiesArray();if(!i)return s;let r=new DataView(i.buffer,i.byteOffset),a=t.propertiesLength(),n=0;for(;n<a;){let o=r.getUint16(n,!0);n+=2;let h=e[o],f=h.name;switch(h.type){case C.Bool:{s[f]=Boolean(r.getUint8(n)),n+=1;break}case C.Byte:{s[f]=r.getInt8(n),n+=1;break}case C.UByte:{s[f]=r.getUint8(n),n+=1;break}case C.Short:{s[f]=r.getInt16(n,!0),n+=2;break}case C.UShort:{s[f]=r.getUint16(n,!0),n+=2;break}case C.Int:{s[f]=r.getInt32(n,!0),n+=4;break}case C.UInt:{s[f]=r.getUint32(n,!0),n+=4;break}case C.Long:{s[f]=Number(r.getBigInt64(n,!0)),n+=8;break}case C.ULong:{s[f]=Number(r.getBigUint64(n,!0)),n+=8;break}case C.Float:{s[f]=r.getFloat32(n,!0),n+=4;break}case C.Double:{s[f]=r.getFloat64(n,!0),n+=8;break}case C.DateTime:case C.String:{let l=r.getUint32(n,!0);n+=4,s[f]=rr.decode(i.subarray(n,n+l)),n+=l;break}case C.Json:{let l=r.getUint32(n,!0);n+=4;let u=rr.decode(i.subarray(n,n+l));s[f]=JSON.parse(u),n+=l;break}default:throw new Error(`Unknown type ${h.type}`)}}return s}function De(t,e){let s=e.columns;return{type:"Feature",geometry:qe(t.geometry(),e.geometryType),properties:Ge(t,s)}}var Xt=new Uint8Array(0);function ar(){return this._source.cancel()}function _s(t,e){if(!t.length)return e;if(!e.length)return t;var s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s}function nr(){var t=this,e=t._array.subarray(t._index);return t._source.read().then(function(s){return t._array=Xt,t._index=0,s.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:_s(e,s.value)}})}function or(t){if((t|=0)<0)throw new Error("invalid length");var e=this,s=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var i=new Uint8Array(t);return i.set(this._array.subarray(this._index)),function r(){return e._source.read().then(function(a){return a.done?(e._array=Xt,e._index=0,s>0?i.subarray(0,s):null):s+a.value.length>=t?(e._array=a.value,e._index=t-s,i.set(a.value.subarray(0,t-s),s),i):(i.set(a.value,s),s+=a.value.length,r())})}()}function vs(t){return typeof t.slice=="function"?t:new je(typeof t.read=="function"?t:t.getReader())}function je(t){this._source=t,this._array=Xt,this._index=0}je.prototype.read=nr;je.prototype.slice=or;je.prototype.cancel=ar;var J=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsCrs(e,s){return(s||new J).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsCrs(e,s){return e.setPosition(e.position()+4),(s||new J).__init(e.readInt32(e.position())+e.position(),e)}org(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}code(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}name(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__string(this.bb_pos+s,e):null}wkt(e){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.__string(this.bb_pos+s,e):null}codeString(e){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.__string(this.bb_pos+s,e):null}static startCrs(e){e.startObject(6)}static addOrg(e,s){e.addFieldOffset(0,s,0)}static addCode(e,s){e.addFieldInt32(1,s,0)}static addName(e,s){e.addFieldOffset(2,s,0)}static addDescription(e,s){e.addFieldOffset(3,s,0)}static addWkt(e,s){e.addFieldOffset(4,s,0)}static addCodeString(e,s){e.addFieldOffset(5,s,0)}static endCrs(e){return e.endObject()}static createCrs(e,s,i,r,a,n,o){return J.startCrs(e),J.addOrg(e,s),J.addCode(e,i),J.addName(e,r),J.addDescription(e,a),J.addWkt(e,n),J.addCodeString(e,o),J.endCrs(e)}};var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsHeader(e,s){return(s||new Tt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsHeader(e,s){return e.setPosition(e.position()+4),(s||new Tt).__init(e.readInt32(e.position())+e.position(),e)}name(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}envelope(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}envelopeLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}envelopeArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}geometryType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):R.Unknown}hasZ(){let e=this.bb.__offset(this.bb_pos,10);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasM(){let e=this.bb.__offset(this.bb_pos,12);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasT(){let e=this.bb.__offset(this.bb_pos,14);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasTm(){let e=this.bb.__offset(this.bb_pos,16);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}columns(e,s){let i=this.bb.__offset(this.bb_pos,18);return i?(s||new L).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}columnsLength(){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__vector_len(this.bb_pos+e):0}featuresCount(){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint64(this.bb_pos+e):BigInt("0")}indexNodeSize(){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readUint16(this.bb_pos+e):16}crs(e){let s=this.bb.__offset(this.bb_pos,24);return s?(e||new J).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}title(e){let s=this.bb.__offset(this.bb_pos,26);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,28);return s?this.bb.__string(this.bb_pos+s,e):null}metadata(e){let s=this.bb.__offset(this.bb_pos,30);return s?this.bb.__string(this.bb_pos+s,e):null}static startHeader(e){e.startObject(14)}static addName(e,s){e.addFieldOffset(0,s,0)}static addEnvelope(e,s){e.addFieldOffset(1,s,0)}static createEnvelopeVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startEnvelopeVector(e,s){e.startVector(8,s,8)}static addGeometryType(e,s){e.addFieldInt8(2,s,R.Unknown)}static addHasZ(e,s){e.addFieldInt8(3,Number(s),Number(!1))}static addHasM(e,s){e.addFieldInt8(4,Number(s),Number(!1))}static addHasT(e,s){e.addFieldInt8(5,Number(s),Number(!1))}static addHasTm(e,s){e.addFieldInt8(6,Number(s),Number(!1))}static addColumns(e,s){e.addFieldOffset(7,s,0)}static createColumnsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startColumnsVector(e,s){e.startVector(4,s,4)}static addFeaturesCount(e,s){e.addFieldInt64(8,s,BigInt("0"))}static addIndexNodeSize(e,s){e.addFieldInt16(9,s,16)}static addCrs(e,s){e.addFieldOffset(10,s,0)}static addTitle(e,s){e.addFieldOffset(11,s,0)}static addDescription(e,s){e.addFieldOffset(12,s,0)}static addMetadata(e,s){e.addFieldOffset(13,s,0)}static endHeader(e){return e.endObject()}static finishHeaderBuffer(e,s){e.finish(s)}static finishSizePrefixedHeaderBuffer(e,s){e.finish(s,void 0,!0)}};function fe(t){let e=Tt.getRootAsHeader(t),s=e.featuresCount(),i=e.indexNodeSize(),r=[];for(let h=0;h<e.columnsLength();h++){let f=e.columns(h);if(!f)throw new Error("Column unexpectedly missing");if(!f.name())throw new Error("Column name unexpectedly missing");r.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=e.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:e.geometryType(),columns:r,envelope:null,featuresCount:Number(s),indexNodeSize:i,crs:n,title:e.title(),description:e.description(),metadata:e.metadata()}}var Ms=function(t,e){return Ms=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var r in i)i.hasOwnProperty(r)&&(s[r]=i[r])},Ms(t,e)};function ah(t,e){Ms(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}function Zt(t,e,s,i){function r(a){return a instanceof s?a:new s(function(n){n(a)})}return new(s||(s=Promise))(function(a,n){function o(l){try{f(i.next(l))}catch(u){n(u)}}function h(l){try{f(i.throw(l))}catch(u){n(u)}}function f(l){l.done?a(l.value):r(l.value).then(o,h)}f((i=i.apply(t,e||[])).next())})}function Et(t,e){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,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(l){return h([f,l])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=f[0]&2?r.return:f[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,f[1])).done)return a;switch(r=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return s.label++,{value:f[1],done:!1};case 5:s.label++,r=f[1],f=[0];continue;case 7:f=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){s=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){s.label=f[1];break}if(f[0]===6&&s.label<a[1]){s.label=a[1],a=f;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(f);break}a[2]&&s.ops.pop(),s.trys.pop();continue}f=e.call(t,s)}catch(l){f=[6,l],r=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],i=0;if(s)return s.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ue(t){return this instanceof ue?(this.v=t,this):new ue(t)}function nh(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=s.apply(t,e||[]),r,a=[];return r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r;function n(c){i[c]&&(r[c]=function(m){return new Promise(function(d,p){a.push([c,m,d,p])>1||o(c,m)})})}function o(c,m){try{h(i[c](m))}catch(d){u(a[0][3],d)}}function h(c){c.value instanceof ue?Promise.resolve(c.value.v).then(f,l):u(a[0][2],c)}function f(c){o("next",c)}function l(c){o("throw",c)}function u(c,m){c(m),a.shift(),a.length&&o(a[0][0],a[0][1])}}var lr=function(t){ah(e,t);function e(s){var i=t.call(this,s)||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 e}(Error),xm=function(){function t(e){if(e<0)throw new RangeError("Capacity may not be less than 0");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(e){if(this.full)throw new Error("Buffer full");this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),wm=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){for(;this._q.length>=this._c;)this._q.shift();this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),Im=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){this._q.length<this._c&&this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}();function gs(t){t!=null&&typeof t.then=="function"&&t.then(We,We)}var ys=0,hr=1,Ut=2,Ve=3,xs=4,He=1024,We=function(){};function Jt(t){var e=t.err,s=Promise.resolve(t.execution).then(function(i){if(e!=null)throw e;return i});return t.err=void 0,t.execution=s.then(function(){},function(){}),t.pending===void 0?s:t.pending.then(function(){return s})}function Bt(t,e){var s=t.state>=Ve;return Promise.resolve(e).then(function(i){return!s&&t.state>=xs?Jt(t).then(function(r){return{value:r,done:!0}}):{value:i,done:s}})}function ws(t,e){var s,i;if(!(t.state>=Ut))if(t.state=Ut,t.onnext(),t.onstop(),t.err==null&&(t.err=e),t.pushes.length===0&&(typeof t.buffer>"u"||t.buffer.empty))le(t);else try{for(var r=Qt(t.pushes),a=r.next();!a.done;a=r.next()){var n=a.value;n.resolve()}}catch(o){s={error:o}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}}function le(t){var e,s;if(!(t.state>=Ve)){t.state<Ut&&ws(t),t.state=Ve,t.buffer=void 0;try{for(var i=Qt(t.nexts),r=i.next();!r.done;r=i.next()){var a=r.value,n=t.pending===void 0?Jt(t):t.pending.then(function(){return Jt(t)});a.resolve(Bt(t,n))}}catch(o){e={error:o}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(e)throw e.error}}t.pushes=[],t.nexts=[]}}function fr(t){t.state>=xs||(t.state<Ve&&le(t),t.state=xs)}function oh(t,e){if(gs(e),t.pushes.length>=He)throw new lr("No more than "+He+" pending calls to push are allowed on a single repeater.");if(t.state>=Ut)return Promise.resolve(void 0);var s=t.pending===void 0?Promise.resolve(e):t.pending.then(function(){return e});s=s.catch(function(h){t.state<Ut&&(t.err=h),fr(t)});var i;if(t.nexts.length){var r=t.nexts.shift();r.resolve(Bt(t,s)),t.nexts.length?i=Promise.resolve(t.nexts[0].value):i=new Promise(function(h){return t.onnext=h})}else typeof t.buffer<"u"&&!t.buffer.full?(t.buffer.add(s),i=Promise.resolve(void 0)):i=new Promise(function(h){return t.pushes.push({resolve:h,value:s})});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),t.pending=s.then(function(){return o}).catch(function(h){t.err=h,fr(t)}),n}function hh(t){var e=ws.bind(null,t),s=new Promise(function(i){return t.onstop=i});return e.then=s.then.bind(s),e.catch=s.catch.bind(s),e.finally=s.finally.bind(s),e}function fh(t){if(!(t.state>=hr)){t.state=hr;var e=oh.bind(null,t),s=hh(t);t.execution=new Promise(function(i){return i(t.executor(e,s))}),t.execution.catch(function(){return ws(t)})}}var ke=new WeakMap,$t=function(){function t(e,s){ke.set(this,{executor:e,buffer:s,err:void 0,state:ys,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:We,onstop:We})}return t.prototype.next=function(e){gs(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");if(s.nexts.length>=He)throw new lr("No more than "+He+" pending calls to next are allowed on a single repeater.");if(s.state<=ys&&fh(s),s.onnext(e),typeof s.buffer<"u"&&!s.buffer.empty){var i=Bt(s,s.buffer.remove());if(s.pushes.length){var r=s.pushes.shift();s.buffer.add(r.value),s.onnext=r.resolve}return i}else if(s.pushes.length){var a=s.pushes.shift();return s.onnext=a.resolve,Bt(s,a.value)}else if(s.state>=Ut)return le(s),Bt(s,Jt(s));return new Promise(function(n){return s.nexts.push({resolve:n,value:e})})},t.prototype.return=function(e){gs(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");return le(s),s.execution=Promise.resolve(s.execution).then(function(){return e}),Bt(s,Jt(s))},t.prototype.throw=function(e){var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");return s.state<=ys||s.state>=Ut||typeof s.buffer<"u"&&!s.buffer.empty?(le(s),s.err==null&&(s.err=e),Bt(s,Jt(s))):this.next(Promise.reject(e))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=lh,t.merge=uh,t.zip=ch,t.latest=dh,t}();function Xe(t,e){var s,i,r=[],a=function(f){f!=null&&typeof f[Symbol.asyncIterator]=="function"?r.push(f[Symbol.asyncIterator]()):f!=null&&typeof f[Symbol.iterator]=="function"?r.push(f[Symbol.iterator]()):r.push(function(){return nh(this,arguments,function(){return Et(this,function(c){switch(c.label){case 0:return e.yieldValues?[4,ue(f)]:[3,3];case 1:return[4,c.sent()];case 2:c.sent(),c.label=3;case 3:return e.returnValues?[4,ue(f)]:[3,5];case 4:return[2,c.sent()];case 5:return[2]}})})}())};try{for(var n=Qt(t),o=n.next();!o.done;o=n.next()){var h=o.value;a(h)}}catch(f){s={error:f}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}return r}function lh(t){var e=this,s=Xe(t,{returnValues:!0});return new $t(function(i,r){return Zt(e,void 0,void 0,function(){var a,n,o,h,f,l;return Et(this,function(u){switch(u.label){case 0:if(!s.length)return r(),[2];n=!1,r.then(function(){a(),n=!0}),u.label=1;case 1:u.trys.push([1,,5,7]),h=void 0,f=0,l=function(){var c,m,d,p,_,M;return Et(this,function(x){switch(x.label){case 0:c=f;try{for(m=(_=void 0,Qt(s)),d=m.next();!d.done;d=m.next())p=d.value,Promise.resolve(p.next()).then(function(g){g.done?(r(),o===void 0&&(o=g)):f===c&&(f++,a(g))},function(g){return r(g)})}catch(g){_={error:g}}finally{try{d&&!d.done&&(M=m.return)&&M.call(m)}finally{if(_)throw _.error}}return[4,new Promise(function(g){return a=g})];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]}})},u.label=2;case 2:return n?[3,4]:[5,l()];case 3:return u.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return r(),[4,Promise.race(s.map(function(c){return c.return&&c.return()}))];case 6:return u.sent(),[7];case 7:return[2]}})})})}function uh(t){var e=this,s=Xe(t,{yieldValues:!0});return new $t(function(i,r){return Zt(e,void 0,void 0,function(){var a,n,o,h=this;return Et(this,function(f){switch(f.label){case 0:if(!s.length)return r(),[2];a=[],n=!1,r.then(function(){var l,u;n=!0;try{for(var c=Qt(a),m=c.next();!m.done;m=c.next()){var d=m.value;d()}}catch(p){l={error:p}}finally{try{m&&!m.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(s.map(function(l,u){return Zt(h,void 0,void 0,function(){var c,m;return Et(this,function(d){switch(d.label){case 0:d.trys.push([0,,6,9]),d.label=1;case 1:return n?[3,5]:(Promise.resolve(l.next()).then(function(p){return a[u](p)},function(p){return r(p)}),[4,new Promise(function(p){a[u]=p})]);case 2:return c=d.sent(),c===void 0?[3,4]:c.done?(o=c,[2]):[4,i(c.value)];case 3:d.sent(),d.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return m=l.return,m?[4,l.return()]:[3,8];case 7:m=d.sent(),d.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return f.sent(),[2,o&&o.value];case 3:return r(),[7];case 4:return[2]}})})})}function ch(t){var e=this,s=Xe(t,{returnValues:!0});return new $t(function(i,r){return Zt(e,void 0,void 0,function(){var a,n,o,h;return Et(this,function(f){switch(f.label){case 0:if(!s.length)return r(),[2,[]];n=!1,r.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(s.map(function(l){return l.next()})).then(function(l){return a(l)},function(l){return r(l)}),[4,new Promise(function(l){return a=l})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(l){return l.value}),o.some(function(l){return l.done})?[2,h]:[4,i(h)]);case 4:return f.sent(),[3,2];case 5:return[3,8];case 6:return r(),[4,Promise.all(s.map(function(l){return l.return&&l.return()}))];case 7:return f.sent(),[7];case 8:return[2]}})})})}function dh(t){var e=this,s=Xe(t,{yieldValues:!0,returnValues:!0});return new $t(function(i,r){return Zt(e,void 0,void 0,function(){var a,n,o,h,f,l=this;return Et(this,function(u){switch(u.label){case 0:if(!s.length)return r(),[2,[]];n=[],o=!1,r.then(function(){var c,m;a();try{for(var d=Qt(n),p=d.next();!p.done;p=d.next()){var _=p.value;_()}}catch(M){c={error:M}}finally{try{p&&!p.done&&(m=d.return)&&m.call(d)}finally{if(c)throw c.error}}o=!0}),u.label=1;case 1:return u.trys.push([1,,5,7]),Promise.all(s.map(function(c){return c.next()})).then(function(c){return a(c)},function(c){return r(c)}),[4,new Promise(function(c){return a=c})];case 2:return h=u.sent(),h===void 0?[2]:(f=h.map(function(c){return c.value}),h.every(function(c){return c.done})?[2,f]:[4,i(f.slice())]);case 3:return u.sent(),[4,Promise.all(s.map(function(c,m){return Zt(l,void 0,void 0,function(){var d;return Et(this,function(p){switch(p.label){case 0:if(h[m].done)return[2,h[m].value];p.label=1;case 1:return o?[3,4]:(Promise.resolve(c.next()).then(function(_){return n[m](_)},function(_){return r(_)}),[4,new Promise(function(_){return n[m]=_})]);case 2:return d=p.sent(),d===void 0?[2,h[m].value]:d.done?[2,d.value]:(f[m]=d.value,[4,i(f.slice())]);case 3:return p.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,u.sent()];case 5:return r(),[4,Promise.all(s.map(function(c){return c.return&&c.return()}))];case 6:return u.sent(),[7];case 7:return[2]}})})})}var ce=class{constructor(){this._extraRequestThreshold=256*1024}extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(e){if(e<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=e}};ce.global=new ce;var Je=ce;var ft;(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error"})(ft||(ft={}));var Ze=class{static debug(...e){this.log(ft.Debug,...e)}static info(...e){this.log(ft.Info,...e)}static warn(...e){this.log(ft.Warn,...e)}static error(...e){this.log(ft.Error,...e)}static log(e,...s){if(!(this.logLevel>e))switch(e){case ft.Debug:{console.debug(...s);break}case ft.Info:{console.info(...s);break}case ft.Warn:{console.warn(...s);break}case ft.Error:{console.error(...s);break}}}};Ze.logLevel=ft.Warn;var T=Ze;var St=8*4+8;var ur=16;function de(t,e){e=Math.min(Math.max(Number(e),2),65535);let s=t,i=s;do s=Math.ceil(s/e),i+=s;while(s!==1);return i*St}function mh(t,e){if(e<2)throw new Error("Node size must be at least 2");if(t===0)throw new Error("Number of items must be greater than 0");let s=t,i=s,r=[s];do s=Math.ceil(s/e),i+=s,r.push(s);while(s!==1);let a=[];s=i;for(let o of r)a.push(s-o),s-=o;let n=[];for(let o=0;o<r.length;o++)n.push([a[o],a[o]+r[o]]);return n}async function*cr(t,e,s,i){class r{constructor(d,p){this._level=p,this.nodes=d}level(){return this._level}startNodeIdx(){return this.nodes[0]}endNodeIdx(){return this.nodes[1]}extendEndNodeIdx(d){console.assert(d>this.nodes[1]),this.nodes[1]=d}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}let{minX:a,minY:n,maxX:o,maxY:h}=s;T.info(`tree items: ${t}, nodeSize: ${e}`);let f=mh(t,e),l=f[0][0],c=[(()=>{let m=[0,1],d=f.length-1;return new r(m,d)})()];for(T.debug(`starting stream search with queue: ${c}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${f}`);c.length!=0;){let m=c.shift();T.debug(`popped node: ${m}, queueLength: ${c.length}`);let d=m.startNodeIdx(),p=d>=l,_=(()=>{let[,S]=f[m.level()],I=Math.min(m.endNodeIdx()+e,S);return p&&I<S?I+1:I})(),M=_-d,x=await i(d*St,M*St),g=new DataView(x);for(let S=d;S<_;S++){let I=S-d,P=I*St;if(o<g.getFloat64(P+0,!0)||h<g.getFloat64(P+8,!0)||a>g.getFloat64(P+16,!0)||n>g.getFloat64(P+24,!0))continue;let B=g.getBigUint64(P+32,!0);if(p){let mt=B,Yt=(()=>{if(S<t-1){let Ir=(I+1)*St;return g.getBigUint64(Ir+32,!0)-mt}return null})(),wr=S-l;yield[Number(mt),wr,Number(Yt)];continue}let N=B,Y=Je.global.extraRequestThreshold()/St,G=c[c.length-1];if(G!==void 0&&G.level()==m.level()-1&&N<G.endNodeIdx()+Y){T.debug(`Merging "nodeRange" request into existing range: ${G}, newEndNodeIdx: ${G.endNodeIdx()} -> ${N}`),G.extendEndNodeIdx(Number(N));continue}let st=(()=>{let mt=m.level()-1,Yt=[Number(N),Number(N)+1];return new r(Yt,mt)})();G!==void 0&&G.level()==st.level()?T.info(`Same level, but too far away. Pushing new request for nodeIdx: ${N} rather than merging with distant ${G}`):T.info(`Pushing new level for ${st} onto queue with nearestNodeRange: ${G} since there's not already a range for this level.`),c.push(st)}}}var dt=new Uint8Array([102,103,98,3,102,103,98,0]),lt=4;var Kt=class{constructor(e,s,i,r){this.headerClient=e,this.header=s,this.headerLength=i,this.indexLength=r}static async open(e){let i=new Qe(e),r=(()=>{let u=ur,c=3,m=0,d;for(d=0;d<c;d++){let p=u**d*St;m+=p}return m})(),a=2024+r;T.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${r})`);{let u=new Uint8Array(await i.getRange(0,8,a,"header"));if(!u.subarray(0,3).every((c,m)=>dt[m]===c))throw T.error(`bytes: ${u} != ${dt}`),new Error("Not a FlatGeobuf file");T.debug("magic bytes look good")}let n;{let u=await i.getRange(8,4,a,"header");n=new DataView(u).getUint32(0,!0);let c=1048576*10;if(n>c||n<8)throw new Error("Invalid header size");T.debug(`headerLength: ${n}`)}let o=await i.getRange(12,n,a,"header"),h=new W(new Uint8Array(o)),f=fe(h),l=de(f.featuresCount,f.indexNodeSize);return T.debug("completed: opening http reader"),new Kt(i,f,n,l)}async*selectBbox(e){let s=this.lengthBeforeTree(),i=this.headerClient,r=async function(h,f){return i.getRange(s+h,f,0,"index")},a=[],n=[];for await(let h of cr(this.header.featuresCount,this.header.indexNodeSize,e,r)){let[f,,]=h,[,,l]=h;if(l||(T.info("final feature"),l=4),n.length==0){n.push([f,l]);continue}let u=n[n.length-1],c=f-(u[0]+u[1]);c>Je.global.extraRequestThreshold()&&(T.info(`Pushing new feature batch, since gap ${c} was too large`),a.push(n),n=[]),n.push([f,l])}this.headerClient.logUsage("header+index"),n.length>0&&a.push(n);let o=a.flatMap(h=>this.readFeatureBatch(h));yield*$t.merge(o)}lengthBeforeTree(){return dt.length+lt+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new Qe(this.headerClient.httpClient)}async*readFeatureBatch(e){let[s]=e[0],[i,r]=e[e.length-1],a=s,o=i+r-a,h=this.buildFeatureClient(),f=o;for(let[l]of e)yield await this.readFeature(h,l,f),f=0;h.logUsage("feature")}async readFeature(e,s,i){let r=s+this.lengthBeforeFeatures(),a;{let l=await e.getRange(r,4,i,"feature length");a=new DataView(l).getUint32(0,!0)}let n=await e.getRange(r+4,a,i,"feature data"),o=new Uint8Array(n),h=new Uint8Array(a+lt);h.set(o,lt);let f=new W(h);return f.setPosition(lt),X.getRootAsFeature(f)}},Qe=class{constructor(e){if(this.bytesEverUsed=0,this.bytesEverFetched=0,this.buffer=new ArrayBuffer(0),this.head=0,typeof e=="string")this.httpClient=new $e(e);else if(e instanceof $e)this.httpClient=e;else throw new Error("Unknown source ")}async getRange(e,s,i,r){this.bytesEverUsed+=s;let a=e-this.head,n=a+s;if(a>=0&&n<=this.buffer.byteLength)return this.buffer.slice(a,n);let o=Math.max(s,i);return this.bytesEverFetched+=o,T.debug(`requesting for new Range: ${e}-${e+o-1}`),this.buffer=await this.httpClient.getRange(e,o,r),this.head=e,this.buffer.slice(0,s)}logUsage(e){let s=e.split(" ")[0],i=this.bytesEverUsed,r=this.bytesEverFetched,a=(100*i/r).toFixed(2);T.info(`${s} bytes used/requested: ${i} / ${r} = ${a}%`)}},$e=class{constructor(e){this.requestsEverMade=0,this.bytesEverRequested=0,this.url=e}async getRange(e,s,i){this.requestsEverMade+=1,this.bytesEverRequested+=s;let r=`bytes=${e}-${e+s-1}`;return T.info(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${s}, ever: ${this.bytesEverRequested}), Range: ${r}`),(await fetch(this.url,{headers:{Range:r}})).arrayBuffer()}};function Ke(t,e,s){if(!t.subarray(0,3).every((l,u)=>dt[u]===l))throw new Error("Not a FlatGeobuf file");let i=new W(t),r=i.readUint32(dt.length);i.setPosition(dt.length+lt);let a=fe(i);s&&s(a);let n=dt.length+lt+r,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=de(h,o));let f=[];for(;n<i.capacity();){let l=i.readUint32(n);i.setPosition(n+lt);let u=X.getRootAsFeature(i);f.push(e(u,a)),n+=lt+l}return f}async function*Ye(t,e,s){let i=vs(t),r=async c=>await i.slice(c),a=new Uint8Array(await r(8,"magic bytes"));if(!a.subarray(0,3).every((c,m)=>dt[m]===c))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await r(4,"header length"));let n=new W(a),o=n.readUint32(0);a=new Uint8Array(await r(o,"header data")),n=new W(a);let h=fe(n);s&&s(h);let{indexNodeSize:f,featuresCount:l}=h;if(f>0){let c=de(l,f);await r(c,"entire index, w/o rect")}let u;for(;u=await ph(r,h,e);)yield u}async function*ts(t,e,s,i){let r=await Kt.open(t);T.debug("opened reader"),i&&i(r.header);for await(let a of r.selectBbox(e))yield s(a,r.header)}async function ph(t,e,s){let i=new Uint8Array(await t(4,"feature length"));if(i.byteLength===0)return;let r=new W(i),a=r.readUint32(0);i=new Uint8Array(await t(a,"feature data"));let n=new Uint8Array(a+4);n.set(i,4),r=new W(n),r.setPosition(lt);let o=X.getRootAsFeature(r);return s(o,e)}function dr(t,e){return{type:"FeatureCollection",features:Ke(t,De,e)}}function mr(t,e){return Ye(t,De,e)}function pr(t,e,s){return ts(t,e,De,s)}function br(t,e,s){return t instanceof Uint8Array?dr(t,s):t instanceof ReadableStream?mr(t,s):pr(t,e,s)}function _r(t,e,s){return t instanceof Uint8Array?Ke(t,e):t instanceof ReadableStream?Ye(t,e):ts(t,s,e)}var yr=br,Mr=_r;function vh(t,e){let s=t.geometry(),i=e.geometryType||s?.type(),r=ps(s,i);return r.properties=Ge(t,e.columns),r}function Is(t,e){let s=e?.flatgeobuf?.shape;switch(s){case"geojson-table":return yh(t,e);case"columnar-table":return{shape:"columnar-table",data:vr(t,e)};case"binary":return vr(t,e);default:throw new Error(s)}}function vr(t,e={}){let s=new Uint8Array(t);return Mr(s,ps)}function yh(t,e={}){if(t.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:s=!1,_targetCrs:i="WGS84"}=e&&e.gis||{},r=new Uint8Array(t),a,n,{features:o}=yr(r,void 0,l=>{a=l,n=er(a)}),h=a&&a.crs,f;if(s&&h)try{f=new Ht({from:h.wkt,to:i})}catch{}return f&&(o=Te(o,l=>f.project(l))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:o}}function gr(t,e){let s=e.flatgeobuf?.shape;switch(s){case"binary":return Mh(t,e);case"geojson-table":return gh(t,e);default:throw new Error(s)}}function Mh(t,e){return Mr(t,vh)}async function*gh(t,e){let{reproject:s=!1,_targetCrs:i="WGS84"}=e&&e.gis||{},r,a=yr(t,void 0,h=>{r=h}),n,o=!0;for await(let h of a){if(o){let f=r&&r.crs;s&&f&&(n=new Ht({from:f.wkt,to:i})),o=!1}s&&n?yield Te([h],f=>n.project(f)):yield h}}var xh="4.2.0-alpha.4",wh=[102,103,98,3,102,103,98,1],Ps={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:xh,worker:!0,extensions:["fgb"],mimeTypes:["application/octet-stream"],category:"geometry",tests:[new Uint8Array(wh).buffer],options:{flatgeobuf:{shape:"geojson-table"},gis:{reproject:!1}}},xr={...Ps,parse:async(t,e)=>Is(t,e),parseSync:Is,parseInBatchesFromStream:gr,binary:!0};return Rr(me);})();
|
|
10
|
+
northing meters`+t;var c=u/2,m=0,d=0,p,_,M,x,g;return c>0&&(p=1e5/Math.pow(10,c),_=t.substring(a,a+c),m=parseFloat(_)*p,M=t.substring(a+c),d=parseFloat(M)*p),x=m+f,g=d+l,{easting:x,northing:g,zoneLetter:o,zoneNumber:n,accuracy:p}}function pa(t,e){for(var s=oi.charCodeAt(e-1),i=1e5,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>oe){if(r)throw"Bad character: "+t;s=Dt,r=!0}i+=1e5}return i}function ba(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var s=hi.charCodeAt(e-1),i=0,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>ne){if(r)throw"Bad character: "+t;s=Dt,r=!0}i+=1e5}return i}function _a(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function jt(t,e,s){if(!(this instanceof jt))return new jt(t,e,s);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof e>"u"){var i=t.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=t,this.y=e,this.z=s||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}jt.fromMGRS=function(t){return new jt(fs(t))};jt.prototype.toMGRS=function(t){return hs([this.x,this.y],t)};var ci=jt;var va=1,ya=.25,di=.046875,mi=.01953125,pi=.01068115234375,Ma=.75,ga=.46875,xa=.013020833333333334,wa=.007120768229166667,Ia=.3645833333333333,Pa=.005696614583333333,Ea=.3076171875;function Ae(t){var e=[];e[0]=va-t*(ya+t*(di+t*(mi+t*pi))),e[1]=t*(Ma-t*(di+t*(mi+t*pi)));var s=t*t;return e[2]=s*(ga-t*(xa+t*wa)),s*=t,e[3]=s*(Ia-t*Pa),e[4]=s*t*Ea,e}function Lt(t,e,s,i){return s*=e,e*=e,i[0]*t-s*(i[1]+e*(i[2]+e*(i[3]+e*i[4])))}var Sa=20;function Ne(t,e,s){for(var i=1/(1-e),r=t,a=Sa;a;--a){var n=Math.sin(r),o=1-e*n*n;if(o=(Lt(r,n,Math.cos(r),s)-t)*(o*Math.sqrt(o))*i,r-=o,Math.abs(o)<v)return r}return r}function Aa(){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=Ae(this.es),this.ml0=Lt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Na(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a,n,o=Math.sin(s),h=Math.cos(s);if(this.es){var l=h*i,u=Math.pow(l,2),c=this.ep2*Math.pow(h,2),m=Math.pow(c,2),d=Math.abs(h)>v?Math.tan(s):0,p=Math.pow(d,2),_=Math.pow(p,2);r=1-this.es*Math.pow(o,2),l=l/Math.sqrt(r);var M=Lt(s,o,h,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+c+u/20*(5-18*p+_+14*c-58*p*c+u/42*(61+179*_-_*p-479*p)))))+this.x0,n=this.a*(this.k0*(M-this.ml0+o*i*l/2*(1+u/12*(5-p+9*c+4*m+u/30*(61+_-58*p+270*c-330*p*c+u/56*(1385+543*_-_*p-3111*p))))))+this.y0}else{var f=h*Math.sin(i);if(Math.abs(Math.abs(f)-1)<v)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>v)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=a,t.y=n,t}function Oa(t){var e,s,i,r,a=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+n/this.k0,s=Ne(e,this.es,this.en),Math.abs(s)<b){var u=Math.sin(s),c=Math.cos(s),m=Math.abs(c)>v?Math.tan(s):0,d=this.ep2*Math.pow(c,2),p=Math.pow(d,2),_=Math.pow(m,2),M=Math.pow(_,2);e=1-this.es*Math.pow(u,2);var x=a*Math.sqrt(e)/this.k0,g=Math.pow(x,2);e=e*m,i=s-e*g/(1-this.es)*.5*(1-g/12*(5+3*_-9*d*_+d-4*p-g/30*(61+90*_-252*d*_+45*M+46*d-g/56*(1385+3633*_+4095*M+1574*M*_)))),r=y(this.long0+x*(1-g/6*(1+2*_+d-g/20*(5+28*_+24*M+8*d*_+6*d-g/42*(61+662*_+1320*M+720*M*_))))/c)}else i=b*ut(n),r=0;else{var o=Math.exp(a/this.k0),h=.5*(o-1/o),f=this.lat0+n/this.k0,l=Math.cos(f);e=Math.sqrt((1-Math.pow(l,2))/(1+Math.pow(h,2))),i=Math.asin(e),n<0&&(i=-i),h===0&&l===0?r=0:r=y(Math.atan2(h,l)+this.long0)}return t.x=r,t.y=i,t}var Fa=["Transverse_Mercator","Transverse Mercator","tmerc"],bi={init:Aa,forward:Na,inverse:Oa,names:Fa};function Oe(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function he(t,e){t=Math.abs(t),e=Math.abs(e);var s=Math.max(t,e),i=Math.min(t,e)/(s||1);return s*Math.sqrt(1+Math.pow(i,2))}function _i(t){var e=1+t,s=e-1;return s===0?t:t*Math.log(e)/s}function vi(t){var e=Math.abs(t);return e=_i(e*(1+e/(he(1,e)+1))),t<0?-e:e}function Fe(t,e){for(var s=2*Math.cos(2*e),i=t.length-1,r=t[i],a=0,n;--i>=0;)n=-a+s*r+t[i],a=r,r=n;return e+n*Math.sin(2*e)}function yi(t,e){for(var s=2*Math.cos(e),i=t.length-1,r=t[i],a=0,n;--i>=0;)n=-a+s*r+t[i],a=r,r=n;return Math.sin(e)*n}function Mi(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function us(t,e,s){for(var i=Math.sin(e),r=Math.cos(e),a=Oe(s),n=Mi(s),o=2*r*n,h=-2*i*a,f=t.length-1,l=t[f],u=0,c=0,m=0,d,p;--f>=0;)d=c,p=u,c=l,u=m,l=-d+o*c-h*u+t[f],m=-p+h*c+o*u;return o=i*n,h=r*a,[o*l-h*m,o*m+h*l]}function La(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),s=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),s=s*e,this.cgb[1]=s*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=s*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),s=s*e,this.cgb[2]=s*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=s*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),s=s*e,this.cgb[3]=s*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=s*(1237/630+e*(-12/5+e*(-24832/14175))),s=s*e,this.cgb[4]=s*(4174/315+e*(-144838/6237)),this.cbg[4]=s*(-734/315+e*(109598/31185)),s=s*e,this.cgb[5]=s*(601676/22275),this.cbg[5]=s*(444337/155925),s=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+s*(1/4+s*(1/64+s/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=s*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=s*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),s=s*e,this.utg[2]=s*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=s*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),s=s*e,this.utg[3]=s*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=s*(49561/161280+e*(-179/168+e*(6601661/7257600))),s=s*e,this.utg[4]=s*(-4583/161280+e*(108847/3991680)),this.gtu[4]=s*(34729/80640+e*(-3418889/1995840)),s=s*e,this.utg[5]=s*(-20648693/638668800),this.gtu[5]=s*(212378941/319334400);var i=Fe(this.cbg,this.lat0);this.Zb=-this.Qn*(i+yi(this.gtu,2*i))}function Ra(t){var e=y(t.x-this.long0),s=t.y;s=Fe(this.cbg,s);var i=Math.sin(s),r=Math.cos(s),a=Math.sin(e),n=Math.cos(e);s=Math.atan2(i,n*r),e=Math.atan2(a*r,he(i,r*n)),e=vi(Math.tan(e));var o=us(this.gtu,2*s,2*e);s=s+o[0],e=e+o[1];var h,f;return Math.abs(e)<=2.623395162778?(h=this.a*(this.Qn*e)+this.x0,f=this.a*(this.Qn*s+this.Zb)+this.y0):(h=1/0,f=1/0),t.x=h,t.y=f,t}function Ca(t){var e=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);s=(s-this.Zb)/this.Qn,e=e/this.Qn;var i,r;if(Math.abs(e)<=2.623395162778){var a=us(this.utg,2*s,2*e);s=s+a[0],e=e+a[1],e=Math.atan(Oe(e));var n=Math.sin(s),o=Math.cos(s),h=Math.sin(e),f=Math.cos(e);s=Math.atan2(n*f,he(h,f*o)),e=Math.atan2(h,f*o),i=y(e+this.long0),r=Fe(this.cgb,s)}else i=1/0,r=1/0;return t.x=i,t.y=r,t}var Ta=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],kt={init:La,forward:Ra,inverse:Ca,names:Ta};function gi(t,e){if(t===void 0){if(t=Math.floor((y(e)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var Ba="etmerc";function Ua(){var t=gi(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*U,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,kt.init.apply(this),this.forward=kt.forward,this.inverse=kt.inverse}var za=["Universal Transverse Mercator System","utm"],xi={init:Ua,names:za,dependsOn:Ba};function Le(t,e){return Math.pow((1-t)/(1+t),e)}var qa=20;function Ga(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+E)/(Math.pow(Math.tan(.5*this.lat0+E),this.C)*Le(this.e*t,this.ratexp))}function Da(t){var e=t.x,s=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*s+E),this.C)*Le(this.e*Math.sin(s),this.ratexp))-b,t.x=this.C*e,t}function ja(t){for(var e=1e-14,s=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+E)/this.K,1/this.C),a=qa;a>0&&(i=2*Math.atan(r*Le(this.e*Math.sin(t.y),-.5*this.e))-b,!(Math.abs(i-t.y)<e));--a)t.y=i;return a?(t.x=s,t.y=i,t):null}var ka=["gauss"],Re={init:Ga,forward:Da,inverse:ja,names:ka};function Va(){Re.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 Ha(t){var e,s,i,r;return t.x=y(t.x-this.long0),Re.forward.apply(this,[t]),e=Math.sin(t.y),s=Math.cos(t.y),i=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*s*i),t.x=r*s*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*s*i),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function Wa(t){var e,s,i,r,a;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,a=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(a,this.R2);e=Math.sin(n),s=Math.cos(n),r=Math.asin(s*this.sinc0+t.y*e*this.cosc0/a),i=Math.atan2(t.x*e,a*this.cosc0*s-t.y*this.sinc0*e)}else r=this.phic0,i=0;return t.x=i,t.y=r,Re.inverse.apply(this,[t]),t.x=y(t.x+this.long0),t}var Xa=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],wi={init:Va,forward:Ha,inverse:Wa,names:Xa};function Ja(t,e,s){return e*=s,Math.tan(.5*(b+t))*Math.pow((1-e)/(1+e),.5*s)}function Za(){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)<=v&&(this.k0=.5*(1+ut(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=v&&(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)<=v&&(this.k0=.5*this.cons*k(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=k(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-b,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Qa(t){var e=t.x,s=t.y,i=Math.sin(s),r=Math.cos(s),a,n,o,h,f,l,u=y(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=v&&Math.abs(s+this.lat0)<=v?(t.x=NaN,t.y=NaN,t):this.sphere?(a=2*this.k0/(1+this.sinlat0*i+this.coslat0*r*Math.cos(u)),t.x=this.a*a*r*Math.sin(u)+this.x0,t.y=this.a*a*(this.coslat0*i-this.sinlat0*r*Math.cos(u))+this.y0,t):(n=2*Math.atan(this.ssfn_(s,i,this.e))-b,h=Math.cos(n),o=Math.sin(n),Math.abs(this.coslat0)<=v?(f=H(this.e,s*this.con,this.con*i),l=2*this.a*this.k0*f/this.cons,t.x=this.x0+l*Math.sin(e-this.long0),t.y=this.y0-this.con*l*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<v?(a=2*this.a*this.k0/(1+h*Math.cos(u)),t.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(u))),t.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(u))+this.y0),t.x=a*h*Math.sin(u)+this.x0,t))}function $a(t){t.x-=this.x0,t.y-=this.y0;var e,s,i,r,a,n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var o=2*Math.atan(n/(2*this.a*this.k0));return e=this.long0,s=this.lat0,n<=v?(t.x=e,t.y=s,t):(s=Math.asin(Math.cos(o)*this.sinlat0+t.y*Math.sin(o)*this.coslat0/n),Math.abs(this.coslat0)<v?this.lat0>0?e=y(this.long0+Math.atan2(t.x,-1*t.y)):e=y(this.long0+Math.atan2(t.x,t.y)):e=y(this.long0+Math.atan2(t.x*Math.sin(o),n*this.coslat0*Math.cos(o)-t.y*this.sinlat0*Math.sin(o))),t.x=e,t.y=s,t)}else if(Math.abs(this.coslat0)<=v){if(n<=v)return s=this.lat0,e=this.long0,t.x=e,t.y=s,t;t.x*=this.con,t.y*=this.con,i=n*this.cons/(2*this.a*this.k0),s=this.con*_t(this.e,i),e=this.con*y(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else r=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,n<=v?a=this.X0:(a=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/n),e=y(this.long0+Math.atan2(t.x*Math.sin(r),n*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)))),s=-1*_t(this.e,Math.tan(.5*(b+a)));return t.x=e,t.y=s,t}var Ka=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Ii={init:Za,forward:Qa,inverse:$a,names:Ka,ssfn_:Ja};function Ya(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),s=this.a,i=this.rf,r=1/i,a=2*r-Math.pow(r,2),n=this.e=Math.sqrt(a);this.R=this.k0*s*Math.sqrt(1-a)/(1-a*Math.pow(e,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+t/2)),f=Math.log((1+n*e)/(1-n*e));this.K=o-this.alpha*h+this.alpha*n/2*f}function tn(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),s=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),i=-this.alpha*(e+s)+this.K,r=2*(Math.atan(Math.exp(i))-Math.PI/4),a=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(a))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(a));return t.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,t.x=this.R*n+this.x0,t}function en(t){for(var e=t.x-this.x0,s=t.y-this.y0,i=e/this.R,r=2*(Math.atan(Math.exp(s/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(i)),n=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+n/this.alpha,h=0,f=a,l=-1e3,u=0;Math.abs(f-l)>1e-7;){if(++u>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)),l=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=o,t.y=f,t}var sn=["somerc"],Pi={init:Ya,forward:tn,inverse:en,names:sn};function rn(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),s=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-s*s);var i=H(this.e,this.lat0,t),r=this.bl/e*Math.sqrt((1-this.es)/(1-s*s));r*r<1&&(r=1);var a,n;if(!isNaN(this.longc))this.lat0>=0?a=r+Math.sqrt(r*r-1):a=r-Math.sqrt(r*r-1),this.el=a*Math.pow(i,this.bl),n=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/r),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=(r+Math.sqrt(r*r-1))*Math.pow(i,this.bl):this.el=(r-Math.sqrt(r*r-1))*Math.pow(i,this.bl);var f=Math.pow(o,this.bl),l=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var u=(this.el*this.el-l*f)/(this.el*this.el+l*f),c=(l-f)/(l+f),m=y(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*m)/c)/this.bl,this.long0=y(this.long0);var d=y(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*d)/n),this.alpha=Math.asin(r*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(r*r-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(r*r-1),Math.cos(this.alpha))}function an(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a,n;if(Math.abs(Math.abs(s)-b)<=v)s>0?n=-1:n=1,a=this.al/this.bl*Math.log(Math.tan(E+n*this.gamma0*.5)),r=-1*n*b*this.al/this.bl;else{var o=H(this.e,s,Math.sin(s)),h=this.el/Math.pow(o,this.bl),f=.5*(h-1/h),l=.5*(h+1/h),u=Math.sin(this.bl*i),c=(f*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/l;Math.abs(Math.abs(c)-1)<=v?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-c)/(1+c))/this.bl,Math.abs(Math.cos(this.bl*i))<=v?r=this.al*this.bl*i:r=this.al*Math.atan2(f*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(t.x=this.x0+r,t.y=this.y0+a):(r-=this.uc,t.x=this.x0+a*Math.cos(this.alpha)+r*Math.sin(this.alpha),t.y=this.y0+r*Math.cos(this.alpha)-a*Math.sin(this.alpha)),t}function nn(t){var e,s;this.no_rot?(s=t.y-this.y0,e=t.x-this.x0):(s=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var i=Math.exp(-1*this.bl*s/this.al),r=.5*(i-1/i),a=.5*(i+1/i),n=Math.sin(this.bl*e/this.al),o=(n*Math.cos(this.gamma0)+r*Math.sin(this.gamma0))/a,h=Math.pow(this.el/Math.sqrt((1+o)/(1-o)),1/this.bl);return Math.abs(o-1)<v?(t.x=this.long0,t.y=b):Math.abs(o+1)<v?(t.x=this.long0,t.y=-1*b):(t.y=_t(this.e,h),t.x=y(this.long0-Math.atan2(r*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*e/this.al))/this.bl)),t}var on=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Ei={init:rn,forward:an,inverse:nn,names:on};function hn(){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)<v)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),s=Math.cos(this.lat1),i=k(this.e,e,s),r=H(this.e,this.lat1,e),a=Math.sin(this.lat2),n=Math.cos(this.lat2),o=k(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)>v?this.ns=Math.log(i/o)/Math.log(r/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=i/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(f,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function fn(t){var e=t.x,s=t.y;Math.abs(2*Math.abs(s)-Math.PI)<=v&&(s=ut(s)*(b-2*v));var i=Math.abs(Math.abs(s)-b),r,a;if(i>v)r=H(this.e,s,Math.sin(s)),a=this.a*this.f0*Math.pow(r,this.ns);else{if(i=s*this.ns,i<=0)return null;a=0}var n=this.ns*y(e-this.long0);return t.x=this.k0*(a*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-a*Math.cos(n))+this.y0,t}function ln(t){var e,s,i,r,a,n=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(n*n+o*o),s=1):(e=-Math.sqrt(n*n+o*o),s=-1);var h=0;if(e!==0&&(h=Math.atan2(s*n,s*o)),e!==0||this.ns>0){if(s=1/this.ns,i=Math.pow(e/(this.a*this.f0),s),r=_t(this.e,i),r===-9999)return null}else r=-b;return a=y(h/this.ns+this.long0),t.x=a,t.y=r,t}var un=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Si={init:hn,forward:fn,inverse:ln,names:un};function cn(){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 dn(t){var e,s,i,r,a,n,o,h=t.x,f=t.y,l=y(h-this.long0);return e=Math.pow((1+this.e*Math.sin(f))/(1-this.e*Math.sin(f)),this.alfa*this.e/2),s=2*(Math.atan(this.k*Math.pow(Math.tan(f/2+this.s45),this.alfa)/e)-this.s45),i=-l*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(s)+Math.sin(this.ad)*Math.cos(s)*Math.cos(i)),a=Math.asin(Math.cos(s)*Math.sin(i)/Math.cos(r)),n=this.n*a,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=o*Math.cos(n)/1,t.x=o*Math.sin(n)/1,this.czech||(t.y*=-1,t.x*=-1),t}function mn(t){var e,s,i,r,a,n,o,h,f=t.x;t.x=t.y,t.y=f,this.czech||(t.y*=-1,t.x*=-1),n=Math.sqrt(t.x*t.x+t.y*t.y),a=Math.atan2(t.y,t.x),r=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),e=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),s=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(e)),t.x=this.long0-s/this.alfa,o=e,h=0;var l=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(h=1),o=t.y,l+=1;while(h===0&&l<15);return l>=15?null:t}var pn=["Krovak","krovak"],Ai={init:cn,forward:dn,inverse:mn,names:pn};function q(t,e,s,i,r){return t*r-e*Math.sin(2*r)+s*Math.sin(4*r)-i*Math.sin(6*r)}function vt(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function yt(t){return .375*t*(1+.25*t*(1+.46875*t))}function Mt(t){return .05859375*t*t*(1+.75*t)}function gt(t){return t*t*t*(35/3072)}function xt(t,e,s){var i=e*s;return t/Math.sqrt(1-i*i)}function nt(t){return Math.abs(t)<b?t:t-ut(t)*Math.PI}function Rt(t,e,s,i,r){var a,n;a=t/e;for(var o=0;o<15;o++)if(n=(t-(e*a-s*Math.sin(2*a)+i*Math.sin(4*a)-r*Math.sin(6*a)))/(e-2*s*Math.cos(2*a)+4*i*Math.cos(4*a)-6*r*Math.cos(6*a)),a+=n,Math.abs(n)<=1e-10)return a;return NaN}function bn(){this.sphere||(this.e0=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.ml0=this.a*q(this.e0,this.e1,this.e2,this.e3,this.lat0))}function _n(t){var e,s,i=t.x,r=t.y;if(i=y(i-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(i)),s=this.a*(Math.atan2(Math.tan(r),Math.cos(i))-this.lat0);else{var a=Math.sin(r),n=Math.cos(r),o=xt(this.a,this.e,a),h=Math.tan(r)*Math.tan(r),f=i*Math.cos(r),l=f*f,u=this.es*n*n/(1-this.es),c=this.a*q(this.e0,this.e1,this.e2,this.e3,r);e=o*f*(1-l*h*(1/6-(8-h+8*u)*l/120)),s=c-this.ml0+o*a/n*l*(.5+(5-h+6*u)*l/24)}return t.x=e+this.x0,t.y=s+this.y0,t}function vn(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,s=t.y/this.a,i,r;if(this.sphere){var a=s+this.lat0;i=Math.asin(Math.sin(a)*Math.cos(e)),r=Math.atan2(Math.tan(e),Math.cos(a))}else{var n=this.ml0/this.a+s,o=Rt(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-b)<=v)return t.x=this.long0,t.y=b,s<0&&(t.y*=-1),t;var h=xt(this.a,this.e,Math.sin(o)),f=h*h*h/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(o),2),u=e*this.a/h,c=u*u;i=o-h*Math.tan(o)/f*u*u*(.5-(1+3*l)*u*u/24),r=u*(1-c*(l/3+(1+3*l)*l*c/15))/Math.cos(o)}return t.x=y(r+this.long0),t.y=nt(i),t}var yn=["Cassini","Cassini_Soldner","cass"],Ni={init:bn,forward:_n,inverse:vn,names:yn};function ot(t,e){var s;return t>1e-7?(s=t*e,(1-t*t)*(e/(1-s*s)-.5/t*Math.log((1-s)/(1+s)))):2*e}var Mn=1,gn=2,xn=3,wn=4;function In(){var t=Math.abs(this.lat0);if(Math.abs(t-b)<v?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<v?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=ot(this.e,1),this.mmf=.5/(1-this.es),this.apa=Rn(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=ot(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Pn(t){var e,s,i,r,a,n,o,h,f,l,u=t.x,c=t.y;if(u=y(u-this.long0),this.sphere){if(a=Math.sin(c),l=Math.cos(c),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+l*i:1+this.sinph0*a+this.cosph0*l*i,s<=v)return null;s=Math.sqrt(2/s),e=s*l*Math.sin(u),s*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*l*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(c+this.lat0)<v)return null;s=E-c*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),e=s*Math.sin(u),s*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(u),r=Math.sin(u),a=Math.sin(c),n=ot(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=b+c,n=this.qp-n;break;case this.S_POLE:f=c-b,n=this.qp+n;break}if(Math.abs(f)<v)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:f=Math.sqrt(2/f),this.mode===this.OBLIQ?s=this.ymf*f*(this.cosb1*o-this.sinb1*h*i):s=(f=Math.sqrt(2/(1+h*i)))*o*this.ymf,e=this.xmf*f*h*r;break;case this.N_POLE:case this.S_POLE:n>=0?(e=(f=Math.sqrt(n))*r,s=i*(this.mode===this.S_POLE?f:-f)):e=s=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*s+this.y0,t}function En(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,s=t.y/this.a,i,r,a,n,o,h,f;if(this.sphere){var l=0,u,c=0;if(u=Math.sqrt(e*e+s*s),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(c=Math.sin(r),l=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=v?0:Math.asin(s*c/u),e*=c,s=l*u;break;case this.OBLIQ:r=Math.abs(u)<=v?this.lat0:Math.asin(l*this.sinph0+s*c*this.cosph0/u),e*=c*this.cosph0,s=(l-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:s=-s,r=b-r;break;case this.S_POLE:r-=b;break}i=s===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,s)}else{if(f=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,s*=this.dd,h=Math.sqrt(e*e+s*s),h<v)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*h/this.rq),a=Math.cos(n),e*=n=Math.sin(n),this.mode===this.OBLIQ?(f=a*this.sinb1+s*n*this.cosb1/h,o=this.qp*f,s=h*this.cosb1*a-s*this.sinb1*n):(f=s*n/h,o=this.qp*f,s=h*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),o=e*e+s*s,!o)return t.x=this.long0,t.y=this.lat0,t;f=1-o/this.qp,this.mode===this.S_POLE&&(f=-f)}i=Math.atan2(e,s),r=Cn(Math.asin(f),this.apa)}return t.x=y(this.long0+i),t.y=r,t}var Sn=.3333333333333333,An=.17222222222222222,Nn=.10257936507936508,On=.06388888888888888,Fn=.0664021164021164,Ln=.016415012942191543;function Rn(t){var e,s=[];return s[0]=t*Sn,e=t*t,s[0]+=e*An,s[1]=e*On,e*=t,s[0]+=e*Nn,s[1]+=e*Fn,s[2]=e*Ln,s}function Cn(t,e){var s=t+t;return t+e[0]*Math.sin(s)+e[1]*Math.sin(s+s)+e[2]*Math.sin(s+s+s)}var Tn=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Oi={init:In,forward:Pn,inverse:En,names:Tn,S_POLE:Mn,N_POLE:gn,EQUIT:xn,OBLIQ:wn};function Q(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function Bn(){Math.abs(this.lat1+this.lat2)<v||(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=k(this.e3,this.sin_po,this.cos_po),this.qs1=ot(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=k(this.e3,this.sin_po,this.cos_po),this.qs2=ot(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=ot(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>v?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 Un(t){var e=t.x,s=t.y;this.sin_phi=Math.sin(s),this.cos_phi=Math.cos(s);var i=ot(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,a=this.ns0*y(e-this.long0),n=r*Math.sin(a)+this.x0,o=this.rh-r*Math.cos(a)+this.y0;return t.x=n,t.y=o,t}function zn(t){var e,s,i,r,a,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),r=0,e!==0&&(r=Math.atan2(i*t.x,i*t.y)),i=e*this.ns0/this.a,this.sphere?n=Math.asin((this.c-i*i)/(2*this.ns0)):(s=(this.c-i*i)/this.ns0,n=this.phi1z(this.e3,s)),a=y(r/this.ns0+this.long0),t.x=a,t.y=n,t}function qn(t,e){var s,i,r,a,n,o=Q(.5*e);if(t<v)return o;for(var h=t*t,f=1;f<=25;f++)if(s=Math.sin(o),i=Math.cos(o),r=t*s,a=1-r*r,n=.5*a*a/i*(e/(1-h)-s/a+.5/t*Math.log((1-r)/(1+r))),o=o+n,Math.abs(n)<=1e-7)return o;return null}var Gn=["Albers_Conic_Equal_Area","Albers","aea"],Fi={init:Bn,forward:Un,inverse:zn,names:Gn,phi1z:qn};function Dn(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function jn(t){var e,s,i,r,a,n,o,h,f=t.x,l=t.y;return i=y(f-this.long0),e=Math.sin(l),s=Math.cos(l),r=Math.cos(i),n=this.sin_p14*e+this.cos_p14*s*r,a=1,n>0||Math.abs(n)<=v?(o=this.x0+this.a*a*s*Math.sin(i)/n,h=this.y0+this.a*a*(this.cos_p14*e-this.sin_p14*s*r)/n):(o=this.x0+this.infinity_dist*s*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*s*r)),t.x=o,t.y=h,t}function kn(t){var e,s,i,r,a,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),s=Math.sin(r),i=Math.cos(r),n=Q(i*this.sin_p14+t.y*s*this.cos_p14/e),a=Math.atan2(t.x*s,e*this.cos_p14*i-t.y*this.sin_p14*s),a=y(this.long0+a)):(n=this.phic0,a=0),t.x=a,t.y=n,t}var Vn=["gnom"],Li={init:Dn,forward:jn,inverse:kn,names:Vn};function Ri(t,e){var s=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-s)<1e-6)return e<0?-1*b:b;for(var i=Math.asin(.5*e),r,a,n,o,h=0;h<30;h++)if(a=Math.sin(i),n=Math.cos(i),o=t*a,r=Math.pow(1-o*o,2)/(2*n)*(e/(1-t*t)-a/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),i+=r,Math.abs(r)<=1e-10)return i;return NaN}function Hn(){this.sphere||(this.k0=k(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Wn(t){var e=t.x,s=t.y,i,r,a=y(e-this.long0);if(this.sphere)i=this.x0+this.a*a*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var n=ot(this.e,Math.sin(s));i=this.x0+this.a*this.k0*a,r=this.y0+this.a*n*.5/this.k0}return t.x=i,t.y=r,t}function Xn(t){t.x-=this.x0,t.y-=this.y0;var e,s;return this.sphere?(e=y(this.long0+t.x/this.a/Math.cos(this.lat_ts)),s=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(s=Ri(this.e,2*t.y*this.k0/this.a),e=y(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=s,t}var Jn=["cea"],Ci={init:Hn,forward:Wn,inverse:Xn,names:Jn};function Zn(){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 Qn(t){var e=t.x,s=t.y,i=y(e-this.long0),r=nt(s-this.lat0);return t.x=this.x0+this.a*i*this.rc,t.y=this.y0+this.a*r,t}function $n(t){var e=t.x,s=t.y;return t.x=y(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=nt(this.lat0+(s-this.y0)/this.a),t}var Kn=["Equirectangular","Equidistant_Cylindrical","eqc"],Ti={init:Zn,forward:Qn,inverse:$n,names:Kn};var Bi=20;function Yn(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.ml0=this.a*q(this.e0,this.e1,this.e2,this.e3,this.lat0)}function to(t){var e=t.x,s=t.y,i,r,a,n=y(e-this.long0);if(a=n*Math.sin(s),this.sphere)Math.abs(s)<=v?(i=this.a*n,r=-1*this.a*this.lat0):(i=this.a*Math.sin(a)/Math.tan(s),r=this.a*(nt(s-this.lat0)+(1-Math.cos(a))/Math.tan(s)));else if(Math.abs(s)<=v)i=this.a*n,r=-1*this.ml0;else{var o=xt(this.a,this.e,Math.sin(s))/Math.tan(s);i=o*Math.sin(a),r=this.a*q(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+o*(1-Math.cos(a))}return t.x=i+this.x0,t.y=r+this.y0,t}function eo(t){var e,s,i,r,a,n,o,h,f;if(i=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=v)e=y(i/this.a+this.long0),s=0;else{n=this.lat0+r/this.a,o=i*i/this.a/this.a+n*n,h=n;var l;for(a=Bi;a;--a)if(l=Math.tan(h),f=-1*(n*(h*l+1)-h-.5*(h*h+o)*l)/((h-n)/l-1),h+=f,Math.abs(f)<=v){s=h;break}e=y(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(s))}else if(Math.abs(r+this.ml0)<=v)s=0,e=y(this.long0+i/this.a);else{n=(this.ml0+r)/this.a,o=i*i/this.a/this.a+n*n,h=n;var u,c,m,d,p;for(a=Bi;a;--a)if(p=this.e*Math.sin(h),u=Math.sqrt(1-p*p)*Math.tan(h),c=this.a*q(this.e0,this.e1,this.e2,this.e3,h),m=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),d=c/this.a,f=(n*(u*d+1)-d-.5*u*(d*d+o))/(this.es*Math.sin(2*h)*(d*d+o-2*n*d)/(4*u)+(n-d)*(u*m-2/Math.sin(2*h))-m),h-=f,Math.abs(f)<=v){s=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),e=y(this.long0+Math.asin(i*u/this.a)/Math.sin(s))}return t.x=e,t.y=s,t}var so=["Polyconic","poly"],Ui={init:Yn,forward:to,inverse:eo,names:so};function io(){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 ro(t){var e,s=t.x,i=t.y,r=i-this.lat0,a=s-this.long0,n=r/Nt*1e-5,o=a,h=1,f=0;for(e=1;e<=10;e++)h=h*n,f=f+this.A[e]*h;var l=f,u=o,c=1,m=0,d,p,_=0,M=0;for(e=1;e<=6;e++)d=c*l-m*u,p=m*l+c*u,c=d,m=p,_=_+this.B_re[e]*c-this.B_im[e]*m,M=M+this.B_im[e]*c+this.B_re[e]*m;return t.x=M*this.a+this.x0,t.y=_*this.a+this.y0,t}function ao(t){var e,s=t.x,i=t.y,r=s-this.x0,a=i-this.y0,n=a/this.a,o=r/this.a,h=1,f=0,l,u,c=0,m=0;for(e=1;e<=6;e++)l=h*n-f*o,u=f*n+h*o,h=l,f=u,c=c+this.C_re[e]*h-this.C_im[e]*f,m=m+this.C_im[e]*h+this.C_re[e]*f;for(var d=0;d<this.iterations;d++){var p=c,_=m,M,x,g=n,S=o;for(e=2;e<=6;e++)M=p*c-_*m,x=_*c+p*m,p=M,_=x,g=g+(e-1)*(this.B_re[e]*p-this.B_im[e]*_),S=S+(e-1)*(this.B_im[e]*p+this.B_re[e]*_);p=1,_=0;var I=this.B_re[1],P=this.B_im[1];for(e=2;e<=6;e++)M=p*c-_*m,x=_*c+p*m,p=M,_=x,I=I+e*(this.B_re[e]*p-this.B_im[e]*_),P=P+e*(this.B_im[e]*p+this.B_re[e]*_);var B=I*I+P*P;c=(g*I+S*P)/B,m=(S*I-g*P)/B}var N=c,Y=m,G=1,st=0;for(e=1;e<=9;e++)G=G*N,st=st+this.D[e]*G;var mt=this.lat0+st*Nt*1e5,te=this.long0+Y;return t.x=te,t.y=mt,t}var no=["New_Zealand_Map_Grid","nzmg"],zi={init:io,forward:ro,inverse:ao,names:no};function oo(){}function ho(t){var e=t.x,s=t.y,i=y(e-this.long0),r=this.x0+this.a*i,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+s/2.5))*1.25;return t.x=r,t.y=a,t}function fo(t){t.x-=this.x0,t.y-=this.y0;var e=y(this.long0+t.x/this.a),s=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=s,t}var lo=["Miller_Cylindrical","mill"],qi={init:oo,forward:ho,inverse:fo,names:lo};var uo=20;function co(){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=Ae(this.es)}function mo(t){var e,s,i=t.x,r=t.y;if(i=y(i-this.long0),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var a=this.n*Math.sin(r),n=uo;n;--n){var o=(this.m*r+Math.sin(r)-a)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<v)break}e=this.a*this.C_x*i*(this.m+Math.cos(r)),s=this.a*this.C_y*r}else{var h=Math.sin(r),f=Math.cos(r);s=this.a*Lt(r,h,f,this.en),e=this.a*i*f/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=s,t}function po(t){var e,s,i,r;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(e))),this.m?e=Q((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=Q(Math.sin(e)/this.n)),i=y(i+this.long0),e=nt(e)):(e=Ne(t.y/this.a,this.es,this.en),r=Math.abs(e),r<b?(r=Math.sin(e),s=this.long0+t.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(e)),i=y(s)):r-v<b&&(i=this.long0)),t.x=i,t.y=e,t}var bo=["Sinusoidal","sinu"],Gi={init:co,forward:mo,inverse:po,names:bo};function _o(){}function vo(t){for(var e=t.x,s=t.y,i=y(e-this.long0),r=s,a=Math.PI*Math.sin(s);;){var n=-(r+Math.sin(r)-a)/(1+Math.cos(r));if(r+=n,Math.abs(n)<v)break}r/=2,Math.PI/2-Math.abs(s)<v&&(i=0);var o=.900316316158*this.a*i*Math.cos(r)+this.x0,h=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=o,t.y=h,t}function yo(t){var e,s;t.x-=this.x0,t.y-=this.y0,s=t.y/(1.4142135623731*this.a),Math.abs(s)>.999999999999&&(s=.999999999999),e=Math.asin(s);var i=y(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),s=(2*e+Math.sin(2*e))/Math.PI,Math.abs(s)>1&&(s=1);var r=Math.asin(s);return t.x=i,t.y=r,t}var Mo=["Mollweide","moll"],Di={init:_o,forward:vo,inverse:yo,names:Mo};function go(){Math.abs(this.lat1+this.lat2)<v||(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=vt(this.es),this.e1=yt(this.es),this.e2=Mt(this.es),this.e3=gt(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=k(this.e,this.sinphi,this.cosphi),this.ml1=q(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<v?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=k(this.e,this.sinphi,this.cosphi),this.ml2=q(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=q(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function xo(t){var e=t.x,s=t.y,i;if(this.sphere)i=this.a*(this.g-s);else{var r=q(this.e0,this.e1,this.e2,this.e3,s);i=this.a*(this.g-r)}var a=this.ns*y(e-this.long0),n=this.x0+i*Math.sin(a),o=this.y0+this.rh-i*Math.cos(a);return t.x=n,t.y=o,t}function wo(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var e,s,i,r;this.ns>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var a=0;if(s!==0&&(a=Math.atan2(e*t.x,e*t.y)),this.sphere)return r=y(this.long0+a/this.ns),i=nt(this.g-s/this.a),t.x=r,t.y=i,t;var n=this.g-s/this.a;return i=Rt(n,this.e0,this.e1,this.e2,this.e3),r=y(this.long0+a/this.ns),t.x=r,t.y=i,t}var Io=["Equidistant_Conic","eqdc"],ji={init:go,forward:xo,inverse:wo,names:Io};function Po(){this.R=this.a}function Eo(t){var e=t.x,s=t.y,i=y(e-this.long0),r,a;Math.abs(s)<=v&&(r=this.x0+this.R*i,a=this.y0);var n=Q(2*Math.abs(s/Math.PI));(Math.abs(i)<=v||Math.abs(Math.abs(s)-b)<=v)&&(r=this.x0,s>=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),l=Math.cos(n),u=l/(f+l-1),c=u*u,m=u*(2/f-1),d=m*m,p=Math.PI*this.R*(o*(u-d)+Math.sqrt(h*(u-d)*(u-d)-(d+h)*(c-d)))/(d+h);i<0&&(p=-p),r=this.x0+p;var _=h+u;return p=Math.PI*this.R*(m*_-o*Math.sqrt((d+h)*(h+1)-_*_))/(d+h),s>=0?a=this.y0+p:a=this.y0-p,t.x=r,t.y=a,t}function So(t){var e,s,i,r,a,n,o,h,f,l,u,c,m;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,i=t.x/u,r=t.y/u,a=i*i+r*r,n=-Math.abs(r)*(1+a),o=n-2*r*r+i*i,h=-2*n+1+2*r*r+a*a,m=r*r/h+(2*o*o*o/h/h/h-9*n*o/h/h)/27,f=(n-o*o/3/h)/h,l=2*Math.sqrt(-f/3),u=3*m/f/l,Math.abs(u)>1&&(u>=0?u=1:u=-1),c=Math.acos(u)/3,t.y>=0?s=(-l*Math.cos(c+Math.PI/3)-o/3/h)*Math.PI:s=-(-l*Math.cos(c+Math.PI/3)-o/3/h)*Math.PI,Math.abs(i)<v?e=this.long0:e=y(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(i*i-r*r)+a*a))/2/i),t.x=e,t.y=s,t}var Ao=["Van_der_Grinten_I","VanDerGrinten","vandg"],ki={init:Po,forward:Eo,inverse:So,names:Ao};function No(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Oo(t){var e=t.x,s=t.y,i=Math.sin(t.y),r=Math.cos(t.y),a=y(e-this.long0),n,o,h,f,l,u,c,m,d,p,_,M,x,g,S,I,P,B,N,Y,G,st,mt;return this.sphere?Math.abs(this.sin_p12-1)<=v?(t.x=this.x0+this.a*(b-s)*Math.sin(a),t.y=this.y0-this.a*(b-s)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(t.x=this.x0+this.a*(b+s)*Math.sin(a),t.y=this.y0+this.a*(b+s)*Math.cos(a),t):(B=this.sin_p12*i+this.cos_p12*r*Math.cos(a),I=Math.acos(B),P=I?I/Math.sin(I):1,t.x=this.x0+this.a*P*r*Math.sin(a),t.y=this.y0+this.a*P*(this.cos_p12*i-this.sin_p12*r*Math.cos(a)),t):(n=vt(this.es),o=yt(this.es),h=Mt(this.es),f=gt(this.es),Math.abs(this.sin_p12-1)<=v?(l=this.a*q(n,o,h,f,b),u=this.a*q(n,o,h,f,s),t.x=this.x0+(l-u)*Math.sin(a),t.y=this.y0-(l-u)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(l=this.a*q(n,o,h,f,b),u=this.a*q(n,o,h,f,s),t.x=this.x0+(l+u)*Math.sin(a),t.y=this.y0+(l+u)*Math.cos(a),t):(c=i/r,m=xt(this.a,this.e,this.sin_p12),d=xt(this.a,this.e,i),p=Math.atan((1-this.es)*c+this.es*m*this.sin_p12/(d*r)),_=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(p)-this.sin_p12*Math.cos(a)),_===0?N=Math.asin(this.cos_p12*Math.sin(p)-this.sin_p12*Math.cos(p)):Math.abs(Math.abs(_)-Math.PI)<=v?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(_)),M=this.e*this.sin_p12/Math.sqrt(1-this.es),x=this.e*this.cos_p12*Math.cos(_)/Math.sqrt(1-this.es),g=M*x,S=x*x,Y=N*N,G=Y*N,st=G*N,mt=st*N,I=m*N*(1-Y*S*(1-S)/6+G/8*g*(1-2*S)+st/120*(S*(4-7*S)-3*M*M*(1-7*S))-mt/48*g),t.x=this.x0+I*Math.sin(_),t.y=this.y0+I*Math.cos(_),t))}function Fo(t){t.x-=this.x0,t.y-=this.y0;var e,s,i,r,a,n,o,h,f,l,u,c,m,d,p,_,M,x,g,S,I,P,B,N;return this.sphere?(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*b*this.a?void 0:(s=e/this.a,i=Math.sin(s),r=Math.cos(s),a=this.long0,Math.abs(e)<=v?n=this.lat0:(n=Q(r*this.sin_p12+t.y*i*this.cos_p12/e),o=Math.abs(this.lat0)-b,Math.abs(o)<=v?this.lat0>=0?a=y(this.long0+Math.atan2(t.x,-t.y)):a=y(this.long0-Math.atan2(-t.x,t.y)):a=y(this.long0+Math.atan2(t.x*i,e*this.cos_p12*r-t.y*this.sin_p12*i))),t.x=a,t.y=n,t)):(h=vt(this.es),f=yt(this.es),l=Mt(this.es),u=gt(this.es),Math.abs(this.sin_p12-1)<=v?(c=this.a*q(h,f,l,u,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=c-e,n=Rt(m/this.a,h,f,l,u),a=y(this.long0+Math.atan2(t.x,-1*t.y)),t.x=a,t.y=n,t):Math.abs(this.sin_p12+1)<=v?(c=this.a*q(h,f,l,u,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=e-c,n=Rt(m/this.a,h,f,l,u),a=y(this.long0+Math.atan2(t.x,t.y)),t.x=a,t.y=n,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),_=Math.atan2(t.x,t.y),d=xt(this.a,this.e,this.sin_p12),M=Math.cos(_),x=this.e*this.cos_p12*M,g=-x*x/(1-this.es),S=3*this.es*(1-g)*this.sin_p12*this.cos_p12*M/(1-this.es),I=e/d,P=I-g*(1+g)*Math.pow(I,3)/6-S*(1+3*g)*Math.pow(I,4)/24,B=1-g*P*P/2-I*P*P*P/6,p=Math.asin(this.sin_p12*Math.cos(P)+this.cos_p12*Math.sin(P)*M),a=y(this.long0+Math.asin(Math.sin(_)*Math.sin(P)/Math.cos(p))),N=Math.sin(p),n=Math.atan2((N-this.es*B*this.sin_p12)*Math.tan(p),N*(1-this.es)),t.x=a,t.y=n,t))}var Lo=["Azimuthal_Equidistant","aeqd"],Vi={init:No,forward:Oo,inverse:Fo,names:Lo};function Ro(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Co(t){var e,s,i,r,a,n,o,h,f=t.x,l=t.y;return i=y(f-this.long0),e=Math.sin(l),s=Math.cos(l),r=Math.cos(i),n=this.sin_p14*e+this.cos_p14*s*r,a=1,(n>0||Math.abs(n)<=v)&&(o=this.a*a*s*Math.sin(i),h=this.y0+this.a*a*(this.cos_p14*e-this.sin_p14*s*r)),t.x=o,t.y=h,t}function To(t){var e,s,i,r,a,n,o;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),s=Q(e/this.a),i=Math.sin(s),r=Math.cos(s),n=this.long0,Math.abs(e)<=v?(o=this.lat0,t.x=n,t.y=o,t):(o=Q(r*this.sin_p14+t.y*i*this.cos_p14/e),a=Math.abs(this.lat0)-b,Math.abs(a)<=v?(this.lat0>=0?n=y(this.long0+Math.atan2(t.x,-t.y)):n=y(this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=o,t):(n=y(this.long0+Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i)),t.x=n,t.y=o,t))}var Bo=["ortho"],Hi={init:Ro,forward:Co,inverse:To,names:Bo};var L={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},A={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Uo(){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>=b-E/2?this.face=L.TOP:this.lat0<=-(b-E/2)?this.face=L.BOTTOM:Math.abs(this.long0)<=E?this.face=L.FRONT:Math.abs(this.long0)<=b+E?this.face=this.long0>0?L.RIGHT:L.LEFT:this.face=L.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 zo(t){var e={x:0,y:0},s,i,r,a,n,o,h={value:0};if(t.x-=this.long0,this.es!==0?s=Math.atan(this.one_minus_f_squared*Math.tan(t.y)):s=t.y,i=t.x,this.face===L.TOP)a=b-s,i>=E&&i<=b+E?(h.value=A.AREA_0,r=i-b):i>b+E||i<=-(b+E)?(h.value=A.AREA_1,r=i>0?i-F:i+F):i>-(b+E)&&i<=-E?(h.value=A.AREA_2,r=i+b):(h.value=A.AREA_3,r=i);else if(this.face===L.BOTTOM)a=b+s,i>=E&&i<=b+E?(h.value=A.AREA_0,r=-i+b):i<E&&i>=-E?(h.value=A.AREA_1,r=-i):i<-E&&i>=-(b+E)?(h.value=A.AREA_2,r=-i-b):(h.value=A.AREA_3,r=i>0?-i+F:-i-F);else{var f,l,u,c,m,d,p;this.face===L.RIGHT?i=Vt(i,+b):this.face===L.BACK?i=Vt(i,+F):this.face===L.LEFT&&(i=Vt(i,-b)),c=Math.sin(s),m=Math.cos(s),d=Math.sin(i),p=Math.cos(i),f=m*p,l=m*d,u=c,this.face===L.FRONT?(a=Math.acos(f),r=Ce(a,u,l,h)):this.face===L.RIGHT?(a=Math.acos(l),r=Ce(a,u,-f,h)):this.face===L.BACK?(a=Math.acos(-f),r=Ce(a,u,-l,h)):this.face===L.LEFT?(a=Math.acos(-l),r=Ce(a,u,f,h)):(a=r=0,h.value=A.AREA_0)}return o=Math.atan(12/F*(r+Math.acos(Math.sin(r)*Math.cos(E))-b)),n=Math.sqrt((1-Math.cos(a))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),h.value===A.AREA_1?o+=b:h.value===A.AREA_2?o+=F:h.value===A.AREA_3&&(o+=1.5*F),e.x=n*Math.cos(o),e.y=n*Math.sin(o),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,t.x=e.x,t.y=e.y,t}function qo(t){var e={lam:0,phi:0},s,i,r,a,n,o,h,f,l,u={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),s=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?u.value=A.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(u.value=A.AREA_1,s-=b):t.x<0&&-t.x>=Math.abs(t.y)?(u.value=A.AREA_2,s=s<0?s+F:s-F):(u.value=A.AREA_3,s+=b),l=F/12*Math.tan(s),n=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(n),r=Math.cos(s),a=Math.tan(i),h=1-r*r*a*a*(1-Math.cos(Math.atan(1/Math.cos(o)))),h<-1?h=-1:h>1&&(h=1),this.face===L.TOP)f=Math.acos(h),e.phi=b-f,u.value===A.AREA_0?e.lam=o+b:u.value===A.AREA_1?e.lam=o<0?o+F:o-F:u.value===A.AREA_2?e.lam=o-b:e.lam=o;else if(this.face===L.BOTTOM)f=Math.acos(h),e.phi=f-b,u.value===A.AREA_0?e.lam=-o+b:u.value===A.AREA_1?e.lam=-o:u.value===A.AREA_2?e.lam=-o-b:e.lam=o<0?-o-F:-o+F;else{var c,m,d;c=h,l=c*c,l>=1?d=0:d=Math.sqrt(1-l)*Math.sin(o),l+=d*d,l>=1?m=0:m=Math.sqrt(1-l),u.value===A.AREA_1?(l=m,m=-d,d=l):u.value===A.AREA_2?(m=-m,d=-d):u.value===A.AREA_3&&(l=m,m=d,d=-l),this.face===L.RIGHT?(l=c,c=-m,m=l):this.face===L.BACK?(c=-c,m=-m):this.face===L.LEFT&&(l=c,c=m,m=-l),e.phi=Math.acos(-d)-b,e.lam=Math.atan2(m,c),this.face===L.RIGHT?e.lam=Vt(e.lam,-b):this.face===L.BACK?e.lam=Vt(e.lam,-F):this.face===L.LEFT&&(e.lam=Vt(e.lam,+b))}if(this.es!==0){var p,_,M;p=e.phi<0?1:0,_=Math.tan(e.phi),M=this.b/Math.sqrt(_*_+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-M*M)/(this.one_minus_f*M)),p&&(e.phi=-e.phi)}return e.lam+=this.long0,t.x=e.lam,t.y=e.phi,t}function Ce(t,e,s,i){var r;return t<v?(i.value=A.AREA_0,r=0):(r=Math.atan2(e,s),Math.abs(r)<=E?i.value=A.AREA_0:r>E&&r<=b+E?(i.value=A.AREA_1,r-=b):r>b+E||r<=-(b+E)?(i.value=A.AREA_2,r=r>=0?r-F:r+F):(i.value=A.AREA_3,r+=b)),r}function Vt(t,e){var s=t+e;return s<-F?s+=ie:s>+F&&(s-=ie),s}var Go=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Wi={init:Uo,forward:zo,inverse:qo,names:Go};var cs=[[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]],fe=[[-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]],Xi=.8487,Ji=1.3523,Zi=at/5,Do=1/Zi,Ht=18,Te=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},jo=function(t,e){return t[1]+e*(2*t[2]+e*3*t[3])};function ko(t,e,s,i){for(var r=e;i;--i){var a=t(r);if(r-=a,Math.abs(a)<s)break}return r}function Vo(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Ho(t){var e=y(t.x-this.long0),s=Math.abs(t.y),i=Math.floor(s*Zi);i<0?i=0:i>=Ht&&(i=Ht-1),s=at*(s-Do*i);var r={x:Te(cs[i],s)*e,y:Te(fe[i],s)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Xi+this.x0,r.y=r.y*this.a*Ji+this.y0,r}function Wo(t){var e={x:(t.x-this.x0)/(this.a*Xi),y:Math.abs(t.y-this.y0)/(this.a*Ji)};if(e.y>=1)e.x/=cs[Ht][0],e.y=t.y<0?-b:b;else{var s=Math.floor(e.y*Ht);for(s<0?s=0:s>=Ht&&(s=Ht-1);;)if(fe[s][0]>e.y)--s;else if(fe[s+1][0]<=e.y)++s;else break;var i=fe[s],r=5*(e.y-i[0])/(fe[s+1][0]-i[0]);r=ko(function(a){return(Te(i,a)-e.y)/jo(i,a)},r,v,100),e.x/=Te(cs[s],r),e.y=(5*s+r)*U,t.y<0&&(e.y=-e.y)}return e.x=y(e.x+this.long0),e}var Xo=["Robinson","robin"],Qi={init:Vo,forward:Ho,inverse:Wo,names:Xo};function Jo(){this.name="geocent"}function Zo(t){var e=Ie(t,this.es,this.a);return e}function Qo(t){var e=Pe(t,this.es,this.a,this.b);return e}var $o=["Geocentric","geocentric","geocent","Geocent"],$i={init:Jo,forward:Zo,inverse:Qo,names:$o};function Ki(t){t.Proj.projections.add(bi),t.Proj.projections.add(kt),t.Proj.projections.add(xi),t.Proj.projections.add(wi),t.Proj.projections.add(Ii),t.Proj.projections.add(Pi),t.Proj.projections.add(Ei),t.Proj.projections.add(Si),t.Proj.projections.add(Ai),t.Proj.projections.add(Ni),t.Proj.projections.add(Oi),t.Proj.projections.add(Fi),t.Proj.projections.add(Li),t.Proj.projections.add(Ci),t.Proj.projections.add(Ti),t.Proj.projections.add(Ui),t.Proj.projections.add(zi),t.Proj.projections.add(qi),t.Proj.projections.add(Gi),t.Proj.projections.add(Di),t.Proj.projections.add(ji),t.Proj.projections.add(ki),t.Proj.projections.add(Vi),t.Proj.projections.add(Hi),t.Proj.projections.add(Wi),t.Proj.projections.add(Qi),t.Proj.projections.add($i)}K.defaultDatum="WGS84";K.Proj=It;K.WGS84=new K.Proj("WGS84");K.Point=ci;K.toPoint=Se;K.defs=qt;K.transform=Ft;K.mgrs=fi;K.version="__VERSION__";Ki(K);var ds=K;var Wt=class{static defineProjectionAliases(e){let s=[];for(let i in e)s.push([i,e[i]]);ds.defs(s)}constructor({from:e="WGS84",to:s="WGS84"}){if(ss(this,"_projection",void 0),this._projection=ds(e,s),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(e){return this._projection.forward(e)}unproject(e){return this._projection.inverse(e)}};function Be(t,e){for(let s of t)s.geometry.coordinates=Yi(s.geometry.coordinates,e);return t}function Yi(t,e){return Ko(t)?e(t):t.map(s=>Yi(s,e))}function Ko(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function ms(t,e){if(t===null)return null;switch(e){case GeometryType.Point:case GeometryType.MultiPoint:return Yo(t);case GeometryType.LineString:case GeometryType.MultiLineString:return th(t);case GeometryType.Polygon:return tr(t);case GeometryType.MultiPolygon:return eh(t);default:throw new Error(`Unimplemented geometry type: ${e}`)}}function Yo(t){let e=t.xyArray(),s=t.zArray();return{positions:ps(e,s)}}function th(t){let e=t.xyArray(),s=t.zArray(),i=ps(e,s),r=t.endsArray()&&Array.from(t.endsArray())||[e.length/2];r.unshift(0);let a={value:new Uint16Array(r),size:1};return{positions:i,pathIndices:a}}function tr(t){let e=t.xyArray(),s=t.zArray(),i=ps(e,s),r=t.endsArray()&&Array.from(t.endsArray())||[e.length/2];r.unshift(0);let a={value:new Uint16Array(r),size:1},n={value:new Uint16Array([0,e.length/2]),size:1};return{positions:i,primitivePolygonIndices:a,polygonIndices:n}}function eh(t){let e=[],s=0,i=1,r=1;for(let c=0;c<t.partsLength();c++){let m=t.parts(c),d=tr(m);s+=d.positions.value.length,i+=d.primitivePolygonIndices.value.length-1,r+=d.polygonIndices.value.length-1,e.push(d)}let a=new Float64Array(s),n=new Uint32Array(i),o=new Uint32Array(r),h=0,f=1,l=1,u=e[0].positions.size;for(let c of e)a.set(c.positions.value,h*u),n.set(c.primitivePolygonIndices.value.subarray(1).map(m=>m+h),f),o.set(c.polygonIndices.value.subarray(1).map(m=>m+h),l),h+=c.positions.value.length/u,f+=c.primitivePolygonIndices.value.length-1,l+=c.polygonIndices.value.length-1;return{positions:{value:a,size:u},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function ps(t,e){if(!e)return{value:t,size:2};if(e.length*2!==t.length)throw new Error("Z array must be half XY array's length");let s=t.length+e.length,i=new Float64Array(s);for(let r=0;r<t.length/2;r++)i[r*3+0]=t[r*2+0],i[r*3+1]=t[r*2+1],i[r*3+2]=e[r];return{value:i,size:3}}function er(t){let e={title:t.title||"",description:t.description||"",crs:JSON.stringify(t.crs)||"",metadata:t.metadata||"",geometryType:String(t.geometryType),indexNodeSize:String(t.indexNodeSize),featureCount:String(t.featuresCount),bounds:t.envelope?.join(",")||""},s=t.columns?.map(i=>sh(i))||[];return{metadata:e,fields:s}}function sh(t){let e={title:t.title||"",description:t.description||"",width:String(t.width),precision:String(t.precision),scale:String(t.scale),unique:String(t.unique),primary_key:String(t.primary_key)};return{name:t.name,type:ih(t.type),nullable:t.nullable,metadata:e}}var j;(function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"})(j||(j={}));function ih(t){switch(t){case j.Byte:return"int8";case j.UByte:return"uint8";case j.Bool:return"bool";case j.Short:return"int16";case j.UShort:return"uint16";case j.Int:return"int32";case j.UInt:return"uint32";case j.Long:return"int64";case j.ULong:return"uint64";case j.Float:return"float32";case j.Double:return"float64";case j.String:return"utf8";case j.Json:return"null";case j.DateTime:return"date-millisecond";case j.Binary:return"binary";default:return"null"}}var C;(function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"})(C||(C={}));var ct=new Int32Array(2),Ue=new Float32Array(ct.buffer),ze=new Float64Array(ct.buffer),Xt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var le;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(le||(le={}));var W=class{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new W(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return ct[0]=this.readInt32(e),Ue[0]}readFloat64(e){return ct[Xt?0:1]=this.readInt32(e),ct[Xt?1:0]=this.readInt32(e+4),ze[0]}writeInt8(e,s){this.bytes_[e]=s}writeUint8(e,s){this.bytes_[e]=s}writeInt16(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8}writeUint16(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8}writeInt32(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8,this.bytes_[e+2]=s>>16,this.bytes_[e+3]=s>>24}writeUint32(e,s){this.bytes_[e]=s,this.bytes_[e+1]=s>>8,this.bytes_[e+2]=s>>16,this.bytes_[e+3]=s>>24}writeInt64(e,s){this.writeInt32(e,Number(BigInt.asIntN(32,s))),this.writeInt32(e+4,Number(BigInt.asIntN(32,s>>BigInt(32))))}writeUint64(e,s){this.writeUint32(e,Number(BigInt.asUintN(32,s))),this.writeUint32(e+4,Number(BigInt.asUintN(32,s>>BigInt(32))))}writeFloat32(e,s){Ue[0]=s,this.writeInt32(e,ct[0])}writeFloat64(e,s){ze[0]=s,this.writeInt32(e,ct[Xt?0:1]),this.writeInt32(e+4,ct[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 e="";for(let s=0;s<4;s++)e+=String.fromCharCode(this.readInt8(this.position_+4+s));return e}__offset(e,s){let i=e-this.readInt32(e);return s<this.readInt16(i)?this.readInt16(i+s):0}__union(e,s){return e.bb_pos=s+this.readInt32(s),e.bb=this,e}__string(e,s){e+=this.readInt32(e);let i=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+i);return s===le.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,s){return typeof e=="string"?this.__string(s):this.__union(e,s)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let s=0;s<4;s++)if(e.charCodeAt(s)!=this.readInt8(this.position()+4+s))return!1;return!0}createScalarList(e,s){let i=[];for(let r=0;r<s;++r){let a=e(r);a!==null&&i.push(a)}return i}createObjList(e,s){let i=[];for(let r=0;r<s;++r){let a=e(r);a!==null&&i.push(a.unpack())}return i}};var D=class{bb=null;bb_pos=0;__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsGeometry(e,s){return(s||new D).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsGeometry(e,s){return e.setPosition(e.position()+4),(s||new D).__init(e.readInt32(e.position())+e.position(),e)}ends(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readUint32(this.bb.__vector(this.bb_pos+s)+e*4):0}endsLength(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__vector_len(this.bb_pos+e):0}endsArray(){let e=this.bb.__offset(this.bb_pos,4);return e?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}xy(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}xyLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}xyArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}z(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}zLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}zArray(){let e=this.bb.__offset(this.bb_pos,8);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}m(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}mLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}mArray(){let e=this.bb.__offset(this.bb_pos,10);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}t(e){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}tLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}tArray(){let e=this.bb.__offset(this.bb_pos,12);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}tm(e){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.readUint64(this.bb.__vector(this.bb_pos+s)+e*8):BigInt(0)}tmLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}type(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readUint8(this.bb_pos+e):C.Unknown}parts(e,s){let i=this.bb.__offset(this.bb_pos,18);return i?(s||new D).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}partsLength(){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__vector_len(this.bb_pos+e):0}static startGeometry(e){e.startObject(8)}static addEnds(e,s){e.addFieldOffset(0,s,0)}static createEndsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addInt32(s[i]);return e.endVector()}static startEndsVector(e,s){e.startVector(4,s,4)}static addXy(e,s){e.addFieldOffset(1,s,0)}static createXyVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startXyVector(e,s){e.startVector(8,s,8)}static addZ(e,s){e.addFieldOffset(2,s,0)}static createZVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startZVector(e,s){e.startVector(8,s,8)}static addM(e,s){e.addFieldOffset(3,s,0)}static createMVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startMVector(e,s){e.startVector(8,s,8)}static addT(e,s){e.addFieldOffset(4,s,0)}static createTVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startTVector(e,s){e.startVector(8,s,8)}static addTm(e,s){e.addFieldOffset(5,s,0)}static createTmVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addInt64(s[i]);return e.endVector()}static startTmVector(e,s){e.startVector(8,s,8)}static addType(e,s){e.addFieldInt8(6,s,C.Unknown)}static addParts(e,s){e.addFieldOffset(7,s,0)}static createPartsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startPartsVector(e,s){e.startVector(4,s,4)}static endGeometry(e){return e.endObject()}static createGeometry(e,s,i,r,a,n,o,h,f){return D.startGeometry(e),D.addEnds(e,s),D.addXy(e,i),D.addZ(e,r),D.addM(e,a),D.addT(e,n),D.addTm(e,o),D.addType(e,h),D.addParts(e,f),D.endGeometry(e)}};function qe(t,e){let s=[];for(let i=0;i<t.length;i+=2){let r=[t[i],t[i+1]];e&&r.push(e[i>>1]),s.push(r)}return s}function ir(t,e,s){if(!s||s.length===0)return[qe(t,e)];let i=0,r=Array.from(s).map(n=>t.slice(i,i=n<<1)),a;return e&&(i=0,a=Array.from(s).map(n=>e.slice(i,i=n))),r.map((n,o)=>qe(n,a?a[o]:void 0))}function ah(t,e){let s=t.xyArray(),i=t.zArray();switch(e){case C.Point:{let r=Array.from(s);return i&&r.push(i[0]),r}case C.MultiPoint:case C.LineString:return qe(s,i);case C.MultiLineString:return ir(s,i,t.endsArray());case C.Polygon:return ir(s,i,t.endsArray())}}function Ge(t,e){let s=e;if(s===C.Unknown&&(s=t.type()),s===C.GeometryCollection){let r=[];for(let a=0;a<t.partsLength();a++){let n=t.parts(a),o=n.type();r.push(Ge(n,o))}return{type:C[s],geometries:r}}else if(s===C.MultiPolygon){let r=[];for(let a=0;a<t.partsLength();a++)r.push(Ge(t.parts(a),C.Polygon));return{type:C[s],coordinates:r.map(a=>a.coordinates)}}let i=ah(t,s);return{type:C[s],coordinates:i}}var T;(function(t){t[t.Byte=0]="Byte",t[t.UByte=1]="UByte",t[t.Bool=2]="Bool",t[t.Short=3]="Short",t[t.UShort=4]="UShort",t[t.Int=5]="Int",t[t.UInt=6]="UInt",t[t.Long=7]="Long",t[t.ULong=8]="ULong",t[t.Float=9]="Float",t[t.Double=10]="Double",t[t.String=11]="String",t[t.Json=12]="Json",t[t.DateTime=13]="DateTime",t[t.Binary=14]="Binary"})(T||(T={}));var R=class{bb=null;bb_pos=0;__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsColumn(e,s){return(s||new R).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsColumn(e,s){return e.setPosition(e.position()+4),(s||new R).__init(e.readInt32(e.position())+e.position(),e)}name(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}type(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):T.Byte}title(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__string(this.bb_pos+s,e):null}width(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readInt32(this.bb_pos+e):-1}precision(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readInt32(this.bb_pos+e):-1}scale(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readInt32(this.bb_pos+e):-1}nullable(){let e=this.bb.__offset(this.bb_pos,18);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!0}unique(){let e=this.bb.__offset(this.bb_pos,20);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}primaryKey(){let e=this.bb.__offset(this.bb_pos,22);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}metadata(e){let s=this.bb.__offset(this.bb_pos,24);return s?this.bb.__string(this.bb_pos+s,e):null}static startColumn(e){e.startObject(11)}static addName(e,s){e.addFieldOffset(0,s,0)}static addType(e,s){e.addFieldInt8(1,s,T.Byte)}static addTitle(e,s){e.addFieldOffset(2,s,0)}static addDescription(e,s){e.addFieldOffset(3,s,0)}static addWidth(e,s){e.addFieldInt32(4,s,-1)}static addPrecision(e,s){e.addFieldInt32(5,s,-1)}static addScale(e,s){e.addFieldInt32(6,s,-1)}static addNullable(e,s){e.addFieldInt8(7,Number(s),Number(!0))}static addUnique(e,s){e.addFieldInt8(8,Number(s),Number(!1))}static addPrimaryKey(e,s){e.addFieldInt8(9,Number(s),Number(!1))}static addMetadata(e,s){e.addFieldOffset(10,s,0)}static endColumn(e){let s=e.endObject();return e.requiredField(s,4),s}static createColumn(e,s,i,r,a,n,o,h,f,l,u,c){return R.startColumn(e),R.addName(e,s),R.addType(e,i),R.addTitle(e,r),R.addDescription(e,a),R.addWidth(e,n),R.addPrecision(e,o),R.addScale(e,h),R.addNullable(e,f),R.addUnique(e,l),R.addPrimaryKey(e,u),R.addMetadata(e,c),R.endColumn(e)}};var X=class{bb=null;bb_pos=0;__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsFeature(e,s){return(s||new X).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFeature(e,s){return e.setPosition(e.position()+4),(s||new X).__init(e.readInt32(e.position())+e.position(),e)}geometry(e){let s=this.bb.__offset(this.bb_pos,4);return s?(e||new D).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}properties(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readUint8(this.bb.__vector(this.bb_pos+s)+e):0}propertiesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}propertiesArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}columns(e,s){let i=this.bb.__offset(this.bb_pos,8);return i?(s||new R).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}columnsLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFeature(e){e.startObject(3)}static addGeometry(e,s){e.addFieldOffset(0,s,0)}static addProperties(e,s){e.addFieldOffset(1,s,0)}static createPropertiesVector(e,s){e.startVector(1,s.length,1);for(let i=s.length-1;i>=0;i--)e.addInt8(s[i]);return e.endVector()}static startPropertiesVector(e,s){e.startVector(1,s,1)}static addColumns(e,s){e.addFieldOffset(2,s,0)}static createColumnsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startColumnsVector(e,s){e.startVector(4,s,4)}static endFeature(e){return e.endObject()}static finishFeatureBuffer(e,s){e.finish(s)}static finishSizePrefixedFeatureBuffer(e,s){e.finish(s,void 0,!0)}static createFeature(e,s,i,r){return X.startFeature(e),X.addGeometry(e,s),X.addProperties(e,i),X.addColumns(e,r),X.endFeature(e)}};var Kd=new TextEncoder,rr=new TextDecoder;function De(t,e){let s={};if(!e||e.length===0)return s;let i=t.propertiesArray();if(!i)return s;let r=new DataView(i.buffer,i.byteOffset),a=t.propertiesLength(),n=0;for(;n<a;){let o=r.getUint16(n,!0);n+=2;let h=e[o],f=h.name;switch(h.type){case T.Bool:{s[f]=Boolean(r.getUint8(n)),n+=1;break}case T.Byte:{s[f]=r.getInt8(n),n+=1;break}case T.UByte:{s[f]=r.getUint8(n),n+=1;break}case T.Short:{s[f]=r.getInt16(n,!0),n+=2;break}case T.UShort:{s[f]=r.getUint16(n,!0),n+=2;break}case T.Int:{s[f]=r.getInt32(n,!0),n+=4;break}case T.UInt:{s[f]=r.getUint32(n,!0),n+=4;break}case T.Long:{s[f]=Number(r.getBigInt64(n,!0)),n+=8;break}case T.ULong:{s[f]=Number(r.getBigUint64(n,!0)),n+=8;break}case T.Float:{s[f]=r.getFloat32(n,!0),n+=4;break}case T.Double:{s[f]=r.getFloat64(n,!0),n+=8;break}case T.DateTime:case T.String:{let l=r.getUint32(n,!0);n+=4,s[f]=rr.decode(i.subarray(n,n+l)),n+=l;break}case T.Json:{let l=r.getUint32(n,!0);n+=4;let u=rr.decode(i.subarray(n,n+l));s[f]=JSON.parse(u),n+=l;break}default:throw new Error(`Unknown type ${h.type}`)}}return s}function je(t,e){let s=e.columns;return{type:"Feature",geometry:Ge(t.geometry(),e.geometryType),properties:De(t,s)}}var Jt=new Uint8Array(0);function ar(){return this._source.cancel()}function bs(t,e){if(!t.length)return e;if(!e.length)return t;var s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s}function nr(){var t=this,e=t._array.subarray(t._index);return t._source.read().then(function(s){return t._array=Jt,t._index=0,s.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:bs(e,s.value)}})}function or(t){if((t|=0)<0)throw new Error("invalid length");var e=this,s=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var i=new Uint8Array(t);return i.set(this._array.subarray(this._index)),function r(){return e._source.read().then(function(a){return a.done?(e._array=Jt,e._index=0,s>0?i.subarray(0,s):null):s+a.value.length>=t?(e._array=a.value,e._index=t-s,i.set(a.value.subarray(0,t-s),s),i):(i.set(a.value,s),s+=a.value.length,r())})}()}function _s(t){return typeof t.slice=="function"?t:new ke(typeof t.read=="function"?t:t.getReader())}function ke(t){this._source=t,this._array=Jt,this._index=0}ke.prototype.read=nr;ke.prototype.slice=or;ke.prototype.cancel=ar;var J=class{bb=null;bb_pos=0;__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsCrs(e,s){return(s||new J).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsCrs(e,s){return e.setPosition(e.position()+4),(s||new J).__init(e.readInt32(e.position())+e.position(),e)}org(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}code(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}name(e){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.__string(this.bb_pos+s,e):null}wkt(e){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.__string(this.bb_pos+s,e):null}codeString(e){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.__string(this.bb_pos+s,e):null}static startCrs(e){e.startObject(6)}static addOrg(e,s){e.addFieldOffset(0,s,0)}static addCode(e,s){e.addFieldInt32(1,s,0)}static addName(e,s){e.addFieldOffset(2,s,0)}static addDescription(e,s){e.addFieldOffset(3,s,0)}static addWkt(e,s){e.addFieldOffset(4,s,0)}static addCodeString(e,s){e.addFieldOffset(5,s,0)}static endCrs(e){return e.endObject()}static createCrs(e,s,i,r,a,n,o){return J.startCrs(e),J.addOrg(e,s),J.addCode(e,i),J.addName(e,r),J.addDescription(e,a),J.addWkt(e,n),J.addCodeString(e,o),J.endCrs(e)}};var Bt=class{bb=null;bb_pos=0;__init(e,s){return this.bb_pos=e,this.bb=s,this}static getRootAsHeader(e,s){return(s||new Bt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsHeader(e,s){return e.setPosition(e.position()+4),(s||new Bt).__init(e.readInt32(e.position())+e.position(),e)}name(e){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__string(this.bb_pos+s,e):null}envelope(e){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readFloat64(this.bb.__vector(this.bb_pos+s)+e*8):0}envelopeLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}envelopeArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}geometryType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):C.Unknown}hasZ(){let e=this.bb.__offset(this.bb_pos,10);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasM(){let e=this.bb.__offset(this.bb_pos,12);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasT(){let e=this.bb.__offset(this.bb_pos,14);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}hasTm(){let e=this.bb.__offset(this.bb_pos,16);return e?Boolean(this.bb.readInt8(this.bb_pos+e)):!1}columns(e,s){let i=this.bb.__offset(this.bb_pos,18);return i?(s||new R).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}columnsLength(){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__vector_len(this.bb_pos+e):0}featuresCount(){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint64(this.bb_pos+e):BigInt("0")}indexNodeSize(){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readUint16(this.bb_pos+e):16}crs(e){let s=this.bb.__offset(this.bb_pos,24);return s?(e||new J).__init(this.bb.__indirect(this.bb_pos+s),this.bb):null}title(e){let s=this.bb.__offset(this.bb_pos,26);return s?this.bb.__string(this.bb_pos+s,e):null}description(e){let s=this.bb.__offset(this.bb_pos,28);return s?this.bb.__string(this.bb_pos+s,e):null}metadata(e){let s=this.bb.__offset(this.bb_pos,30);return s?this.bb.__string(this.bb_pos+s,e):null}static startHeader(e){e.startObject(14)}static addName(e,s){e.addFieldOffset(0,s,0)}static addEnvelope(e,s){e.addFieldOffset(1,s,0)}static createEnvelopeVector(e,s){e.startVector(8,s.length,8);for(let i=s.length-1;i>=0;i--)e.addFloat64(s[i]);return e.endVector()}static startEnvelopeVector(e,s){e.startVector(8,s,8)}static addGeometryType(e,s){e.addFieldInt8(2,s,C.Unknown)}static addHasZ(e,s){e.addFieldInt8(3,Number(s),Number(!1))}static addHasM(e,s){e.addFieldInt8(4,Number(s),Number(!1))}static addHasT(e,s){e.addFieldInt8(5,Number(s),Number(!1))}static addHasTm(e,s){e.addFieldInt8(6,Number(s),Number(!1))}static addColumns(e,s){e.addFieldOffset(7,s,0)}static createColumnsVector(e,s){e.startVector(4,s.length,4);for(let i=s.length-1;i>=0;i--)e.addOffset(s[i]);return e.endVector()}static startColumnsVector(e,s){e.startVector(4,s,4)}static addFeaturesCount(e,s){e.addFieldInt64(8,s,BigInt("0"))}static addIndexNodeSize(e,s){e.addFieldInt16(9,s,16)}static addCrs(e,s){e.addFieldOffset(10,s,0)}static addTitle(e,s){e.addFieldOffset(11,s,0)}static addDescription(e,s){e.addFieldOffset(12,s,0)}static addMetadata(e,s){e.addFieldOffset(13,s,0)}static endHeader(e){return e.endObject()}static finishHeaderBuffer(e,s){e.finish(s)}static finishSizePrefixedHeaderBuffer(e,s){e.finish(s,void 0,!0)}};function ue(t){let e=Bt.getRootAsHeader(t),s=e.featuresCount(),i=e.indexNodeSize(),r=[];for(let h=0;h<e.columnsLength();h++){let f=e.columns(h);if(!f)throw new Error("Column unexpectedly missing");if(!f.name())throw new Error("Column name unexpectedly missing");r.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=e.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:e.geometryType(),columns:r,envelope:null,featuresCount:Number(s),indexNodeSize:i,crs:n,title:e.title(),description:e.description(),metadata:e.metadata()}}var ys=function(t,e){return ys=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var r in i)i.hasOwnProperty(r)&&(s[r]=i[r])},ys(t,e)};function nh(t,e){ys(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}function Qt(t,e,s,i){function r(a){return a instanceof s?a:new s(function(n){n(a)})}return new(s||(s=Promise))(function(a,n){function o(l){try{f(i.next(l))}catch(u){n(u)}}function h(l){try{f(i.throw(l))}catch(u){n(u)}}function f(l){l.done?a(l.value):r(l.value).then(o,h)}f((i=i.apply(t,e||[])).next())})}function Et(t,e){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,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(l){return h([f,l])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=f[0]&2?r.return:f[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,f[1])).done)return a;switch(r=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return s.label++,{value:f[1],done:!1};case 5:s.label++,r=f[1],f=[0];continue;case 7:f=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){s=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){s.label=f[1];break}if(f[0]===6&&s.label<a[1]){s.label=a[1],a=f;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(f);break}a[2]&&s.ops.pop(),s.trys.pop();continue}f=e.call(t,s)}catch(l){f=[6,l],r=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function $t(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],i=0;if(s)return s.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function de(t){return this instanceof de?(this.v=t,this):new de(t)}function oh(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=s.apply(t,e||[]),r,a=[];return r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r;function n(c){i[c]&&(r[c]=function(m){return new Promise(function(d,p){a.push([c,m,d,p])>1||o(c,m)})})}function o(c,m){try{h(i[c](m))}catch(d){u(a[0][3],d)}}function h(c){c.value instanceof de?Promise.resolve(c.value.v).then(f,l):u(a[0][2],c)}function f(c){o("next",c)}function l(c){o("throw",c)}function u(c,m){c(m),a.shift(),a.length&&o(a[0][0],a[0][1])}}var lr=function(t){nh(e,t);function e(s){var i=t.call(this,s)||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 e}(Error),wm=function(){function t(e){if(e<0)throw new RangeError("Capacity may not be less than 0");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(e){if(this.full)throw new Error("Buffer full");this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),Im=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){for(;this._q.length>=this._c;)this._q.shift();this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),Pm=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){this._q.length<this._c&&this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}();function Ms(t){t!=null&&typeof t.then=="function"&&t.then(Xe,Xe)}var vs=0,hr=1,zt=2,He=3,gs=4,We=1024,Xe=function(){};function Zt(t){var e=t.err,s=Promise.resolve(t.execution).then(function(i){if(e!=null)throw e;return i});return t.err=void 0,t.execution=s.then(function(){},function(){}),t.pending===void 0?s:t.pending.then(function(){return s})}function Ut(t,e){var s=t.state>=He;return Promise.resolve(e).then(function(i){return!s&&t.state>=gs?Zt(t).then(function(r){return{value:r,done:!0}}):{value:i,done:s}})}function xs(t,e){var s,i;if(!(t.state>=zt))if(t.state=zt,t.onnext(),t.onstop(),t.err==null&&(t.err=e),t.pushes.length===0&&(typeof t.buffer>"u"||t.buffer.empty))ce(t);else try{for(var r=$t(t.pushes),a=r.next();!a.done;a=r.next()){var n=a.value;n.resolve()}}catch(o){s={error:o}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}}function ce(t){var e,s;if(!(t.state>=He)){t.state<zt&&xs(t),t.state=He,t.buffer=void 0;try{for(var i=$t(t.nexts),r=i.next();!r.done;r=i.next()){var a=r.value,n=t.pending===void 0?Zt(t):t.pending.then(function(){return Zt(t)});a.resolve(Ut(t,n))}}catch(o){e={error:o}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(e)throw e.error}}t.pushes=[],t.nexts=[]}}function fr(t){t.state>=gs||(t.state<He&&ce(t),t.state=gs)}function hh(t,e){if(Ms(e),t.pushes.length>=We)throw new lr("No more than "+We+" pending calls to push are allowed on a single repeater.");if(t.state>=zt)return Promise.resolve(void 0);var s=t.pending===void 0?Promise.resolve(e):t.pending.then(function(){return e});s=s.catch(function(h){t.state<zt&&(t.err=h),fr(t)});var i;if(t.nexts.length){var r=t.nexts.shift();r.resolve(Ut(t,s)),t.nexts.length?i=Promise.resolve(t.nexts[0].value):i=new Promise(function(h){return t.onnext=h})}else typeof t.buffer<"u"&&!t.buffer.full?(t.buffer.add(s),i=Promise.resolve(void 0)):i=new Promise(function(h){return t.pushes.push({resolve:h,value:s})});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),t.pending=s.then(function(){return o}).catch(function(h){t.err=h,fr(t)}),n}function fh(t){var e=xs.bind(null,t),s=new Promise(function(i){return t.onstop=i});return e.then=s.then.bind(s),e.catch=s.catch.bind(s),e.finally=s.finally.bind(s),e}function lh(t){if(!(t.state>=hr)){t.state=hr;var e=hh.bind(null,t),s=fh(t);t.execution=new Promise(function(i){return i(t.executor(e,s))}),t.execution.catch(function(){return xs(t)})}}var Ve=new WeakMap,Kt=function(){function t(e,s){Ve.set(this,{executor:e,buffer:s,err:void 0,state:vs,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:Xe,onstop:Xe})}return t.prototype.next=function(e){Ms(e);var s=Ve.get(this);if(s===void 0)throw new Error("WeakMap error");if(s.nexts.length>=We)throw new lr("No more than "+We+" pending calls to next are allowed on a single repeater.");if(s.state<=vs&&lh(s),s.onnext(e),typeof s.buffer<"u"&&!s.buffer.empty){var i=Ut(s,s.buffer.remove());if(s.pushes.length){var r=s.pushes.shift();s.buffer.add(r.value),s.onnext=r.resolve}return i}else if(s.pushes.length){var a=s.pushes.shift();return s.onnext=a.resolve,Ut(s,a.value)}else if(s.state>=zt)return ce(s),Ut(s,Zt(s));return new Promise(function(n){return s.nexts.push({resolve:n,value:e})})},t.prototype.return=function(e){Ms(e);var s=Ve.get(this);if(s===void 0)throw new Error("WeakMap error");return ce(s),s.execution=Promise.resolve(s.execution).then(function(){return e}),Ut(s,Zt(s))},t.prototype.throw=function(e){var s=Ve.get(this);if(s===void 0)throw new Error("WeakMap error");return s.state<=vs||s.state>=zt||typeof s.buffer<"u"&&!s.buffer.empty?(ce(s),s.err==null&&(s.err=e),Ut(s,Zt(s))):this.next(Promise.reject(e))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=uh,t.merge=ch,t.zip=dh,t.latest=mh,t}();function Je(t,e){var s,i,r=[],a=function(f){f!=null&&typeof f[Symbol.asyncIterator]=="function"?r.push(f[Symbol.asyncIterator]()):f!=null&&typeof f[Symbol.iterator]=="function"?r.push(f[Symbol.iterator]()):r.push(function(){return oh(this,arguments,function(){return Et(this,function(c){switch(c.label){case 0:return e.yieldValues?[4,de(f)]:[3,3];case 1:return[4,c.sent()];case 2:c.sent(),c.label=3;case 3:return e.returnValues?[4,de(f)]:[3,5];case 4:return[2,c.sent()];case 5:return[2]}})})}())};try{for(var n=$t(t),o=n.next();!o.done;o=n.next()){var h=o.value;a(h)}}catch(f){s={error:f}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}return r}function uh(t){var e=this,s=Je(t,{returnValues:!0});return new Kt(function(i,r){return Qt(e,void 0,void 0,function(){var a,n,o,h,f,l;return Et(this,function(u){switch(u.label){case 0:if(!s.length)return r(),[2];n=!1,r.then(function(){a(),n=!0}),u.label=1;case 1:u.trys.push([1,,5,7]),h=void 0,f=0,l=function(){var c,m,d,p,_,M;return Et(this,function(x){switch(x.label){case 0:c=f;try{for(m=(_=void 0,$t(s)),d=m.next();!d.done;d=m.next())p=d.value,Promise.resolve(p.next()).then(function(g){g.done?(r(),o===void 0&&(o=g)):f===c&&(f++,a(g))},function(g){return r(g)})}catch(g){_={error:g}}finally{try{d&&!d.done&&(M=m.return)&&M.call(m)}finally{if(_)throw _.error}}return[4,new Promise(function(g){return a=g})];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]}})},u.label=2;case 2:return n?[3,4]:[5,l()];case 3:return u.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return r(),[4,Promise.race(s.map(function(c){return c.return&&c.return()}))];case 6:return u.sent(),[7];case 7:return[2]}})})})}function ch(t){var e=this,s=Je(t,{yieldValues:!0});return new Kt(function(i,r){return Qt(e,void 0,void 0,function(){var a,n,o,h=this;return Et(this,function(f){switch(f.label){case 0:if(!s.length)return r(),[2];a=[],n=!1,r.then(function(){var l,u;n=!0;try{for(var c=$t(a),m=c.next();!m.done;m=c.next()){var d=m.value;d()}}catch(p){l={error:p}}finally{try{m&&!m.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(s.map(function(l,u){return Qt(h,void 0,void 0,function(){var c,m;return Et(this,function(d){switch(d.label){case 0:d.trys.push([0,,6,9]),d.label=1;case 1:return n?[3,5]:(Promise.resolve(l.next()).then(function(p){return a[u](p)},function(p){return r(p)}),[4,new Promise(function(p){a[u]=p})]);case 2:return c=d.sent(),c===void 0?[3,4]:c.done?(o=c,[2]):[4,i(c.value)];case 3:d.sent(),d.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return m=l.return,m?[4,l.return()]:[3,8];case 7:m=d.sent(),d.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return f.sent(),[2,o&&o.value];case 3:return r(),[7];case 4:return[2]}})})})}function dh(t){var e=this,s=Je(t,{returnValues:!0});return new Kt(function(i,r){return Qt(e,void 0,void 0,function(){var a,n,o,h;return Et(this,function(f){switch(f.label){case 0:if(!s.length)return r(),[2,[]];n=!1,r.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(s.map(function(l){return l.next()})).then(function(l){return a(l)},function(l){return r(l)}),[4,new Promise(function(l){return a=l})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(l){return l.value}),o.some(function(l){return l.done})?[2,h]:[4,i(h)]);case 4:return f.sent(),[3,2];case 5:return[3,8];case 6:return r(),[4,Promise.all(s.map(function(l){return l.return&&l.return()}))];case 7:return f.sent(),[7];case 8:return[2]}})})})}function mh(t){var e=this,s=Je(t,{yieldValues:!0,returnValues:!0});return new Kt(function(i,r){return Qt(e,void 0,void 0,function(){var a,n,o,h,f,l=this;return Et(this,function(u){switch(u.label){case 0:if(!s.length)return r(),[2,[]];n=[],o=!1,r.then(function(){var c,m;a();try{for(var d=$t(n),p=d.next();!p.done;p=d.next()){var _=p.value;_()}}catch(M){c={error:M}}finally{try{p&&!p.done&&(m=d.return)&&m.call(d)}finally{if(c)throw c.error}}o=!0}),u.label=1;case 1:return u.trys.push([1,,5,7]),Promise.all(s.map(function(c){return c.next()})).then(function(c){return a(c)},function(c){return r(c)}),[4,new Promise(function(c){return a=c})];case 2:return h=u.sent(),h===void 0?[2]:(f=h.map(function(c){return c.value}),h.every(function(c){return c.done})?[2,f]:[4,i(f.slice())]);case 3:return u.sent(),[4,Promise.all(s.map(function(c,m){return Qt(l,void 0,void 0,function(){var d;return Et(this,function(p){switch(p.label){case 0:if(h[m].done)return[2,h[m].value];p.label=1;case 1:return o?[3,4]:(Promise.resolve(c.next()).then(function(_){return n[m](_)},function(_){return r(_)}),[4,new Promise(function(_){return n[m]=_})]);case 2:return d=p.sent(),d===void 0?[2,h[m].value]:d.done?[2,d.value]:(f[m]=d.value,[4,i(f.slice())]);case 3:return p.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,u.sent()];case 5:return r(),[4,Promise.all(s.map(function(c){return c.return&&c.return()}))];case 6:return u.sent(),[7];case 7:return[2]}})})})}var ws=class{_extraRequestThreshold=256*1024;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(e){if(e<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=e}},St=ws;ve(St,"global",new ws);var ft;(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error"})(ft||(ft={}));var O=class{static debug(...e){this.log(ft.Debug,...e)}static info(...e){this.log(ft.Info,...e)}static warn(...e){this.log(ft.Warn,...e)}static error(...e){this.log(ft.Error,...e)}static log(e,...s){if(!(this.logLevel>e))switch(e){case ft.Debug:{console.debug(...s);break}case ft.Info:{console.info(...s);break}case ft.Warn:{console.warn(...s);break}case ft.Error:{console.error(...s);break}}}};ve(O,"logLevel",ft.Warn);var At=8*4+8;var ur=16;function me(t,e){e=Math.min(Math.max(Number(e),2),65535);let s=t,i=s;do s=Math.ceil(s/e),i+=s;while(s!==1);return i*At}function ph(t,e){if(e<2)throw new Error("Node size must be at least 2");if(t===0)throw new Error("Number of items must be greater than 0");let s=t,i=s,r=[s];do s=Math.ceil(s/e),i+=s,r.push(s);while(s!==1);let a=[];s=i;for(let o of r)a.push(s-o),s-=o;let n=[];for(let o=0;o<r.length;o++)n.push([a[o],a[o]+r[o]]);return n}async function*cr(t,e,s,i){class r{_level;nodes;constructor(d,p){this._level=p,this.nodes=d}level(){return this._level}startNodeIdx(){return this.nodes[0]}endNodeIdx(){return this.nodes[1]}extendEndNodeIdx(d){console.assert(d>this.nodes[1]),this.nodes[1]=d}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}let{minX:a,minY:n,maxX:o,maxY:h}=s;O.info(`tree items: ${t}, nodeSize: ${e}`);let f=ph(t,e),l=f[0][0],c=[(()=>{let m=[0,1],d=f.length-1;return new r(m,d)})()];for(O.debug(`starting stream search with queue: ${c}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${f}`);c.length!=0;){let m=c.shift();O.debug(`popped node: ${m}, queueLength: ${c.length}`);let d=m.startNodeIdx(),p=d>=l,_=(()=>{let[,S]=f[m.level()],I=Math.min(m.endNodeIdx()+e,S);return p&&I<S?I+1:I})(),M=_-d,x=await i(d*At,M*At),g=new DataView(x);for(let S=d;S<_;S++){let I=S-d,P=I*At;if(o<g.getFloat64(P+0,!0)||h<g.getFloat64(P+8,!0)||a>g.getFloat64(P+16,!0)||n>g.getFloat64(P+24,!0))continue;let B=g.getBigUint64(P+32,!0);if(p){let mt=B,te=(()=>{if(S<t-1){let Ir=(I+1)*At;return g.getBigUint64(Ir+32,!0)-mt}return null})(),wr=S-l;yield[Number(mt),wr,Number(te)];continue}let N=B,Y=St.global.extraRequestThreshold()/At,G=c[c.length-1];if(G!==void 0&&G.level()==m.level()-1&&N<G.endNodeIdx()+Y){O.debug(`Merging "nodeRange" request into existing range: ${G}, newEndNodeIdx: ${G.endNodeIdx()} -> ${N}`),G.extendEndNodeIdx(Number(N));continue}let st=(()=>{let mt=m.level()-1,te=[Number(N),Number(N)+1];return new r(te,mt)})();G!==void 0&&G.level()==st.level()?O.info(`Same level, but too far away. Pushing new request for nodeIdx: ${N} rather than merging with distant ${G}`):O.info(`Pushing new level for ${st} onto queue with nearestNodeRange: ${G} since there's not already a range for this level.`),c.push(st)}}}var dt=new Uint8Array([102,103,98,3,102,103,98,0]),lt=4;var Yt=class{headerClient;header;headerLength;indexLength;constructor(e,s,i,r){this.headerClient=e,this.header=s,this.headerLength=i,this.indexLength=r}static async open(e){let i=new Ze(e),r=(()=>{let u=ur,c=3,m=0,d;for(d=0;d<c;d++){let p=u**d*At;m+=p}return m})(),a=2024+r;O.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${r})`);{let u=new Uint8Array(await i.getRange(0,8,a,"header"));if(!u.subarray(0,3).every((c,m)=>dt[m]===c))throw O.error(`bytes: ${u} != ${dt}`),new Error("Not a FlatGeobuf file");O.debug("magic bytes look good")}let n;{let u=await i.getRange(8,4,a,"header");n=new DataView(u).getUint32(0,!0);let c=1048576*10;if(n>c||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=ue(h),l=me(f.featuresCount,f.indexNodeSize);return O.debug("completed: opening http reader"),new Yt(i,f,n,l)}async*selectBbox(e){let s=this.lengthBeforeTree(),i=this.headerClient,r=async function(h,f){return i.getRange(s+h,f,0,"index")},a=[],n=[];for await(let h of cr(this.header.featuresCount,this.header.indexNodeSize,e,r)){let[f,,]=h,[,,l]=h;if(l||(O.info("final feature"),l=4),n.length==0){n.push([f,l]);continue}let u=n[n.length-1],c=f-(u[0]+u[1]);c>St.global.extraRequestThreshold()&&(O.info(`Pushing new feature batch, since gap ${c} was too large`),a.push(n),n=[]),n.push([f,l])}this.headerClient.logUsage("header+index"),n.length>0&&a.push(n);let o=a.flatMap(h=>this.readFeatureBatch(h));yield*Kt.merge(o)}lengthBeforeTree(){return dt.length+lt+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new Ze(this.headerClient.httpClient)}async*readFeatureBatch(e){let[s]=e[0],[i,r]=e[e.length-1],a=s,o=i+r-a,h=this.buildFeatureClient(),f=o;for(let[l]of e)yield await this.readFeature(h,l,f),f=0;h.logUsage("feature")}async readFeature(e,s,i){let r=s+this.lengthBeforeFeatures(),a;{let l=await e.getRange(r,4,i,"feature length");a=new DataView(l).getUint32(0,!0)}let n=await e.getRange(r+4,a,i,"feature data"),o=new Uint8Array(n),h=new Uint8Array(a+lt);h.set(o,lt);let f=new W(h);return f.setPosition(lt),X.getRootAsFeature(f)}},Ze=class{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(e){if(typeof e=="string")this.httpClient=new Qe(e);else if(e instanceof Qe)this.httpClient=e;else throw new Error("Unknown source ")}async getRange(e,s,i,r){this.bytesEverUsed+=s;let a=e-this.head,n=a+s;if(a>=0&&n<=this.buffer.byteLength)return this.buffer.slice(a,n);let o=Math.max(s,i);return this.bytesEverFetched+=o,O.debug(`requesting for new Range: ${e}-${e+o-1}`),this.buffer=await this.httpClient.getRange(e,o,r),this.head=e,this.buffer.slice(0,s)}logUsage(e){let s=e.split(" ")[0],i=this.bytesEverUsed,r=this.bytesEverFetched,a=(100*i/r).toFixed(2);O.info(`${s} bytes used/requested: ${i} / ${r} = ${a}%`)}},Qe=class{url;requestsEverMade=0;bytesEverRequested=0;constructor(e){this.url=e}async getRange(e,s,i){this.requestsEverMade+=1,this.bytesEverRequested+=s;let r=`bytes=${e}-${e+s-1}`;return O.info(`request: #${this.requestsEverMade}, purpose: ${i}), bytes: (this_request: ${s}, ever: ${this.bytesEverRequested}), Range: ${r}`),(await fetch(this.url,{headers:{Range:r}})).arrayBuffer()}};function $e(t,e,s){if(!t.subarray(0,3).every((l,u)=>dt[u]===l))throw new Error("Not a FlatGeobuf file");let i=new W(t),r=i.readUint32(dt.length);i.setPosition(dt.length+lt);let a=ue(i);s&&s(a);let n=dt.length+lt+r,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=me(h,o));let f=[];for(;n<i.capacity();){let l=i.readUint32(n);i.setPosition(n+lt);let u=X.getRootAsFeature(i);f.push(e(u,a)),n+=lt+l}return f}async function*Ke(t,e,s){let i=_s(t),r=async c=>await i.slice(c),a=new Uint8Array(await r(8,"magic bytes"));if(!a.subarray(0,3).every((c,m)=>dt[m]===c))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(await r(4,"header length"));let n=new W(a),o=n.readUint32(0);a=new Uint8Array(await r(o,"header data")),n=new W(a);let h=ue(n);s&&s(h);let{indexNodeSize:f,featuresCount:l}=h;if(f>0){let c=me(l,f);await r(c,"entire index, w/o rect")}let u;for(;u=await bh(r,h,e);)yield u}async function*Ye(t,e,s,i){let r=await Yt.open(t);O.debug("opened reader"),i&&i(r.header);for await(let a of r.selectBbox(e))yield s(a,r.header)}async function bh(t,e,s){let i=new Uint8Array(await t(4,"feature length"));if(i.byteLength===0)return;let r=new W(i),a=r.readUint32(0);i=new Uint8Array(await t(a,"feature data"));let n=new Uint8Array(a+4);n.set(i,4),r=new W(n),r.setPosition(lt);let o=X.getRootAsFeature(r);return s(o,e)}function dr(t,e){return{type:"FeatureCollection",features:$e(t,je,e)}}function mr(t,e){return Ke(t,je,e)}function pr(t,e,s){return Ye(t,e,je,s)}function br(t,e,s){return t instanceof Uint8Array?dr(t,s):t instanceof ReadableStream?mr(t,s):pr(t,e,s)}function _r(t,e,s){return t instanceof Uint8Array?$e(t,e):t instanceof ReadableStream?Ke(t,e):Ye(t,s,e)}var yr=br,Mr=_r;function yh(t,e){let s=t.geometry(),i=e.geometryType||s?.type(),r=ms(s,i);return r.properties=De(t,e.columns),r}function Is(t,e){let s=e?.flatgeobuf?.shape;switch(s){case"geojson-table":return Mh(t,e);case"columnar-table":return{shape:"columnar-table",data:vr(t,e)};case"binary":return vr(t,e);default:throw new Error(s)}}function vr(t,e={}){let s=new Uint8Array(t);return Mr(s,ms)}function Mh(t,e={}){if(t.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:s=!1,_targetCrs:i="WGS84"}=e&&e.gis||{},r=new Uint8Array(t),a,n,{features:o}=yr(r,void 0,l=>{a=l,n=er(a)}),h=a&&a.crs,f;if(s&&h)try{f=new Wt({from:h.wkt,to:i})}catch{}return f&&(o=Be(o,l=>f.project(l))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:o}}function gr(t,e){let s=e.flatgeobuf?.shape;switch(s){case"binary":return gh(t,e);case"geojson-table":return xh(t,e);default:throw new Error(s)}}function gh(t,e){return Mr(t,yh)}async function*xh(t,e){let{reproject:s=!1,_targetCrs:i="WGS84"}=e&&e.gis||{},r,a=yr(t,void 0,h=>{r=h}),n,o=!0;for await(let h of a){if(o){let f=r&&r.crs;s&&f&&(n=new Wt({from:f.wkt,to:i})),o=!1}s&&n?yield Be([h],f=>n.project(f)):yield h}}var wh="4.2.0-alpha.5",Ih=[102,103,98,3,102,103,98,1],Ps={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:wh,worker:!0,extensions:["fgb"],mimeTypes:["application/octet-stream"],category:"geometry",tests:[new Uint8Array(Ih).buffer],options:{flatgeobuf:{shape:"geojson-table"},gis:{reproject:!1}}},xr={...Ps,parse:async(t,e)=>Is(t,e),parseSync:Is,parseInBatchesFromStream:gr,binary:!0};return Cr(pe);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
@repeaterjs/repeater/repeater.js:
|