@loaders.gl/flatgeobuf 4.3.0-beta.1 → 4.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +1 -1
- package/dist/flatgeobuf-loader.js +1 -1
- package/dist/flatgeobuf-worker.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"use strict";var __exports__=(()=>{var Ir=Object.create;var te=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Sr=Object.getPrototypeOf,Ar=Object.prototype.hasOwnProperty;var Nr=(t,e,s)=>e in t?te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Or=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fr=(t,e)=>{for(var s in e)te(t,s,{get:e[s],enumerable:!0})},pe=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Pr(e))!Ar.call(t,r)&&r!==s&&te(t,r,{get:()=>e[r],enumerable:!(i=Er(e,r))||i.enumerable});return t},be=(t,e,s)=>(pe(t,e,"default"),s&&pe(s,e,"default")),Rr=(t,e,s)=>(s=t!=null?Ir(Sr(t)):{},pe(e||!t||!t.__esModule?te(s,"default",{value:t,enumerable:!0}):s,t)),Lr=t=>pe(te({},"__esModule",{value:!0}),t);var _e=(t,e,s)=>(Nr(t,typeof e!="symbol"?e+"":e,s),s);var ws=Or((Sh,xs)=>{xs.exports=globalThis.loaders});var me={};Fr(me,{FlatGeobufLoader:()=>Ye,FlatGeobufWorkerLoader:()=>gs});be(me,Rr(ws(),1));function Is(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,Es=4,ee=5,At=484813681109536e-20,b=Math.PI/2,Ps=.16666666666666666,Ss=.04722222222222222,As=.022156084656084655,v=1e-10,U=.017453292519943295,at=57.29577951308232,P=Math.PI/4,se=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 Ns={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var Os=/[\s_\-\/\(\)]/g;function $(t,e){if(t[e])return t[e];for(var s=Object.keys(t),i=e.toLowerCase().replace(Os,""),r=-1,a,n;++r<s.length;)if(a=s[r],n=a.toLowerCase().replace(Os,""),n===i)return t[a]}function ie(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=$(Ns,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 Fs=Ur,re=1,Rs=2,Ls=3,ve=4,Cs=5,ts=-1,Cr=/\s/,Tr=/[A-Za-z]/,Br=/[A-Za-z84_]/,ye=/[,\]]/,Ts=/[\d\.E\-\+]/;function bt(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=re}bt.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 re:return this.neutral(t);case Rs:return this.keyword(t);case ve:return this.quoted(t);case Cs:return this.afterquote(t);case Ls:return this.number(t);case ts:return}};bt.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)};bt.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=re;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=re,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ts);return}};bt.prototype.number=function(t){if(Ts.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)};bt.prototype.quoted=function(t){if(t==='"'){this.state=Cs;return}this.word+=t};bt.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=re;return}if(ye.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};bt.prototype.neutral=function(t){if(Tr.test(t)){this.word=t,this.state=Rs;return}if(t==='"'){this.word="",this.state=ve;return}if(Ts.test(t)){this.word=t,this.state=Ls;return}if(ye.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};bt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ts)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Ur(t){var e=new bt(t);return e.output()}function Bs(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]],Bs(e,s,t);return;default:for(i=-1;++i<t.length;)if(!Array.isArray(t[i]))return Nt(t,e[s]);return Bs(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 ct(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 c=t.to_meter||1;return f*c}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",ct],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ct],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",ct],["lat0","latitude_of_origin",ct],["lat0","standard_parallel_1",ct],["lat1","standard_parallel_1",ct],["lat2","standard_parallel_2",ct],["azimuth","Azimuth"],["alpha","azimuth",ct],["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=ct(t.lat1>0?90:-90),t.lat_ts=t.lat1):!t.lat_ts&&t.lat0&&t.projName==="Polar_Stereographic"&&(t.lat_ts=t.lat0,t.lat0=ct(t.lat0>0?90:-90))}function Me(t){var e=Fs(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]=ie(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}}Is(tt);var zt=tt;function jr(t){return typeof t=="string"}function Dr(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(jr(t)){if(Dr(t))return zt[t];if(Vr(t)){var e=Me(t);if(Wr(e))return zt["EPSG:3857"];var s=Xr(e);return s?ie(s):e}if(Jr(t))return ie(t)}else return t}var Us=Zr;function es(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)*se}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(P+.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"],zs={init:Qr,forward:$r,inverse:Kr,names:Yr};function ta(){}function qs(t){return t}var ea=["longlat","identity"],Gs={init:ta,forward:qs,inverse:qs,names:ea};var sa=[zs,Gs],ge={},xe=[];function js(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(js)}var Ds={start:ra,add:js,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 ks=w.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};w.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Vs(t,e,s,i){var r=t*t,a=e*e,n=(r-a)/r,o=0;i?(t*=1-n*(Ps+n*(Ss+n*As)),r=t*t,n=0):o=Math.sqrt(n);var h=(r-a)/a;return{es:n,e:o,ep2:h}}function Hs(t,e,s,i,r){if(!t){var a=$(w,i);a||(a=ks),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=ee:n.datum_type=Es,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 Ws=aa;function qt(t,e){if(!(this instanceof qt))return new qt(t);e=e||function(h){if(h)throw h};var s=Us(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=Hs(s.a,s.b,s.rf,s.ellps,s.sphere),n=Vs(a.a,a.b,a.rf,s.R_A),o=s.datum||Ws(s.datumCode,s.datum_params,a.a,a.b,n.es,n.ep2);es(this,s),es(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=Ds;qt.projections.start();var wt=qt;function Xs(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,c,l,u,m,d,p,_,M,x,g,S=t.x,I=t.y,E=t.z?t.z:0,B,N,Y;if(o=Math.sqrt(S*S+I*I),h=Math.sqrt(S*S+I*I+E*E),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=E/h,c=o/h,l=1/Math.sqrt(1-e*(2-e)*c*c),d=c*(1-e)*l,p=f*l,g=0;do g++,m=s/Math.sqrt(1-e*p*p),Y=o*d+E*p-m*(1-e*p*p),u=e*m/(m+Y),l=1/Math.sqrt(1-u*(2-u)*c*c),_=c*(1-u)*l,M=f*l,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 Js(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 Zs(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],c=(t.x-i)/f,l=(t.y-r)/f,u=(t.z-a)/f;return{x:c+h*l-o*u,y:-h*c+l+n*u,z:o*c-n*l+u}}}function Ee(t){return t===it||t===rt}function Qs(t,e,s){return Xs(t,e)||t.datum_type===ee||e.datum_type===ee||t.es===e.es&&t.a===e.a&&!Ee(t.datum_type)&&!Ee(e.datum_type)?s:(s=we(s,t.es,t.a),Ee(t.datum_type)&&(s=Js(s,t.datum_type,t.datum_params)),Ee(e.datum_type)&&(s=Zs(s,e.datum_type,e.datum_params)),Ie(s,e.es,e.a,e.b))}function ss(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 Pe(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 Ks(t){$s(t.x),$s(t.y)}function $s(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=Pe(s)),Ks(s),t.datum&&e.datum&&na(t,e)&&(i=new wt("WGS84"),s=Ot(t,i,s),t=i),t.axis!=="enu"&&(s=ss(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=Qs(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"?ss(e,!0,s):s}var Ys=wt("WGS84");function is(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 ti(t){return t instanceof wt?t:t.oProj?t.oProj:wt(t)}function oa(t,e,s){t=ti(t);var i=!1,r;return typeof e>"u"?(e=t,t=Ys,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(s=e,e=t,t=Ys,i=!0),e=ti(e),s?is(t,e,s):(r={forward:function(a){return is(t,e,a)},inverse:function(a){return is(e,t,a)}},i&&(r.oProj=e),r)}var K=oa;var ei=6,ii="AJSAJS",ri="AFAFAF",Gt=65,Z=73,et=79,ae=86,ne=90,ai={forward:as,inverse:ha,toPoint:ns};function as(t,e){return e=e||5,ca(fa({lat:t[1],lon:t[0]}),e)}function ha(t){var e=os(oi(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function ns(t){var e=os(oi(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function rs(t){return t*(Math.PI/180)}function si(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,c,l,u,m=rs(e),d=rs(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=rs(n),o=r/(1-r),h=i/Math.sqrt(1-r*Math.sin(m)*Math.sin(m)),f=Math.tan(m)*Math.tan(m),c=o*Math.cos(m)*Math.cos(m),l=Math.cos(m)*(d-p),u=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*(l+(1-f+c)*l*l*l/6+(5-18*f+f*f+72*c-58*o)*l*l*l*l*l/120)+5e5,x=a*(u+h*Math.tan(m)*(l*l/2+(5-f+9*c+4*c*c)*l*l*l*l/24+(61-58*f+f*f+600*c-330*o)*l*l*l*l*l*l/720));return e<0&&(x+=1e7),{northing:Math.round(x),easting:Math.round(M),zoneNumber:_,zoneLetter:la(e)}}function os(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)),c,l,u,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),c=n/Math.sqrt(1-o*Math.sin(x)*Math.sin(x)),l=Math.tan(x)*Math.tan(x),u=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/(c*a);var I=x-c*Math.tan(x)/m*(d*d/2-(5+3*l+10*u-4*u*u-9*h)*d*d*d*d/24+(61+90*l+298*u+45*l*l-252*h-3*u*u)*d*d*d*d*d*d/720);I=si(I);var E=(d-(1+2*l+u)*d*d*d/6+(5-2*u+28*l-3*u*u+8*h+24*l*l)*d*d*d*d*d/120)/Math.cos(x);E=_+si(E);var B;if(t.accuracy){var N=os({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:E}}else B={lat:I,lon:E};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 ca(t,e){var s="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+ua(t.easting,t.northing,t.zoneNumber)+s.substr(s.length-5,e)+i.substr(i.length-5,e)}function ua(t,e,s){var i=ni(s),r=Math.floor(t/1e5),a=Math.floor(e/1e5)%20;return da(r,a,i)}function ni(t){var e=t%ei;return e===0&&(e=ei),e}function da(t,e,s){var i=s-1,r=ii.charCodeAt(i),a=ri.charCodeAt(i),n=r+t-1,o=a+e,h=!1;n>ne&&(n=n-ne+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>ne&&(n=n-ne+Gt-1),o>ae?(o=o-ae+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>ae&&(o=o-ae+Gt-1);var f=String.fromCharCode(n)+String.fromCharCode(o);return f}function oi(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=ni(n),f=ma(s.charAt(0),h),c=pa(s.charAt(1),h);c<ba(o);)c+=2e6;var l=e-a;if(l%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 u=l/2,m=0,d=0,p,_,M,x,g;return u>0&&(p=1e5/Math.pow(10,u),_=t.substring(a,a+u),m=parseFloat(_)*p,M=t.substring(a+u),d=parseFloat(M)*p),x=m+f,g=d+c,{easting:x,northing:g,zoneLetter:o,zoneNumber:n,accuracy:p}}function ma(t,e){for(var s=ii.charCodeAt(e-1),i=1e5,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>ne){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=ri.charCodeAt(e-1),i=0,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 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 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(ns(t))};jt.prototype.toMGRS=function(t){return as([this.x,this.y],t)};var hi=jt;var _a=1,va=.25,fi=.046875,li=.01953125,ci=.01068115234375,ya=.75,Ma=.46875,ga=.013020833333333334,xa=.007120768229166667,wa=.3645833333333333,Ia=.005696614583333333,Ea=.3076171875;function Se(t){var e=[];e[0]=_a-t*(va+t*(fi+t*(li+t*ci))),e[1]=t*(ya-t*(fi+t*(li+t*ci)));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*Ea,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 Pa=20;function Ae(t,e,s){for(var i=1/(1-e),r=t,a=Pa;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 c=h*i,l=Math.pow(c,2),u=this.ep2*Math.pow(h,2),m=Math.pow(u,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),c=c/Math.sqrt(r);var M=Ft(s,o,h,this.en);a=this.a*(this.k0*c*(1+l/6*(1-p+u+l/20*(5-18*p+_+14*u-58*p*u+l/42*(61+179*_-_*p-479*p)))))+this.x0,n=this.a*(this.k0*(M-this.ml0+o*i*c/2*(1+l/12*(5-p+9*u+4*m+l/30*(61+_-58*p+270*u-330*p*u+l/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 l=Math.sin(s),u=Math.cos(s),m=Math.abs(u)>v?Math.tan(s):0,d=this.ep2*Math.pow(u,2),p=Math.pow(d,2),_=Math.pow(m,2),M=Math.pow(_,2);e=1-this.es*Math.pow(l,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*_))))/u)}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,c=Math.cos(f);e=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(h,2))),i=Math.asin(e),n<0&&(i=-i),h===0&&c===0?r=0:r=y(Math.atan2(h,c)+this.long0)}return t.x=r,t.y=i,t}var Oa=["Transverse_Mercator","Transverse Mercator","tmerc"],ui={init:Sa,forward:Aa,inverse:Na,names:Oa};function Ne(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function oe(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 di(t){var e=1+t,s=e-1;return s===0?t:t*Math.log(e)/s}function mi(t){var e=Math.abs(t);return e=di(e*(1+e/(oe(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 pi(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 bi(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function hs(t,e,s){for(var i=Math.sin(e),r=Math.cos(e),a=Ne(s),n=bi(s),o=2*r*n,h=-2*i*a,f=t.length-1,c=t[f],l=0,u=0,m=0,d,p;--f>=0;)d=u,p=l,u=c,l=m,c=-d+o*u-h*l+t[f],m=-p+h*u+o*l;return o=i*n,h=r*a,[o*c-h*m,o*m+h*c]}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+pi(this.gtu,2*i))}function Ra(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,oe(i,r*n)),e=mi(Math.tan(e));var o=hs(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 La(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=hs(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,oe(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"],Dt={init:Fa,forward:Ra,inverse:La,names:Ca};function _i(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=_i(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,Dt.init.apply(this),this.forward=Dt.forward,this.inverse=Dt.inverse}var Ua=["Universal Transverse Mercator System","utm"],vi={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+P)/(Math.pow(Math.tan(.5*this.lat0+P),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+P),this.C)*Fe(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+P)/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 Da=["gauss"],Re={init:qa,forward:Ga,inverse:ja,names:Da};function ka(){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 Va(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 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,Re.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"],yi={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,c,l=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(l)),t.x=this.a*a*r*Math.sin(l)+this.x0,t.y=this.a*a*(this.coslat0*i-this.sinlat0*r*Math.cos(l))+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),c=2*this.a*this.k0*f/this.cons,t.x=this.x0+c*Math.sin(e-this.long0),t.y=this.y0-this.con*c*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<v?(a=2*this.a*this.k0/(1+h*Math.cos(l)),t.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(l))),t.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(l))+this.y0),t.x=a*h*Math.sin(l)+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)"],Mi={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,c=-1e3,l=0;Math.abs(f-c)>1e-7;){if(++l>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)),c=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=o,t.y=f,t}var en=["somerc"],gi={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),c=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var l=(this.el*this.el-c*f)/(this.el*this.el+c*f),u=(c-f)/(c+f),m=y(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(l*Math.tan(.5*this.bl*m)/u)/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(P+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),c=.5*(h+1/h),l=Math.sin(this.bl*i),u=(f*Math.sin(this.gamma0)-l*Math.cos(this.gamma0))/c;Math.abs(Math.abs(u)-1)<=v?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-u)/(1+u))/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)+l*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"],xi={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"],wi={init:on,forward:hn,inverse:fn,names:ln};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 un(t){var e,s,i,r,a,n,o,h=t.x,f=t.y,c=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=-c*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 c=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,c+=1;while(h===0&&c<15);return c>=15?null:t}var mn=["Krovak","krovak"],Ii={init:cn,forward:un,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 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 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),c=f*f,l=this.es*n*n/(1-this.es),u=this.a*q(this.e0,this.e1,this.e2,this.e3,r);e=o*f*(1-c*h*(1/6-(8-h+8*l)*c/120)),s=u-this.ml0+o*a/n*c*(.5+(5-h+6*l)*c/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=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),c=Math.pow(Math.tan(o),2),l=e*this.a/h,u=l*l;i=o-h*Math.tan(o)/f*l*l*(.5-(1+3*c)*l*l/24),r=l*(1-u*(c/3+(1+3*c)*c*u/15))/Math.cos(o)}return t.x=y(r+this.long0),t.y=nt(i),t}var vn=["Cassini","Cassini_Soldner","cass"],Ei={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=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 In(t){var e,s,i,r,a,n,o,h,f,c,l=t.x,u=t.y;if(l=y(l-this.long0),this.sphere){if(a=Math.sin(u),c=Math.cos(u),i=Math.cos(l),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+c*i:1+this.sinph0*a+this.cosph0*c*i,s<=v)return null;s=Math.sqrt(2/s),e=s*c*Math.sin(l),s*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(u+this.lat0)<v)return null;s=P-u*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),e=s*Math.sin(l),s*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(l),r=Math.sin(l),a=Math.sin(u),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+u,n=this.qp-n;break;case this.S_POLE:f=u-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 c=0,l,u=0;if(l=Math.sqrt(e*e+s*s),r=l*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(u=Math.sin(r),c=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(l)<=v?0:Math.asin(s*u/l),e*=u,s=c*l;break;case this.OBLIQ:r=Math.abs(l)<=v?this.lat0:Math.asin(c*this.sinph0+s*u*this.cosph0/l),e*=u*this.cosph0,s=(c-Math.sin(r)*this.sinph0)*l;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=Ln(Math.asin(f),this.apa)}return t.x=y(this.long0+i),t.y=r,t}var Pn=.3333333333333333,Sn=.17222222222222222,An=.10257936507936508,Nn=.06388888888888888,On=.0664021164021164,Fn=.016415012942191543;function Rn(t){var e,s=[];return s[0]=t*Pn,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 Ln(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"],Pi={init:wn,forward:In,inverse:En,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"],Si={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 jn(t){var e,s,i,r,a,n,o,h,f=t.x,c=t.y;return i=y(f-this.long0),e=Math.sin(c),s=Math.cos(c),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 Dn(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"],Ai={init:Gn,forward:jn,inverse:Dn,names:kn};function Ni(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=Ni(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"],Oi={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"],Fi={init:Jn,forward:Zn,inverse:Qn,names:$n};var Ri=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 c;for(a=Ri;a;--a)if(c=Math.tan(h),f=-1*(n*(h*c+1)-h-.5*(h*h+o)*c)/((h-n)/c-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 l,u,m,d,p;for(a=Ri;a;--a)if(p=this.e*Math.sin(h),l=Math.sqrt(1-p*p)*Math.tan(h),u=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=u/this.a,f=(n*(l*d+1)-d-.5*l*(d*d+o))/(this.es*Math.sin(2*h)*(d*d+o-2*n*d)/(4*l)+(n-d)*(l*m-2/Math.sin(2*h))-m),h-=f,Math.abs(f)<=v){s=h;break}l=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),e=y(this.long0+Math.asin(i*l/this.a)/Math.sin(s))}return t.x=e,t.y=s,t}var eo=["Polyconic","poly"],Li={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 c=f,l=o,u=1,m=0,d,p,_=0,M=0;for(e=1;e<=6;e++)d=u*c-m*l,p=m*c+u*l,u=d,m=p,_=_+this.B_re[e]*u-this.B_im[e]*m,M=M+this.B_im[e]*u+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,c,l,u=0,m=0;for(e=1;e<=6;e++)c=h*n-f*o,l=f*n+h*o,h=c,f=l,u=u+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=u,_=m,M,x,g=n,S=o;for(e=2;e<=6;e++)M=p*u-_*m,x=_*u+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],E=this.B_im[1];for(e=2;e<=6;e++)M=p*u-_*m,x=_*u+p*m,p=M,_=x,I=I+e*(this.B_re[e]*p-this.B_im[e]*_),E=E+e*(this.B_im[e]*p+this.B_re[e]*_);var B=I*I+E*E;u=(g*I+S*E)/B,m=(S*I-g*E)/B}var N=u,Y=m,G=1,st=0;for(e=1;e<=9;e++)G=G*N,st=st+this.D[e]*G;var pt=this.lat0+st*At*1e5,Yt=this.long0+Y;return t.x=Yt,t.y=pt,t}var ao=["New_Zealand_Map_Grid","nzmg"],Ci={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"],Ti={init:no,forward:oo,inverse:ho,names:fo};var lo=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=Se(this.es)}function uo(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"],Bi={init:co,forward:uo,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"],Ui={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=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 wo=["Equidistant_Conic","eqdc"],zi={init:Mo,forward:go,inverse:xo,names:wo};function Io(){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),c=Math.cos(n),l=c/(f+c-1),u=l*l,m=l*(2/f-1),d=m*m,p=Math.PI*this.R*(o*(l-d)+Math.sqrt(h*(l-d)*(l-d)-(d+h)*(u-d)))/(d+h);i<0&&(p=-p),r=this.x0+p;var _=h+l;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 Po(t){var e,s,i,r,a,n,o,h,f,c,l,u,m;return t.x-=this.x0,t.y-=this.y0,l=Math.PI*this.R,i=t.x/l,r=t.y/l,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,c=2*Math.sqrt(-f/3),l=3*m/f/c,Math.abs(l)>1&&(l>=0?l=1:l=-1),u=Math.acos(l)/3,t.y>=0?s=(-c*Math.cos(u+Math.PI/3)-o/3/h)*Math.PI:s=-(-c*Math.cos(u+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"],qi={init:Io,forward:Eo,inverse:Po,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,c,l,u,m,d,p,_,M,x,g,S,I,E,B,N,Y,G,st,pt;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),E=I?I/Math.sin(I):1,t.x=this.x0+this.a*E*r*Math.sin(a),t.y=this.y0+this.a*E*(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?(c=this.a*q(n,o,h,f,b),l=this.a*q(n,o,h,f,s),t.x=this.x0+(c-l)*Math.sin(a),t.y=this.y0-(c-l)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(c=this.a*q(n,o,h,f,b),l=this.a*q(n,o,h,f,s),t.x=this.x0+(c+l)*Math.sin(a),t.y=this.y0+(c+l)*Math.cos(a),t):(u=i/r,m=xt(this.a,this.e,this.sin_p12),d=xt(this.a,this.e,i),p=Math.atan((1-this.es)*u+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,pt=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))-pt/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,c,l,u,m,d,p,_,M,x,g,S,I,E,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),c=Mt(this.es),l=gt(this.es),Math.abs(this.sin_p12-1)<=v?(u=this.a*q(h,f,c,l,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=u-e,n=Rt(m/this.a,h,f,c,l),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?(u=this.a*q(h,f,c,l,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=e-u,n=Rt(m/this.a,h,f,c,l),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,E=I-g*(1+g)*Math.pow(I,3)/6-S*(1+3*g)*Math.pow(I,4)/24,B=1-g*E*E/2-I*E*E*E/6,p=Math.asin(this.sin_p12*Math.cos(E)+this.cos_p12*Math.sin(E)*M),a=y(this.long0+Math.asin(Math.sin(_)*Math.sin(E)/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"],Gi={init:Ao,forward:No,inverse:Oo,names:Fo};function Ro(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Lo(t){var e,s,i,r,a,n,o,h,f=t.x,c=t.y;return i=y(f-this.long0),e=Math.sin(c),s=Math.cos(c),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"],ji={init:Ro,forward:Lo,inverse:Co,names:To};var R={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-P/2?this.face=R.TOP:this.lat0<=-(b-P/2)?this.face=R.BOTTOM:Math.abs(this.long0)<=P?this.face=R.FRONT:Math.abs(this.long0)<=b+P?this.face=this.long0>0?R.RIGHT:R.LEFT:this.face=R.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===R.TOP)a=b-s,i>=P&&i<=b+P?(h.value=A.AREA_0,r=i-b):i>b+P||i<=-(b+P)?(h.value=A.AREA_1,r=i>0?i-F:i+F):i>-(b+P)&&i<=-P?(h.value=A.AREA_2,r=i+b):(h.value=A.AREA_3,r=i);else if(this.face===R.BOTTOM)a=b+s,i>=P&&i<=b+P?(h.value=A.AREA_0,r=-i+b):i<P&&i>=-P?(h.value=A.AREA_1,r=-i):i<-P&&i>=-(b+P)?(h.value=A.AREA_2,r=-i-b):(h.value=A.AREA_3,r=i>0?-i+F:-i-F);else{var f,c,l,u,m,d,p;this.face===R.RIGHT?i=kt(i,+b):this.face===R.BACK?i=kt(i,+F):this.face===R.LEFT&&(i=kt(i,-b)),u=Math.sin(s),m=Math.cos(s),d=Math.sin(i),p=Math.cos(i),f=m*p,c=m*d,l=u,this.face===R.FRONT?(a=Math.acos(f),r=Le(a,l,c,h)):this.face===R.RIGHT?(a=Math.acos(c),r=Le(a,l,-f,h)):this.face===R.BACK?(a=Math.acos(-f),r=Le(a,l,-c,h)):this.face===R.LEFT?(a=Math.acos(-c),r=Le(a,l,f,h)):(a=r=0,h.value=A.AREA_0)}return o=Math.atan(12/F*(r+Math.acos(Math.sin(r)*Math.cos(P))-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 zo(t){var e={lam:0,phi:0},s,i,r,a,n,o,h,f,c,l={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)?l.value=A.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(l.value=A.AREA_1,s-=b):t.x<0&&-t.x>=Math.abs(t.y)?(l.value=A.AREA_2,s=s<0?s+F:s-F):(l.value=A.AREA_3,s+=b),c=F/12*Math.tan(s),n=Math.sin(c)/(Math.cos(c)-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===R.TOP)f=Math.acos(h),e.phi=b-f,l.value===A.AREA_0?e.lam=o+b:l.value===A.AREA_1?e.lam=o<0?o+F:o-F:l.value===A.AREA_2?e.lam=o-b:e.lam=o;else if(this.face===R.BOTTOM)f=Math.acos(h),e.phi=f-b,l.value===A.AREA_0?e.lam=-o+b:l.value===A.AREA_1?e.lam=-o:l.value===A.AREA_2?e.lam=-o-b:e.lam=o<0?-o-F:-o+F;else{var u,m,d;u=h,c=u*u,c>=1?d=0:d=Math.sqrt(1-c)*Math.sin(o),c+=d*d,c>=1?m=0:m=Math.sqrt(1-c),l.value===A.AREA_1?(c=m,m=-d,d=c):l.value===A.AREA_2?(m=-m,d=-d):l.value===A.AREA_3&&(c=m,m=d,d=-c),this.face===R.RIGHT?(c=u,u=-m,m=c):this.face===R.BACK?(u=-u,m=-m):this.face===R.LEFT&&(c=u,u=m,m=-c),e.phi=Math.acos(-d)-b,e.lam=Math.atan2(m,u),this.face===R.RIGHT?e.lam=kt(e.lam,-b):this.face===R.BACK?e.lam=kt(e.lam,-F):this.face===R.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 Le(t,e,s,i){var r;return t<v?(i.value=A.AREA_0,r=0):(r=Math.atan2(e,s),Math.abs(r)<=P?i.value=A.AREA_0:r>P&&r<=b+P?(i.value=A.AREA_1,r-=b):r>b+P||r<=-(b+P)?(i.value=A.AREA_2,r=r>=0?r-F:r+F):(i.value=A.AREA_3,r+=b)),r}function kt(t,e){var s=t+e;return s<-F?s+=se:s>+F&&(s-=se),s}var qo=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Di={init:Bo,forward:Uo,inverse:zo,names:qo};var fs=[[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]],he=[[-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]],ki=.8487,Vi=1.3523,Hi=at/5,Go=1/Hi,Vt=18,Ce=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 Do(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*Hi);i<0?i=0:i>=Vt&&(i=Vt-1),s=at*(s-Go*i);var r={x:Ce(fs[i],s)*e,y:Ce(he[i],s)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*ki+this.x0,r.y=r.y*this.a*Vi+this.y0,r}function Ho(t){var e={x:(t.x-this.x0)/(this.a*ki),y:Math.abs(t.y-this.y0)/(this.a*Vi)};if(e.y>=1)e.x/=fs[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(he[s][0]>e.y)--s;else if(he[s+1][0]<=e.y)++s;else break;var i=he[s],r=5*(e.y-i[0])/(he[s+1][0]-i[0]);r=Do(function(a){return(Ce(i,a)-e.y)/jo(i,a)},r,v,100),e.x/=Ce(fs[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"],Wi={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"],Xi={init:Xo,forward:Jo,inverse:Zo,names:Qo};function Ji(t){t.Proj.projections.add(ui),t.Proj.projections.add(Dt),t.Proj.projections.add(vi),t.Proj.projections.add(yi),t.Proj.projections.add(Mi),t.Proj.projections.add(gi),t.Proj.projections.add(xi),t.Proj.projections.add(wi),t.Proj.projections.add(Ii),t.Proj.projections.add(Ei),t.Proj.projections.add(Pi),t.Proj.projections.add(Si),t.Proj.projections.add(Ai),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(Bi),t.Proj.projections.add(Ui),t.Proj.projections.add(zi),t.Proj.projections.add(qi),t.Proj.projections.add(Gi),t.Proj.projections.add(ji),t.Proj.projections.add(Di),t.Proj.projections.add(Wi),t.Proj.projections.add(Xi)}K.defaultDatum="WGS84";K.Proj=wt;K.WGS84=new K.Proj("WGS84");K.Point=hi;K.toPoint=Pe;K.defs=zt;K.transform=Ot;K.mgrs=ai;K.version="__VERSION__";Ji(K);var ls=K;var Ht=class{static defineProjectionAliases(e){let s=[];for(let i in e)s.push([i,e[i]]);ls.defs(s)}constructor({from:e="WGS84",to:s="WGS84"}){if(this._projection=ls(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=Zi(s.geometry.coordinates,e);return t}function Zi(t,e){return $o(t)?e(t):t.map(s=>Zi(s,e))}function $o(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function cs(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 Qi(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:us(e,s)}}function Yo(t){let e=t.xyArray(),s=t.zArray(),i=us(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 Qi(t){let e=t.xyArray(),s=t.zArray(),i=us(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 u=0;u<t.partsLength();u++){let m=t.parts(u),d=Qi(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,c=1,l=e[0].positions.size;for(let u of e)a.set(u.positions.value,h*l),n.set(u.primitivePolygonIndices.value.subarray(1).map(m=>m+h),f),o.set(u.polygonIndices.value.subarray(1).map(m=>m+h),c),h+=u.positions.value.length/l,f+=u.primitivePolygonIndices.value.length-1,c+=u.polygonIndices.value.length-1;return{positions:{value:a,size:l},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function us(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 $i(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 D;(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"})(D||(D={}));function sh(t){switch(t){case D.Byte:return"int8";case D.UByte:return"uint8";case D.Bool:return"bool";case D.Short:return"int16";case D.UShort:return"uint16";case D.Int:return"int32";case D.UInt:return"uint32";case D.Long:return"int64";case D.ULong:return"uint64";case D.Float:return"float32";case D.Double:return"float64";case D.String:return"utf8";case D.Json:return"null";case D.DateTime:return"date-millisecond";case D.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 dt=new Int32Array(2),Be=new Float32Array(dt.buffer),Ue=new Float64Array(dt.buffer),Wt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var fe;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(fe||(fe={}));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 dt[0]=this.readInt32(e),Be[0]}readFloat64(e){return dt[Wt?0:1]=this.readInt32(e),dt[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,dt[0])}writeFloat64(e,s){Ue[0]=s,this.writeInt32(e,dt[Wt?0:1]),this.writeInt32(e+4,dt[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===fe.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 j=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 j).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsGeometry(e,s){return e.setPosition(e.position()+4),(s||new j).__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 j).__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 j.startGeometry(e),j.addEnds(e,s),j.addXy(e,i),j.addZ(e,r),j.addM(e,a),j.addT(e,n),j.addTm(e,o),j.addType(e,h),j.addParts(e,f),j.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 Yi(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 C.Point:{let r=Array.from(s);return i&&r.push(i[0]),r}case C.MultiPoint:case C.LineString:return ze(s,i);case C.MultiLineString:return Yi(s,i,t.endsArray());case C.Polygon:return Yi(s,i,t.endsArray())}}function qe(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(qe(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(qe(t.parts(a),C.Polygon));return{type:C[s],coordinates:r.map(a=>a.coordinates)}}let i=rh(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 L=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 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):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,c,l,u){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,c),L.addPrimaryKey(e,l),L.addMetadata(e,u),L.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 j).__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 kd=new TextEncoder,tr=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 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 c=r.getUint32(n,!0);n+=4,s[f]=tr.decode(i.subarray(n,n+c)),n+=c;break}case T.Json:{let c=r.getUint32(n,!0);n+=4;let l=tr.decode(i.subarray(n,n+c));s[f]=JSON.parse(l),n+=c;break}default:throw new Error(`Unknown type ${h.type}`)}}return s}function je(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 er(){return this._source.cancel()}function ds(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 sr(){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:ds(e,s.value)}})}function ir(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 ms(t){return typeof t.slice=="function"?t:new De(typeof t.read=="function"?t:t.getReader())}function De(t){this._source=t,this._array=Xt,this._index=0}De.prototype.read=sr;De.prototype.slice=ir;De.prototype.cancel=er;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 Tt=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 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):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 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,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 le(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 bs=function(t,e){return bs=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])},bs(t,e)};function ah(t,e){bs(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(c){try{f(i.next(c))}catch(l){n(l)}}function h(c){try{f(i.throw(c))}catch(l){n(l)}}function f(c){c.done?a(c.value):r(c.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(c){return h([f,c])}}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(c){f=[6,c],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(u){i[u]&&(r[u]=function(m){return new Promise(function(d,p){a.push([u,m,d,p])>1||o(u,m)})})}function o(u,m){try{h(i[u](m))}catch(d){l(a[0][3],d)}}function h(u){u.value instanceof ue?Promise.resolve(u.value.v).then(f,c):l(a[0][2],u)}function f(u){o("next",u)}function c(u){o("throw",u)}function l(u,m){u(m),a.shift(),a.length&&o(a[0][0],a[0][1])}}var nr=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),mm=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}(),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){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}(),bm=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 _s(t){t!=null&&typeof t.then=="function"&&t.then(We,We)}var ps=0,rr=1,Ut=2,Ve=3,vs=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>=vs?Jt(t).then(function(r){return{value:r,done:!0}}):{value:i,done:s}})}function ys(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))ce(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 ce(t){var e,s;if(!(t.state>=Ve)){t.state<Ut&&ys(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 ar(t){t.state>=vs||(t.state<Ve&&ce(t),t.state=vs)}function oh(t,e){if(_s(e),t.pushes.length>=He)throw new nr("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),ar(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,ar(t)}),n}function hh(t){var e=ys.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>=rr)){t.state=rr;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 ys(t)})}}var ke=new WeakMap,$t=function(){function t(e,s){ke.set(this,{executor:e,buffer:s,err:void 0,state:ps,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:We,onstop:We})}return t.prototype.next=function(e){_s(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");if(s.nexts.length>=He)throw new nr("No more than "+He+" pending calls to next are allowed on a single repeater.");if(s.state<=ps&&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 ce(s),Bt(s,Jt(s));return new Promise(function(n){return s.nexts.push({resolve:n,value:e})})},t.prototype.return=function(e){_s(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");return ce(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<=ps||s.state>=Ut||typeof s.buffer<"u"&&!s.buffer.empty?(ce(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=ch,t.zip=uh,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(u){switch(u.label){case 0:return e.yieldValues?[4,ue(f)]:[3,3];case 1:return[4,u.sent()];case 2:u.sent(),u.label=3;case 3:return e.returnValues?[4,ue(f)]:[3,5];case 4:return[2,u.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,c;return Et(this,function(l){switch(l.label){case 0:if(!s.length)return r(),[2];n=!1,r.then(function(){a(),n=!0}),l.label=1;case 1:l.trys.push([1,,5,7]),h=void 0,f=0,c=function(){var u,m,d,p,_,M;return Et(this,function(x){switch(x.label){case 0:u=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===u&&(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]}})},l.label=2;case 2:return n?[3,4]:[5,c()];case 3:return l.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return r(),[4,Promise.race(s.map(function(u){return u.return&&u.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function ch(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 c,l;n=!0;try{for(var u=Qt(a),m=u.next();!m.done;m=u.next()){var d=m.value;d()}}catch(p){c={error:p}}finally{try{m&&!m.done&&(l=u.return)&&l.call(u)}finally{if(c)throw c.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(s.map(function(c,l){return Zt(h,void 0,void 0,function(){var u,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(c.next()).then(function(p){return a[l](p)},function(p){return r(p)}),[4,new Promise(function(p){a[l]=p})]);case 2:return u=d.sent(),u===void 0?[3,4]:u.done?(o=u,[2]):[4,i(u.value)];case 3:d.sent(),d.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return m=c.return,m?[4,c.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 uh(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(c){return c.next()})).then(function(c){return a(c)},function(c){return r(c)}),[4,new Promise(function(c){return a=c})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(c){return c.value}),o.some(function(c){return c.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(c){return c.return&&c.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,c=this;return Et(this,function(l){switch(l.label){case 0:if(!s.length)return r(),[2,[]];n=[],o=!1,r.then(function(){var u,m;a();try{for(var d=Qt(n),p=d.next();!p.done;p=d.next()){var _=p.value;_()}}catch(M){u={error:M}}finally{try{p&&!p.done&&(m=d.return)&&m.call(d)}finally{if(u)throw u.error}}o=!0}),l.label=1;case 1:return l.trys.push([1,,5,7]),Promise.all(s.map(function(u){return u.next()})).then(function(u){return a(u)},function(u){return r(u)}),[4,new Promise(function(u){return a=u})];case 2:return h=l.sent(),h===void 0?[2]:(f=h.map(function(u){return u.value}),h.every(function(u){return u.done})?[2,f]:[4,i(f.slice())]);case 3:return l.sent(),[4,Promise.all(s.map(function(u,m){return Zt(c,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(u.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,l.sent()];case 5:return r(),[4,Promise.all(s.map(function(u){return u.return&&u.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}var Ms=class{_extraRequestThreshold=256*1024;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(e){if(e<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=e}},Pt=Ms;_e(Pt,"global",new Ms);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}}}};_e(O,"logLevel",ft.Warn);var St=8*4+8;var or=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*hr(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=mh(t,e),c=f[0][0],u=[(()=>{let m=[0,1],d=f.length-1;return new r(m,d)})()];for(O.debug(`starting stream search with queue: ${u}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${f}`);u.length!=0;){let m=u.shift();O.debug(`popped node: ${m}, queueLength: ${u.length}`);let d=m.startNodeIdx(),p=d>=c,_=(()=>{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,E=I*St;if(o<g.getFloat64(E+0,!0)||h<g.getFloat64(E+8,!0)||a>g.getFloat64(E+16,!0)||n>g.getFloat64(E+24,!0))continue;let B=g.getBigUint64(E+32,!0);if(p){let pt=B,Yt=(()=>{if(S<t-1){let wr=(I+1)*St;return g.getBigUint64(wr+32,!0)-pt}return null})(),xr=S-c;yield[Number(pt),xr,Number(Yt)];continue}let N=B,Y=Pt.global.extraRequestThreshold()/St,G=u[u.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 pt=m.level()-1,Yt=[Number(N),Number(N)+1];return new r(Yt,pt)})();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.`),u.push(st)}}}var mt=new Uint8Array([102,103,98,3,102,103,98,0]),lt=4;var Kt=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 Je(e),r=(()=>{let l=or,u=3,m=0,d;for(d=0;d<u;d++){let p=l**d*St;m+=p}return m})(),a=2024+r;O.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${r})`);{let l=new Uint8Array(await i.getRange(0,8,a,"header"));if(!l.subarray(0,3).every((u,m)=>mt[m]===u))throw O.error(`bytes: ${l} != ${mt}`),new Error("Not a FlatGeobuf file");O.debug("magic bytes look good")}let n;{let l=await i.getRange(8,4,a,"header");n=new DataView(l).getUint32(0,!0);let u=1048576*10;if(n>u||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=le(h),c=de(f.featuresCount,f.indexNodeSize);return O.debug("completed: opening http reader"),new Kt(i,f,n,c)}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 hr(this.header.featuresCount,this.header.indexNodeSize,e,r)){let[f,,]=h,[,,c]=h;if(c||(O.info("final feature"),c=4),n.length==0){n.push([f,c]);continue}let l=n[n.length-1],u=f-(l[0]+l[1]);u>Pt.global.extraRequestThreshold()&&(O.info(`Pushing new feature batch, since gap ${u} was too large`),a.push(n),n=[]),n.push([f,c])}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 mt.length+lt+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new Je(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[c]of e)yield await this.readFeature(h,c,f),f=0;h.logUsage("feature")}async readFeature(e,s,i){let r=s+this.lengthBeforeFeatures(),a;{let c=await e.getRange(r,4,i,"feature length");a=new DataView(c).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)}},Je=class{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(e){if(typeof e=="string")this.httpClient=new Ze(e);else if(e instanceof Ze)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}%`)}},Ze=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 Qe(t,e,s){if(!t.subarray(0,3).every((c,l)=>mt[l]===c))throw new Error("Not a FlatGeobuf file");let i=new W(t),r=i.readUint32(mt.length);i.setPosition(mt.length+lt);let a=le(i);s&&s(a);let n=mt.length+lt+r,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=de(h,o));let f=[];for(;n<i.capacity();){let c=i.readUint32(n);i.setPosition(n+lt);let l=X.getRootAsFeature(i);f.push(e(l,a)),n+=lt+c}return f}async function*$e(t,e,s){let i=ms(t),r=async u=>await i.slice(u),a=new Uint8Array(await r(8,"magic bytes"));if(!a.subarray(0,3).every((u,m)=>mt[m]===u))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=le(n);s&&s(h);let{indexNodeSize:f,featuresCount:c}=h;if(f>0){let u=de(c,f);await r(u,"entire index, w/o rect")}let l;for(;l=await ph(r,h,e);)yield l}async function*Ke(t,e,s,i){let r=await Kt.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 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 fr(t,e){return{type:"FeatureCollection",features:Qe(t,je,e)}}function lr(t,e){return $e(t,je,e)}function cr(t,e,s){return Ke(t,e,je,s)}function ur(t,e,s){return t instanceof Uint8Array?fr(t,s):t instanceof ReadableStream?lr(t,s):cr(t,e,s)}function dr(t,e,s){return t instanceof Uint8Array?Qe(t,e):t instanceof ReadableStream?$e(t,e):Ke(t,s,e)}var pr=ur,br=dr;function _r(t,e){let s=e.shape;switch(s){case"geojson-table":return vh(t,e);case"columnar-table":return{shape:"columnar-table",data:mr(t,e)};case"binary":return mr(t,e);default:throw new Error(s)}}function mr(t,e={}){let s=new Uint8Array(t);return br(s,cs)}function vh(t,e){if(t.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:s=!1,crs:i="WGS84"}=e,r=new Uint8Array(t),a,n,o=e.boundingBox&&yr(e.boundingBox),{features:h}=pr(r,o,l=>{a=l,n=$i(a)}),f=a?.crs?.wkt,c;if(s&&f)try{c=new Ht({from:f,to:i})}catch{}return c&&(h=Te(h,l=>c.project(l))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:h}}function vr(t,e){let s=e.shape;switch(s){case"binary":return yh(t,e);case"geojson-table":return Mh(t,e);default:throw new Error(s)}}function yh(t,e){let s=e.boundingBox&&yr(e.boundingBox);return br(t,gh,s)}async function*Mh(t,e){let{reproject:s=!1,crs:i="WGS84"}=e||{},r,a=pr(t,void 0,h=>{r=h}),n,o=!0;for await(let h of a){if(o){let f=r?.crs?.wkt;s&&f&&(n=new Ht({from:f,to:i})),o=!1}s&&n?yield Te([h],f=>n.project(f)):yield h}}function yr(t){return{minX:t[0][0],minY:t[0][1],maxX:t[1][0],maxY:t[1][1]}}function gh(t,e){let s=t.geometry(),i=e.geometryType||s?.type(),r=cs(s,i);return r.properties=Ge(t,e.columns),r}var xh="4.3.0-alpha.8",wh=[102,103,98,3,102,103,98,1],gs={dataType:null,batchType:null,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}}},Ye={...gs,parse:async(t,e={})=>Mr(t,e),parseSync:Mr,parseInBatchesFromStream:Ih,binary:!0};function Mr(t,e={}){return _r(t,gr(e))}function Ih(t,e){return vr(t,gr(e))}function gr(t){return t={...t,flatgeobuf:{...Ye.options.flatgeobuf,...t?.flatgeobuf},gis:{...Ye.options.gis,...t?.gis}},{shape:t?.flatgeobuf?.shape??"geojson-table",boundingBox:t?.flatgeobuf?.boundingBox,crs:t?.gis?._targetCrs||"WGS84",reproject:t?.gis?.reproject||!1}}return Lr(me);})();
|
|
10
|
+
northing meters`+t;var u=l/2,m=0,d=0,p,_,M,x,g;return u>0&&(p=1e5/Math.pow(10,u),_=t.substring(a,a+u),m=parseFloat(_)*p,M=t.substring(a+u),d=parseFloat(M)*p),x=m+f,g=d+c,{easting:x,northing:g,zoneLetter:o,zoneNumber:n,accuracy:p}}function ma(t,e){for(var s=ii.charCodeAt(e-1),i=1e5,r=!1;s!==t.charCodeAt(0);){if(s++,s===Z&&s++,s===et&&s++,s>ne){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=ri.charCodeAt(e-1),i=0,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 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 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(ns(t))};jt.prototype.toMGRS=function(t){return as([this.x,this.y],t)};var hi=jt;var _a=1,va=.25,fi=.046875,li=.01953125,ci=.01068115234375,ya=.75,Ma=.46875,ga=.013020833333333334,xa=.007120768229166667,wa=.3645833333333333,Ia=.005696614583333333,Ea=.3076171875;function Se(t){var e=[];e[0]=_a-t*(va+t*(fi+t*(li+t*ci))),e[1]=t*(ya-t*(fi+t*(li+t*ci)));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*Ea,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 Pa=20;function Ae(t,e,s){for(var i=1/(1-e),r=t,a=Pa;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 c=h*i,l=Math.pow(c,2),u=this.ep2*Math.pow(h,2),m=Math.pow(u,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),c=c/Math.sqrt(r);var M=Ft(s,o,h,this.en);a=this.a*(this.k0*c*(1+l/6*(1-p+u+l/20*(5-18*p+_+14*u-58*p*u+l/42*(61+179*_-_*p-479*p)))))+this.x0,n=this.a*(this.k0*(M-this.ml0+o*i*c/2*(1+l/12*(5-p+9*u+4*m+l/30*(61+_-58*p+270*u-330*p*u+l/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 l=Math.sin(s),u=Math.cos(s),m=Math.abs(u)>v?Math.tan(s):0,d=this.ep2*Math.pow(u,2),p=Math.pow(d,2),_=Math.pow(m,2),M=Math.pow(_,2);e=1-this.es*Math.pow(l,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*_))))/u)}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,c=Math.cos(f);e=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(h,2))),i=Math.asin(e),n<0&&(i=-i),h===0&&c===0?r=0:r=y(Math.atan2(h,c)+this.long0)}return t.x=r,t.y=i,t}var Oa=["Transverse_Mercator","Transverse Mercator","tmerc"],ui={init:Sa,forward:Aa,inverse:Na,names:Oa};function Ne(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function oe(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 di(t){var e=1+t,s=e-1;return s===0?t:t*Math.log(e)/s}function mi(t){var e=Math.abs(t);return e=di(e*(1+e/(oe(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 pi(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 bi(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function hs(t,e,s){for(var i=Math.sin(e),r=Math.cos(e),a=Ne(s),n=bi(s),o=2*r*n,h=-2*i*a,f=t.length-1,c=t[f],l=0,u=0,m=0,d,p;--f>=0;)d=u,p=l,u=c,l=m,c=-d+o*u-h*l+t[f],m=-p+h*u+o*l;return o=i*n,h=r*a,[o*c-h*m,o*m+h*c]}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+pi(this.gtu,2*i))}function Ra(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,oe(i,r*n)),e=mi(Math.tan(e));var o=hs(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 La(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=hs(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,oe(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"],Dt={init:Fa,forward:Ra,inverse:La,names:Ca};function _i(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=_i(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,Dt.init.apply(this),this.forward=Dt.forward,this.inverse=Dt.inverse}var Ua=["Universal Transverse Mercator System","utm"],vi={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+P)/(Math.pow(Math.tan(.5*this.lat0+P),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+P),this.C)*Fe(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+P)/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 Da=["gauss"],Re={init:qa,forward:Ga,inverse:ja,names:Da};function ka(){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 Va(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 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,Re.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"],yi={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,c,l=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(l)),t.x=this.a*a*r*Math.sin(l)+this.x0,t.y=this.a*a*(this.coslat0*i-this.sinlat0*r*Math.cos(l))+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),c=2*this.a*this.k0*f/this.cons,t.x=this.x0+c*Math.sin(e-this.long0),t.y=this.y0-this.con*c*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<v?(a=2*this.a*this.k0/(1+h*Math.cos(l)),t.y=a*o):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*h*Math.cos(l))),t.y=a*(this.cosX0*o-this.sinX0*h*Math.cos(l))+this.y0),t.x=a*h*Math.sin(l)+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)"],Mi={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,c=-1e3,l=0;Math.abs(f-c)>1e-7;){if(++l>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)),c=f,f=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=o,t.y=f,t}var en=["somerc"],gi={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),c=Math.pow(h,this.bl);a=this.el/f,n=.5*(a-1/a);var l=(this.el*this.el-c*f)/(this.el*this.el+c*f),u=(c-f)/(c+f),m=y(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(l*Math.tan(.5*this.bl*m)/u)/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(P+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),c=.5*(h+1/h),l=Math.sin(this.bl*i),u=(f*Math.sin(this.gamma0)-l*Math.cos(this.gamma0))/c;Math.abs(Math.abs(u)-1)<=v?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-u)/(1+u))/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)+l*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"],xi={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"],wi={init:on,forward:hn,inverse:fn,names:ln};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 un(t){var e,s,i,r,a,n,o,h=t.x,f=t.y,c=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=-c*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 c=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,c+=1;while(h===0&&c<15);return c>=15?null:t}var mn=["Krovak","krovak"],Ii={init:cn,forward:un,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 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 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),c=f*f,l=this.es*n*n/(1-this.es),u=this.a*q(this.e0,this.e1,this.e2,this.e3,r);e=o*f*(1-c*h*(1/6-(8-h+8*l)*c/120)),s=u-this.ml0+o*a/n*c*(.5+(5-h+6*l)*c/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=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),c=Math.pow(Math.tan(o),2),l=e*this.a/h,u=l*l;i=o-h*Math.tan(o)/f*l*l*(.5-(1+3*c)*l*l/24),r=l*(1-u*(c/3+(1+3*c)*c*u/15))/Math.cos(o)}return t.x=y(r+this.long0),t.y=nt(i),t}var vn=["Cassini","Cassini_Soldner","cass"],Ei={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=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 In(t){var e,s,i,r,a,n,o,h,f,c,l=t.x,u=t.y;if(l=y(l-this.long0),this.sphere){if(a=Math.sin(u),c=Math.cos(u),i=Math.cos(l),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+c*i:1+this.sinph0*a+this.cosph0*c*i,s<=v)return null;s=Math.sqrt(2/s),e=s*c*Math.sin(l),s*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(u+this.lat0)<v)return null;s=P-u*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),e=s*Math.sin(l),s*=i}}else{switch(o=0,h=0,f=0,i=Math.cos(l),r=Math.sin(l),a=Math.sin(u),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+u,n=this.qp-n;break;case this.S_POLE:f=u-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 c=0,l,u=0;if(l=Math.sqrt(e*e+s*s),r=l*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(u=Math.sin(r),c=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(l)<=v?0:Math.asin(s*u/l),e*=u,s=c*l;break;case this.OBLIQ:r=Math.abs(l)<=v?this.lat0:Math.asin(c*this.sinph0+s*u*this.cosph0/l),e*=u*this.cosph0,s=(c-Math.sin(r)*this.sinph0)*l;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=Ln(Math.asin(f),this.apa)}return t.x=y(this.long0+i),t.y=r,t}var Pn=.3333333333333333,Sn=.17222222222222222,An=.10257936507936508,Nn=.06388888888888888,On=.0664021164021164,Fn=.016415012942191543;function Rn(t){var e,s=[];return s[0]=t*Pn,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 Ln(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"],Pi={init:wn,forward:In,inverse:En,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"],Si={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 jn(t){var e,s,i,r,a,n,o,h,f=t.x,c=t.y;return i=y(f-this.long0),e=Math.sin(c),s=Math.cos(c),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 Dn(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"],Ai={init:Gn,forward:jn,inverse:Dn,names:kn};function Ni(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=Ni(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"],Oi={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"],Fi={init:Jn,forward:Zn,inverse:Qn,names:$n};var Ri=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 c;for(a=Ri;a;--a)if(c=Math.tan(h),f=-1*(n*(h*c+1)-h-.5*(h*h+o)*c)/((h-n)/c-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 l,u,m,d,p;for(a=Ri;a;--a)if(p=this.e*Math.sin(h),l=Math.sqrt(1-p*p)*Math.tan(h),u=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=u/this.a,f=(n*(l*d+1)-d-.5*l*(d*d+o))/(this.es*Math.sin(2*h)*(d*d+o-2*n*d)/(4*l)+(n-d)*(l*m-2/Math.sin(2*h))-m),h-=f,Math.abs(f)<=v){s=h;break}l=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),e=y(this.long0+Math.asin(i*l/this.a)/Math.sin(s))}return t.x=e,t.y=s,t}var eo=["Polyconic","poly"],Li={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 c=f,l=o,u=1,m=0,d,p,_=0,M=0;for(e=1;e<=6;e++)d=u*c-m*l,p=m*c+u*l,u=d,m=p,_=_+this.B_re[e]*u-this.B_im[e]*m,M=M+this.B_im[e]*u+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,c,l,u=0,m=0;for(e=1;e<=6;e++)c=h*n-f*o,l=f*n+h*o,h=c,f=l,u=u+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=u,_=m,M,x,g=n,S=o;for(e=2;e<=6;e++)M=p*u-_*m,x=_*u+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],E=this.B_im[1];for(e=2;e<=6;e++)M=p*u-_*m,x=_*u+p*m,p=M,_=x,I=I+e*(this.B_re[e]*p-this.B_im[e]*_),E=E+e*(this.B_im[e]*p+this.B_re[e]*_);var B=I*I+E*E;u=(g*I+S*E)/B,m=(S*I-g*E)/B}var N=u,Y=m,G=1,st=0;for(e=1;e<=9;e++)G=G*N,st=st+this.D[e]*G;var pt=this.lat0+st*At*1e5,Yt=this.long0+Y;return t.x=Yt,t.y=pt,t}var ao=["New_Zealand_Map_Grid","nzmg"],Ci={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"],Ti={init:no,forward:oo,inverse:ho,names:fo};var lo=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=Se(this.es)}function uo(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"],Bi={init:co,forward:uo,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"],Ui={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=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 wo=["Equidistant_Conic","eqdc"],zi={init:Mo,forward:go,inverse:xo,names:wo};function Io(){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),c=Math.cos(n),l=c/(f+c-1),u=l*l,m=l*(2/f-1),d=m*m,p=Math.PI*this.R*(o*(l-d)+Math.sqrt(h*(l-d)*(l-d)-(d+h)*(u-d)))/(d+h);i<0&&(p=-p),r=this.x0+p;var _=h+l;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 Po(t){var e,s,i,r,a,n,o,h,f,c,l,u,m;return t.x-=this.x0,t.y-=this.y0,l=Math.PI*this.R,i=t.x/l,r=t.y/l,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,c=2*Math.sqrt(-f/3),l=3*m/f/c,Math.abs(l)>1&&(l>=0?l=1:l=-1),u=Math.acos(l)/3,t.y>=0?s=(-c*Math.cos(u+Math.PI/3)-o/3/h)*Math.PI:s=-(-c*Math.cos(u+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"],qi={init:Io,forward:Eo,inverse:Po,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,c,l,u,m,d,p,_,M,x,g,S,I,E,B,N,Y,G,st,pt;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),E=I?I/Math.sin(I):1,t.x=this.x0+this.a*E*r*Math.sin(a),t.y=this.y0+this.a*E*(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?(c=this.a*q(n,o,h,f,b),l=this.a*q(n,o,h,f,s),t.x=this.x0+(c-l)*Math.sin(a),t.y=this.y0-(c-l)*Math.cos(a),t):Math.abs(this.sin_p12+1)<=v?(c=this.a*q(n,o,h,f,b),l=this.a*q(n,o,h,f,s),t.x=this.x0+(c+l)*Math.sin(a),t.y=this.y0+(c+l)*Math.cos(a),t):(u=i/r,m=xt(this.a,this.e,this.sin_p12),d=xt(this.a,this.e,i),p=Math.atan((1-this.es)*u+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,pt=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))-pt/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,c,l,u,m,d,p,_,M,x,g,S,I,E,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),c=Mt(this.es),l=gt(this.es),Math.abs(this.sin_p12-1)<=v?(u=this.a*q(h,f,c,l,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=u-e,n=Rt(m/this.a,h,f,c,l),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?(u=this.a*q(h,f,c,l,b),e=Math.sqrt(t.x*t.x+t.y*t.y),m=e-u,n=Rt(m/this.a,h,f,c,l),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,E=I-g*(1+g)*Math.pow(I,3)/6-S*(1+3*g)*Math.pow(I,4)/24,B=1-g*E*E/2-I*E*E*E/6,p=Math.asin(this.sin_p12*Math.cos(E)+this.cos_p12*Math.sin(E)*M),a=y(this.long0+Math.asin(Math.sin(_)*Math.sin(E)/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"],Gi={init:Ao,forward:No,inverse:Oo,names:Fo};function Ro(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Lo(t){var e,s,i,r,a,n,o,h,f=t.x,c=t.y;return i=y(f-this.long0),e=Math.sin(c),s=Math.cos(c),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"],ji={init:Ro,forward:Lo,inverse:Co,names:To};var R={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-P/2?this.face=R.TOP:this.lat0<=-(b-P/2)?this.face=R.BOTTOM:Math.abs(this.long0)<=P?this.face=R.FRONT:Math.abs(this.long0)<=b+P?this.face=this.long0>0?R.RIGHT:R.LEFT:this.face=R.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===R.TOP)a=b-s,i>=P&&i<=b+P?(h.value=A.AREA_0,r=i-b):i>b+P||i<=-(b+P)?(h.value=A.AREA_1,r=i>0?i-F:i+F):i>-(b+P)&&i<=-P?(h.value=A.AREA_2,r=i+b):(h.value=A.AREA_3,r=i);else if(this.face===R.BOTTOM)a=b+s,i>=P&&i<=b+P?(h.value=A.AREA_0,r=-i+b):i<P&&i>=-P?(h.value=A.AREA_1,r=-i):i<-P&&i>=-(b+P)?(h.value=A.AREA_2,r=-i-b):(h.value=A.AREA_3,r=i>0?-i+F:-i-F);else{var f,c,l,u,m,d,p;this.face===R.RIGHT?i=kt(i,+b):this.face===R.BACK?i=kt(i,+F):this.face===R.LEFT&&(i=kt(i,-b)),u=Math.sin(s),m=Math.cos(s),d=Math.sin(i),p=Math.cos(i),f=m*p,c=m*d,l=u,this.face===R.FRONT?(a=Math.acos(f),r=Le(a,l,c,h)):this.face===R.RIGHT?(a=Math.acos(c),r=Le(a,l,-f,h)):this.face===R.BACK?(a=Math.acos(-f),r=Le(a,l,-c,h)):this.face===R.LEFT?(a=Math.acos(-c),r=Le(a,l,f,h)):(a=r=0,h.value=A.AREA_0)}return o=Math.atan(12/F*(r+Math.acos(Math.sin(r)*Math.cos(P))-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 zo(t){var e={lam:0,phi:0},s,i,r,a,n,o,h,f,c,l={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)?l.value=A.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(l.value=A.AREA_1,s-=b):t.x<0&&-t.x>=Math.abs(t.y)?(l.value=A.AREA_2,s=s<0?s+F:s-F):(l.value=A.AREA_3,s+=b),c=F/12*Math.tan(s),n=Math.sin(c)/(Math.cos(c)-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===R.TOP)f=Math.acos(h),e.phi=b-f,l.value===A.AREA_0?e.lam=o+b:l.value===A.AREA_1?e.lam=o<0?o+F:o-F:l.value===A.AREA_2?e.lam=o-b:e.lam=o;else if(this.face===R.BOTTOM)f=Math.acos(h),e.phi=f-b,l.value===A.AREA_0?e.lam=-o+b:l.value===A.AREA_1?e.lam=-o:l.value===A.AREA_2?e.lam=-o-b:e.lam=o<0?-o-F:-o+F;else{var u,m,d;u=h,c=u*u,c>=1?d=0:d=Math.sqrt(1-c)*Math.sin(o),c+=d*d,c>=1?m=0:m=Math.sqrt(1-c),l.value===A.AREA_1?(c=m,m=-d,d=c):l.value===A.AREA_2?(m=-m,d=-d):l.value===A.AREA_3&&(c=m,m=d,d=-c),this.face===R.RIGHT?(c=u,u=-m,m=c):this.face===R.BACK?(u=-u,m=-m):this.face===R.LEFT&&(c=u,u=m,m=-c),e.phi=Math.acos(-d)-b,e.lam=Math.atan2(m,u),this.face===R.RIGHT?e.lam=kt(e.lam,-b):this.face===R.BACK?e.lam=kt(e.lam,-F):this.face===R.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 Le(t,e,s,i){var r;return t<v?(i.value=A.AREA_0,r=0):(r=Math.atan2(e,s),Math.abs(r)<=P?i.value=A.AREA_0:r>P&&r<=b+P?(i.value=A.AREA_1,r-=b):r>b+P||r<=-(b+P)?(i.value=A.AREA_2,r=r>=0?r-F:r+F):(i.value=A.AREA_3,r+=b)),r}function kt(t,e){var s=t+e;return s<-F?s+=se:s>+F&&(s-=se),s}var qo=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Di={init:Bo,forward:Uo,inverse:zo,names:qo};var fs=[[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]],he=[[-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]],ki=.8487,Vi=1.3523,Hi=at/5,Go=1/Hi,Vt=18,Ce=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 Do(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*Hi);i<0?i=0:i>=Vt&&(i=Vt-1),s=at*(s-Go*i);var r={x:Ce(fs[i],s)*e,y:Ce(he[i],s)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*ki+this.x0,r.y=r.y*this.a*Vi+this.y0,r}function Ho(t){var e={x:(t.x-this.x0)/(this.a*ki),y:Math.abs(t.y-this.y0)/(this.a*Vi)};if(e.y>=1)e.x/=fs[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(he[s][0]>e.y)--s;else if(he[s+1][0]<=e.y)++s;else break;var i=he[s],r=5*(e.y-i[0])/(he[s+1][0]-i[0]);r=Do(function(a){return(Ce(i,a)-e.y)/jo(i,a)},r,v,100),e.x/=Ce(fs[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"],Wi={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"],Xi={init:Xo,forward:Jo,inverse:Zo,names:Qo};function Ji(t){t.Proj.projections.add(ui),t.Proj.projections.add(Dt),t.Proj.projections.add(vi),t.Proj.projections.add(yi),t.Proj.projections.add(Mi),t.Proj.projections.add(gi),t.Proj.projections.add(xi),t.Proj.projections.add(wi),t.Proj.projections.add(Ii),t.Proj.projections.add(Ei),t.Proj.projections.add(Pi),t.Proj.projections.add(Si),t.Proj.projections.add(Ai),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(Bi),t.Proj.projections.add(Ui),t.Proj.projections.add(zi),t.Proj.projections.add(qi),t.Proj.projections.add(Gi),t.Proj.projections.add(ji),t.Proj.projections.add(Di),t.Proj.projections.add(Wi),t.Proj.projections.add(Xi)}K.defaultDatum="WGS84";K.Proj=wt;K.WGS84=new K.Proj("WGS84");K.Point=hi;K.toPoint=Pe;K.defs=zt;K.transform=Ot;K.mgrs=ai;K.version="__VERSION__";Ji(K);var ls=K;var Ht=class{static defineProjectionAliases(e){let s=[];for(let i in e)s.push([i,e[i]]);ls.defs(s)}constructor({from:e="WGS84",to:s="WGS84"}){if(this._projection=ls(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=Zi(s.geometry.coordinates,e);return t}function Zi(t,e){return $o(t)?e(t):t.map(s=>Zi(s,e))}function $o(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function cs(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 Qi(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:us(e,s)}}function Yo(t){let e=t.xyArray(),s=t.zArray(),i=us(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 Qi(t){let e=t.xyArray(),s=t.zArray(),i=us(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 u=0;u<t.partsLength();u++){let m=t.parts(u),d=Qi(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,c=1,l=e[0].positions.size;for(let u of e)a.set(u.positions.value,h*l),n.set(u.primitivePolygonIndices.value.subarray(1).map(m=>m+h),f),o.set(u.polygonIndices.value.subarray(1).map(m=>m+h),c),h+=u.positions.value.length/l,f+=u.primitivePolygonIndices.value.length-1,c+=u.polygonIndices.value.length-1;return{positions:{value:a,size:l},primitivePolygonIndices:{value:n,size:1},polygonIndices:{value:o,size:1}}}function us(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 $i(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 D;(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"})(D||(D={}));function sh(t){switch(t){case D.Byte:return"int8";case D.UByte:return"uint8";case D.Bool:return"bool";case D.Short:return"int16";case D.UShort:return"uint16";case D.Int:return"int32";case D.UInt:return"uint32";case D.Long:return"int64";case D.ULong:return"uint64";case D.Float:return"float32";case D.Double:return"float64";case D.String:return"utf8";case D.Json:return"null";case D.DateTime:return"date-millisecond";case D.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 dt=new Int32Array(2),Be=new Float32Array(dt.buffer),Ue=new Float64Array(dt.buffer),Wt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var fe;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(fe||(fe={}));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 dt[0]=this.readInt32(e),Be[0]}readFloat64(e){return dt[Wt?0:1]=this.readInt32(e),dt[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,dt[0])}writeFloat64(e,s){Ue[0]=s,this.writeInt32(e,dt[Wt?0:1]),this.writeInt32(e+4,dt[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===fe.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 j=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 j).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsGeometry(e,s){return e.setPosition(e.position()+4),(s||new j).__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 j).__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 j.startGeometry(e),j.addEnds(e,s),j.addXy(e,i),j.addZ(e,r),j.addM(e,a),j.addT(e,n),j.addTm(e,o),j.addType(e,h),j.addParts(e,f),j.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 Yi(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 C.Point:{let r=Array.from(s);return i&&r.push(i[0]),r}case C.MultiPoint:case C.LineString:return ze(s,i);case C.MultiLineString:return Yi(s,i,t.endsArray());case C.Polygon:return Yi(s,i,t.endsArray())}}function qe(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(qe(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(qe(t.parts(a),C.Polygon));return{type:C[s],coordinates:r.map(a=>a.coordinates)}}let i=rh(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 L=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 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):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,c,l,u){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,c),L.addPrimaryKey(e,l),L.addMetadata(e,u),L.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 j).__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 kd=new TextEncoder,tr=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 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 c=r.getUint32(n,!0);n+=4,s[f]=tr.decode(i.subarray(n,n+c)),n+=c;break}case T.Json:{let c=r.getUint32(n,!0);n+=4;let l=tr.decode(i.subarray(n,n+c));s[f]=JSON.parse(l),n+=c;break}default:throw new Error(`Unknown type ${h.type}`)}}return s}function je(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 er(){return this._source.cancel()}function ds(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 sr(){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:ds(e,s.value)}})}function ir(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 ms(t){return typeof t.slice=="function"?t:new De(typeof t.read=="function"?t:t.getReader())}function De(t){this._source=t,this._array=Xt,this._index=0}De.prototype.read=sr;De.prototype.slice=ir;De.prototype.cancel=er;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 Tt=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 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):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 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,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 le(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 bs=function(t,e){return bs=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])},bs(t,e)};function ah(t,e){bs(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(c){try{f(i.next(c))}catch(l){n(l)}}function h(c){try{f(i.throw(c))}catch(l){n(l)}}function f(c){c.done?a(c.value):r(c.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(c){return h([f,c])}}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(c){f=[6,c],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(u){i[u]&&(r[u]=function(m){return new Promise(function(d,p){a.push([u,m,d,p])>1||o(u,m)})})}function o(u,m){try{h(i[u](m))}catch(d){l(a[0][3],d)}}function h(u){u.value instanceof ue?Promise.resolve(u.value.v).then(f,c):l(a[0][2],u)}function f(u){o("next",u)}function c(u){o("throw",u)}function l(u,m){u(m),a.shift(),a.length&&o(a[0][0],a[0][1])}}var nr=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),mm=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}(),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){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}(),bm=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 _s(t){t!=null&&typeof t.then=="function"&&t.then(We,We)}var ps=0,rr=1,Ut=2,Ve=3,vs=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>=vs?Jt(t).then(function(r){return{value:r,done:!0}}):{value:i,done:s}})}function ys(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))ce(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 ce(t){var e,s;if(!(t.state>=Ve)){t.state<Ut&&ys(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 ar(t){t.state>=vs||(t.state<Ve&&ce(t),t.state=vs)}function oh(t,e){if(_s(e),t.pushes.length>=He)throw new nr("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),ar(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,ar(t)}),n}function hh(t){var e=ys.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>=rr)){t.state=rr;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 ys(t)})}}var ke=new WeakMap,$t=function(){function t(e,s){ke.set(this,{executor:e,buffer:s,err:void 0,state:ps,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:We,onstop:We})}return t.prototype.next=function(e){_s(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");if(s.nexts.length>=He)throw new nr("No more than "+He+" pending calls to next are allowed on a single repeater.");if(s.state<=ps&&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 ce(s),Bt(s,Jt(s));return new Promise(function(n){return s.nexts.push({resolve:n,value:e})})},t.prototype.return=function(e){_s(e);var s=ke.get(this);if(s===void 0)throw new Error("WeakMap error");return ce(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<=ps||s.state>=Ut||typeof s.buffer<"u"&&!s.buffer.empty?(ce(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=ch,t.zip=uh,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(u){switch(u.label){case 0:return e.yieldValues?[4,ue(f)]:[3,3];case 1:return[4,u.sent()];case 2:u.sent(),u.label=3;case 3:return e.returnValues?[4,ue(f)]:[3,5];case 4:return[2,u.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,c;return Et(this,function(l){switch(l.label){case 0:if(!s.length)return r(),[2];n=!1,r.then(function(){a(),n=!0}),l.label=1;case 1:l.trys.push([1,,5,7]),h=void 0,f=0,c=function(){var u,m,d,p,_,M;return Et(this,function(x){switch(x.label){case 0:u=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===u&&(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]}})},l.label=2;case 2:return n?[3,4]:[5,c()];case 3:return l.sent(),[3,2];case 4:return[2,o&&o.value];case 5:return r(),[4,Promise.race(s.map(function(u){return u.return&&u.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function ch(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 c,l;n=!0;try{for(var u=Qt(a),m=u.next();!m.done;m=u.next()){var d=m.value;d()}}catch(p){c={error:p}}finally{try{m&&!m.done&&(l=u.return)&&l.call(u)}finally{if(c)throw c.error}}}),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,Promise.all(s.map(function(c,l){return Zt(h,void 0,void 0,function(){var u,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(c.next()).then(function(p){return a[l](p)},function(p){return r(p)}),[4,new Promise(function(p){a[l]=p})]);case 2:return u=d.sent(),u===void 0?[3,4]:u.done?(o=u,[2]):[4,i(u.value)];case 3:d.sent(),d.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return m=c.return,m?[4,c.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 uh(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(c){return c.next()})).then(function(c){return a(c)},function(c){return r(c)}),[4,new Promise(function(c){return a=c})]);case 3:return o=f.sent(),o===void 0?[2]:(h=o.map(function(c){return c.value}),o.some(function(c){return c.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(c){return c.return&&c.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,c=this;return Et(this,function(l){switch(l.label){case 0:if(!s.length)return r(),[2,[]];n=[],o=!1,r.then(function(){var u,m;a();try{for(var d=Qt(n),p=d.next();!p.done;p=d.next()){var _=p.value;_()}}catch(M){u={error:M}}finally{try{p&&!p.done&&(m=d.return)&&m.call(d)}finally{if(u)throw u.error}}o=!0}),l.label=1;case 1:return l.trys.push([1,,5,7]),Promise.all(s.map(function(u){return u.next()})).then(function(u){return a(u)},function(u){return r(u)}),[4,new Promise(function(u){return a=u})];case 2:return h=l.sent(),h===void 0?[2]:(f=h.map(function(u){return u.value}),h.every(function(u){return u.done})?[2,f]:[4,i(f.slice())]);case 3:return l.sent(),[4,Promise.all(s.map(function(u,m){return Zt(c,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(u.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,l.sent()];case 5:return r(),[4,Promise.all(s.map(function(u){return u.return&&u.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}var Ms=class{_extraRequestThreshold=256*1024;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(e){if(e<0)throw new Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=e}},Pt=Ms;_e(Pt,"global",new Ms);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}}}};_e(O,"logLevel",ft.Warn);var St=8*4+8;var or=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*hr(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=mh(t,e),c=f[0][0],u=[(()=>{let m=[0,1],d=f.length-1;return new r(m,d)})()];for(O.debug(`starting stream search with queue: ${u}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${f}`);u.length!=0;){let m=u.shift();O.debug(`popped node: ${m}, queueLength: ${u.length}`);let d=m.startNodeIdx(),p=d>=c,_=(()=>{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,E=I*St;if(o<g.getFloat64(E+0,!0)||h<g.getFloat64(E+8,!0)||a>g.getFloat64(E+16,!0)||n>g.getFloat64(E+24,!0))continue;let B=g.getBigUint64(E+32,!0);if(p){let pt=B,Yt=(()=>{if(S<t-1){let wr=(I+1)*St;return g.getBigUint64(wr+32,!0)-pt}return null})(),xr=S-c;yield[Number(pt),xr,Number(Yt)];continue}let N=B,Y=Pt.global.extraRequestThreshold()/St,G=u[u.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 pt=m.level()-1,Yt=[Number(N),Number(N)+1];return new r(Yt,pt)})();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.`),u.push(st)}}}var mt=new Uint8Array([102,103,98,3,102,103,98,0]),lt=4;var Kt=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 Je(e),r=(()=>{let l=or,u=3,m=0,d;for(d=0;d<u;d++){let p=l**d*St;m+=p}return m})(),a=2024+r;O.debug(`fetching header. minReqLength: ${a} (assumedHeaderLength: ${2024}, assumedIndexLength: ${r})`);{let l=new Uint8Array(await i.getRange(0,8,a,"header"));if(!l.subarray(0,3).every((u,m)=>mt[m]===u))throw O.error(`bytes: ${l} != ${mt}`),new Error("Not a FlatGeobuf file");O.debug("magic bytes look good")}let n;{let l=await i.getRange(8,4,a,"header");n=new DataView(l).getUint32(0,!0);let u=1048576*10;if(n>u||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=le(h),c=de(f.featuresCount,f.indexNodeSize);return O.debug("completed: opening http reader"),new Kt(i,f,n,c)}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 hr(this.header.featuresCount,this.header.indexNodeSize,e,r)){let[f,,]=h,[,,c]=h;if(c||(O.info("final feature"),c=4),n.length==0){n.push([f,c]);continue}let l=n[n.length-1],u=f-(l[0]+l[1]);u>Pt.global.extraRequestThreshold()&&(O.info(`Pushing new feature batch, since gap ${u} was too large`),a.push(n),n=[]),n.push([f,c])}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 mt.length+lt+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(){return new Je(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[c]of e)yield await this.readFeature(h,c,f),f=0;h.logUsage("feature")}async readFeature(e,s,i){let r=s+this.lengthBeforeFeatures(),a;{let c=await e.getRange(r,4,i,"feature length");a=new DataView(c).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)}},Je=class{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(e){if(typeof e=="string")this.httpClient=new Ze(e);else if(e instanceof Ze)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}%`)}},Ze=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 Qe(t,e,s){if(!t.subarray(0,3).every((c,l)=>mt[l]===c))throw new Error("Not a FlatGeobuf file");let i=new W(t),r=i.readUint32(mt.length);i.setPosition(mt.length+lt);let a=le(i);s&&s(a);let n=mt.length+lt+r,{indexNodeSize:o,featuresCount:h}=a;o>0&&(n+=de(h,o));let f=[];for(;n<i.capacity();){let c=i.readUint32(n);i.setPosition(n+lt);let l=X.getRootAsFeature(i);f.push(e(l,a)),n+=lt+c}return f}async function*$e(t,e,s){let i=ms(t),r=async u=>await i.slice(u),a=new Uint8Array(await r(8,"magic bytes"));if(!a.subarray(0,3).every((u,m)=>mt[m]===u))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=le(n);s&&s(h);let{indexNodeSize:f,featuresCount:c}=h;if(f>0){let u=de(c,f);await r(u,"entire index, w/o rect")}let l;for(;l=await ph(r,h,e);)yield l}async function*Ke(t,e,s,i){let r=await Kt.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 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 fr(t,e){return{type:"FeatureCollection",features:Qe(t,je,e)}}function lr(t,e){return $e(t,je,e)}function cr(t,e,s){return Ke(t,e,je,s)}function ur(t,e,s){return t instanceof Uint8Array?fr(t,s):t instanceof ReadableStream?lr(t,s):cr(t,e,s)}function dr(t,e,s){return t instanceof Uint8Array?Qe(t,e):t instanceof ReadableStream?$e(t,e):Ke(t,s,e)}var pr=ur,br=dr;function _r(t,e){let s=e.shape;switch(s){case"geojson-table":return vh(t,e);case"columnar-table":return{shape:"columnar-table",data:mr(t,e)};case"binary":return mr(t,e);default:throw new Error(s)}}function mr(t,e={}){let s=new Uint8Array(t);return br(s,cs)}function vh(t,e){if(t.byteLength===0)return{shape:"geojson-table",type:"FeatureCollection",features:[]};let{reproject:s=!1,crs:i="WGS84"}=e,r=new Uint8Array(t),a,n,o=e.boundingBox&&yr(e.boundingBox),{features:h}=pr(r,o,l=>{a=l,n=$i(a)}),f=a?.crs?.wkt,c;if(s&&f)try{c=new Ht({from:f,to:i})}catch{}return c&&(h=Te(h,l=>c.project(l))),{shape:"geojson-table",schema:n,type:"FeatureCollection",features:h}}function vr(t,e){let s=e.shape;switch(s){case"binary":return yh(t,e);case"geojson-table":return Mh(t,e);default:throw new Error(s)}}function yh(t,e){let s=e.boundingBox&&yr(e.boundingBox);return br(t,gh,s)}async function*Mh(t,e){let{reproject:s=!1,crs:i="WGS84"}=e||{},r,a=pr(t,void 0,h=>{r=h}),n,o=!0;for await(let h of a){if(o){let f=r?.crs?.wkt;s&&f&&(n=new Ht({from:f,to:i})),o=!1}s&&n?yield Te([h],f=>n.project(f)):yield h}}function yr(t){return{minX:t[0][0],minY:t[0][1],maxX:t[1][0],maxY:t[1][1]}}function gh(t,e){let s=t.geometry(),i=e.geometryType||s?.type(),r=cs(s,i);return r.properties=Ge(t,e.columns),r}var xh="4.3.0-beta.1",wh=[102,103,98,3,102,103,98,1],gs={dataType:null,batchType:null,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}}},Ye={...gs,parse:async(t,e={})=>Mr(t,e),parseSync:Mr,parseInBatchesFromStream:Ih,binary:!0};function Mr(t,e={}){return _r(t,gr(e))}function Ih(t,e){return vr(t,gr(e))}function gr(t){return t={...t,flatgeobuf:{...Ye.options.flatgeobuf,...t?.flatgeobuf},gis:{...Ye.options.gis,...t?.gis}},{shape:t?.flatgeobuf?.shape??"geojson-table",boundingBox:t?.flatgeobuf?.boundingBox,crs:t?.gis?._targetCrs||"WGS84",reproject:t?.gis?.reproject||!1}}return Lr(me);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
@repeaterjs/repeater/repeater.js:
|