@zwishing/emap 0.1.2 → 0.2.0
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/CHANGELOG.md +52 -1
- package/README.md +5 -0
- package/dist/emap.js +1 -1
- package/dist/emap.mjs +1 -1
- package/dist/mapshaper-vendor.js +1 -1
- package/dist/mapshaper-vendor.mjs +1 -1
- package/dist/source/topology-source.d.ts +28 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var r={exports:{}},i=n(Object.freeze({__proto__:null,default:{}}));function a(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function u(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,t="/"===r.charAt(0))}return(t?"/":"")+(e=a(y(e.split("/"),function(e){return!!e}),!t).join("/"))||"."}function c(e){var t=f(e),n="/"===b(e,-1);return(e=a(y(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function f(e){return"/"===e.charAt(0)}function l(){return c(y(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=u(e).substr(1),t=u(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}var c=[];for(s=o;s<r.length;s++)c.push("..");return(c=c.concat(i.slice(o))).join("/")}function p(e){var t=s(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function d(e,t){var n=s(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function g(e){return s(e)[3]}var m={extname:g,basename:d,dirname:p,sep:"/",delimiter:":",relative:h,join:l,isAbsolute:f,normalize:c,resolve:u};function y(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var v,b="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)},_=n(Object.freeze({__proto__:null,basename:d,default:m,delimiter:":",dirname:p,extname:g,isAbsolute:f,join:l,normalize:c,relative:h,resolve:u,sep:"/"}));v=r,function(){var e=Math.abs,t=Math.floor,n=Math.sin,r=Math.cos,a=Math.tan,o=Math.asin,s=Math.acos,u=Math.atan,c=Math.atan2,f=Math.sqrt,l=Math.pow,h=Math.exp,p=Math.log,d=Math.hypot,g=Math.sinh,m=Math.cosh,y=Math.min,b=Math.max,x=1/0,w=Math.PI,S=57.29577951308232,A=.017453292519943295,E=6378137,M=.0066943799901413165,I=w/4,k=w/2,C=1.5*w,P=2*w,O=2/w,N=-45,T=-47,L=1e-10,z={last_errno:0,debug_level:0,logger:null},R=["no arguments in initialization list","no options found in 'init' file","invalid init= string","projection not named","unknown projection id","effective eccentricity = 1","unknown unit conversion id","invalid boolean param argument","unknown elliptical parameter name","reciprocal flattening (1/f) = 0","|radius reference latitude| > 90","squared eccentricity < 0","major axis or radius = 0 or not given","latitude or longitude exceeded limits","invalid x or y","improperly formed DMS value","non-convergent inverse meridional dist","non-convergent inverse phi2","acos/asin: |arg| >1+1e-14","tolerance condition error","conic lat_1 = -lat_2","lat_1 >= 90","lat_1 = 0","lat_ts >= 90","no distance between control points","projection not selected to be rotated","W <= 0 or M <= 0","lsat not in 1-5 range","path not in range","h <= 0","k <= 0","lat_0 = 0 or 90 or alpha = 90","lat_1=lat_2 or lat_1=0 or lat_2=90","elliptical usage required","invalid UTM zone number","arg(s) out of range for Tcheby eval","failed to find projection to be rotated","failed to load datum shift file","both n & m must be spec'd and > 0","n <= 0, n > 1 or not specified","lat_1 or lat_2 not specified","|lat_1| == |lat_2|","lat_0 is pi/2 from mean lat","unparseable coordinate system definition","geocentric transformation missing z or ellps","unknown prime meridian conversion id","illegal axis orientation combination","point not within available datum shift grids","invalid sweep axis, choose x or y","invalid value for h","point outside of projection domain"];function D(){var e=z.last_errno;e&&(e>0||!function(e){return j.indexOf(e)>-1}(e))&&q(e)}var j=[-14,-15,-17,-18,-19,-20,-27,-48];function F(e){z.last_errno=e}function U(){F(-20)}function B(){F(-20)}function G(e){q(e)}function q(e){F(e),V()}function V(e,t){var n;throw t||(t={}),t.code||(t.code=z.last_errno||0),e||(n=t.code,e=R[~n]||"unknown error"),z.last_errno=0,new $(e,t)}function $(e,t){var n=new Error(e);return n.name="ProjError",Object.keys(t).forEach(function(e){n[e]=t[e]}),n}function J(e){return W(e)*A}function W(e){var t=/(-?[0-9.]+)d?([0-9.]*)'?([0-9.]*)"?([nsew]?)$/i.exec(e),n=NaN;return t&&(n=+(t[1]||"0")+ +(t[2]||"0")/60+ +(t[3]||"0")/3600,/[ws]/i.test(t[4])&&(n=-n)),isNaN(n)&&q(-16),n}function Z(e){return Y(e)}function Y(e){return parseFloat(e)}function H(e,t){var n,r,i=t[0],a=e[t.substr(1)],o=void 0!==a;return"t"==i?n=o:o?(r=a.param,a.used=!0,"i"==i?n=parseInt(r):"d"==i?n=Z(r):"r"==i?n=J(r):"s"==i?n=String(r):"b"==i&&("T"==r||"t"==r||!0===r?n=!0:("F"==r||"f"==r||F(-8),n=!1))):n={i:0,b:!1,d:0,r:0,s:""}[i],void 0===n&&V("invalid request to pj_param, fatal"),n}function X(e){for(var t,n=/\+([a-z][a-z0-9_]*(?:=[^\s]*)?)/gi,r={};t=n.exec(e);)K(r,t[1]);return r}function K(e,t){var n,r,i=t.split("=");1==i.length?(n=t,r=!0):(n=i[0],r=t.substr(i[0].length+1)),e[n]={used:!1,param:r}}var Q={};function ee(e,t,n,r){Q[t]={init:e,name:n,description:r}}function te(e){return!e||e.is_latlong}function ne(e){var t=!1,n="";return"datum"in e.params?(t=!0,n+=ie(e,"datum")):"R"in e.params?n+=ie(e,"R"):"ellps"in e.params?n+=ie(e,"ellps"):"a"in e.params?(n+=ie(e,"a"),"b"in e.params?n+=ie(e,"b"):"es"in e.params?n+=ie(e,"es"):"f"in e.params?n+=ie(e,"f"):n+=" +es="+e.es):G(-13),t||(n+=ie(e,"towgs84"),n+=ie(e,"nadgrids")),n+=ie(e,"R_A"),n+=ie(e,"R_V"),n+=ie(e,"R_a"),n+=ie(e,"R_lat_a"),n+=ie(e,"R_lat_g"),n+=ie(e,"pm")}function re(e){var t="datum,ellps,a,b,es,rf,f,towgs84,nadgrids,R,R_A,R_V,R_a,R_lat_a,R_lat_g,pm,init,no_defs".split(","),n="";return Object.keys(e.params).forEach(function(r){-1==t.indexOf(r)&&(n+=ie(e,r))}),(n+=ne(e)).trim()}function ie(e,t){var n="";return t in e.params&&(n=" +"+t,!0!==e.params[t].param&&(n+="="+H(e.params,"s"+t))),n}var ae=[["WGS84","towgs84=0,0,0","WGS84","WGS_1984"],["GGRS87","towgs84=-199.87,74.79,246.62","GRS80","Greek_Geodetic_Reference_System_1987"],["NAD83","towgs84=0,0,0","GRS80","North_American_Datum_1983"],["NAD27","nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat","clrk66","North_American_Datum_1927"],["potsdam","towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7","bessel","Potsdam Rauenberg 1950 DHDN"],["carthage","towgs84=-263.0,6.0,431.0","clrk80ign","Carthage 1934 Tunisia"],["hermannskogel","towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232","bessel","Hermannskogel"],["ire65","towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15","mod_airy","Ireland 1965"],["nzgd49","towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993","intl","New Zealand Geodetic Datum 1949"],["OSGB36","towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894","airy","OSGB 1936"],[null,null,null,null]],oe=[["greenwich","0dE"],["lisbon","9d07'54.862\"W"],["paris","2d20'14.025\"E"],["bogota","74d04'51.3\"W"],["madrid","3d41'16.58\"W"],["rome","12d27'8.4\"E"],["bern","7d26'22.5\"E"],["jakarta","106d48'27.79\"E"],["ferro","17d40'W"],["brussels","4d22'4.71\"E"],["stockholm","18d3'29.8\"E"],["athens","23d42'58.815\"E"],["oslo","10d43'22.5\"E"],[null,null]];function se(e){var t=ae.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],defn:t[1],ellipse_id:t[2],name:t[3]}:null}var ue=[["MERIT","a=6378137.0","rf=298.257","MERIT 1983"],["SGS85","a=6378136.0","rf=298.257","Soviet Geodetic System 85"],["GRS80","a=6378137.0","rf=298.257222101","GRS 1980(IUGG, 1980)"],["IAU76","a=6378140.0","rf=298.257","IAU 1976"],["airy","a=6377563.396","b=6356256.910","Airy 1830"],["APL4.9","a=6378137.0","rf=298.25","Appl. Physics. 1965"],["NWL9D","a=6378145.0","rf=298.25","Naval Weapons Lab., 1965"],["mod_airy","a=6377340.189","b=6356034.446","Modified Airy"],["andrae","a=6377104.43","rf=300.0","Andrae 1876 (Den., Iclnd.)"],["aust_SA","a=6378160.0","rf=298.25","Australian Natl & S. Amer. 1969"],["GRS67","a=6378160.0","rf=298.2471674270","GRS 67(IUGG 1967)"],["bessel","a=6377397.155","rf=299.1528128","Bessel 1841"],["bess_nam","a=6377483.865","rf=299.1528128","Bessel 1841 (Namibia)"],["clrk66","a=6378206.4","b=6356583.8","Clarke 1866"],["clrk80","a=6378249.145","rf=293.4663","Clarke 1880 mod."],["clrk80ign","a=6378249.2","rf=293.4660212936269","Clarke 1880 (IGN)."],["CPM","a=6375738.7","rf=334.29","Comm. des Poids et Mesures 1799"],["delmbr","a=6376428","rf=311.5","Delambre 1810 (Belgium)"],["engelis","a=6378136.05","rf=298.2566","Engelis 1985"],["evrst30","a=6377276.345","rf=300.8017","Everest 1830"],["evrst48","a=6377304.063","rf=300.8017","Everest 1948"],["evrst56","a=6377301.243","rf=300.8017","Everest 1956"],["evrst69","a=6377295.664","rf=300.8017","Everest 1969"],["evrstSS","a=6377298.556","rf=300.8017","Everest (Sabah & Sarawak)"],["fschr60","a=6378166","rf=298.3","Fischer (Mercury Datum) 1960"],["fschr60m","a=6378155","rf=298.3","Modified Fischer 1960"],["fschr68","a=6378150","rf=298.3","Fischer 1968"],["helmert","a=6378200","rf=298.3","Helmert 1906"],["hough","a=6378270.0","rf=297","Hough"],["intl","a=6378388.0","rf=297","International 1909 (Hayford)"],["krass","a=6378245.0","rf=298.3","Krasovsky 1940"],["kaula","a=6378163","rf=298.24","Kaula 1961"],["lerch","a=6378139","rf=298.257","Lerch 1979"],["mprts","a=6397300","rf=191","Maupertius 1738"],["new_intl","a=6378157.5","b=6356772.2","New International 1967"],["plessis","a=6376523","b=6355863","Plessis 1817 (France)"],["SEasia","a=6378155.0","b=6356773.3205","Southeast Asia"],["walbeck","a=6376896.0","b=6355834.8467","Walbeck"],["WGS60","a=6378165.0","rf=298.3","WGS 60"],["WGS66","a=6378145.0","rf=298.25","WGS 66"],["WGS72","a=6378135.0","rf=298.26","WGS 72"],["WGS84","a=6378137.0","rf=298.257223563","WGS 84"],["sphere","a=6370997.0","b=6370997.0","Normal Sphere (r=6370997)"],[null,null,null,null]];function ce(e){var t=ue.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],major:t[1],ell:t[2],name:t[3]}:null}var fe=[["km","1000","Kilometer"],["m","1","Meter"],["dm","1/10","Decimeter"],["cm","1/100","Centimeter"],["mm","1/1000","Millimeter"],["kmi","1852.0","International Nautical Mile"],["in","0.0254","International Inch"],["ft","0.3048","International Foot"],["yd","0.9144","International Yard"],["mi","1609.344","International Statute Mile"],["fath","1.8288","International Fathom"],["ch","20.1168","International Chain"],["link","0.201168","International Link"],["us-in","1/39.37","U.S. Surveyor's Inch"],["us-ft","0.304800609601219","U.S. Surveyor's Foot"],["us-yd","0.914401828803658","U.S. Surveyor's Yard"],["us-ch","20.11684023368047","U.S. Surveyor's Chain"],["us-mi","1609.347218694437","U.S. Surveyor's Statute Mile"],["ind-yd","0.91439523","Indian Yard"],["ind-ft","0.30479841","Indian Foot"],["ind-ch","20.11669506","Indian Chain"],[null,null,null]];function le(e){var t=fe.reduce(function(t,n){return e===n[0]?n:t},null);return t?{id:t[0],to_meter:t[1],name:t[2]}:null}var he={},pe={};function de(e){return pe[e]||null}function ge(e){var t,n,r,a,o,s,u,c,f=e.split(":"),l=f[0],h=f[1];return h&&l||G(-3),(t=de(l=l.toLowerCase()))||(n=l,a=i,s=(o=_).join(o.dirname("/Users/zhang/code/emap/node_modules/mproj/dist"),"../nad"),u=o.join(s,n.toUpperCase()),c=o.join(s,n.toLowerCase()),a.existsSync(u)?r=a.readFileSync(u,"utf8"):a.existsSync(c)?r=a.readFileSync(c,"utf8"):V("unable to read from 'init' file named "+n),t=r,pe[l]=t),t?function(e,t){var n,r,i="",a="";return(n=e.indexOf("<"+t+">"))>-1&&((r=e.lastIndexOf("#",n))>-1&&(a=e.substring(r+1,n).trim(),/\n/.test(a)&&(a="")),i=(i=(i=" "+(i=(i=(i=(i=(i=e.substr(n+t.length+2)).substr(0,i.indexOf("<"))).replace(/#.*/g,"")).replace(/[\s]+/g," ")).replace(/\+title=[^+]*[^ +]/g,function(e){return e.replace(/ /g,"\t")}))).replace(/ (?=[a-z])/gi," +")).replace(/\t/g," ").trim()),i?{opts:i,comment:a}:null}(t,h):null}function me(t){var r,i,a=X(t),o={params:a,is_latlong:!1,is_geocent:!1,is_long_wrap_set:!1,long_wrap_center:0,axis:"enu",gridlist:null,gridlist_count:0,vgridlist_geoid:null,vgridlist_geoid_count:0};return Object.keys(a).length||G(-1),H(a,"tinit")&&function(e,t){var n=he[t.toLowerCase()]||null;n||function(e,t){he[e.toLowerCase()]=t}(t,n=ge(t)),n||G(-2),ye(e,n.opts)}(a,H(a,"sinit")),(r=H(a,"sproj"))||G(-4),(i=Q[r])||G(-5),H(a,"bno_defs")||function(e){ye(e,"+ellps=WGS84")}(o.params),function(e){var t,n,r,i,a=484813681109536e-20,o=e.datum_params=[0,0,0,0,0,0,0];e.datum_type=0,(t=H(e.params,"sdatum"))&&((n=se(t))||G(-9),n.ellipse_id&&K(e.params,"ellps="+n.ellipse_id),n.defn&&K(e.params,n.defn)),(r=H(e.params,"snadgrids"))&&"@null"!=r&&V("+nadgrids is not implemented"),H(e.params,"scatalog")&&V("+catalog is not implemented"),(i=H(e.params,"stowgs84"))&&(i.split(",").forEach(function(e,t){o[t]=Z(e)||0}),0!=o[3]||0!=o[4]||0!=o[5]||0!=o[6]?(e.datum_type=2,o[3]*=a,o[4]*=a,o[5]*=a,o[6]=o[6]/1e6+1):e.datum_type=1)}(o),function(t){var r,i,a,o,s,u=.16666666666666666,c=t.params,l=0,h=0;H(c,"tR")?l=H(c,"dR"):((r=H(c,"sellps"))&&((i=ce(r))||G(-9),K(c,i.major),K(c,i.ell)),l=H(c,"da"),H(c,"tes")?h=H(c,"des"):H(c,"te")?h=(a=H(c,"de"))*a:H(c,"trf")?((a=H(c,"drf"))||G(-10),h=(a=1/a)*(2-a)):H(c,"tf")?h=(a=H(c,"df"))*(2-a):H(c,"tb")&&(h=1-(o=H(c,"db"))*o/(l*l)),o||(o=l*f(1-h)),H(c,"bR_A")?(l*=1-h*(u+h*(.04722222222222222+.022156084656084655*h)),h=0):H(c,"bR_V")?l*=1-h*(u+h*(.06944444444444445+.04243827160493827*h)):H(c,"bR_a")?(l=.5*(l+o),h=0):H(c,"bR_g")?(l=f(l*o),h=0):H(c,"bR_h")?(l+o===0&&G(-20),l=2*l*o/(l+o),h=0):(s=H(c,"tR_lat_a")||H(c,"tR_lat_g"))&&(a=n(H(c,s?"rR_lat_a":"rR_lat_g")),e(a)>k&&G(-11),a=1-h*a*a,l*=s?.5*(1-h+a)/(a*f(a)):f(1-h)/a,h=0)),h<0&&G(-12),l<=0&&G(-13),t.es=h,t.a=l}(o),o.a_orig=o.a,o.es_orig=o.es,o.e=f(o.es),o.ra=1/o.a,o.one_es=1-o.es,o.one_es||G(-6),o.rone_es=1/o.one_es,function(e){return 1==e.datum_type&&e.datum_params[0]==e.datum_params[1]==e.datum_params[2]===0&&6378137==e.a&&Math.abs(e.es-.00669437999)<5e-11}(o)&&(o.datum_type=4),o.geoc=!!o.es&&H(a,"bgeoc"),o.over=H(a,"bover"),o.has_geoid_vgrids=H(a,"tgeoidgrids"),o.has_geoid_vgrids&&H(a,"sgeoidgrids"),o.is_long_wrap_set=H(a,"tlon_wrap"),o.is_long_wrap_set&&(o.long_wrap_center=H(a,"rlon_wrap"),e(o.long_wrap_center)<10*P==0&&G(-14)),H(a,"saxis")&&function(e){var t="ewnsud",n=H(e.params,"saxis");3!=n.length&&G(T),-1!=t.indexOf(n[0])&&-1!=t.indexOf(n[1])&&-1!=t.indexOf(n[2])||G(T),e.axis=n}(o),o.lam0=H(a,"rlon_0"),o.phi0=H(a,"rlat_0"),o.x0=H(a,"dx_0"),o.y0=H(a,"dy_0"),H(a,"tk_0")?o.k0=H(a,"dk_0"):H(a,"tk")?o.k0=H(a,"dk"):o.k0=1,o.k0<=0&&G(-31),function(e){var t,n,r,i=e.params;(t=H(i,"sunits"))&&((r=le(t))||G(-7),n=r.to_meter),n||(n=H(i,"sto_meter"))?(e.to_meter=ve(n),e.fr_meter=1/e.to_meter):e.to_meter=e.fr_meter=1,n=null,(t=H(i,"svunits"))&&((r=le(t))||G(-7),n=r.to_meter),n||H(i,"svto_meter")?(e.vto_meter=ve(n),e.vfr_meter=1/e.vto_meter):(e.vto_meter=e.to_meter,e.vfr_meter=e.fr_meter)}(o),function(e){var t,n,r,i=e.params;(t=H(i,"spm"))?(n=function(e){var t=oe.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],definition:t[1]}:null}(t),r=J(n?n.definition:t),isNaN(r)&&G(-46),e.from_greenwich=r):e.from_greenwich=0}(o),i.init(o),o}function ye(e,t){var n=X(t),r=["datum","ellps","a","b","rf","f"].reduce(function(t,n){return t||n in e},!1);Object.keys(n).forEach(function(t){t in e||"ellps"==t&&r||(e[t]=n[t])})}function ve(e){var t=e.split("/"),n=Y(t[0]);return t.length>1&&(n/=Y(t[1])),n}function be(e,t){var n=0,r=e*e,i=t*t;return e<=0&&(n|=4),t<=0&&(n|=8),e<t&&(n|=16),n?null:{a:e,b:t,a2:r,b2:i,e2:(r-i)/r,ep2:(r-i)/i}}function _e(e,t,i,a,o){var s,u,c,l,h=0,p=i[t],d=a[t],g=o[t];return d<-k&&d>-1.001*k?d=-k:d>k&&d<1.001*k?d=k:(d<-k||d>k)&&(h|=1),h||(p>w&&(p-=2*w),u=n(d),l=r(d),c=u*u,s=e.a/f(1-e.e2*c),i[t]=(s+g)*l*r(p),a[t]=(s+g)*l*n(p),o[t]=(s*(1-e.e2)+g)*u),h}function xe(t,n,r,i,a){var o,s,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E=1e-12,M=r[n],I=i[n],C=a[n];if(h=f(M*M+I*I),p=f(M*M+I*I+C*C),h/t.a<E){if(s=0,p/t.a<E)return r[n]=0,i[n]=k,a[n]=-t.b,0}else s=c(I,M);d=C/p,g=h/p,m=1/f(1-t.e2*(2-t.e2)*g*g),b=g*(1-t.e2)*m,_=d*m,A=0;do{A++,l=h*b+C*_-(y=t.a/f(1-t.e2*_*_))*(1-t.e2*_*_),v=t.e2*y/(y+l),S=(w=d*(m=1/f(1-v*(2-v)*g*g)))*b-(x=g*(1-v)*m)*_,b=x,_=w}while(S*S>1e-24&&A<30);o=u(w/e(x)),r[n]=s,i[n]=o,a[n]=l}function we(e,t,n){var r=n.length>2,i=[n[0]],a=[n[1]],o=[r?n[2]:0];e.is_latlong&&(i[0]*=A,a[0]*=A),z.last_errno=0,Se(e,t,i,a,o),(z.last_errno||i[0]==x)&&V(null,{point:n}),t.is_latlong&&(i[0]*=S,a[0]*=S),n[0]=i[0],n[1]=a[0],r&&(n[2]=o[0])}function Se(e,t,n,r,i){var a,o,s=n.length,u={},c={};if("enu"!=e.axis&&Ae(e.axis,!1,n,r,i),1!=e.vto_meter&&i)for(a=0;a<s;a++)i[a]*=e.vto_meter;if(e.is_geocent){if(i||G(N),1!=e.to_meter)for(a=0;a<s;a++)n[a]!=x&&(n[a]*=e.to_meter,r[a]*=e.to_meter);Ee(e.a_orig,e.es_orig,n,r,i)}else if(!e.is_latlong)if(e.inv3d||e.inv||V("source projection not invertible"),e.inv3d)V("inverse 3d transformations not supported");else for(a=0;a<s;a++)c.x=n[a],c.y=r[a],o=Ce(c,e),n[a]=o.lam,r[a]=o.phi,D();if(0!==e.from_greenwich)for(a=0;a<s;a++)n[a]!=x&&(n[a]+=e.from_greenwich);if(e.has_geoid_vgrids&&i&&V("vgrid transformation not supported"),function(e,t,n,r,i){var a,o,s,u,c=n.length;0!=e.datum_type&&0!=t.datum_type&&(function(e,t){return e.datum_type==t.datum_type&&(!(e.a_orig!=t.a_orig||Math.abs(e.es_orig-t.es_orig)>5e-11)&&(1==e.datum_type?e.datum_params[0]==t.datum_params[0]&&e.datum_params[1]==t.datum_params[1]&&e.datum_params[2]==t.datum_params[2]:2==e.datum_type?e.datum_params[0]==t.datum_params[0]&&e.datum_params[1]==t.datum_params[1]&&e.datum_params[2]==t.datum_params[2]&&e.datum_params[3]==t.datum_params[3]&&e.datum_params[4]==t.datum_params[4]&&e.datum_params[5]==t.datum_params[5]&&e.datum_params[6]==t.datum_params[6]:3!=e.datum_type||H(e.params,"snadgrids")==H(t.params,"snadgrids")))}(e,t)||(a=e.a_orig,o=e.es_orig,s=t.a_orig,u=t.es_orig,i||(i=new Float64Array(c)),3==e.datum_type&&(V("gridshift not implemented"),a=E,o=M),3==t.datum_type&&(s=E,u=M),o==u&&a==s&&1!=e.datum_type&&2!=e.datum_type&&1!=t.datum_type&&2!=t.datum_type||(Me(a,o,n,r,i),1!=e.datum_type&&2!=e.datum_type||function(e,t,n,r){var i,a,o,s,u,c,f,l,h=t.length,p=e.datum_params,d=p[0],g=p[1],m=p[2];if(1==e.datum_type)for(l=0;l<h;l++)t[l]!=x&&(t[l]+=d,n[l]+=g,r[l]+=m);else if(2==e.datum_type)for(s=p[3],u=p[4],c=p[5],f=p[6],l=0;l<h;l++)t[l]!=x&&(i=f*(t[l]-c*n[l]+u*r[l])+d,a=f*(c*t[l]+n[l]-s*r[l])+g,o=f*(-u*t[l]+s*n[l]+r[l])+m,t[l]=i,n[l]=a,r[l]=o)}(e,n,r,i),1!=t.datum_type&&2!=t.datum_type||function(e,t,n,r){var i,a,o,s,u,c,f,l,h=t.length,p=e.datum_params,d=p[0],g=p[1],m=p[2];if(1==e.datum_type)for(l=0;l<h;l++)t[l]!=x&&(t[l]-=d,n[l]-=g,r[l]-=m);else if(2==e.datum_type)for(s=p[3],u=p[4],c=p[5],f=p[6],l=0;l<h;l++)t[l]!=x&&(i=(t[l]-d)/f,a=(n[l]-g)/f,o=(r[l]-m)/f,t[l]=i+c*a-u*o,n[l]=-c*i+a+s*o,r[l]=u*i-s*a+o)}(t,n,r,i),Ee(s,u,n,r,i),3==t.datum_type&&pj_apply_gridshift_2(t,1,n,r,i))))}(e,t,n,r,i),t.has_geoid_vgrids&&i&&V("vgrid transformation not supported"),0!==t.from_greenwich)for(a=0;a<s;a++)n[a]!=x&&(n[a]-=t.from_greenwich);if(t.is_geocent){if(i||G(N),Me(t.a_orig,t.es_orig,n,r,i),1!=t.fr_meter)for(a=0;a<s;a++)n[a]!=x&&(n[a]*=t.fr_meter,r[a]*=t.fr_meter)}else if(t.is_latlong){if(t.is_latlong&&t.is_long_wrap_set)for(a=0;a<s;a++)if(n[a]!=x){for(;n[a]<t.long_wrap_center-w;)n[a]+=P;for(;n[a]>t.long_wrap_center+w;)n[a]-=P}}else if(t.fwd3d)V("3d transformation not supported");else for(a=0;a<s;a++)u.lam=n[a],u.phi=r[a],o=ke(u,t),n[a]=o.x,r[a]=o.y,D();if(1!=t.vto_meter&&i)for(a=0;a<s;a++)i[a]*=t.vfr_meter;return"enu"!=t.axis&&Ae(t.axis,!0,n,r,i),1==s?z.last_errno:0}function Ae(e,t,n,r,i){var a,o,s,u,c,f,l=n.length,h=0;if(t){for(s=0;s<l;s++)if(a=n[s],o=r[s],a!=x)for(i&&(h=i[s]),u=0;u<3;u++)if(2!=u||i)switch(f=0==u?n:1==u?r:i,e[u]){case"e":f[s]=a;break;case"w":f[s]=-a;break;case"n":f[s]=o;break;case"s":f[s]=-o;break;case"u":f[s]=h;break;case"d":f[s]=-h;break;default:G(T)}}else for(s=0;s<l;s++)if(a=n[s],o=r[s],a!=x)for(i&&(h=i[s]),u=0;u<3;u++)switch(c=0==u?a:1==u?o:h,e[u]){case"e":n[s]=c;break;case"w":n[s]=-c;break;case"n":r[s]=c;break;case"s":r[s]=-c;break;case"u":i&&(i[s]=c);break;case"d":i&&(i[s]=-c);break;default:G(T)}}function Ee(e,t,n,r,i){var a,o,s=n.length;for((o=be(e,0==t?e:e*f(1-t)))||G(N),a=0;a<s;a++)n[a]!=x&&xe(o,a,n,r,i)}function Me(e,t,n,r,i){var a,o,s=n.length;for((o=be(e,0===t?e:e*f(1-t)))||G(N),a=0;a<s;a++)n[a]!=x&&_e(o,a,n,r,i)&&(n[a]=r[a]=x)}function Ie(n){var r=6.283185307179586,i=3.141592653589793;return e(n)>3.14159265359&&(n+=i,n-=r*t(n/r),n-=i),n}function ke(t,n){var r={x:0,y:0},i=e(t.phi)-k;return i<=1e-12&&e(t.lam)<=10?(z.last_errno=0,e(i)<=1e-12?t.phi=t.phi<0?-k:k:n.geoc&&(t.phi=u(n.rone_es*a(t.phi))),t.lam-=n.lam0,n.over||(t.lam=Ie(t.lam)),n.fwd?(n.fwd(t,r),r.x=n.fr_meter*(n.a*r.x+n.x0),r.y=n.fr_meter*(n.a*r.y+n.y0)):r.x=r.y=x):F(-14),!z.last_errno&&isFinite(r.x)&&isFinite(r.y)||(r.x=r.y=x),r}function Ce(t,n){var r={lam:0,phi:0};return t.x<x&&t.y<x?(z.last_errno=0,n.inv?(t.x=(t.x*n.to_meter-n.x0)*n.ra,t.y=(t.y*n.to_meter-n.y0)*n.ra,n.inv(t,r),r.lam+=n.lam0,n.over||(r.lam=Ie(r.lam)),n.geoc&&e(e(r.phi)-k)>1e-12&&(r.phi=u(n.one_es*a(r.phi)))):r.lam=r.phi=x):F(-15),!z.last_errno&&isFinite(r.lam)&&isFinite(r.phi)||(r.lam=r.phi=x),r}function Pe(e,n,r,i){var a,o,s;for((e<0||e>=9)&&(e=3),a=1,s=0;s<e;s++)a*=10;return o=3600*a,function(s){var u,c,f,l,h="",p="",d="";return s===x||isNaN(s)?"":(s<0?(s=-s,(f=i||"")||(h="-")):f=r||"",c=(s=t(s*o+.5))/a%60,u=(s=t(s/(60*a)))%60,l=t(s/60)+"d",d=c.toFixed(e),d=(c=parseFloat(d))?(n?d:String(c))+'"':"",(c||u)&&2==(p=String(u)+"'").length&&n&&(p="0"+p),h+l+p+d+f)}}function Oe(e,t,n){var r,i,a,o,s,u;return"string"!=typeof e?Tn:("string"!=typeof t?(i="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",a=e,r=t):(i=e,a=t,r=n),u=Ne(o=me(i),s=me(a)),r?u(r):{forward:u,inverse:Ne(s,o)})}function Ne(e,t){return function(n){var r=Array.isArray(n);return n=r?n.concat():[n.x,n.y],we(e,t,n),r||(n={x:n[0],y:n[1]}),n}}function Te(e){var t=e.proj in Q?Q[e.proj].name:"",n=re(e),r=Ke(e);return{PROJCS:{NAME:t?r.NAME+" / "+t:"unnamed",GEOGCS:r,PROJECTION:"custom_proj4",PARAMETER:[],UNIT:Je(e),EXTENSION:["PROJ4",n+" +wktext"]}}}function Le(e){var t=e.EXTENSION;return t&&"PROJ4"==t[0]?(t[1]||"").replace(" +wktext",""):null}Oe.WGS84="+proj=longlat +datum=WGS84",Oe.toPoint=function(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t};var ze=[],Re=[];function De(e){return"string"==typeof e}function je(e){var t=Ue(e,Re);return t||(t=function(e){return Le(e)?Le:null}(e)),t||Ve("unsupported WKT definition: "+(e.NAME||"[unknown]")),t}function Fe(e){var t=Ue(e,ze);return t||(t=Te),t||Ve("unsupported projection: "+function(e){return Be(e)||"[unknown]"}(e)),t}function Ue(e,t){for(var n=0;n<t.length;n++)if((0,t[n][0])(e))return t[n][1];return null}function Be(e){return H(e.params,"sproj")}function Ge(e){return e.replace(/[-_ \/]+/g,"_").toLowerCase()}function qe(e){var t;return Array.isArray(e)?t=e:e&&e.length>0&&(t=e.split(",")),t}function Ve(e){throw new Error(e)}function $e(e){return{to_meter:e.UNIT[1]}}function Je(e){return["Meter",e.to_meter||1]}function We(e,t){var n,r,i=e.DATUM,a=i.SPHEROID,o=function(e){var t,n={northamerican1983:"NAD83",newzealand1949:"nzgd49"},r=Ze(e.NAME);if(r in n)return n[r];for(var i=0;i<ae.length&&Ze((t=ae[i])[3])!=r&&Ze(t[0])!=r;i++);return t?t[0]:null}(i),s=function(e){var t,n={international1924:"intl"},r=Ze(e[0]);if(r in n)return n[r];if(/^grs1980/.test(r))return"GRS80";if("sphere"==r)return null;for(var i=0;i<ue.length&&Ze((t=ue[i])[3])!=r&&Ze(t[0])!=r;i++);return t?t[0]:null}(a),u=t&&t.aux_sphere,c=a[1],f=a[2];return Ye(e.UNIT,"degree"),u?n="+a="+a[1]:o?n="+datum="+o:s?n="+ellps="+s:(n="+a="+c,f>0&&(n+=" +rf="+f)),!i.TOWGS84||u||o||(n+=" +towgs84="+i.TOWGS84.join(",")),((r=e.PRIMEM?e.PRIMEM[1]:0)>0||r<0)&&(n+=" +pm="+r),n}function Ze(e){return(e||"").replace(/^(GCS|D)_/i,"").replace(/[ _]/g,"").toLowerCase()}function Ye(e,t){e&&e[0].toLowerCase()!=t&&Ve("unexpected geographic units: "+geogcs.UNIT[0])}function He(e){return function(){return"+proj="+e}}function Xe(e){return function(t){var n,r;return[e.PROJECTION(t),e.PARAMETER(t),e.GEOGCS?e.GEOGCS(t):We(t.GEOGCS),(n=$e(t),r="",1!=n.to_meter&&(r="+to_meter="+n.to_meter),r),"+no_defs"].filter(function(e){return!!e}).join(" ")}}function Ke(e){return{NAME:tt(e),DATUM:Qe(e),PRIMEM:["Greenwich",0],UNIT:["degree",.017453292519943295]}}function Qe(e){var t={NAME:rt(e),SPHEROID:et(e)},n=H(e.params,"stowgs84");return/[1-9]/.test(n)&&(t.TOWGS84=n),t}function et(e){var t;return t=H(e.params,"trf")?H(e.params,"drf"):e.es?1/(1-Math.sqrt(1-e.es)):0,[nt(e),e.a,t]}function tt(e){var t;return te(e)&&(t=ut(e)),t||(t=it(e),t=/^[a-z]+$/.test(t)?t[0].toUpperCase()+t.substr(1):t.toUpperCase()),t||"UNK"}function nt(e){var t=ce(function(e){var t=it(e),n=t?se(t):null;return(n?n.ellipse_id:H(e.params,"sellps"))||""}(e));return t?t.name:"Unknown ellipsoid"}function rt(e){var t=se(it(e));return t&&t.name||"Unknown datum"}function it(e){return H(e.params,"sdatum")}function at(e){return Fe(e)(e)}function ot(e,t){return st({PROJECTION:e,PARAMETER:Ot(t)})}function st(e){return function(t){var n={GEOGCS:e.GEOGCS&&e.GEOGCS(t)||Ke(t),PROJECTION:De(e.PROJECTION)?e.PROJECTION:e.PROJECTION(t),PARAMETER:e.PARAMETER(t),UNIT:Je(t)};return n.NAME=e.NAME&&e.NAME(t,n)||function(e,t){var n=ut(e);return n||t.GEOGCS.NAME+" / "+t.PROJECTION}(t,n),{PROJCS:n}}}function ut(e){var t;return H(e.params,"tinit")&&(t=ge(H(e.params,"sinit"))),t?t.comment:""}function ct(e,t,n){var r=lt(t),i=function(e,t){return Xe({PROJECTION:He(e),PARAMETER:Pt(t)})}(e,n);pt(r,i)}function ft(e,t,n){dt(ht(e),ot(t,n))}function lt(e){var t=qe(e).map(Ge);return function(e){var n=e.PROJECTION[0];return t.indexOf(Ge(n))>-1}}function ht(e){return function(t){var n=Be(t);return n&&n==e}}function pt(e,t){"function"!=typeof e&&Ve("Missing WKT parser test"),"function"!=typeof t&&Ve("Missing WKT parse function"),Re.push([e,t])}function dt(e,t){"function"!=typeof e&&Ve("Missing WKT maker test"),"function"!=typeof t&&Ve("Missing WKT maker function"),ze.push([e,t])}pt(function(e){return gt.test(Ge(e.NAME))},function(e){return Xe({PROJECTION:He("utm"),PARAMETER:function(e){var t=gt.exec(Ge(e.NAME)),n="+zone="+t[1];return"s"==t[2].toLowerCase()&&(n+=" +south"),n}})(e)}),pt(function(e){return mt.test(Ge(e.NAME))},function(e){return Xe({PROJECTION:He("ups"),PARAMETER:function(e){var t=mt.exec(Ge(e.NAME));return"south"==t[1].toLowerCase()?"+south":""}})(e)}),dt(ht("utm"),function(e){return st({NAME:yt,PROJECTION:function(){return"Transverse_Mercator"},PARAMETER:bt})(e)}),dt(ht("ups"),function(e){return st({NAME:vt,PROJECTION:function(){return"Polar_Stereographic"},PARAMETER:_t})(e)});var gt=/UTM_zone_([0-9]{1,2})(N|S)/i,mt=/UPS_(North|South)/i;function yt(e,t){return t.GEOGCS.NAME+" / UTM zone "+H(e.params,"szone")+(H(e.params,"tsouth")?"S":"N")}function vt(e,t){return t.GEOGCS.NAME+" / UPS "+(H(e.params,"tsouth")?"South":"North")}function bt(e){return[["latitude_of_origin",0],["central_meridian",180*e.lam0/w],["scale_factor",e.k0],["false_easting",e.x0],["false_northing",e.y0]]}function _t(e){return[["latitude_of_origin",-90],["central_meridian",0],["scale_factor",.994],["false_easting",2e6],["false_northing",2e6]]}function xt(e){return H(e.params,"tlat_ts")&&0!=H(e.params,"dlat_ts")}function wt(e){return 0===e.es&&6378137==e.a}pt(lt("Mercator_2SP,Mercator_1SP,Mercator,Mercator_Auxiliary_Sphere"),Xe({GEOGCS:function(e){var t=function(e){return/(Web_Mercator|Pseudo_Mercator)/i.test(Ge(e.NAME))}(e)?{aux_sphere:!0}:null;return We(e.GEOGCS,t)},PROJECTION:He("merc"),PARAMETER:function(e){return Pt(function(e){var t=kt(e,"standard_parallel_1");return t&&0!=t[1]}(e)?"lat_ts,lat_0b":"lat_tsb,lat_ts")(e)}})),dt(ht("merc"),st({GEOGCS:function(e){return wt(e)?Ke(me("+proj=longlat +datum=WGS84")):null},PROJECTION:function(e){return xt(e)?"Mercator_2SP":"Mercator_1SP"},PARAMETER:function(e){return Ot(xt(e)?"lat_ts,lat_0b":"lat_tsb")(e)},NAME:function(e){return wt(e)?"WGS 84 / Pseudo-Mercator":null}}));var St=[["x_0","false_easting","m"],["y_0","false_northing","m"],["k_0","scale_factor","f"],["lat_0","latitude_of_center"],["lon_0","central_meridian"]],At={lat_0b:["lat_0","latitude_of_origin"],lat_0c:["lat_0",null],lat_0d:["lat_0","standard_parallel_1"],lat_1:["lat_1","standard_parallel_1"],lat_1b:["lat_1","latitude_of_point_1"],lat_1c:["lat_1","latitude_of_origin"],lat_2:["lat_2","standard_parallel_2"],lat_2b:["lat_2","latitude_of_point_2"],lat_ts:["lat_ts","standard_parallel_1"],lat_tsb:["lat_ts","latitude_of_origin"],lonc:["lonc","central_meridian"],lon_1:["lon_1","longitude_of_point_1"],lon_2:["lon_2","longitude_of_point_2"],alpha:["alpha","azimuth"],gamma:["gamma","rectified_grid_angle"],h:["h","height","f"]},Et={longitude_of_center:"central_meridian",latitude_of_origin:"latitude_of_center",latitude_of_center:"latitude_of_origin",longitude_of_1st_point:"longitude_of_point_1",longitude_of_2nd_point:"longitude_of_point_2",latitude_of_1st_point:"latitude_of_point_1",latitude_of_2nd_point:"latitude_of_point_2",k:"k_0"};function Mt(e,t,n){for(var r=0;r<n.length;r++)if(n[r][t]===e)return n[r];return null}function It(e,t,n){var r=null;return!(r=Mt(e=e.toLowerCase(),t,n))&&e in Et&&(r=Mt(Et[e],t,n)),r}function kt(e,t){for(var n,r=e.PARAMETER||[],i=0;i<r.length;i++)if(t===(n=r[i][0].toLowerCase())||t===Et[n])return r[i];return null}function Ct(e){var t=null;return e&&(t=qe(e).reduce(function(e,t){var n=At[t];return n||Ve("missing parameter rule: "+t),e.push(n),e},[])),(t||[]).concat(St)}function Pt(e){return function(t){var n=[],r=Ct(e),i=$e(t);return(t.PARAMETER||[]).forEach(function(e){var t,a=It(e[0],1,r);a?(t=function(e,t,n){var r=e[0];if("m"==e[2]&&(t*=n.to_meter),!("x_0,y_0,lat_0,lon_0".indexOf(r)>-1&&0===t||"k_0"==r&&1==t))return"+"+r+"="+t}(a,e[1],i),t&&n.push(t)):function(e){console.error("[wkt] "+e)}("unhandled parameter: "+e[0])}),n.join(" ")}}function Ot(e){return function(t){var n=[],r=Ct(e);return Object.keys(t.params).forEach(function(e){var i,a=It(e,0,r);a&&a[1]&&(i=H(t.params,"s"+e),n.push(function(e,t,n){var r,i=e[2];return r="m"==i?parseFloat(t)/n:"f"==i?parseFloat(t):W(t),[e[1],r]}(a,i,t.to_meter)))}),n}}function Nt(e){return!("lat_1"in e.params&&"lat_2"in e.params)}function Tt(e){return"omerc"==Be(e)&&("alpha"in e.params||"gamma"in e.params)}function Lt(e){return Tt(e)&&("no_uoff"in e.params||"no_off"in e.params)}function zt(e){return H(e.params,"tlat_ts")}function Rt(e){var t=JSON.stringify(jt(e));return t=(t=t.replace(/\["([A-Z0-9]+)",/g,"$1[")).replace(/"(EAST|NORTH|SOUTH|WEST)"/g,"$1")}function Dt(e){return"NAME,PROJCS,GEOGCS,GEOCCS,DATUM,SPHEROID,PRIMEM,PROJECTION,PARAMETER,UNIT,AXIS".indexOf(e)+1||999}function jt(e,t){var n,r=[];return t=t||0,function(e){return Object.keys(e).sort(function(e,t){return Dt(e)-Dt(t)})}(e).forEach(function(i){var a=e[i];!function(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}(a)?"NAME"==i?r.push(De(a)?a:a[0]):"PARAMETER"==i||"AXIS"==i?a.forEach(function(e){r.push([i].concat(e))}):De(a)?r.push([i,a]):Array.isArray(a)?r.push([i].concat(a)):((n={})[i]=a,Ve("Incorrectly formatted WKT element: "+JSON.stringify(n))):r.push([i].concat(jt(a,t+1)))}),0===t&&1==r.length&&(r=r[0]),r}function Ft(e){var t={};return Ut(e).forEach(function(e){Gt(e,t)}),t}function Ut(e){var t;e="["+(e=(e=(e=Bt(e)).replace(/([A-Z0-9]+)\[(?![^"]*[^\[,"]")/g,'["$1",')).replace(/, *([a-zA-Z]+) *(?=[,\]])/g,',"$1"'))+"]";try{t=JSON.parse(e)}catch(e){Ve("unparsable WKT format")}return t}function Bt(e){var t=0;return e.replace(/"+/g,function(e){var n=t%2==0;return t+=e.length,'"'==e||'""'==e&&n?e:n?'"'+e.substring(1).replace(/""/g,'\\"'):e.replace(/""/g,'\\"')})}function Gt(e,t){var n,r=e[0];if("GEOGCS"==r||"GEOCCS"==r||"PROJCS"==r||"DATUM"==r||"VERTCS"==r)for(t[r]={NAME:e[1]},n=2;n<e.length;n++){if(!Array.isArray(e[n]))throw Ve("WKT parse error");Gt(e[n],t[r])}else"AXIS"==r||"PARAMETER"==r?(r in t==0&&(t[r]=[]),t[r].push(e.slice(1))):t[r]=e.slice(1);return t}pt(lt("Lambert_Conformal_Conic,Lambert_Conformal_Conic_1SP,Lambert_Conformal_Conic_2SP"),Xe({PROJECTION:He("lcc"),PARAMETER:function(e){return Pt(function(e){return!kt(e,"standard_parallel_2")}(e)?"lat_1c":"lat_0b,lat_1,lat_2")(e)}})),dt(ht("lcc"),st({PROJECTION:function(e){return Nt(e)?"Lambert_Conformal_Conic_1SP":"Lambert_Conformal_Conic_2SP"},PARAMETER:function(e){return Ot(Nt(e)?"lat_1c,lat_0c":"lat_0b,lat_1,lat_2")(e)}})),pt(lt("Hotine_Oblique_Mercator,Hotine_Oblique_Mercator_Azimuth_Natural_Origin"),Xe({PROJECTION:He("omerc"),PARAMETER:function(e){return Pt("alpha,gamma,lonc")(e)+" +no_uoff"}})),dt(Lt,ot("Hotine_Oblique_Mercator","alpha,gamma,lonc")),ct("omerc","Oblique_Mercator,Hotine_Oblique_Mercator_Azimuth_Center","alpha,gamma,lonc"),dt(function(e){return Tt(e)&&!Lt(e)},ot("Oblique_Mercator","alpha,gamma,lonc")),ct("omerc","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","lat_1b,lat_2b,lon_1,lon_2"),dt(function(e){return"omerc"==Be(e)&&"lat_2"in e.params&&"lon_2"in e.params},ot("Hotine_Oblique_Mercator_Two_Point_Natural_Origin","lat_1b,lat_2b,lon_1,lon_2")),pt(lt("Stereographic,Polar_Stereographic,Stereographic_North_Pole,Stereographic_South_Pole"),Xe({PROJECTION:He("stere"),PARAMETER:function(e){var t=Pt("lat_ts,lat_tsb")(e),n=/lat_ts=([^ ]+)/.exec(t);return n&&-1==t.indexOf("lat_0=")&&(t="+lat_0="+(parseFloat(n[1])<0?-90:90)+" "+t),t}})),dt(ht("stere"),st({PROJECTION:function(e){return zt(e)?"Polar_Stereographic":"Stereographic"},PARAMETER:function(e){return zt(e)?Ot("lat_tsb,lat_0c")(e):Ot("lat_0b")(e)}})),ft("vandg","VanDerGrinten"),pt(lt("VanDerGrinten,Van_der_Grinten_I"),Xe({PROJECTION:He("vandg"),PARAMETER:function(e){var t=Pt("")(e);return t&&(t+=" "),t+"+R_A"}})),[["aitoff","Aitoff","lat1"],["aea","Albers_Conic_Equal_Area,Albers","lat_1,lat_2"],["aeqd","Azimuthal_Equidistant"],["bonne","Bonne","lat_1"],["cass","Cassini_Soldner,Cassini"],["cea","Cylindrical_Equal_Area","lat_ts"],["eck1","Eckert_I"],["eck2","Eckert_II"],["eck3","Eckert_III"],["eck4","Eckert_IV"],["eck5","Eckert_V"],["eck6","Eckert_VI"],["eqdc","Equidistant_Conic","lat_1,lat_2"],["eqc","Plate_Carree,Equirectangular,Equidistant_Cylindrical","lat_ts"],["gall","Gall_Stereographic"],["gnom","Gnomonic"],["laea","Lambert_Azimuthal_Equal_Area"],["loxim","Loximuthal","lat_1"],["mill","Miller_Cylindrical"],["moll","Mollweide"],["nsper","Vertical_Near_Side_Perspective","h"],["nzmg","New_Zealand_Map_Grid","lat_0b"],["ortho","Orthographic","lat_0b"],["poly","Polyconic"],["robin","Robinson"],["sinu","Sinusoidal"],["sterea","Oblique_Stereographic,Double_Stereographic"],["tmerc","Transverse_Mercator,Gauss_Kruger","lat_0b"],["tpeqd","Two_Point_Equidistant","lat_1b,lat_2b,lon_1,lon_2"],["wag1","Wagner_I"],["wag2","Wagner_II"],["wag3","Wagner_III","lat_ts"],["wag4","Wagner_IV"],["wag5","Wagner_V"],["wag6","Wagner_VI"],["wag7","Wagner_VII"],["wink1","Winkel_I","lat_ts"],["wink2","Winkel_II"],["wintri","Winkel_Tripel","lat_1"]].forEach(function(e){var t=e[2]||null;ct(e[0],e[1],t),ft(e[0],e[1].split(",")[0],t)});var qt,Vt,$t={};function Jt(e,t,n){var r;return t>=1e-7?n*(e/(1-(r=t*e)*r)-.5/t*p((1-r)/(1+r))):e+e}function Wt(e,t,n){return t/f(1-n*e*e)}function Zt(t,i,a){var s,u,l,h,g,m,y,v,b,_,w,S,A,E;t.fwd=function(e,i){var a,o=e.lam;(a=l-(y?u*Jt(n(e.phi),t.e,t.one_es):g*n(e.phi)))<0&&U(),a=h*f(a),i.x=a*n(o*=u),i.y=m-a*r(o)},t.inv=function(i,a){var f=i.x,v=m-i.y,b=d(f,v);0!=b?(u<0&&(b=-b,f=-f,v=-v),a.phi=b/h,y?(a.phi=(l-a.phi*a.phi)/u,e(s-e(a.phi))>1e-7?(a.phi=function(t,i,a){var s,u,c,f,l,h,d=15,g=1e-7,m=1e-10;if(s=o(.5*t),i<g)return s;h=d;do{s+=l=.5*(f=1-(c=i*(u=n(s)))*c)*f/r(s)*(t/a-u/f+.5/i*p((1-c)/(1+c)))}while(e(l)>m&&--h);return h?s:x}(a.phi,t.e,t.one_es))==x&&B():a.phi=a.phi<0?-k:k):e(a.phi=(l-a.phi*a.phi)/g)<=1?a.phi=o(a.phi):a.phi=a.phi<0?-k:k,a.lam=c(f,v)/u):(a.lam=0,a.phi=u>0?k:-k)},e(i+a)<L&&q(-21),u=b=n(i),v=r(i),_=e(i-a)>=L,(y=t.es>0)?(Yt(t.es),E=Wt(b,v,t.es),A=Jt(b,t.e,t.one_es),_&&(S=Wt(b=n(a),v=r(a),t.es),w=Jt(b,t.e,t.one_es),u=(E*E-S*S)/(w-A)),s=1-.5*t.one_es*p((1-t.e)/(1+t.e))/t.e,m=(h=1/u)*f((l=E*E+u*A)-u*Jt(n(t.phi0),t.e,t.one_es))):(_&&(u=.5*(u+n(a))),m=(h=1/u)*f((l=v*v+(g=u+u)*b)-g*n(t.phi0)))}function Yt(e){var t,n=.046875,r=.01953125,i=.01068115234375,a=[];return a[0]=1-e*(.25+e*(n+e*(r+e*i))),a[1]=e*(.75-e*(n+e*(r+e*i))),a[2]=(t=e*e)*(.46875-e*(.013020833333333334+.007120768229166667*e)),a[3]=(t*=e)*(.3645833333333333-.005696614583333333*e),a[4]=t*e*.3076171875,a}function Ht(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}function Xt(t,i,a){var o,s,u,c=1/(1-i);u=t;for(var l=10;l>0;--l)if(s=1-i*(o=n(u))*o,u-=s=(Ht(u,o,r(u),a)-t)*(s*f(s))*c,e(s)<1e-11)return u;return F(z),u}function Kt(t){var n=e(t);return n>=1?(n>1.00000000000001&&F(-19),t<0?-k:k):o(t)}function Qt(t){var n=e(t);return n>=1?(n>1.00000000000001&&F(-19),t<0?w:0):s(t)}function en(e){return e<=0?0:f(e)}function tn(t,n){return e(t)<1e-50&&e(n)<1e-50?0:c(t,n)}function nn(t){var i=t.opaque||{mode:0};t.inv=function(t,a){var o,u,c,f,h,p,d,g,m,y,v,b,_,x,S,A,E,M=1e-12,I=0;if(e(t.x)<M&&e(t.y)<M)return a.phi=0,void(a.lam=0);a.phi=t.y,a.lam=t.x;do{o=0;do{for(b=n(.5*a.lam),S=r(.5*a.lam),_=n(a.phi),c=1-(u=(x=r(a.phi))*S)*u,f=2*(u=s(u)/l(c,1.5))*c*x*b,h=u*c*_,p=2*(b*S*_*x/c-u*_*b),d=x*x*b*b/c+u*x*S*_*_,g=_*_*S/c+u*b*b*x,m=.5*(_*x*b/c-u*_*x*x*b*S),i.mode&&(f=.5*(f+a.lam*i.cosphi1),h=.5*(h+a.phi),p*=.5,d=.5*(d+i.cosphi1),g=.5*(g+1),m*=.5),f-=t.x,v=((h-=t.y)*p-f*g)/(y=p*m-g*d),y=(f*m-h*d)/y;v>w;)v-=w;for(;v<-w;)v+=w;a.phi-=y,a.lam-=v}while((e(y)>M||e(v)>M)&&o++<10);a.phi>k&&(a.phi-=2*(a.phi-k)),a.phi<-k&&(a.phi-=2*(a.phi+k)),e(e(a.phi)-k)<M&&!i.mode&&(a.lam=0),(u=s(r(a.phi)*r(c=.5*a.lam)))?(A=2*u*r(a.phi)*n(c)*(E=1/n(u)),E*=u*n(a.phi)):A=E=0,i.mode&&(A=.5*(A+a.lam*i.cosphi1),E=.5*(E+a.phi))}while((e(t.x-A)>M||e(t.y-E)>M)&&I++<20)},t.fwd=function(e,t){var a,o;(o=s(r(e.phi)*r(a=.5*e.lam)))?(t.x=2*o*r(e.phi)*n(a)*(t.y=1/n(o)),t.y*=o*n(e.phi)):t.x=t.y=0,i.mode&&(t.x=.5*(t.x+e.lam*i.cosphi1),t.y=.5*(t.y+e.phi))},t.es=0}function rn(t,r,i){t.es=0,t.fwd=function(t,a){var o,s,u=2.4674011002723395;a.y=r?k*n(t.phi):t.phi,(o=e(t.lam))>=1e-10?(i&&o>=k?a.x=f(u-t.phi*t.phi+1e-10)+o-k:(s=.5*(u/o+o),a.x=o-s+f(s*s-a.y*a.y)),t.lam<0&&(a.x=-a.x)):a.x=0}}function an(e){var t,n=[];return n[0]=.3333333333333333*e,t=e*e,n[0]+=.17222222222222222*t,n[1]=.06388888888888888*t,t*=e,n[0]+=.10257936507936508*t,n[1]+=.0664021164021164*t,n[2]=.01677689594356261*t,n}function on(e,t){var r=e+e;return e+t[0]*n(r)+t[1]*n(r+r)+t[2]*n(r+r+r)}function sn(e,t){e.es=0,e.fwd=function(e,n){n.y=t.C_y*e.phi,n.x=t.C_x*e.lam*(t.A+en(1-t.B*e.phi*e.phi))},e.inv=function(e,n){n.phi=e.y/t.C_y,n.lam=e.x/(t.C_x*(t.A+en(1-t.B*n.phi*n.phi)))}}function un(t){var i,o,s,l,h,y,v=[],b=[],_=[],w=[];function S(e,t){for(var i,a=2*r(2*t),o=e.length-1,s=e[o],u=0;--o>=0;)i=a*s-u+e[o],u=s,s=i;return t+i*n(2*t)}function A(e,t,i){for(var a,o,s=n(t),u=r(t),c=g(i),f=m(i),l=2*u*f,h=-2*s*c,p=e.length-1,d=e[p],y=0,v=0,b=0;--p>=0;)a=v,o=y,d=l*(v=d)-a-h*(y=b)+e[p],b=h*v-o+l*y;return[(l=s*f)*d-(h=u*c)*b,l*b+h*d]}t.es<=0&&q(-34),h=l=(s=t.es/(1+f(1-t.es)))/(2-s),v[0]=l*(2+l*(-2/3+l*(l*(116/45+l*(26/45+l*(-2854/675)))-2))),b[0]=l*(l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))-2),h*=l,v[1]=h*(7/3+l*(l*(-227/45+l*(2704/315+l*(2323/945)))-1.6)),b[1]=h*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),h*=l,v[2]=h*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),b[2]=h*(-26/15+l*(34/21+l*(1.6+l*(-12686/2835)))),h*=l,v[3]=h*(4279/630+l*(-332/35+l*(-399572/14175))),b[3]=h*(1237/630+l*(l*(-24832/14175)-2.4)),h*=l,v[4]=h*(4174/315+l*(-144838/6237)),b[4]=h*(-734/315+l*(109598/31185)),h*=l,v[5]=h*(601676/22275),b[5]=h*(444337/155925),h=l*l,i=t.k0/(1+l)*(1+h*(1/4+h*(1/64+h/256))),_[0]=l*(l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))-.5),w[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),_[1]=h*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),w[1]=h*(13/48+l*(l*(557/1440+l*(281/630+l*(-1983433/1935360)))-.6)),h*=l,_[2]=h*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),w[2]=h*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),h*=l,_[3]=h*(-4397/161280+l*(11/504+l*(830251/7257600))),w[3]=h*(49561/161280+l*(-179/168+l*(6601661/7257600))),h*=l,_[4]=h*(-4583/161280+l*(108847/3991680)),w[4]=h*(34729/80640+l*(-3418889/1995840)),h*=l,_[5]=h*(-20648693/638668800),w[5]=.6650675310896665*h,y=S(b,t.phi0),o=-i*(y+function(e,t){for(var i,a=2*r(t),o=e.length-1,s=e[o],u=0;--o>=0;)i=a*s-u+e[o],u=s,s=i;return n(t)*i}(w,2*y)),t.fwd=function(t,s){var u,f,l,h,g,m,y,v=t.phi,_=t.lam;v=S(b,v),u=n(v),f=r(v),h=n(_),l=r(_),v=c(u,l*f),_=c(h*f,d(u,f*l)),m=a(_),y=function(e){var t=1+e,n=t-1;return 0===n?e:e*p(t)/n}((y=e(m))*(1+y/(d(1,y)+1))),g=A(w,2*v,2*(_=m<0?-y:y)),v+=g[0],_+=g[1],e(_)<=2.623395162778?(s.y=i*v+o,s.x=i*_):s.x=s.y=x},t.inv=function(t,a){var s,f,l,h,p,m=t.y,y=t.x;m=(m-o)/i,e(y/=i)<=2.623395162778?(m+=(p=A(_,2*m,2*y))[0],y+=p[1],y=u(g(y)),s=n(m),f=r(m),h=n(y),l=r(y),y=c(h,l*f),m=c(s*l,d(h,l*f)),a.phi=S(v,m),a.lam=y):a.phi=a.lam=x}}function cn(t){var i;t.es?(i=Yt(t.es),t.fwd=function(e,a){var o,s;a.y=Ht(e.phi,o=n(e.phi),s=r(e.phi),i),a.x=e.lam*s/f(1-t.es*o*o)},t.inv=function(a,o){var s=e(o.phi=Xt(a.y,t.es,i));s<k?(s=n(o.phi),o.lam=a.x*f(1-t.es*s*s)/r(o.phi)):s-L<k?o.lam=0:B()}):fn(t,0,1)}function fn(t,i,a){var o,s;o=(s=f((i+1)/a))/(i+1),t.es=0,t.fwd=function(t,u){var c,f,l;if(i){for(c=a*n(t.phi),l=8;l&&(t.phi-=f=(i*t.phi+n(t.phi)-c)/(i+r(t.phi)),!(e(f)<1e-7));--l);l||U()}else t.phi=1!=a?Kt(a*n(t.phi)):t.phi;u.x=o*t.lam*(i+r(t.phi)),u.y=s*t.phi},t.inv=function(e,t){e.y/=s,t.phi=i?Kt((i*e.y+n(e.y))/a):1!=a?Kt(n(e.y)/a):e.y,t.lam=e.x/(o*(i+r(e.y)))}}function ln(e){pn(e,hn(0,k))}function hn(e,t){var r=n(t),i=t+t,a=f(P*r/(i+n(i)));return{C_x:2*a/w,C_y:a/r,C_p:i+n(i)}}function pn(t,i){t.fwd=function(t,a){var o,s,u;for(o=i.C_p*n(t.phi),u=10;u&&(t.phi-=s=(t.phi+n(t.phi)-o)/(1+r(t.phi)),!(e(s)<1e-7));--u);u?t.phi*=.5:t.phi=t.phi<0?-k:k,a.x=i.C_x*t.lam*r(t.phi),a.y=i.C_y*n(t.phi)},t.inv=function(t,a){a.phi=Kt(t.y/i.C_y),a.lam=t.x/(i.C_x*r(a.phi)),e(a.lam)-w<L?(a.phi+=a.phi,a.phi=Kt((a.phi+n(a.phi))/i.C_p)):a.lam=a.phi=x},t.es=0}function dn(r,i){var a,s,u,c,h,p=[[0,-1],[1,0]],d=[[-1,0],[0,-1]],g=[[0,1],[-1,0]],m=[[[1,0],[0,1]],p,d,g,g,d,p],v=1e-15;function _(r,i){var a=r.lam,s=r.phi,u=o(2/3);if(e(s)<=u)i.x=a,i.y=3*w/8*n(s);else{var c,l=f(3*(1-e(n(s)))),h=t(2*a/w+2);h>=4&&(h=3),c=-3*I+k*h,i.x=c+(a-c)*l,i.y=A(s)*I*(2-l)}}function S(n,r){var i=n.x,a=n.y,s=I;if(e(a)<=s)r.lam=i,r.phi=o(8*a/(3*w));else if(e(a)<k){var u,c,f=t(2*i/w+2);f>=4&&(f=3),u=-3*I+k*f,c=2-4*e(a)/w,r.lam=u+(i-u)/c,r.phi=A(a)*o(1-l(c,2)/3)}else r.lam=-w,r.phi=A(a)*k}function A(e){return e>0?1:e<0?-1:0}function E(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case-1:return 4;case-2:return 5;case-3:return 6}return 0}function M(e,t){return function(e,t,n){var r,i,a,o,s,u=0,c=e.length;for(s=0;s<c;s++)if(t==e[s][0]&&n==e[s][1])return!0;for(r=e[0][0],i=e[0][1],s=1;s<c;s++)a=e[s%c][0],o=e[s%c][1],n>y(i,o)&&n<=b(i,o)&&t<=b(r,a)&&i!=o&&(r==a||t<=(n-i)*(a-r)/(o-i)+r)&&u++,r=a,i=o;return u%2!=0}(h,e,t)}function C(t,r,i){if(i)return on(r,c);var a=Jt(n(r),t.e,1-t.es)/u;return e(a)>1&&(a=A(a)),o(a)}function P(e,t,n,r){var i,a,o,s,u,c,f=0,l=function(e,t,n,r,i){var a,o={};if(o.x=e,o.y=t,i){if(t>I)o.region="north",o.x=-3*I+n*k,o.y=k,e-=n*k;else{if(!(t<-I))return o.region="equatorial",o.cn=0,o;o.region="south",o.x=-3*I+r*k,o.y=-k,e-=r*k}"north"==o.region?o.cn=t>=-e-I-v&&t<e+5*I-v?(n+1)%4:t>-e-I+v&&t>=e+5*I-v?(n+2)%4:t<=-e-I+v&&t>e+5*I+v?(n+3)%4:n:"south"==o.region&&(o.cn=t<=e+I+v&&t>-e-5*I+v?(r+1)%4:t<e+I-v&&t<=-e-5*I+v?(r+2)%4:t>=e+I-v&&t<-e-5*I-v?(r+3)%4:r)}else{if(t>I)o.region="north",a=k;else{if(!(t<-I))return o.region="equatorial",o.cn=0,o;o.region="south",a=-k}e<-k?(o.cn=0,o.x=-3*I,o.y=a):e>=-k&&e<0?(o.cn=1,o.x=-I,o.y=a):e>=0&&e<k?(o.cn=2,o.x=I,o.y=a):(o.cn=3,o.x=3*I,o.y=a)}return o}(e.x,e.y,t,n,r);if("equatorial"==l.region)return e.x=l.x,void(e.y=l.y);i=[e.x,e.y],a=[l.x,l.y],r?"north"==l.region?(f=t,c=m[E(-1*(l.cn-f))]):(f=n,c=m[E(l.cn-f)]):"north"==l.region?(f=t,c=m[E(l.cn-f)]):(f=n,c=m[E(-1*(l.cn-f))]),s=function(e,t){return[e[0]-t[0],e[1]-t[1]]}(i,a),u=function(e,t){var n,r,i=[0,0];for(n=0;n<2;n++)for(r=0;r<2;r++)i[n]+=e[n][r]*t[r];return i}(c,s),o=function(e,t){return[e[0]+t[0],e[1]+t[1]]}(u,[-3*I+(r?l.cn:0)*k,k]),e.x=o[0],e.y=o[1]}i?(a=H(r.params,"inorth_square"),s=H(r.params,"isouth_square"),(a<0||a>3)&&q(-47),(s<0||s>3)&&q(-47),h=[[-w-v,I+v],[a*k-w-v,I+v],[a*k-w-v,3*I+v],[(a+1)*k-w+v,3*I+v],[(a+1)*k-w+v,I+v],[w+v,I+v],[w+v,-I-v],[(s+1)*k-w+v,-I-v],[(s+1)*k-w+v,-3*I-v],[s*k-w-v,-3*I-v],[s*k-w-v,-I-v],[-w-v,-I-v]],0!=r.es?(c=an(r.es),u=Jt(1,r.e,r.one_es),r.a=r.a*f(.5*u),r.ra=1/r.a,r.fwd=function(e,t){return e.phi=C(r,e.phi,0),_(e,t),P(t,a,s,0)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);P(e,a,s,1),S(e,t),t.phi=C(r,t.phi,1)}):(r.fwd=function(e,t){_(e,t),P(t,a,s,0)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);P(e,a,s,1),S(e,t)})):(h=[[-w-v,I],[-3*I,k+v],[-k,I+v],[-I,k+v],[0,I+v],[I,k+v],[k,I+v],[3*I,k+v],[w+v,I],[w+v,-I],[3*I,-k-v],[k,-I-v],[I,-k-v],[0,-I-v],[-I,-k-v],[-k,-I-v],[-3*I,-k-v],[-w-v,-I]],0!=r.es?(c=an(r.es),u=Jt(1,r.e,r.one_es),r.a=r.a*f(.5*u),r.ra=1/r.a,r.fwd=function(e,t){e.phi=C(r,e.phi,0),_(e,t)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);S(e,t),t.phi=C(r,t.phi,1)}):(r.fwd=function(e,t){_(e,t)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);S(e,t)}))}function gn(e){e.x0=0,e.y0=0,e.is_latlong=!0,e.fwd=function(t,n){n.x=t.lam/e.a,n.y=t.phi/e.a},e.inv=function(t,n){n.lam=t.x*e.a,n.phi=t.y*e.a}}function mn(e,t,n){return t*=n,a(.5*(k-e))/l((1-t)/(1+t),.5*n)}function yn(t,r){var i,a,o=.5*r,s=k-2*u(t),c=15;do{i=r*n(s),s+=a=k-2*u(t*l((1-i)/(1+i),o))-s}while(e(a)>1e-10&&--c);return c<=0&&F(-18),s}function vn(e,t){var n,r,i,a=t.length-1;for(r=t[a][0],i=t[a][1];--a>=0;)n=r,r=t[a][0]+e.r*n-e.i*i,i=t[a][1]+e.r*i+e.i*n;return{r:e.r*r-e.i*i,i:e.r*i+e.i*r}}function bn(e,t,n){var r,i,a,o,s,u=!0,c=t.length-1;for(i=o=t[c][0],r=a=t[c][1];--c>=0;)u?u=!1:(o=i+e.r*(s=o)-e.i*a,a=r+e.r*a+e.i*s),i=t[c][0]+e.r*(s=i)-e.i*r,r=t[c][1]+e.r*r+e.i*s;return n.r=i+e.r*o-e.i*a,n.i=r+e.r*a+e.i*o,{r:e.r*i-e.i*r,i:e.r*r+e.i*i}}function _n(t,i){var o,s,f,h,p=1e-12;0!=t.es?(o=t.e*n(t.phi0),s=2*u(a(.5*(k+t.phi0))*l((1-o)/(1+o),.5*t.e))-k):s=t.phi0,h=n(s),f=r(s),t.inv=function(o,s){var g,m,y,v,b,_,w,S={},A={},E={},M=0,I=0,C=0,P=0;for(S.r=o.x,S.i=o.y,g=20;g&&((m=bn(S,i,A)).r-=o.x,m.i-=o.y,y=A.r*A.r+A.i*A.i,E.r=-(m.r*A.r+m.i*A.i)/y,E.i=-(m.i*A.r-m.r*A.i)/y,S.r+=E.r,S.i+=E.i,!(e(E.r)+e(E.i)<=p));--g);if(g){if(M=d(S.r,S.i),v=2*u(.5*M),I=n(v),C=r(v),s.lam=t.lam0,e(M)<=p)return s.lam=0,void(s.phi=t.phi0);for(P=b=Kt(C*h+S.i*I*f/M),g=20;g&&(_=t.e*n(P),P+=w=2*u(a(.5*(k+b))*l((1+_)/(1-_),.5*t.e))-k-P,!(e(w)<=p));--g);}g?(s.phi=P,s.lam=c(S.r*I,M*f*C-S.i*h*I)):s.lam=s.phi=x},t.fwd=function(e,o){var s,c,p,d,g,m,y,v={};s=n(e.lam),c=r(e.lam),p=t.e*n(e.phi),d=2*u(a(.5*(k+e.phi))*l((1-p)/(1+p),.5*t.e))-k,g=n(d),m=r(d),y=2/(1+h*g+f*m*c),v.r=y*m*s,v.i=y*(f*g-h*m*c),v=vn(v,i),o.x=v.r,o.y=v.i}}function xn(t,i,a,s){var u,l,h,p,g,m,y,v,b,_,x,w,S=!isNaN(a)&&!isNaN(s);i<=0&&q(-30),S&&(b=r(s),_=n(s),w=r(a),x=n(a)),e(e(t.phi0)-k)<L?u=t.phi0<0?1:0:e(t.phi0)<L?u=2:(u=3,l=n(t.phi0),h=r(t.phi0)),m=i/t.a,g=1/(p=1+m),y=(p+1)*(v=1/m),t.fwd=function(e,t){var i,a,o,s,c;switch(o=n(e.phi),a=r(e.phi),i=r(e.lam),u){case 3:t.y=l*o+h*a*i;break;case 2:t.y=a*i;break;case 1:t.y=-o;break;case 0:t.y=o}switch(t.y<g&&U(),t.y=m/(p-t.y),t.x=t.y*a*n(e.lam),u){case 3:t.y*=h*o-l*a*i;break;case 2:t.y*=o;break;case 0:i=-i;case 1:t.y*=a*i}S&&(c=1/((s=t.y*b+t.x*_)*x*v+w),t.x=(t.x*b-t.y*_)*w*c,t.y=s*c)},t.inv=function(r,i){var a,s,g,v,A,E;if(S&&(E=1/(m-r.y*x),v=m*r.x*E,A=m*r.y*w*E,r.x=v*b+A*_,r.y=A*b-v*_),a=d(r.x,r.y),(g=1-a*a*y)<0&&B(),g=(p-f(g))/(m/a+a/m),s=f(1-g*g),e(a)<=L)i.lam=0,i.phi=t.phi0;else{switch(u){case 3:i.phi=o(s*l+r.y*g*h/a),r.y=(s-l*n(i.phi))*a,r.x*=g*h;break;case 2:i.phi=o(r.y*g/a),r.y=s*a,r.x*=g;break;case 0:i.phi=o(s),r.y=-r.y;break;case 1:i.phi=-o(s)}i.lam=c(r.x,r.y)}},t.es=0}function wn(e,t){var n=.79788456,r=.1013211836*(t?2:4);e.es=0,e.fwd=function(e,t){t.x=n*e.lam*(1-r*e.phi*e.phi),t.y=n*e.phi},e.inv=function(e,t){t.phi=e.y/n,t.lam=e.x/(n*(1-r*t.phi*t.phi))}}function Sn(e,t,i){e.es=0,e.fwd=function(e,a){e.phi=Kt(.883883476*n(e.phi)),a.x=t*e.lam*r(e.phi),a.x/=r(e.phi*=.333333333333333),a.y=i*n(e.phi)},e.inv=function(e,a){a.phi=Kt(e.y/i),a.lam=e.x*r(a.phi)/t,a.phi*=3,a.lam/=r(a.phi),a.phi=Kt(1.13137085*n(a.phi))}}function An(e,t){var n=t?1.5:2,r=t?.5:1,i=1.01346,a=1.2158542;e.es=0,e.fwd=function(e,t){t.x=i*e.lam*(n-r*f(1+a*e.phi*e.phi)),t.y=i*e.phi},e.inv=function(e,t){t.phi=e.y/i,t.lam=e.x/(i*(n-r*f(1+a*t.phi*t.phi)))}}function En(t,r){var i,a,o,s,u,c=1.732050807568877;r?(o=.44329,s=.80404,i=6,a=5.61125,u=3):(o=1.01346,s=.9191,i=4,a=2.147143718212938,u=2),t.es=0,t.fwd=function(t,r){var l,h,d,g;for(l=a*n(t.phi),t.phi*=1.10265779,g=10;g&&(h=f(1+t.phi*t.phi),t.phi-=d=((i-h)*t.phi-p(t.phi+h)-l)/(i-2*h),!(e(d)<1e-10));--g);g||(t.phi=l<0?-c:c),r.x=o*t.lam*(u-f(1+t.phi*t.phi)),r.y=s*t.phi},t.inv=function(e,t){var n;t.phi=e.y/s,n=f(1+t.phi*t.phi),t.lam=e.x/(o*(u-n)),t.phi=Kt(((i-n)*t.phi-p(t.phi+n))/a)}}function Mn(t){return function(i){!function(t,i){var o,s,l,h,p,g,m,y,v,b,_=1e-10;switch(H(t.params,"tlat_1")&&H(t.params,"tlat_2")?(l=H(t.params,"rlat_1"),h=H(t.params,"rlat_2"),y=.5*(h+l),(e(o=.5*(h-l))<_||e(y)<_)&&q(-42)):q(-41),i){case"TISSOT":p=n(y),s=r(o),m=f(((g=p/s+s/p)-2*n(t.phi0))/p);break;case"MURD1":g=n(o)/(o*a(y))+y,m=g-t.phi0,p=n(y);break;case"MURD2":g=(s=f(r(o)))/a(y),m=g+a(y-t.phi0),p=n(y)*s;break;case"MURD3":g=o/(a(y)*a(o))+y,m=g-t.phi0,p=n(y)*n(o)*a(o)/(o*o);break;case"EULER":p=n(y)*n(o)/o,g=(o*=.5)/(a(o)*a(y))+y,m=g-t.phi0;break;case"PCONIC":p=n(y),b=r(o),v=1/a(y),e(o=t.phi0-y)-_>=k&&q(-43),m=b*(v-a(o));break;case"VITK1":p=(s=a(o))*n(y)/o,g=o/(s*a(y))+y,m=g-t.phi0}function x(e,t){var o;switch(i){case"MURD2":o=g+a(y-e.phi);break;case"PCONIC":o=b*(v-a(e.phi-y));break;default:o=g-e.phi}t.x=o*n(e.lam*=p),t.y=m-o*r(e.lam)}function w(e,t){var n;switch(n=d(e.x,e.y=m-e.y),p<0&&(n=-n,e.x=-e.x,e.y=-e.y),t.lam=c(e.x,e.y)/p,i){case"PCONIC":t.phi=u(v-n/b)+y;break;case"MURD2":t.phi=y-u(n-g);break;default:t.phi=g-n}}t.inv=w,t.fwd=x,t.es=0}(i,t)}}function In(t,i){var s,h,p,g,m,y,v,b,_=1e-10;if(b=e((h=e(t.phi0))-k)<_?t.phi0<0?0:1:h>_?2:3,i=e(i),t.es){switch(b){case 1:case 0:e(i-k)<_?v=2*t.k0/f(l(1+t.e,1+t.e)*l(1-t.e,1-t.e)):(v=r(i)/mn(i,h=n(i),t.e),h*=t.e,v/=f(1-h*h));break;case 3:case 2:h=n(t.phi0),s=2*u(x(t.phi0,h,t.e))-k,h*=t.e,v=2*t.k0*r(t.phi0)/f(1-h*h),m=n(s),y=r(s)}t.fwd=function(e,i){var a,o,s,c,f,l=0,h=0;switch(a=r(e.lam),o=n(e.lam),f=n(e.phi),(2==b||3==b)&&(l=n(s=2*u(x(e.phi,f,t.e))-k),h=r(s)),b){case 2:c=v/(y*(1+m*l+y*h*a)),i.y=c*(y*l-m*h*a),i.x=c*h;break;case 3:c=v/(1+h*a),i.y=c*l,i.x=c*h;break;case 0:e.phi=-e.phi,a=-a,f=-f;case 1:i.x=v*mn(e.phi,f,t.e),i.y=-i.x*a}i.x=i.x*o},t.inv=function(i,s){s.phi;var f,h,p,g,_=0,x=0,w=0,S=0;switch(p=d(i.x,i.y),b){case 2:case 3:f=r(_=2*c(p*y,v)),h=n(_),x=o(0==p?f*m:f*m+i.y*h*y/p),_=a(.5*(k+x)),i.x*=h,i.y=p*y*f-i.y*m*h,S=k,w=.5*t.e;break;case 1:i.y=-i.y;case 0:x=k-2*u(_=-p/v),S=-k,w=-.5*t.e}for(g=0;g<8;g++,x=s.phi)if(h=t.e*n(x),s.phi=2*u(_*l((1+h)/(1-h),w))-S,e(x-s.phi)<1e-10)return 0==b&&(s.phi=-s.phi),void(s.lam=0==i.x&&0==i.y?0:c(i.x,i.y));B()}}else{switch(b){case 2:p=n(t.phi0),g=r(t.phi0);case 3:v=2*t.k0;break;case 0:case 1:v=e(i-k)>=_?r(i)/a(I-.5*i):2*t.k0}t.fwd=function(t,i){var o=t.phi,s=n(o),u=r(o),c=r(t.lam),f=n(t.lam);switch(b){case 3:case 2:i.y=3==b?1+u*c:1+p*s+g*u*c,i.y<=_&&U(),i.x=(i.y=v/i.y)*u*f,i.y*=3==b?s:g*s-p*u*c;break;case 1:c=-c,o=-o;case 0:e(o-k)<1e-8&&U(),i.x=f*(i.y=v*a(I+.5*o)),i.y*=c}},t.inv=function(i,a){var s,f,l,h;switch(l=n(s=2*u((f=d(i.x,i.y))/v)),h=r(s),a.lam=0,b){case 3:e(f)<=_?a.phi=0:a.phi=o(i.y*l/f),0==h&&0==i.x||(a.lam=c(i.x*l,h*f));break;case 2:e(f)<=_?a.phi=t.phi0:a.phi=o(h*p+i.y*l*g/f),0==(s=h-p*n(a.phi))&&0==i.x||(a.lam=c(i.x*l*g,s*f));break;case 1:i.y=-i.y;case 0:e(f)<=_?a.phi=t.phi0:a.phi=o(0==b?-h:h),a.lam=0==i.x&&0==i.y?0:c(i.x,i.y)}}}function x(e,t,n){return t*=n,a(.5*(k+e))*l((1-t)/(1+t),.5*n)}}function kn(e,t){return l((1-e)/(1+e),t)}function Cn(e,t,i,o){var s=i/t,c=t,f=1/i;e.inv=function(e,t){var n;e.y/=c,n=r(t.phi=o?u(e.y):Kt(e.y)),t.phi/=f,t.lam=e.x/(s*r(t.phi)),o?t.lam/=n*n:t.lam*=n},e.fwd=function(e,t){var i;t.x=s*e.lam*r(e.phi),t.y=c,e.phi*=f,i=r(e.phi),o?(t.x*=i*i,t.y*=a(e.phi)):(t.x/=i,t.y*=n(e.phi))},e.es=0}function Pn(t){var i,a,u,l=1e-10,d=.5,g=.16666666666666666,m=.08333333333333333,y=.05,v=.03333333333333333,b=.023809523809523808,_=.017857142857142856;t.es?((u=Yt(t.es))||e_error_0(),a=Ht(t.phi0,n(t.phi0),r(t.phi0),u),i=t.es/(1-t.es),t.fwd=function(o,s){var c,h,p,d,x,w;o.lam<-k||o.lam>k?F(-14):(c=n(o.phi),h=r(o.phi),p=e(h)>l?c/h:0,p*=p,d=h*o.lam,x=d*d,d/=f(1-t.es*c*c),w=i*h*h,s.x=t.k0*d*(1+g*x*(1-p+w+y*x*(5+p*(p-18)+w*(14-58*p)+b*x*(61+p*(p*(179-p)-479))))),s.y=t.k0*(Ht(o.phi,c,h,u)-a+c*d*o.lam*.5*(1+m*x*(5-p+w*(9+4*w)+v*x*(61+p*(p-58)+w*(270-330*p)+_*x*(1385+p*(p*(543-p)-3111)))))))},t.inv=function(o,s){var c,l,h,p,x,w,S;s.phi=Xt(a+o.y/t.k0,t.es,u),e(s.phi)>=k?(s.phi=o.y<0?-k:k,s.lam=0):(w=n(s.phi),h=r(s.phi),S=e(h)>1e-10?w/h:0,c=i*h*h,p=o.x*f(l=1-t.es*w*w)/t.k0,l*=S,S*=S,x=p*p,s.phi-=l*x/(1-t.es)*d*(1-x*m*(5+S*(3-9*c)+c*(1-4*c)-x*v*(61+S*(90-252*c+45*S)+46*c-x*_*(1385+S*(3633+S*(4095+1575*S)))))),s.lam=p*(1-x*g*(1+2*S+c-x*y*(5+S*(28+24*S+8*c)+6*c-x*b*(61+S*(662+S*(1320+720*S))))))/h)}):(i=t.k0,a=.5*i,t.fwd=function(o,u){var c,h;o.lam<-k||o.lam>k?F(-14):(h=r(o.phi),c=h*n(o.lam),e(e(c)-1)<=l&&U(),u.x=a*p((1+c)/(1-c)),u.y=h*r(o.lam)/f(1-c*c),(c=e(u.y))>=1?c-1>l?U():u.y=0:u.y=s(u.y),o.phi<0&&(u.y=-u.y),u.y=i*(u.y-t.phi0))},t.inv=function(e,n){var a=h(e.x/i),s=.5*(a-1/a);a=r(t.phi0+e.y/i),n.phi=o(f((1-a*a)/(1+s*s))),e.y<0&&-n.phi+t.phi0<0&&(n.phi=-n.phi),n.lam=s||a?c(s,a):0})}function On(e,t){var i=.8773826753,a=1.139753528477/t;e.es=0,e.fwd=function(e,o){var s=Kt(t*n(e.phi));o.x=i*e.lam*r(s),o.y=a*s},e.inv=function(e,o){e.y/=a,o.phi=Kt(n(e.y)/t),o.lam=e.x/(i*r(e.y))}}function Nn(t,n){t.fwd=function(t,r){var i,a,o,s;o=e(O*t.phi),s=(s=1-o*o)<0?0:f(s),e(t.lam)<1e-10?(r.x=0,r.y=w*(t.phi<0?-o:o)/(1+s)):(a=.5*e(w/t.lam-t.lam/w),n?(i=o/(1+s),r.x=w*(f(a*a+1-i*i)-a),r.y=w*i):(i=(s*f(1+a*a)-a*s*s)/(1+a*a*o*o),r.x=w*i,r.y=w*f(1-i*(i+2*a)+1e-10)),t.lam<0&&(r.x=-r.x),t.phi<0&&(r.y=-r.y))},t.es=0}$t.Constants={},$t.Math={},$t.Accumulator={},(qt=$t.Constants).WGS84={a:6378137,f:1/298.257223563},qt.version={major:1,minor:48,patch:0},qt.version_string="1.48",(Vt=$t.Math).digits=53,Vt.epsilon=Math.pow(.5,Vt.digits-1),Vt.degree=Math.PI/180,Vt.sq=function(e){return e*e},Vt.hypot=function(e,t){var n,r;return e=Math.abs(e),t=Math.abs(t),n=Math.max(e,t),r=Math.min(e,t)/(n||1),n*Math.sqrt(1+r*r)},Vt.cbrt=function(e){var t=Math.pow(Math.abs(e),1/3);return e<0?-t:t},Vt.log1p=function(e){var t=1+e,n=t-1;return 0===n?e:e*Math.log(t)/n},Vt.atanh=function(e){var t=Math.abs(e);return t=Vt.log1p(2*t/(1-t))/2,e<0?-t:t},Vt.copysign=function(e,t){return Math.abs(e)*(t<0||0===t&&1/t<0?-1:1)},Vt.sum=function(e,t){var n=e+t,r=n-t,i=n-r;return{s:n,t:-((r-=e)+(i-=t))}},Vt.polyval=function(e,t,n,r){for(var i=e<0?0:t[n++];--e>=0;)i=i*r+t[n++];return i},Vt.AngRound=function(e){if(0===e)return e;var t=1/16,n=Math.abs(e);return n=n<t?t-(t-n):n,e<0?-n:n},Vt.AngNormalize=function(e){return(e%=360)<=-180?e+360:e<=180?e:e-360},Vt.LatFix=function(e){return Math.abs(e)>90?Number.NaN:e},Vt.AngDiff=function(e,t){var n=Vt.sum(Vt.AngNormalize(-e),Vt.AngNormalize(t)),r=Vt.AngNormalize(n.s),i=n.t;return Vt.sum(180===r&&i>0?-180:r,i)},Vt.sincosd=function(e){var t,n,r,i,a,o;switch(t=e%360,t-=90*(n=Math.floor(t/90+.5)),t*=this.degree,r=Math.sin(t),i=Math.cos(t),3&n){case 0:a=r,o=i;break;case 1:a=i,o=-r;break;case 2:a=-r,o=-i;break;default:a=-i,o=r}return e&&(a+=0,o+=0),{s:a,c:o}},Vt.atan2d=function(e,t){var n,r,i=0;switch(Math.abs(e)>Math.abs(t)&&(n=t,t=e,e=n,i=2),t<0&&(t=-t,++i),r=Math.atan2(e,t)/this.degree,i){case 1:r=(e>=0?180:-180)-r;break;case 2:r=90-r;break;case 3:r=-90+r}return r},function(e,t){e.Accumulator=function(e){this.Set(e)},e.Accumulator.prototype.Set=function(t){t||(t=0),t.constructor===e.Accumulator?(this._s=t._s,this._t=t._t):(this._s=t,this._t=0)},e.Accumulator.prototype.Add=function(e){var n=t.sum(e,this._t),r=t.sum(n.s,this._s);n=n.t,this._s=r.s,this._t=r.t,0===this._s?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(t){var n;return t?((n=new e.Accumulator(this)).Add(t),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1}}($t.Accumulator,$t.Math),$t.Geodesic={},$t.GeodesicLine={},$t.PolygonArea={},function(e,t,n,r,i){var a,o,s,u,c,f,l,h,p,d,g,m=20+r.digits+10,y=r.epsilon,v=200*y,b=Math.sqrt(y),_=y*v,x=1e3*b;e.tiny_=Math.sqrt(Number.MIN_VALUE),e.nC1_=6,e.nC1p_=6,e.nC2_=6,e.nC3_=6,e.nC4_=6,a=e.nC3_*(e.nC3_-1)/2,o=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=32671,e.LONG_UNROLL=32768,e.OUT_MASK=32640|e.LONG_UNROLL,e.SinCosSeries=function(e,t,n,r){var i=r.length,a=i-(e?1:0),o=2*(n-t)*(n+t),s=1&a?r[--i]:0,u=0;for(a=Math.floor(a/2);a--;)s=o*(u=o*s-u+r[--i])-s+r[--i];return e?2*t*n*s:n*(s-u)},s=function(e,t){var n,i,a,o,s,u,c,f,l,h,p,d,g=r.sq(e),m=r.sq(t),y=(g+m-1)/6;return 0===m&&y<=0?n=0:(u=y,(s=(i=g*m/4)*(i+2*(o=y*(a=r.sq(y)))))>=0?(c=i+o,c+=c<0?-Math.sqrt(s):Math.sqrt(s),u+=(f=r.cbrt(c))+(0!==f?a/f:0)):(l=Math.atan2(Math.sqrt(-s),-(i+o)),u+=2*y*Math.cos(l/3)),h=Math.sqrt(r.sq(u)+m),d=((p=u<0?m/(h-u):u+h)-m)/(2*h),n=p/(Math.sqrt(p+r.sq(d))+d)),n},u=[1,4,64,0,256],e.A1m1f=function(e){var t=Math.floor(3);return(r.polyval(t,u,0,r.sq(e))/u[t+1]+e)/(1-e)},c=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1_;++i)a=Math.floor((e.nC1_-i)/2),n[i]=s*r.polyval(a,c,u,o)/c[u+a+1],u+=a+2,s*=t},f=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1p_;++i)a=Math.floor((e.nC1p_-i)/2),n[i]=s*r.polyval(a,f,u,o)/f[u+a+1],u+=a+2,s*=t},l=[-11,-28,-192,0,256],e.A2m1f=function(e){var t=Math.floor(3);return(r.polyval(t,l,0,r.sq(e))/l[t+1]-e)/(1+e)},h=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC2_;++i)a=Math.floor((e.nC2_-i)/2),n[i]=s*r.polyval(a,h,u,o)/h[u+a+1],u+=a+2,s*=t},e.Geodesic=function(e,t){if(this.a=e,this.f=t,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/r.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(r.sq(this.a)+r.sq(this._b)*(0===this._e2?1:(this._e2>0?r.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*b/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(6),this._C3x=new Array(a),this._C4x=new Array(o),this.A3coeff(),this.C3coeff(),this.C4coeff()},p=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var e,t,n=0,i=0;for(e=5;e>=0;--e)t=Math.min(6-e-1,e),this._A3x[i++]=r.polyval(t,p,n,this._n)/p[n+t+1],n+=t+2},d=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var t,n,i,a=0,o=0;for(t=1;t<e.nC3_;++t)for(n=e.nC3_-1;n>=t;--n)i=Math.min(e.nC3_-n-1,n),this._C3x[o++]=r.polyval(i,d,a,this._n)/d[a+i+1],a+=i+2},g=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var t,n,i,a=0,o=0;for(t=0;t<e.nC4_;++t)for(n=e.nC4_-1;n>=t;--n)i=e.nC4_-n-1,this._C4x[o++]=r.polyval(i,g,a,this._n)/g[a+i+1],a+=i+2},e.Geodesic.prototype.A3f=function(e){return r.polyval(5,this._A3x,0,e)},e.Geodesic.prototype.C3f=function(t,n){var i,a,o=1,s=0;for(i=1;i<e.nC3_;++i)a=e.nC3_-i-1,o*=t,n[i]=o*r.polyval(a,this._C3x,s,t),s+=a+1},e.Geodesic.prototype.C4f=function(t,n){var i,a,o=1,s=0;for(i=0;i<e.nC4_;++i)a=e.nC4_-i-1,n[i]=o*r.polyval(a,this._C4x,s,t),s+=a+1,o*=t},e.Geodesic.prototype.Lengths=function(t,n,r,i,a,o,s,u,c,f,l,h,p){var d,g,m,y,v={},b=0,_=0,x=0,w=0;if((l&=e.OUT_MASK)&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(x=e.A1m1f(t),e.C1f(t,h),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(w=e.A2m1f(t),e.C2f(t,p),b=x-w,w=1+w),x=1+x),l&e.DISTANCE)d=e.SinCosSeries(!0,o,s,h)-e.SinCosSeries(!0,r,i,h),v.s12b=x*(n+d),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(_=b*n+(x*d-w*(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))));else if(l&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(g=1;g<=e.nC2_;++g)p[g]=x*h[g]-w*p[g];_=b*n+(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))}return l&e.REDUCEDLENGTH&&(v.m0=b,v.m12b=u*(i*o)-a*(r*s)-i*s*_),l&e.GEODESICSCALE&&(m=i*s+r*o,y=this._ep2*(c-f)*(c+f)/(a+u),v.M12=m+(y*o-s*_)*r/a,v.M21=m-(y*r-i*_)*o/u),v},e.Geodesic.prototype.InverseStart=function(t,n,i,a,o,u,c,f,l,h,p){var d,g,m,y,b,_,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R={},D=a*n-o*t,j=o*n+a*t;return R.sig12=-1,d=a*n,d+=o*t,(g=j>=0&&D<.5&&o*c<.5)?(y=r.sq(t+a),y/=y+r.sq(n+o),R.dnm=Math.sqrt(1+this._ep2*y),m=c/(this._f1*R.dnm),b=Math.sin(m),_=Math.cos(m)):(b=f,_=l),R.salp1=o*b,R.calp1=_>=0?D+o*t*r.sq(b)/(1+_):d-o*t*r.sq(b)/(1-_),S=r.hypot(R.salp1,R.calp1),A=t*a+n*o*_,g&&S<this._etol2?(R.salp2=n*b,R.calp2=D-n*a*(_>=0?r.sq(b)/(1+_):1-_),w=r.hypot(R.salp2,R.calp2),R.salp2/=w,R.calp2/=w,R.sig12=Math.atan2(S,A)):Math.abs(this._n)>.1||A>=0||S>=6*Math.abs(this._n)*Math.PI*r.sq(n)||(z=Math.atan2(-f,-l),this.f>=0?(C=(k=r.sq(t)*this._ep2)/(2*(1+Math.sqrt(1+k))+k),E=z/(I=this.f*n*this.A3f(C)*Math.PI),M=d/(I*n)):(P=o*n-a*t,O=Math.atan2(d,P),M=c/(I=((E=(N=this.Lengths(this._n,Math.PI+O,t,-n,i,a,o,u,n,o,e.REDUCEDLENGTH,h,p)).m12b/(n*o*N.m0*Math.PI)-1)<-.01?d/E:-this.f*r.sq(n)*Math.PI)/n)),M>-v&&E>-1-x?this.f>=0?(R.salp1=Math.min(1,-E),R.calp1=-Math.sqrt(1-r.sq(R.salp1))):(R.calp1=Math.max(E>-v?0:-1,E),R.salp1=Math.sqrt(1-r.sq(R.calp1))):(T=s(E,M),L=I*(this.f>=0?-E*T/(1+T):-M*(1+T)/T),b=Math.sin(L),_=-Math.cos(L),R.salp1=o*b,R.calp1=d-o*t*r.sq(b)/(1-_))),R.salp1<=0?(R.salp1=1,R.calp1=0):(w=r.hypot(R.salp1,R.calp1),R.salp1/=w,R.calp1/=w),R},e.Geodesic.prototype.Lambda12=function(t,n,i,a,o,s,u,c,f,l,h,p,d,g){var m,y,v,b,_,x,w,S,A,E,M,I,k,C={};return 0===t&&0===c&&(c=-e.tiny_),y=u*n,v=r.hypot(c,u*t),C.ssig1=t,b=y*t,C.csig1=_=c*n,m=r.hypot(C.ssig1,C.csig1),C.ssig1/=m,C.csig1/=m,C.salp2=o!==n?y/o:u,C.calp2=o!==n||Math.abs(a)!==-t?Math.sqrt(r.sq(c*n)+(n<-t?(o-n)*(n+o):(t-a)*(t+a)))/o:Math.abs(c),C.ssig2=a,x=y*a,C.csig2=w=C.calp2*o,m=r.hypot(C.ssig2,C.csig2),C.ssig2/=m,C.csig2/=m,C.sig12=Math.atan2(Math.max(0,C.csig1*C.ssig2-C.ssig1*C.csig2),C.csig1*C.csig2+C.ssig1*C.ssig2),S=Math.max(0,_*x-b*w),A=_*w+b*x,M=Math.atan2(S*l-A*f,A*l+S*f),I=r.sq(v)*this._ep2,C.eps=I/(2*(1+Math.sqrt(1+I))+I),this.C3f(C.eps,g),E=e.SinCosSeries(!0,C.ssig2,C.csig2,g)-e.SinCosSeries(!0,C.ssig1,C.csig1,g),C.domg12=-this.f*this.A3f(C.eps)*y*(C.sig12+E),C.lam12=M+C.domg12,h&&(0===C.calp2?C.dlam12=-2*this._f1*i/t:(k=this.Lengths(C.eps,C.sig12,C.ssig1,C.csig1,i,C.ssig2,C.csig2,s,n,o,e.REDUCEDLENGTH,p,d),C.dlam12=k.m12b,C.dlam12*=this._f1/(C.calp2*o))),C},e.Geodesic.prototype.Inverse=function(t,n,i,a,o){var s,u;return o||(o=e.STANDARD),o===e.LONG_UNROLL&&(o|=e.STANDARD),o&=e.OUT_MASK,u=(s=this.InverseInt(t,n,i,a,o)).vals,o&e.AZIMUTH&&(u.azi1=r.atan2d(s.salp1,s.calp1),u.azi2=r.atan2d(s.salp2,s.calp2)),u},e.Geodesic.prototype.InverseInt=function(t,n,i,a,o){var s,u,c,f,l,h,p,d,g,v,b,x,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R,D,j,F,U,B,G,q,V,$,J,W,Z,Y,H,X,K,Q,ee,te,ne,re,ie,ae,oe,se,ue,ce,fe,le,he,pe,de,ge,me,ye,ve,be,_e,xe={};if(xe.lat1=t=r.LatFix(t),xe.lat2=i=r.LatFix(i),t=r.AngRound(t),i=r.AngRound(i),u=(s=r.AngDiff(n,a)).t,s=s.s,o&e.LONG_UNROLL?(xe.lon1=n,xe.lon2=n+s+u):(xe.lon1=r.AngNormalize(n),xe.lon2=r.AngNormalize(a)),s=(c=s>=0?1:-1)*r.AngRound(s),u=r.AngRound(180-s-c*u),A=s*r.degree,E=(f=r.sincosd(s>90?u:s)).s,M=(s>90?-1:1)*f.c,(l=Math.abs(t)<Math.abs(i)?-1:1)<0&&(c*=-1,f=t,t=i,i=f),t*=h=t<0?1:-1,i*=h,f=r.sincosd(t),p=this._f1*f.s,d=f.c,p/=f=r.hypot(p,d),d/=f,d=Math.max(e.tiny_,d),f=r.sincosd(i),g=this._f1*f.s,v=f.c,g/=f=r.hypot(g,v),v/=f,v=Math.max(e.tiny_,v),d<-p?v===d&&(g=g<0?p:-p):Math.abs(g)===-p&&(v=d),w=Math.sqrt(1+this._ep2*r.sq(p)),S=Math.sqrt(1+this._ep2*r.sq(g)),N=new Array(e.nC1_+1),T=new Array(e.nC2_+1),L=new Array(e.nC3_),(z=-90===t||0===E)&&(C=E,O=0,D=p,j=(k=M)*d,F=g,U=(P=1)*v,I=Math.atan2(Math.max(0,j*F-D*U),j*U+D*F),b=(R=this.Lengths(this._n,I,D,j,w,F,U,S,d,v,o|e.DISTANCE|e.REDUCEDLENGTH,N,T)).s12b,x=R.m12b,0!==(o&e.GEODESICSCALE)&&(xe.M12=R.M12,xe.M21=R.M21),I<1||x>=0?(I<3*e.tiny_&&(I=x=b=0),x*=this._b,b*=this._b,xe.a12=I/r.degree):z=!1),he=2,!z&&0===p&&(this.f<=0||u>=180*this.f))k=P=0,C=O=1,b=this.a*A,I=G=A/this._f1,x=this._b*Math.sin(I),o&e.GEODESICSCALE&&(xe.M12=xe.M21=Math.cos(I)),xe.a12=s/this._f1;else if(!z)if(I=(R=this.InverseStart(p,d,w,g,v,S,A,E,M,N,T)).sig12,C=R.salp1,k=R.calp1,I>=0)O=R.salp2,P=R.calp2,q=R.dnm,b=I*this._b*q,x=r.sq(q)*this._b*Math.sin(I/q),o&e.GEODESICSCALE&&(xe.M12=xe.M21=Math.cos(I/q)),xe.a12=I/r.degree,G=A/(this._f1*q);else{for(V=0,$=e.tiny_,J=1,W=e.tiny_,Z=-1,Y=!1,H=!1;V<m&&(X=(R=this.Lambda12(p,d,w,g,v,S,C,k,E,M,V<20,N,T,L)).lam12,O=R.salp2,P=R.calp2,I=R.sig12,D=R.ssig1,j=R.csig1,F=R.ssig2,U=R.csig2,B=R.eps,de=R.domg12,K=R.dlam12,!H&&Math.abs(X)>=(Y?8:1)*y);++V)X>0&&(V<20||k/C>Z/W)?(W=C,Z=k):X<0&&(V<20||k/C<J/$)&&($=C,J=k),V<20&&K>0&&(Q=-X/K,ee=Math.sin(Q),(ne=C*(te=Math.cos(Q))+k*ee)>0&&Math.abs(Q)<Math.PI)?(k=k*te-C*ee,C=ne,C/=f=r.hypot(C,k),k/=f,Y=Math.abs(X)<=16*y):(C=($+W)/2,k=(J+Z)/2,C/=f=r.hypot(C,k),k/=f,Y=!1,H=Math.abs($-C)+(J-k)<_||Math.abs(C-W)+(k-Z)<_);re=o|(o&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),b=(R=this.Lengths(B,I,D,j,w,F,U,S,d,v,re,N,T)).s12b,x=R.m12b,0!==(o&e.GEODESICSCALE)&&(xe.M12=R.M12,xe.M21=R.M21),x*=this._b,b*=this._b,xe.a12=I/r.degree,o&e.AREA&&(be=Math.sin(de),he=E*(_e=Math.cos(de))-M*be,pe=M*_e+E*be)}return o&e.DISTANCE&&(xe.s12=0+b),o&e.REDUCEDLENGTH&&(xe.m12=0+x),o&e.AREA&&(ie=C*d,0!==(ae=r.hypot(k,C*p))&&0!==ie?(D=p,j=k*d,F=g,U=P*v,B=(se=r.sq(ae)*this._ep2)/(2*(1+Math.sqrt(1+se))+se),ue=r.sq(this.a)*ae*ie*this._e2,D/=f=r.hypot(D,j),j/=f,F/=f=r.hypot(F,U),U/=f,ce=new Array(e.nC4_),this.C4f(B,ce),fe=e.SinCosSeries(!1,D,j,ce),le=e.SinCosSeries(!1,F,U,ce),xe.S12=ue*(le-fe)):xe.S12=0,!z&&he>1&&(he=Math.sin(G),pe=Math.cos(G)),!z&&pe>-.7071&&g-p<1.75?(de=1+pe,ge=1+d,me=1+v,oe=2*Math.atan2(he*(p*me+g*ge),de*(p*g+ge*me))):(ve=P*k+O*C,0===(ye=O*k-P*C)&&ve<0&&(ye=e.tiny_*k,ve=-1),oe=Math.atan2(ye,ve)),xe.S12+=this._c2*oe,xe.S12*=l*c*h,xe.S12+=0),l<0&&(f=C,C=O,O=f,f=k,k=P,P=f,o&e.GEODESICSCALE&&(f=xe.M12,xe.M12=xe.M21,xe.M21=f)),{vals:xe,salp1:C*=l*c,calp1:k*=l*h,salp2:O*=l*c,calp2:P*=l*h}},e.Geodesic.prototype.GenDirect=function(n,r,i,a,o,s){return s?s===e.LONG_UNROLL&&(s|=e.STANDARD):s=e.STANDARD,a||(s|=e.DISTANCE_IN),new t.GeodesicLine(this,n,r,i,s).GenPosition(a,o,s)},e.Geodesic.prototype.Direct=function(e,t,n,r,i){return this.GenDirect(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirect=function(e,t,n,r,i){return this.GenDirect(e,t,n,!0,r,i)},e.Geodesic.prototype.Line=function(e,n,r,i){return new t.GeodesicLine(this,e,n,r,i)},e.Geodesic.prototype.DirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!0,r,i)},e.Geodesic.prototype.GenDirectLine=function(n,r,i,a,o,s){var u;return s||(s=e.STANDARD|e.DISTANCE_IN),a||(s|=e.DISTANCE_IN),(u=new t.GeodesicLine(this,n,r,i,s)).GenSetDistance(a,o),u},e.Geodesic.prototype.InverseLine=function(n,i,a,o,s){var u,c,f;return s||(s=e.STANDARD|e.DISTANCE_IN),u=this.InverseInt(n,i,a,o,e.ARC),f=r.atan2d(u.salp1,u.calp1),s&e.OUT_MASK&e.DISTANCE_IN&&(s|=e.DISTANCE),(c=new t.GeodesicLine(this,n,i,f,s,u.salp1,u.calp1)).SetArc(u.vals.a12),c},e.Geodesic.prototype.Polygon=function(e){return new n.PolygonArea(this,e)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)}($t.Geodesic,$t.GeodesicLine,$t.PolygonArea,$t.Math,$t.Constants),function(e,t,n){t.GeodesicLine=function(t,r,i,a,o,s,u){var c,f,l,h,p,d;o||(o=e.STANDARD|e.DISTANCE_IN),this.a=t.a,this.f=t.f,this._b=t._b,this._c2=t._c2,this._f1=t._f1,this.caps=o|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=n.LatFix(r),this.lon1=i,void 0===s||void 0===u?(this.azi1=n.AngNormalize(a),c=n.sincosd(n.AngRound(this.azi1)),this.salp1=c.s,this.calp1=c.c):(this.azi1=a,this.salp1=s,this.calp1=u),c=n.sincosd(n.AngRound(this.lat1)),l=this._f1*c.s,f=c.c,l/=c=n.hypot(l,f),f/=c,f=Math.max(e.tiny_,f),this._dn1=Math.sqrt(1+t._ep2*n.sq(l)),this._salp0=this.salp1*f,this._calp0=n.hypot(this.calp1,this.salp1*l),this._ssig1=l,this._somg1=this._salp0*l,this._csig1=this._comg1=0!==l||0!==this.calp1?f*this.calp1:1,c=n.hypot(this._ssig1,this._csig1),this._ssig1/=c,this._csig1/=c,this._k2=n.sq(this._calp0)*t._ep2,h=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(h),this._C1a=new Array(e.nC1_+1),e.C1f(h,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),p=Math.sin(this._B11),d=Math.cos(this._B11),this._stau1=this._ssig1*d+this._csig1*p,this._ctau1=this._csig1*d-this._ssig1*p),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(h,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(h),this._C2a=new Array(e.nC2_+1),e.C2f(h,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),t.C3f(h,this._C3a),this._A3c=-this.f*this._salp0*t.A3f(h),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),t.C4f(h,this._C4a),this._A4=n.sq(this.a)*this._calp0*this._salp0*t._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=Number.NaN},t.GeodesicLine.prototype.GenPosition=function(t,r,i){var a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P,O={};return i?i===e.LONG_UNROLL&&(i|=e.STANDARD):i=e.STANDARD,i&=this.caps&e.OUT_MASK,O.lat1=this.lat1,O.azi1=this.azi1,O.lon1=i&e.LONG_UNROLL?this.lon1:n.AngNormalize(this.lon1),t?O.a12=r:O.s12=r,t||this.caps&e.DISTANCE_IN&e.OUT_MASK?(u=0,c=0,t?(a=r*n.degree,o=(I=n.sincosd(r)).s,s=I.c):(h=r/(this._b*(1+this._A1m1)),p=Math.sin(h),d=Math.cos(h),a=h-((u=-e.SinCosSeries(!0,this._stau1*d+this._ctau1*p,this._ctau1*d-this._stau1*p,this._C1pa))-this._B11),o=Math.sin(a),s=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,u=e.SinCosSeries(!0,f,l,this._C1a),a-=((1+this._A1m1)*(a+(u-this._B11))-r/this._b)/Math.sqrt(1+this._k2*n.sq(f)),o=Math.sin(a),s=Math.cos(a))),f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,S=Math.sqrt(1+this._k2*n.sq(f)),i&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((t||Math.abs(this.f)>.01)&&(u=e.SinCosSeries(!0,f,l,this._C1a)),c=(1+this._A1m1)*(u-this._B11)),y=this._calp0*f,0===(v=n.hypot(this._salp0,this._calp0*l))&&(v=l=e.tiny_),x=this._salp0,w=this._calp0*l,t&&i&e.DISTANCE&&(O.s12=this._b*((1+this._A1m1)*a+c)),i&e.LONGITUDE&&(b=this._salp0*f,_=l,m=n.copysign(1,this._salp0),g=((i&e.LONG_UNROLL?m*(a-(Math.atan2(f,l)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(m*b,_)-Math.atan2(m*this._somg1,this._comg1))):Math.atan2(b*this._comg1-_*this._somg1,_*this._comg1+b*this._somg1))+this._A3c*(a+(e.SinCosSeries(!0,f,l,this._C3a)-this._B31)))/n.degree,O.lon2=i&e.LONG_UNROLL?this.lon1+g:n.AngNormalize(n.AngNormalize(this.lon1)+n.AngNormalize(g))),i&e.LATITUDE&&(O.lat2=n.atan2d(y,this._f1*v)),i&e.AZIMUTH&&(O.azi2=n.atan2d(x,w)),i&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(A=e.SinCosSeries(!0,f,l,this._C2a),E=(1+this._A2m1)*(A-this._B21),M=(this._A1m1-this._A2m1)*a+(c-E),i&e.REDUCEDLENGTH&&(O.m12=this._b*(S*(this._csig1*f)-this._dn1*(this._ssig1*l)-this._csig1*l*M)),i&e.GEODESICSCALE&&(I=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+S),O.M12=s+(I*f-l*M)*this._ssig1/this._dn1,O.M21=s-(I*this._ssig1-this._csig1*M)*f/S)),i&e.AREA&&(k=e.SinCosSeries(!1,f,l,this._C4a),0===this._calp0||0===this._salp0?(C=x*this.calp1-w*this.salp1,P=w*this.calp1+x*this.salp1):(C=this._calp0*this._salp0*(s<=0?this._csig1*(1-s)+o*this._ssig1:o*(this._csig1*o/(1+s)+this._ssig1)),P=n.sq(this._salp0)+n.sq(this._calp0)*this._csig1*l),O.S12=this._c2*Math.atan2(C,P)+this._A4*(k-this._B41)),t||(O.a12=a/n.degree),O):(O.a12=Number.NaN,O)},t.GeodesicLine.prototype.Position=function(e,t){return this.GenPosition(!1,e,t)},t.GeodesicLine.prototype.ArcPosition=function(e,t){return this.GenPosition(!0,e,t)},t.GeodesicLine.prototype.GenSetDistance=function(e,t){e?this.SetArc(t):this.SetDistance(t)},t.GeodesicLine.prototype.SetDistance=function(t){var n;this.s13=t,n=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+n.a12},t.GeodesicLine.prototype.SetArc=function(t){var n;this.a13=t,n=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+n.s12}}($t.Geodesic,$t.GeodesicLine,$t.Math),function(e,t,n,r){var i,a;i=function(e,t){var r;return e=n.AngNormalize(e),t=n.AngNormalize(t),r=n.AngDiff(e,t).s,e<=0&&t>0&&r>0?1:t<=0&&e>0&&r<0?-1:0},a=function(e,t){return((t%=720)>=0&&t<360||t<-360?0:1)-((e%=720)>=0&&e<360||e<-360?0:1)},e.PolygonArea=function(e,n){this._geod=e,this.a=this._geod.a,this.f=this._geod.f,this._area0=4*Math.PI*e._c2,this.polyline=n||!1,this._mask=t.LATITUDE|t.LONGITUDE|t.DISTANCE|(this.polyline?t.NONE:t.AREA|t.LONG_UNROLL),this.polyline||(this._areasum=new r.Accumulator(0)),this._perimetersum=new r.Accumulator(0),this.Clear()},e.PolygonArea.prototype.Clear=function(){this.num=0,this._crossings=0,this.polyline||this._areasum.Set(0),this._perimetersum.Set(0),this._lat0=this._lon0=this.lat=this.lon=Number.NaN},e.PolygonArea.prototype.AddPoint=function(e,t){var n;0===this.num?(this._lat0=this.lat=e,this._lon0=this.lon=t):(n=this._geod.Inverse(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(n.s12),this.polyline||(this._areasum.Add(n.S12),this._crossings+=i(this.lon,t)),this.lat=e,this.lon=t),++this.num},e.PolygonArea.prototype.AddEdge=function(e,t){var n;this.num&&(n=this._geod.Direct(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(t),this.polyline||(this._areasum.Add(n.S12),this._crossings+=a(this.lon,n.lon2)),this.lat=n.lat2,this.lon=n.lon2),++this.num},e.PolygonArea.prototype.Compute=function(e,t){var n,a,o={number:this.num};return this.num<2?(o.perimeter=0,this.polyline||(o.area=0),o):this.polyline?(o.perimeter=this._perimetersum.Sum(),o):(n=this._geod.Inverse(this.lat,this.lon,this._lat0,this._lon0,this._mask),o.perimeter=this._perimetersum.Sum(n.s12),(a=new r.Accumulator(this._areasum)).Add(n.S12),1&this._crossings+i(this.lon,this._lon0)&&a.Add((a.Sum()<0?1:-1)*this._area0/2),e||a.Negate(),t?a.Sum()>this._area0/2?a.Add(-this._area0):a.Sum()<=-this._area0/2&&a.Add(+this._area0):(a.Sum()>=this._area0||a<0)&&a.Add(-this._area0),o.area=a.Sum(),o)},e.PolygonArea.prototype.TestPoint=function(e,t,n,r){var a,o,s,u,c={number:this.num+1};if(0===this.num)return c.perimeter=0,this.polyline||(c.area=0),c;for(c.perimeter=this._perimetersum.Sum(),o=this.polyline?0:this._areasum.Sum(),s=this._crossings,u=0;u<(this.polyline?1:2);++u)a=this._geod.Inverse(0===u?this.lat:e,0===u?this.lon:t,0!==u?this._lat0:e,0!==u?this._lon0:t,this._mask),c.perimeter+=a.s12,this.polyline||(o+=a.S12,s+=i(0===u?this.lon:t,0!==u?this._lon0:t));return this.polyline||(1&s&&(o+=(o<0?1:-1)*this._area0/2),n||(o*=-1),r?o>this._area0/2?o-=this._area0:o<=-this._area0/2&&(o+=this._area0):o>=this._area0?o-=this._area0:o<0&&(o+=this._area0),c.area=o),c},e.PolygonArea.prototype.TestEdge=function(e,t,n,r){var o,s,u,c={number:this.num?this.num+1:0};return 0===this.num||(c.perimeter=this._perimetersum.Sum()+t,this.polyline||(s=this._areasum.Sum(),u=this._crossings,s+=(o=this._geod.Direct(this.lat,this.lon,e,t,this._mask)).S12,u+=a(this.lon,o.lon2),o=this._geod.Inverse(o.lat2,o.lon2,this._lat0,this._lon0,this._mask),c.perimeter+=o.s12,s+=o.S12,1&(u+=i(o.lon2,this._lon0))&&(s+=(s<0?1:-1)*this._area0/2),n||(s*=-1),r?s>this._area0/2?s-=this._area0:s<=-this._area0/2&&(s+=this._area0):s>=this._area0?s-=this._area0:s<0&&(s+=this._area0),c.area=s)),c}}($t.PolygonArea,$t.Geodesic,$t.Math,$t.Accumulator),ee(function(e){var t=H(e.params,"rlat_1"),n=H(e.params,"rlat_2");Zt(e,t,n)},"aea","Albers Equal Area","Conic Sph&Ell\nlat_1= lat_2="),ee(function(e){var t=H(e.params,"rlat_1"),n=H(e.params,"bsouth")?-k:k;Zt(e,t,n)},"leac","Lambert Equal Area Conic","Conic, Sph&Ell\nlat_1= south"),ee(function(t){var i,o,u,l,h,p,g,m=1e-10;if(t.phi0=H(t.params,"rlat_0"),e(e(t.phi0)-k)<m?(h=t.phi0<0?1:0,i=t.phi0<0?-1:1,o=0):e(t.phi0)<m?(h=2,i=0,o=1):(h=3,i=n(t.phi0),o=r(t.phi0)),t.es)if(g=new $t.Geodesic.Geodesic(t.a,t.es/(1+f(t.one_es))),p=Yt(t.es),H(t.params,"bguam"))u=Ht(t.phi0,i,o,p),t.inv=function(e,i){var o,s,c;for(o=.5*e.x*e.x,i.phi=t.phi0,c=0;c<3;++c)s=t.e*n(i.phi),i.phi=Xt(u+e.y-o*a(i.phi)*(s=f(1-s*s)),t.es,p);i.lam=e.x*s/r(i.phi)},t.fwd=function(e,i){var a,o,s;a=r(e.phi),o=n(e.phi),s=1/f(1-t.es*o*o),i.x=e.lam*a*s,i.y=Ht(e.phi,o,a,p)-u+.5*e.lam*e.lam*a*o*s};else{switch(h){case 0:l=Ht(k,1,0,p);break;case 1:l=Ht(-k,-1,0,p);break;case 2:case 3:t.inv=v,t.fwd=y,f(1-t.es*i*i),t.e,f(t.one_es)}t.inv=v,t.fwd=y}else t.inv=function(e,a){var s,u,f,l=e.x,p=e.y;if((u=d(l,p))>w)u-m>w&&B(),u=w;else if(u<m)return a.phi=t.phi0,void(a.lam=0);3==h||2==h?(f=n(u),s=r(u),2==h?(a.phi=Kt(p*f/u),l*=f,p=s*u):(a.phi=Kt(s*i+p*f*o/u),p=(s-i*n(a.phi))*u,l*=f*o),a.lam=0==p?0:c(l,p)):0==h?(a.phi=k-u,a.lam=c(l,-p)):(a.phi=u-k,a.lam=c(l,p))},t.fwd=function(t,a){var u,c,f;switch(f=n(t.phi),c=r(t.phi),u=r(t.lam),h){case 2:case 3:a.y=2==h?c*u:i*f+o*c*u,e(e(a.y)-1)<1e-14?a.y<0?U():a.x=a.y=0:(a.y=s(a.y),a.y/=n(a.y),a.x=a.y*c*n(t.lam),a.y*=2==h?f:o*f-i*c*u);break;case 0:t.phi=-t.phi,u=-u;case 1:e(t.phi-k)<m&&U(),a.x=(a.y=k+t.phi)*n(t.lam),a.y*=u}};function y(i,a){var o,s,u,c,f,d,y,v,b,_,x;switch(o=r(i.lam),s=r(i.phi),u=n(i.phi),h){case 0:o=-o;case 1:a.x=(c=e(l-Ht(i.phi,u,s,p)))*n(i.lam),a.y=c*o;break;case 2:case 3:if(e(i.lam)<m&&e(i.phi-t.phi0)<m){a.x=a.y=0;break}v=t.phi0/A,y=t.lam0/A,_=i.phi/A,b=(i.lam+t.lam0)/A,f=(x=g.Inverse(v,y,_,b,g.AZIMUTH)).azi1*A,d=x.s12,a.x=d*n(f)/t.a,a.y=d*r(f)/t.a}}function v(e,n){var r,i,a,o,s,u,y,v;if((r=d(e.x,e.y))<m)return n.phi=t.phi0,n.lam=0,n;3==h||2==h?(o=e.x*t.a,s=e.y*t.a,u=t.phi0/A,y=t.lam0/A,i=c(o,s)/A,a=f(o*o+s*s),v=g.Direct(u,y,i,a,g.STANDARD),n.phi=v.lat2*A,n.lam=v.lon2*A,n.lam-=t.lam0):(n.phi=Xt(0==h?l-r:l+r,t.es,p),n.lam=c(e.x,0==h?-e.y:e.y))}},"aeqd","Azimuthal Equidistant","Azi, Sph&Ell\nlat_0 guam"),ee(function(t){var i,o,s,u,c,f,l=1e-10;t.es=0,t.fwd=function(t,f){var h,d,g,m,y,v,b,_;switch(h=n(t.lam),d=r(t.lam),u){case 2:case 3:m=n(t.phi),_=(g=r(t.phi))*d,3==u&&(_=i*m+o*_),!c&&_<-l&&U(),b=e(v=1-_)>l?-p(y=.5*(1+_))/v-s/y:.5-s,f.x=b*g*h,f.y=3==u?b*(o*m-i*g*d):b*m;break;case 1:case 0:t.phi=e(p_halfpi-t.phi),!c&&t.phi-l>k&&U(),(t.phi*=.5)>l?(y=a(t.phi),b=-2*(p(r(t.phi))/y+y*s),f.x=b*h,f.y=b*d,0==u&&(f.y=-f.y)):f.x=f.y=0}},c=H(t.params,"bno_cut"),f=.5*(k-H(t.params,"rlat_b")),e(f)<l?s=-.5:(s=1/a(f),s*=s*p(r(f))),e(e(t.phi0)-k)<l?t.phi0<0?(p_halfpi=-k,u=1):(p_halfpi=k,u=0):e(t.phi0)<l?u=2:(u=3,i=n(t.phi0),o=r(t.phi0))},"airy","Airy","Misc Sph, no inv.\nno_cut lat_b="),ee(function(e){var t=e.opaque={mode:1};H(e.params,"tlat_1")?0===(t.cosphi1=r(H(e.params,"rlat_1")))&&q(-22):t.cosphi1=.6366197723675814,nn(e)},"wintri","Winkel Tripel","Misc Sph\nlat_1"),ee(nn,"aitoff","Aitoff","Misc Sph"),ee(function(e){e.fwd=function(e,t){var i,o,s,u,c,l,h,p=4/3,d=e.lam;i=a(.5*e.phi),s=1+(o=f(1-i*i))*r(d*=.5),u=n(d)*o/s,l=i/s,t.x=p*u*(3+(c=u*u)-3*(h=l*l)),t.y=p*l*(3+3*c-h)},e.es=0},"august","August Epicycloidal","Misc Sph, no inv."),ee(function(e){rn(e,!1,!1)},"apian","Apian Globular I","Misc Sph, no inv."),ee(function(e){rn(e,!1,!0)},"ortel","Ortelius Oval","Misc Sph, no inv."),ee(function(e){rn(e,!0,!1)},"bacon","Bacon Globular","Misc Sph, no inv."),ee(function(e){var t,i,a,s;e.es=0,e.fwd=function(e,u){var l,h,p,d,g,m;return e.lam+=-16.5*A,h=r(e.phi),p=r(e.lam)*h,d=n(e.lam)*h,m=(g=n(e.phi))*t+p*i,e.lam=c(d*a-m*s,p*t-g*i),m=m*a+d*s,e.phi=o(m),e.lam=Ie(e.lam),e.lam+e.phi<-1.4&&(l=(e.lam-e.phi+1.6)*(e.lam+e.phi+1.4)/8,e.lam+=l,e.phi-=.8*l*n(e.phi+w/2)),h=r(e.phi),l=f(2/(1+h*r(e.lam/2))),u.x=1.68*l*h*n(e.lam/2),u.y=l*n(e.phi),l=(1-r(e.lam*e.phi))/12,u.y<0&&(u.x*=1+l),u.y>0&&(u.y*=1+l/1.5*u.x*u.x),u},e.lam0=0,e.phi0=-42*A,t=r(e.phi0),i=n(e.phi0),a=1,s=0},"bertin1953","Bertin 1953","Misc., Sph., NoInv."),ee(function(t){var i=f(2);t.fwd=function(t,a){var o,s,u,c;if(o=t.phi,e(e(t.phi)-k)<1e-7)a.x=0;else{for(u=n(o)*w,c=20;c&&(o-=s=(o+n(o)-u)/(1+r(o)),!(e(s)<1e-7));--c);o*=.5,a.x=2.00276*t.lam/(1/r(t.phi)+1.11072/r(o))}a.y=.49931*(t.phi+i*n(o))},t.es=0},"boggs","Boggs Eumorphic","PCyl., no inv., Sph."),ee(function(t){var i,o,s,u,l,h,p=1e-10;i=H(t.params,"rlat_1"),e(i)<p&&q(-23),t.es?(l=Yt(t.es),u=Ht(i,s=n(i),h=r(i),l),s=h/(f(1-t.es*s*s)*s),t.inv=function(i,a){var o,h;h=d(i.x,i.y=s-i.y),a.phi=Xt(s+u-h,t.es,l),(o=e(a.phi))<k?(o=n(a.phi),a.lam=h*c(i.x,i.y)*f(1-t.es*o*o)/r(a.phi)):e(o-k)<=p?a.lam=0:B()},t.fwd=function(e,i){var a,o,c;a=s+u-Ht(e.phi,o=n(e.phi),c=r(e.phi),l),o=c*e.lam/(a*f(1-t.es*o*o)),i.x=a*n(o),i.y=s-a*r(o)}):(o=e(i)+p>=k?0:1/a(i),t.inv=function(t,n){var a=d(t.x,t.y=o-t.y);n.phi=o+i-a,e(n.phi)>k&&B(),e(e(n.phi)-k)<=p?n.lam=0:n.lam=a*c(t.x,t.y)/r(n.phi)},t.fwd=function(t,a){var s,u;u=o+i-t.phi,e(u)>p?(a.x=u*n(s=t.lam*r(t.phi)/u),a.y=o-u*r(s)):a.x=a.y=0})},"bonne","Bonne (Werner lat_1=90)","Conic Sph&Ell\nlat_1="),ee(function(e){var t,i,s=.16666666666666666,u=.008333333333333333,l=.041666666666666664,h=.06666666666666667;e.es?(i=Yt(e.es),t=Ht(e.phi0,n(e.phi0),r(e.phi0),i),e.fwd=function(o,c){var h,p,d,g,m,y;c.y=Ht(o.phi,h=n(o.phi),g=r(o.phi),i),h=1/f(1-e.es*h*h),y=a(o.phi),p=y*y,d=o.lam*g,g*=e.es*g/(1-e.es),m=d*d,c.x=h*d*(1-m*p*(s-(8-p+8*g)*m*u)),c.y-=t-h*y*m*(.5+(5-p+6*g)*m*l)},e.inv=function(o,s){var u,c,p,d,g,m,y;y=Xt(t+o.y,e.es,i),m=a(y),c=m*m,u=n(y),p=1/(1-e.es*u*u),u=f(p),p*=(1-e.es)*u,d=o.x/u,g=d*d,s.phi=y-u*m/p*g*(.5-(1+3*c)*g*l),s.lam=d*(1+c*g*((1+3*c)*g*h-.3333333333333333))/r(y)}):(e.fwd=function(t,i){i.x=o(r(t.phi)*n(t.lam)),i.y=c(a(t.phi),r(t.lam))-e.phi0},e.inv=function(t,i){var s=t.y+e.phi0;i.phi=o(n(s)*r(t.x)),i.lam=c(a(t.x),r(s))})},"cass","Cassini","Cyl, Sph&Ell"),ee(function(t){var i,a,s=0;H(t.params,"tlat_ts")&&(t.k0=r(s=H(t.params,"rlat_ts")),t.k0<0&&q(-24)),t.es?(s=n(s),t.k0/=f(1-t.es*s*s),t.e=f(t.es),(a=an(t.es))||e_error_0(),i=Jt(1,t.e,t.one_es),t.fwd=function(e,r){r.x=t.k0*e.lam,r.y=.5*Jt(n(e.phi),t.e,t.one_es)/t.k0},t.inv=function(e,n){n.phi=on(o(2*e.y*t.k0/i),a),n.lam=e.x/t.k0}):(t.fwd=function(e,r){r.x=t.k0*e.lam,r.y=n(e.phi)/t.k0},t.inv=function(n,r){var i,a=n.x,s=n.y;(i=e(s*=t.k0))-L<=1?(r.phi=i>=1?s<0?-k:k:o(s),r.lam=a/t.k0):B()})},"cea","Equal Area Cylindrical","Cyl, Sph&Ell\nlat_ts="),ee(function(t){var i,a,o,s,u,l,h,p=1/3,d=[];for(l=0;l<3;++l)d[l]={p:{}},d[l].phi=H(t.params,"rlat_"+(l+1)),d[l].lam=H(t.params,"rlon_"+(l+1)),d[l].lam=Ie(d[l].lam-t.lam0),d[l].cosphi=r(d[l].phi),d[l].sinphi=n(d[l].phi);for(l=0;l<3;++l)h=2==l?0:l+1,d[l].v=g(d[h].phi-d[l].phi,d[l].cosphi,d[l].sinphi,d[h].cosphi,d[h].sinphi,d[h].lam-d[l].lam),d[l].v.r||q(-25);function g(t,i,a,o,s,u){var l,h,p,d={};return l=r(u),e(t)>1||e(u)>1?d.r=Qt(cs1*s+i*o*l):(h=n(.5*t),p=n(.5*u),d.r=2*Kt(f(h*h+i*o*p*p))),e(d.r)>1e-9?d.Az=c(o*n(u),i*s-a*o*l):d.r=d.Az=0,d}function m(e,t,n){return Qt(.5*(e*e+t*t-n*n)/(e*t))}o=m(d[0].v.r,d[2].v.r,d[1].v.r),s=m(d[0].v.r,d[1].v.r,d[2].v.r),u=w-o,a=2*(d[0].p.y=d[1].p.y=d[2].v.r*n(o)),d[2].p.y=0,d[0].p.x=-(d[1].p.x=.5*d[0].v.r),i=d[2].p.x=d[0].p.x+d[2].v.r*r(o),t.es=0,t.fwd=function(e,t){var o,c,f,l,h,y,v,b=[];for(o=n(e.phi),c=r(e.phi),l=0;l<3&&(b[l]=g(e.phi-d[l].phi,d[l].cosphi,d[l].sinphi,c,o,e.lam-d[l].lam),b[l].r);++l)b[l].Az=Ie(b[l].Az-d[l].v.Az);if(l<3)y=d[l].p.x,v=d[l].p.y;else{for(y=i,v=a,l=0;l<3;++l)h=2==l?0:l+1,f=m(d[l].v.r,b[l].r,b[h].r),b[l].Az<0&&(f=-f),l?1==l?(f=s-f,y-=b[l].r*r(f),v-=b[l].r*n(f)):(f=u-f,y+=b[l].r*r(f),v+=b[l].r*n(f)):(y+=b[l].r*r(f),v-=b[l].r*n(f));y*=p,v*=p}t.x=y,t.y=v}},"chamb","Chamberlin Trimetric","Misc Sph, no inv.\nlat_1= lon_1= lat_2= lon_2= lat_3= lon_3="),ee(function(e){var t=1/3;e.inv=function(e,n){n.phi=3*o(.32573500793527993*e.y),n.lam=1.0233267079464885*e.x/(2*r((n.phi+n.phi)*t)-1)},e.fwd=function(e,i){e.phi*=t,i.x=.9772050238058398*e.lam*(2*r(e.phi+e.phi)-1),i.y=3.0699801238394655*n(e.phi)},e.es=0},"crast","Craster Parabolic (Putnins P4)","PCyl., Sph."),ee(function(e){var t=.5253,i=.7264,a=1/Math.sqrt(t*i),s=.9701,u=p(22*A),c=d(0),l=n(u),h=r(u);function p(e){return o(i*n(e)+.4188*f(t*i))}function d(e){return t*e}H(e.params,"tlon_0")||(e.lam0=11.023*A),e.es=0,e.fwd=function(e,t){var i=p(e.phi),o=d(e.lam),g=n(i),m=r(i),y=n(o-c),v=r(o-c),b=f(2/(1+n(u)*g+h*m*v));t.x=a*b*m*y*s,t.y=a*b*(h*g-l*m*v)/s}},"cupola","Cupola","PCyl., Sph., NoInv."),ee(function(t){t.fwd=function(t,n){var i=e(t.lam);n.y=t.phi,n.x=t.lam,n.x*=r((.95+i*(i*i*.0016666666666666666-.08333333333333333))*(t.phi*(.9+.03*t.phi*t.phi*t.phi*t.phi)))},t.es=0},"denoy","Denoyer Semi-Elliptical","PCyl, Sph., no inv."),ee(function(t){var n=.9213177319235613,r=.3183098861837907;t.es=0,t.fwd=function(t,i){i.x=n*t.lam*(1-r*e(t.phi)),i.y=n*t.phi},t.inv=function(t,i){i.phi=t.y/n,i.lam=t.x/(n*(1-r*e(i.phi)))}},"eck1","Eckert I","PCyl Sph"),ee(function(t){var r=.46065886596178063,i=1.4472025091165353;t.es=0,t.fwd=function(t,a){a.x=r*t.lam*(a.y=f(4-3*n(e(t.phi)))),a.y=i*(2-a.y),t.phi<0&&(a.y=-a.y)},t.inv=function(t,n){n.lam=t.x/(r*(n.phi=2-e(t.y)/i)),n.phi=.3333333333333333*(4-n.phi*n.phi),e(n.phi)>=1?e(n.phi)>1.0000001?B():n.phi=n.phi<0?-k:k:n.phi=o(n.phi),t.y<0&&(n.phi=-n.phi)}},"eck2","Eckert II","PCyl Sph"),ee(function(e){sn(e,{C_x:.4222382003157712,C_y:.8444764006315424,A:1,B:.4052847345693511})},"eck3","Eckert III","PCyl Sph"),ee(function(e){sn(e,{C_x:.94745,C_y:.94745,A:0,B:.3039635509270133})},"wag6","Wagner VI","PCyl Sph"),ee(function(e){sn(e,{C_x:.8660254037844,C_y:1,A:0,B:.3039635509270133})},"kav7","Kavraisky VII","PCyl Sph"),ee(function(e){sn(e,{C_x:1.8949,C_y:.94745,A:-.5,B:.3039635509270133})},"putp1","Putnins P1","PCyl Sph"),ee(function(t){var i=.4222382003157712,a=1.3265004281770023,o=3.5707963267948966;t.es=0,t.fwd=function(t,s){var u,c,f,l,h;for(u=o*n(t.phi),c=t.phi*t.phi,t.phi*=.895168+c*(.0218849+.00826809*c),h=6;h&&(l=r(t.phi),f=n(t.phi),t.phi-=c=(t.phi+f*(l+2)-u)/(1+l*(l+2)-f*f),!(e(c)<1e-7));--h);h?(s.x=i*t.lam*(1+r(t.phi)),s.y=a*n(t.phi)):(s.x=i*t.lam,s.y=t.phi<0?-a:a)},t.inv=function(e,t){var s;t.phi=Kt(e.y/a),t.lam=e.x/(i*(1+(s=r(t.phi)))),t.phi=Kt((t.phi+n(t.phi)*(s+2))/o)}},"eck4","Eckert IV","PCyl Sph"),ee(function(e){e.es=0,e.fwd=function(e,t){t.x=.4410127717245515*(1+r(e.phi))*e.lam,t.y=.882025543449103*e.phi},e.inv=function(e,t){t.lam=2.267508027238226*e.x/(1+r(t.phi=1.133754013619113*e.y))}},"eck5","Eckert V","PCyl Sph"),ee(function(e){var t=r(H(e.params,"rlat_ts"));t<=0&&q(-24),e.es=0,e.fwd=function(n,r){r.x=t*n.lam,r.y=n.phi-e.phi0},e.inv=function(n,r){r.lam=n.x/t,r.phi=n.y+e.phi0}},"eqc","Equidistant Cylindrical (Plate Caree)","Cyl, Sph\nlat_ts=[, lat_0=0]"),ee(function(t){var i,a,o,s,u,f,l,h,p,g,m,y,v;i=H(t.params,"rlat_1"),a=H(t.params,"rlat_2"),e(i+a)<L&&q(-21),(l=Yt(t.es))||e_error_0(),o=g=n(i),p=r(i),m=e(i-a)>=L,(h=t.es>0)?(v=Wt(g,p,t.es),y=Ht(i,g,p,l),m&&(g=n(a),p=r(a),o=(v-Wt(g,p,t.es))/(Ht(a,g,p,l)-y)),u=(f=y+v/o)-Ht(t.phi0,n(t.phi0),r(t.phi0),l)):(m&&(o=(p-r(a))/(a-i)),f=i+r(i)/o,u=f-t.phi0),t.fwd=function(e,t){s=f-(h?Ht(e.phi,n(e.phi),r(e.phi),l):e.phi),t.x=s*n(e.lam*=o),t.y=u-s*r(e.lam)},t.inv=function(e,n){0!=(s=d(e.x,e.y=u-e.y))?(o<0&&(s=-s,e.x=-e.x,e.y=-e.y),n.phi=f-s,h&&(n.phi=Xt(n.phi,t.es,l)),n.lam=c(e.x,e.y)/o):(n.lam=0,n.phi=o>0?k:-k)}},"eqdc","Equidistant Conic","Conic, Sph&Ell\nlat_1= lat_2="),ee(function(e){var t=1.340264,n=-.081106,r=893e-6,i=.003796,a=Math.sqrt(3)/2;e.es=0,e.fwd=function(e,o){var s=Math.asin(a*Math.sin(e.phi)),u=s*s,c=u*u*u;o.x=e.lam*Math.cos(s)/(a*(t+3*n*u+c*(7*r+9*i*u))),o.y=s*(t+n*u+c*(r+i*u))},e.inv=function(e,o){var s,u,c,f,l=e.y;for(f=0;f<12&&(l-=c=(l*(t+n*(s=l*l)+(u=s*s*s)*(r+i*s))-e.y)/(t+3*n*s+u*(7*r+9*i*s)),!(Math.abs(c)<1e-9));++f);u=(s=l*l)*s*s,o.lam=a*e.x*(t+3*n*s+u*(7*r+9*i*s))/Math.cos(l),o.phi=Math.asin(Math.sin(l)/a)}},"eqearth","Equal Earth","PCyl., Sph."),ee(un,"etmerc","Extended Transverse Mercator","Cyl, Sph\nlat_ts=(0)\nlat_0=(0)"),ee(function(e){e.fwd=function(e,t){t.x=.7071067811865476*e.lam,t.y=1.7071067811865475*a(.5*e.phi)},e.inv=function(e,t){t.lam=1.4142135623730951*e.x,t.phi=2*u(.585786437626905*e.y)},e.es=0},"gall","Gall (Gall Stereographic)","Cyl, Sph"),ee(function(e){e.is_geocent=!0,e.x0=0,e.y0=0,e.fwd=function(e,t){t.x=e.lam,t.y=e.phi},e.inv=function(e,t){t.phi=e.y,t.lam=e.x}},"geocent","Geocentric",""),ee(function(e){var t,i,o,s,l,h,p,g=H(e.params,"dh"),m=H(e.params,"ssweep");m?"x"==m?p=1:"y"==m?p=0:q(-49):p=0,((l=g/e.a)<=0||l>1e10)&&q(-50),h=(s=1+l)*s-1,0!=e.es?(t=f(e.one_es),i=e.one_es,o=e.rone_es,e.inv=function(e,n){var i,g,m,y,v,b;i=-1,p?(m=a(e.y/l),g=a(e.x/l)*d(1,m)):(g=a(e.x/l),m=a(e.y/l)*d(1,g));var _=(v=2*s*i)*v-4*(y=g*g+(y=m/t)*y+i*i)*h;_<0&&q(-51),b=(-v-f(_))/(2*y),i=s+b*i,g*=b,m*=b,n.lam=c(g,i),n.phi=u(m*r(n.lam)/i),n.phi=u(o*a(n.phi))},e.fwd=function(e,c){var f,h,g,m,y;e.phi=u(i*a(e.phi)),f=t/d(t*r(e.phi),n(e.phi)),h=f*r(e.lam)*r(e.phi),g=f*n(e.lam)*r(e.phi),m=f*n(e.phi),(s-h)*h-g*g-m*m*o<0&&q(-51),y=s-h,p?(c.x=l*u(g/d(m,y)),c.y=l*u(m/y)):(c.x=l*u(g/y),c.y=l*u(m/d(g,y)))}):(t=i=o=1,e.inv=function(e,t){var n,i,o,d,g,m;n=-1,p?(o=a(e.y/l),i=a(e.x/l)*f(1+o*o)):(i=a(e.x/l),o=a(e.y/l)*f(1+i*i));var y=(g=2*s*n)*g-4*(d=i*i+o*o+n*n)*h;y<0&&q(-51),m=(-g-f(y))/(2*d),n=s+m*n,i*=m,o*=m,t.lam=c(i,n),t.phi=u(o*r(t.lam)/n)},e.fwd=function(e,t){var i=r(e.phi),a=r(e.lam)*i,o=n(e.lam)*i,c=n(e.phi);i=s-a,p?(t.x=l*u(o/d(c,i)),t.y=l*u(c/i)):(t.x=l*u(o/i),t.y=l*u(c/d(o,i)))})},"geos","Geostationary Satellite View","Azi, Sph&Ell"),ee(function(e){var t=s(H(e.params,"tlat_1")?H(e.params,"rlat_1"):0),i=n(t),o=r(t);function s(e){return Kt(a(.5*e))}e.fwd=function(e,t){var a=.5*e.lam,u=s(e.phi),c=n(u),f=r(u),l=r(a);i*c+o*f*l>=0?(t.x=f*n(a),t.y=o*c-i*f*l):U()},e.es=0},"gilbert","Gilbert Two World Perspective","PCyl., Sph., NoInv.\nlat_1="),ee(function(e){e.fwd=function(e,t){var n=e.phi*e.phi;t.y=e.phi*(1+.08333333333333333*n),t.x=e.lam*(1-.162388*n),n=e.lam*e.lam,t.x*=.87-952426e-9*n*n},e.es=0},"gins8","Ginsburg VIII (TsNIIGAiK)","PCyl, Sph., no inv."),ee(function(e){H(e.params,"tn"),H(e.params,"tm")?fn(e,H(e.params,"dm"),H(e.params,"dn")):q(-99)},"gn_sinu","General Sinusoidal Series","PCyl, Sph.\nm= n="),ee(cn,"sinu","Sinusoidal (Sanson-Flamsteed)","PCyl, Sph&Ell"),ee(function(e){fn(e,1,2.5707963267948966)},"eck6","Eckert VI","PCyl, Sph.\nm= n="),ee(function(e){fn(e,.5,1.7853981633974483)},"mbtfps","McBryde-Thomas Flat-Polar Sinusoidal","PCyl, Sph."),ee(function(t){var i,a,s=1e-10;e(e(t.phi0)-k)<s?a=t.phi0<0?1:0:e(t.phi0)<s?a=2:(a=3,sinph0=n(t.phi0),i=r(t.phi0)),t.inv=function(r,l){var h,p,g,m=r.x,y=r.y;if(h=d(m,y),g=n(l.phi=u(h)),p=f(1-g*g),e(h)<=s)l.phi=t.phi0,l.lam=0;else{switch(a){case 3:l.phi=p*sinph0+y*g*i/h,e(l.phi)>=1?l.phi=l.phi>0?k:-k:l.phi=o(l.phi),y=(p-sinph0*n(l.phi))*h,m*=g*i;break;case 2:l.phi=y*g/h,e(l.phi)>=1?l.phi=l.phi>0?k:-k:l.phi=o(l.phi),y=p*h,m*=g;break;case 1:l.phi-=k;break;case 0:l.phi=k-l.phi,y=-y}l.lam=c(m,y)}},t.fwd=function(e,t){var o,u,c;switch(c=n(e.phi),u=r(e.phi),o=r(e.lam),a){case 2:t.y=u*o;break;case 3:t.y=sinph0*c+i*u*o;break;case 1:t.y=-c;break;case 0:t.y=c}switch(t.y<=s&&U(),t.x=(t.y=1/t.y)*u*n(e.lam),a){case 2:t.y*=c;break;case 3:t.y*=i*c-sinph0*u*o;break;case 0:o=-o;case 1:t.y*=u*o}},t.es=0},"gnom","Gnomonic","Azi, Sph."),ee(ln,"moll","Mollweide","PCyl Sph"),ee(function(e){pn(e,hn(0,w/3))},"wag4","Wagner IV","PCyl Sph"),ee(function(e){pn(e,{C_x:.90977,C_y:1.65014,C_p:3.00896})},"wag5","Wagner V","PCyl Sph"),ee(function(t){var n,r,i,a,o=.0528,s=.7109307819790236;t.es=0,cn(t),n=t.fwd,r=t.inv,ln(t),i=t.fwd,a=t.inv,t.fwd=function(t,r){e(t.phi)<s?n(t,r):(i(t,r),r.y-=t.phi>0?o:-o)},t.inv=function(t,n){e(t.y)<=s?r(t,n):(t.y+=t.y>0?o:-o,a(t,n))}},"goode","Goode Homolosine","PCyl, Sph."),ee(function(t){var i,a,o;t.inv=function(t,n){var r=f(1-.25*i*i*t.x*t.x-.25*t.y*t.y);e(2*r*r-1)<1e-10?(n.lam=x,n.phi=x,pj_errno=-14):(n.lam=tn(i*t.x*r,2*r*r-1)/i,n.phi=Kt(r*t.y))},t.fwd=function(e,t){var s,u;u=f(2/(1+(s=r(e.phi))*r(e.lam*=i))),t.x=a*u*s*n(e.lam),t.y=o*u*n(e.phi)},t.es=0,H(t.params,"tW")?(i=e(H(t.params,"dW")))<=0&&q(-27):i=.5,H(t.params,"tM")?(a=e(H(t.params,"dM")))<=0&&q(-27):a=1,o=1/a,a/=i},"hammer","Hammer & Eckert-Greifendorff","Misc Sph,\nW= M="),ee(function(t){var i=1.000001;t.inv=function(t,a){var s=t.y*(t.y<0?.5179951515653813:.5686373742600607);e(s)>1?e(s)>i?B():s=s>0?k:-k:s=o(s),a.lam=1.1764705882352942*t.x/r(s),s+=s,a.phi=(s+n(s))*(t.y<0?.4102345310814193:.3736990601468637),e(a.phi)>1?e(a.phi)>i?B():a.phi=a.phi>0?k:-k:a.phi=o(a.phi)},t.fwd=function(t,i){var a,o,s;for(o=n(t.phi)*(t.phi<0?2.43763:2.67595),s=20;s&&(t.phi-=a=(t.phi+n(t.phi)-o)/(1+r(t.phi)),!(e(a)<1e-7));--s);i.x=.85*t.lam*r(t.phi*=.5),i.y=n(t.phi)*(t.phi<0?1.93052:1.75859)},t.es=0},"hatano","Hatano Asymmetrical Equal Area","PCyl., Sph."),ee(dn,"healpix","HEALPix","Sph., Ellps."),ee(function(e){dn(e,!0)},"rhealpix","rHEALPix","Sph., Ellps.\nnorth_square= south_square="),ee(function(t){var i,a=n(.5),u=o(a),l=2*f(w/(i=w+4*u*2)),h=.5*l*(2+f(3));t.es=0,t.fwd=function(t,a){var o,s,p=1-n(t.phi);if(p&&p<2){var d,g,m,y,v,b=k-t.phi,_=25;do{g=n(b),m=r(b),v=u+c(g,2-m),b-=d=(b-1*u-2*g+(y=5-4*m)*v-.5*p*i)/(4*g*v)}while(e(d)>1e-12&&--_>0);o=l*f(y),s=t.lam*v/w}else o=l*(1+p),s=t.lam*u/w;a.x=o*n(s),a.y=h-o*r(s)},t.inv=function(e,t){var r=e.x,a=e.y,p=r*r+(a-=h)*a,d=(5-p/(l*l))/4,g=s(d),m=n(g),y=u+c(m,2-d);t.lam=o(r/f(p))*w/y,t.phi=o(1-2*(g-1*u-2*m+(5-4*d)*y)/i)}},"hill","Hill Eucyclic","PCyl., Sph."),ee(function(t){var i,s,h,p,d,g,m,y,v,b=.785398163397448,_=1.37008346281555;t.a=6377397.155,t.e=f(t.es=.006674372230614),H(t.params,"tlat_0")||(t.phi0=.863937979737193),H(t.params,"tlon_0")||(t.lam0=.4334234309119251),H(t.params,"tk")||(t.k0=.9999),v=1,H(t.params,"tczech")||(v=-1),p=f(1+t.es*l(r(t.phi0),4)/(1-t.es)),i=o(n(t.phi0)/p),h=l((1+t.e*n(t.phi0))/(1-t.e*n(t.phi0)),p*t.e/2),d=a(i/2+b)/l(a(t.phi0/2+b),p)*h,s=f(1-t.es)/(1-t.es*l(n(t.phi0),2)),g=n(_),m=t.k0*s/a(_),y=.5286277629901559,t.inv=function(i,s){var h,x,w,S,A,E,M,I;M=i.x,i.x=i.y,i.y=M,i.x*=v,i.y*=v,A=f(i.x*i.x+i.y*i.y),S=c(i.y,i.x)/n(_),w=2*(u(l(m/A,1/g)*a(_/2+b))-b),h=o(r(y)*n(w)-n(y)*r(w)*r(S)),x=o(r(w)*n(S)/r(h)),s.lam=t.lam0-x/p,E=h,I=0;do{s.phi=2*(u(l(d,-1/p)*l(a(h/2+b),1/p)*l((1+t.e*n(E))/(1-t.e*n(E)),t.e/2))-b),e(E-s.phi)<1e-15&&(I=1),E=s.phi}while(0===I);s.lam-=t.lam0},t.fwd=function(e,i){var s,c,f,h,x,w,S;s=l((1+t.e*n(e.phi))/(1-t.e*n(e.phi)),p*t.e/2),c=2*(u(d*l(a(e.phi/2+b),p)/s)-b),f=-e.lam*p,h=o(r(y)*n(c)+n(y)*r(c)*r(f)),x=o(r(c)*n(f)/r(h)),w=g*x,S=m*l(a(_/2+b),g)/l(a(h/2+b),g),i.y=S*r(w),i.x=S*n(w),i.y*=v,i.x*=v}},"krovak","Krovak","PCyl., Ellps."),ee(function(t){var i,a,s,u,l,h,p,g,m,y,v,b=1e-10;if(y=e(t.phi0),m=e(y-k)<b?t.phi0<0?1:0:e(y)<b?2:3,t.es){switch(t.e=f(t.es),l=Jt(1,t.e,t.one_es),t.es,g=an(t.es),m){case 0:case 1:h=1;break;case 2:h=1/(p=f(.5*l)),s=1,u=.5*l;break;case 3:p=f(.5*l),v=n(t.phi0),i=Jt(v,t.e,t.one_es)/l,a=f(1-i*i),h=r(t.phi0)/(f(1-t.es*v*v)*p*a),u=(s=p)/h,s*=h}t.inv=function(e,s){var u,f,y,v,_=0;switch(m){case 2:case 3:if(e.x/=h,e.y*=h,(v=d(e.x,e.y))<b)return s.lam=0,s.phi=t.phi0,s;f=2*o(.5*v/p),u=r(f),f=n(f),e.x*=f,3==m?(_=u*i+e.y*f*a/v,e.y=v*a*u-e.y*i*f):(_=e.y*f/v,e.y=v*u);break;case 0:e.y=-e.y;case 1:if(!(y=e.x*e.x+e.y*e.y))return s.lam=0,s.phi=t.phi0,s;_=1-y/l,1==m&&(_=-_)}return s.lam=c(e.x,e.y),s.phi=on(o(_),g),s},t.fwd=function(o,c){var h,p,d,g,y=0,v=0,_=0;switch(h=r(o.lam),p=n(o.lam),d=n(o.phi),g=Jt(d,t.e,t.one_es),(3==m||2==m)&&(v=f(1-(y=g/l)*y)),m){case 3:_=1+i*y+a*v*h;break;case 2:_=1+v*h;break;case 0:_=k+o.phi,g=l-g;break;case 1:_=o.phi-k,g=l+g}switch(e(_)<b&&U(),m){case 3:case 2:3==m?(_=f(2/_),c.y=u*_*(a*y-i*v*h)):(_=f(2/(1+v*h)),c.y=_*y*u),c.x=s*_*v*p;break;case 0:case 1:g>=0?(_=f(g),c.x=_*p,c.y=h*(1==m?_:-_)):c.x=c.y=0}}}else 3==m&&(i=n(t.phi0),a=r(t.phi0)),t.inv=function(s,u){var f,l=0,h=0;switch(f=d(s.x,s.y),(u.phi=.5*f)>1&&B(),u.phi=2*o(u.phi),(3==m||2==m)&&(h=n(u.phi),l=r(u.phi)),m){case 2:u.phi=e(f)<=b?0:o(s.y*h/f),s.x*=h,s.y=l*f;break;case 3:u.phi=e(f)<=b?t.phi0:o(l*i+s.y*h*a/f),s.x*=h*a,s.y=(l-n(u.phi)*i)*f;break;case 0:s.y=-s.y,u.phi=k-u.phi;break;case 1:u.phi-=k}u.lam=0!=s.y||2!=m&&3!=m?c(s.x,s.y):0},t.fwd=function(o,s){var u,c,l;switch(l=n(o.phi),c=r(o.phi),u=r(o.lam),m){case 2:case 3:s.y=2==m?1+c*u:1+i*l+a*c*u,s.y<=b&&U(),s.y=f(2/s.y),s.x=s.y*c*n(o.lam),s.y*=2==m?l:a*l-i*c*u;break;case 0:u=-u;case 1:e(o.phi+t.phi0)<b&&U(),s.y=I-.5*o.phi,s.y=2*(1==m?r(s.y):n(s.y)),s.x=s.y*n(o.lam),s.y*=u}}},"laea","Lambert Azimuthal Equal Area","Azi, Sph&Ell"),ee(gn,"lonlat","Lat/long (Geodetic)",""),ee(gn,"longlat","Lat/long (Geodetic alias)",""),ee(gn,"latlon","Lat/long (Geodetic alias)",""),ee(gn,"latlong","Lat/long (Geodetic alias)",""),ee(function(t){var i,o,s,h,g,m,y,v,b,_,w,S=1e-10;t.inv=function(e,n){var r,i=e.x,a=e.y;i/=t.k0,a/=t.k0,0!=(r=d(i,a=y-a))?(m<0&&(r=-r,i=-i,a=-a),b?(n.phi=yn(l(r/v,1/m),t.e),n.phi==x&&B()):n.phi=2*u(l(v/r,1/m))-k,n.lam=c(i,a)/m):(n.lam=0,n.phi=m>0?k:-k)},t.fwd=function(i,o){var s,u=i.lam;e(e(i.phi)-k)<S?(i.phi*m<=0&&U(),s=0):s=v*(b?l(mn(i.phi,n(i.phi),t.e),m):l(a(I+.5*i.phi),-m)),u*=m,o.x=t.k0*(s*n(u)),o.y=t.k0*(y-s*r(u))},h=H(t.params,"rlat_1"),H(t.params,"tlat_2")?g=H(t.params,"rlat_2"):(g=h,H(t.params,"tlat_0")||(t.phi0=h)),e(h+g)<S&&q(-21),m=o=n(h),i=r(h),s=e(h-g)>=S,(b=0!=t.es)?(t.e=f(t.es),w=Wt(o,i,t.es),_=mn(h,o,t.e),s&&(o=n(g),m=p(w/Wt(o,r(g),t.es)),m/=p(_/mn(g,o,t.e))),v=y=w*l(_,-m)/m,y*=e(e(t.phi0)-k)<S?0:l(mn(t.phi0,n(t.phi0),t.e),m)):(s&&(m=p(i/r(g))/p(a(I+.5*g)/a(I+.5*h))),v=i*l(a(I+.5*h),m)/m,y=e(e(t.phi0)-k)<S?0:v*l(a(I+.5*t.phi0),-m))},"lcc","Lambert Conformal Conic","Conic, Sph&Ell\nlat_1= and lat_2= or lat_0="),ee(function(t){var n,i,o,s=1e-8;n=H(t.params,"rlat_1"),i=r(n),o=a(I+.5*n),i<s&&q(-22),t.fwd=function(t,r){r.y=t.phi-n,e(r.y)<s?r.x=t.lam*i:(r.x=I+.5*t.phi,e(r.x)<s||e(e(r.x)-k)<s?r.x=0:r.x=t.lam*r.y/p(a(r.x)/o))},t.inv=function(t,r){r.phi=t.y+n,e(t.y)<s?r.lam=t.x/i:(r.lam=I+.5*r.phi,e(r.lam)<s||e(e(r.lam)-k)<s?r.lam=0:r.lam=t.x*p(a(r.lam)/o)/t.y)},t.es=0},"loxim","Loximuthal","PCyl Sph"),ee(function(t){var i=.9525793444156804,a=.9258200997725514,s=3.401680257083045,u=2/3,c=1/3,f=1.0000001;t.fwd=function(e,t){e.phi=o(i*n(e.phi)),t.x=a*e.lam*(2*r(u*e.phi)-1),t.y=s*n(c*e.phi)},t.inv=function(t,c){c.phi=t.y/s,e(c.phi)>=1?e(c.phi)>f?B():c.phi=c.phi<0?-k:k:c.phi=o(c.phi),c.lam=t.x/(a*(2*r(u*(c.phi*=3))-1)),e(c.phi=n(c.phi)/i)>=1?e(c.phi)>f?B():c.phi=c.phi<0?-k:k:c.phi=o(c.phi)},t.es=0},"mbt_fpp","McBride-Thomas Flat-Polar Parabolic","Cyl., Sph."),ee(function(t){var i=1.000001;t.fwd=function(t,i){var a,o,s;for(o=1.7071067811865475*n(t.phi),s=20;s&&(t.phi-=a=(n(.5*t.phi)+n(t.phi)-o)/(.5*r(.5*t.phi)+r(t.phi)),!(e(a)<1e-7));--s);i.x=.3124597141037825*t.lam*(1+2*r(t.phi)/r(.5*t.phi)),i.y=1.874758284622695*n(.5*t.phi)},t.inv=function(t,a){var s;a.phi=.533402096794177*t.y,e(a.phi)>1?e(a.phi)>i?B():a.phi<0?(s=-1,a.phi=-w):(s=1,a.phi=w):a.phi=2*o(s=a.phi),a.lam=3.2004125807650623*t.x/(1+2*r(a.phi)/r(.5*a.phi)),a.phi=.585786437626905*(s+n(a.phi)),e(a.phi)>1?e(a.phi)>i?B():a.phi=a.phi<0?-k:k:a.phi=o(a.phi)},t.es=0},"mbt_fpq","McBryde-Thomas Flat-Polar Quartic","Cyl., Sph."),ee(function(t){var i=.45503,a=1.36509,o=1.41546,s=.22248,u=1.44492,c=1/3;t.fwd=function(t,f){var l,h,p,d;for(l=o*n(t.phi),d=10;d&&(p=t.phi/a,t.phi-=h=(i*n(p)+n(t.phi)-l)/(c*r(p)+r(t.phi)),!(e(h)<1e-7));--d);p=t.phi/a,f.x=s*t.lam*(1+3*r(t.phi)/r(p)),f.y=u*n(p)},t.inv=function(e,t){var c;t.phi=a*(c=Kt(e.y/u)),t.lam=e.x/(s*(1+3*r(t.phi)/r(c))),t.phi=Kt((i*n(c)+n(t.phi))/o)},t.es=0},"mbt_fps","McBryde-Thomas Flat-Pole Sine (No. 2)","Cyl., Sph."),ee(function(t){var i=1e-10,o=0,s=H(t.params,"tlat_ts");s&&(o=H(t.params,"rlat_ts"))>=k&&q(-24),t.es?(s&&(t.k0=Wt(n(o),r(o),t.es)),t.inv=function(e,n){n.phi=yn(h(-e.y/t.k0),t.e),n.phi===x&&B(),n.lam=e.x/t.k0},t.fwd=function(r,a){e(e(r.phi)-k)<=i&&U(),a.x=t.k0*r.lam,a.y=-t.k0*p(mn(r.phi,n(r.phi),t.e))}):(t.inv=function(e,n){n.phi=k-2*u(h(-e.y/t.k0)),n.lam=e.x/t.k0},t.fwd=function(n,r){e(e(n.phi)-k)<=i&&U(),r.x=t.k0*n.lam,r.y=t.k0*p(a(I+.5*n.phi))})},"merc","Mercator","Cyl, Sph&Ell\nlat_ts="),ee(function(t){t.k0=1,t.inv=function(e,n){n.phi=k-2*u(h(-e.y/t.k0)),n.lam=e.x/t.k0},t.fwd=function(n,r){e(e(n.phi)-k)<=L&&U(),r.x=t.k0*n.lam,r.y=t.k0*p(a(I+.5*n.phi))}},"webmerc","Web Mercator / Pseudo Mercator","Cyl, Ell"),ee(function(e){e.fwd=function(e,t){t.x=e.lam,t.y=1.25*p(a(I+.4*e.phi))},e.inv=function(e,t){t.lam=e.x,t.phi=2.5*(u(h(.8*e.y))-I)},e.es=0},"mill","Miller Cylindrical","Cyl, Sph"),ee(function(e){e.lam0=20*A,e.phi0=18*A,e.es=0,_n(e,[[.9245,0],[0,0],[.01943,0]])},"mil_os","Miller Oblated Stereographic","Azi(mod)"),ee(function(e){e.lam0=-165*A,e.phi0=-10*A,e.es=0,_n(e,[[.721316,0],[0,0],[-.0088162,-.00617325]])},"lee_os","Lee Oblated Stereographic","Azi(mod)"),ee(function(e){e.lam0=-96*A,e.phi0=39*A,e.es=0,e.a=6370997,_n(e,[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]])},"gs48","Mod Stereographic of 48 U.S.","Azi(mod)"),ee(function(e){var t;e.lam0=-152*A,e.phi0=64*A,0!=e.es?(t=[[.9945303,0],[.0052083,-.0027404],[.0072721,.0048181],[-.0151089,-.1932526],[.0642675,-.1381226],[.3582802,-.2884586]],e.a=6378206.4,e.e=f(e.es=.00676866)):(t=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],e.a=6370997),_n(e,t)},"alsk","Mod Stereographic of Alaska","Azi(mod)"),ee(function(e){var t;e.lam0=-120*A,e.phi0=45*A,0!=e.es?(t=[[.9827497,0],[.0210669,.0053804],[-.1031415,-.0571664],[-.0323337,-.0322847],[.0502303,.1211983],[.0251805,.0895678],[-.0012315,-.1416121],[.0072202,-.1317091],[-.0194029,.0759677],[-.0210072,.0834037]],e.a=6378206.4,e.e=f(e.es=.00676866)):(t=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],e.a=6370997),_n(e,t)},"gs50","Mod Stereographic of 50 U.S.","Azi(mod)"),ee(function(t){var n=.8707,r=-.131979,i=-.013791,a=.003971,o=-.001529,s=1.007226,u=.015085,c=-.044475,f=.028874,l=-.005916,h=s,p=3*u,d=7*c,g=9*f,m=11*l,y=.8707*.52*w;t.es=0,t.fwd=function(e,t){var h,p;p=(h=e.phi*e.phi)*h,t.x=e.lam*(n+h*(r+h*(i+p*h*(a+h*o)))),t.y=e.phi*(s+h*(u+p*(c+f*h+l*p)))},t.inv=function(t,v){var b,_,x,w,S=t.x,A=t.y;for(A>y?A=y:A<-y&&(A=-y),b=A;b-=_=(b*(s+(x=b*b)*(u+(w=x*x)*(c+f*x+l*w)))-A)/(h+x*(p+w*(d+g*x+m*w))),!(e(_)<1e-11););v.phi=b,x=b*b,v.lam=S/(n+x*(r+x*(i+x*x*x*(a+x*o))))}},"natearth","Natural Earth","PCyl., Sph."),ee(function(t){var n=.84719,r=-.13063,i=-.04515,a=.05494,o=-.02326,s=.00331,u=1.01183,c=-.02625,f=.01926,l=-.00396,h=u,p=9*c,d=.45334622460635143*w;t.es=0,t.fwd=function(e,t){var h,p,d;d=(h=e.phi*e.phi)*(p=h*h),t.x=e.lam*(n+r*h+d*d*(i+a*h+o*p+s*d)),t.y=e.phi*(u+p*p*(c+f*h+l*p))},t.inv=function(t,g){var m,y,v,b,_,x=t.x,w=t.y;for(w>d?w=d:w<-d&&(w=-d),m=w;m-=y=(m*(u+(b=(v=m*m)*v)*b*(c+f*v+l*b))-w)/(h+b*b*(p+.21186*v+-.05148*b)),!(e(y)<1e-11););g.phi=m,_=(v=m*m)*(b=v*v),g.lam=x/(n+r*v+_*_*(i+a*v+o*b+s*_))}},"natearth2","Natural Earth 2","PCyl., Sph."),ee(function(t){t.inv=function(e,t){t.lam=2*e.x/(1+r(e.y)),t.phi=Kt(.5*(e.y+n(e.y)))},t.fwd=function(t,i){var a,o,s;for(a=2*n(t.phi),o=t.phi*t.phi,t.phi*=1.00371+o*(-.011412*o-.0935382),s=10;s&&(t.phi-=o=(t.phi+n(t.phi)-a)/(1+r(t.phi)),!(e(o)<1e-7));--s);i.x=.5*t.lam*(1+r(t.phi)),i.y=t.phi},t.es=0},"nell","Nell","PCyl., Sph."),ee(function(t){t.es=0,t.fwd=function(e,t){t.x=.5*e.lam*(1+r(e.phi)),t.y=2*(e.phi-a(.5*e.phi))},t.inv=function(t,n){var i,o,s,u;for(s=.5*t.y,u=9;u>0&&(o=r(.5*n.phi),n.phi-=i=(n.phi-a(n.phi/2)-s)/(1-.5/(o*o)),!(e(i)<1e-7));--u);u?n.lam=2*t.x/(1+r(n.phi)):(n.phi=s<0?-k:k,n.lam=2*t.x)}},"nell_h","Nell-Hammer","PCyl., Sph."),ee(function(t){t.es=0,t.fwd=function(t,i){var a=1e-10;if(e(t.lam)<a)i.x=0,i.y=t.phi;else if(e(t.phi)<a)i.x=t.lam,i.y=0;else if(e(e(t.lam)-k)<a)i.x=t.lam*r(t.phi),i.y=k*n(t.phi);else if(e(e(t.phi)-k)<a)i.x=0,i.y=t.phi;else{var o=k/t.lam-t.lam/k,s=t.phi/k,u=n(t.phi),c=(1-s*s)/(u-s),l=o/c,h=(o*u/c-.5*o)/(1+(l*=l)),p=(u/l+.5*c)/(1+1/l);i.x=r(t.phi),i.x=f(h*h+i.x*i.x/(1+l)),i.x=k*(h+(t.lam<0?-i.x:i.x)),i.y=f(p*p-(u*u/l+c*u-1)/(1+1/l)),i.y=k*(p+(t.phi<0?i.y:-i.y))}}},"nicol","Nicolosi Globular","Misc Sph, no inv"),ee(function(e){xn(e,H(e.params,"dh"))},"nsper","Near-sided perspective","Azi, Sph\nh="),ee(function(e){var t=H(e.params,"dtilt")*A,n=H(e.params,"dazi")*A,r=H(e.params,"dh");xn(e,r,t,n)},"tpers","Tilted perspective","Azi, Sph\ntilt= azi= h="),ee(function(t){var n=[[.7557853228,0],[.249204646,.003371507],[-.001541739,.04105856],[-.10162907,.01727609],[-.26623489,-.36249218],[-.6870983,-1.1651967]],r=[1.5627014243,.5185406398,-.03333098,-.1052906,-.0368594,.007317,.0122,.00394,-.0013],i=[.6399175073,-.1358797613,.063294409,-.02526853,.0117879,-.0055161,.0026906,-.001333,67e-5,-34e-5];t.ra=1/(t.a=6378388),t.lam0=173*A,t.phi0=-41*A,t.x0=251e4,t.y0=6023150,t.inv=function(i,a){var o,s,u,c,f,l,h={r:i.y,i:i.x},p={};for(o=20;o>0&&((f=bn(h,n,p)).r-=i.y,f.i-=i.x,l=p.r*p.r+p.i*p.i,h.r+=u=-(f.r*p.r+f.i*p.i)/l,h.i+=c=-(f.i*p.r-f.r*p.i)/l,!(e(u)+e(c)<=1e-10));--o);if(o>0){for(a.lam=h.i,s=r.length-1,a.phi=r[s],--s;s>=0;--s)a.phi=r[s]+h.r*a.phi;a.phi=t.phi0+h.r*a.phi*.484813681109536}else a.lam=a.phi=x},t.fwd=function(e,r){var a=i.length-1,o={r:i[a]},s=2.0626480624709638*(e.phi-t.phi0);for(--a;a>=0;--a)o.r=i[a]+s*o.r;o.r*=s,o.i=e.lam,o=vn(o,n),r.x=o.i,r.y=o.r}},"nzmg","New Zealand Map Grid","fixed Earth"),ee(function(t){var i,o,s,f,l,h,p,d,g,m,y,v,b,_,w,E=1e-10;i=H(t.params,"so_proj"),o=Q[i],i||q(-26),o&&"ob_tran"!=i||q(-37),t.es=0,s={},Object.keys(t).forEach(function(e){s[e]=t[e]}),o.init(s),s.is_latlong&&1==t.to_meter&&(t.to_meter=A,t.fr_meter=S),H(t.params,"to_alpha")?(d=H(t.params,"ro_lon_c"),g=H(t.params,"ro_lat_c"),m=H(t.params,"ro_alpha"),e(e(g)-k)<=E&&q(-32),f=d+tn(-r(m),-n(m)*n(g)),p=Kt(r(g)*n(m))):H(t.params,"to_lat_p")?(f=H(t.params,"ro_lon_p"),p=H(t.params,"ro_lat_p")):(y=H(t.params,"ro_lon_1"),b=H(t.params,"ro_lat_1"),v=H(t.params,"ro_lon_2"),_=H(t.params,"ro_lat_2"),(e(b-_)<=E||(w=e(b))<=E||e(w-k)<=E||e(e(_)-k)<=E)&&q(-33),f=c(r(b)*n(_)*r(y)-n(b)*r(_)*r(v),n(b)*r(_)*n(v)-r(b)*n(_)*n(y)),p=u(-r(f-y)/a(b))),e(p)>E?(l=r(p),h=n(p),t.fwd=function(e,t){var i,a,o;i=r(e.lam),a=n(e.phi),o=r(e.phi),e.lam=Ie(tn(o*n(e.lam),h*o*i+l*a)+f),e.phi=Kt(h*a-l*o*i),s.fwd(e,t)},t.inv=s.inv?function(e,t){var i,a,o;s.inv(e,t),t.lam!=x&&(i=r(t.lam-=f),a=n(t.phi),o=r(t.phi),t.phi=Kt(h*a+l*o*i),t.lam=tn(o*n(t.lam),h*o*i-l*a))}:null):(t.fwd=function(e,t){var i,a;i=r(e.phi),a=r(e.lam),e.lam=Ie(tn(i*n(e.lam),n(e.phi))+f),e.phi=Kt(-i*a),s.fwd(e,t)},t.inv=s.inv?function(e,t){var i,a;s.inv(e,t),t.lam!=x&&(i=r(t.phi),a=t.lam-f,t.lam=tn(i*n(a),-n(t.phi)),t.phi=Kt(i*r(a)))}:null)},"ob_tran","General Oblique Transformation","Misc Sph\no_proj= plus parameters for projection\no_lat_p= o_lon_p= (new pole) or\no_alpha= o_lon_c= o_lat_c= or\no_lon_1= o_lat_1= o_lon_2= o_lat_2="),ee(function(e){var t,i,s,l,h,p,d,g,m,y,v;d=1/e.k0,g=e.k0,H(e.params,"talpha")?(p=H(e.params,"ralpha"),h=H(e.params,"rlonc"),v=u(-r(p)/(-n(0)*n(p)))+h,m=o(r(0)*n(p))):(t=H(e.params,"rlat_1"),i=H(e.params,"rlat_2"),s=H(e.params,"rlon_1"),l=H(e.params,"rlon_2"),v=c(r(t)*n(i)*r(s)-n(t)*r(i)*r(l),n(t)*r(i)*n(l)-r(t)*n(i)*n(s)),s==-k&&(v=-v),m=u(-r(v-s)/a(t))),e.lam0=v+k,y=r(m),m=n(m),v=n(v),e.es=0,e.fwd=function(e,t){var i;t.y=n(e.lam),i=r(e.lam),t.x=u((a(e.phi)*y+m*t.y)/i),i<0&&(t.x+=w),t.x*=g,t.y=d*(m*n(e.phi)-y*r(e.phi)*t.y)},e.inv=function(e,t){var i,a;e.y/=d,e.x/=g,i=f(1-e.y*e.y),t.phi=o(e.y*m+i*y*(a=n(e.x))),t.lam=c(i*m*a-e.y*y,i*r(e.x))}},"ocea","Oblique Cylindrical Equal Area","Cyl, Sph lonc= alpha= or\nlat_1= lat_2= lon_1= lon_2="),ee(function(t){var i,s,d,g,m,y,v,b,_,S,A,E,M,C,O,N,T,z,R,D,j,F,G,V,$,J,W,Z=1e-7,Y=0,X=0,K=0,Q=0,ee=0,te=0,ne=0,re=0;W=H(t.params,"tno_rot"),0!=(E=H(t.params,"talpha"))&&(ne=H(t.params,"ralpha")),0!=(M=H(t.params,"tgamma"))&&(Y=H(t.params,"rgamma")),E||M?(X=H(t.params,"rlonc"),(re=H(t.params,"tno_off")||H(t.params,"tno_uoff"))&&(H(t.params,"sno_uoff"),H(t.params,"sno_off"))):(K=H(t.params,"rlon_1"),ee=H(t.params,"rlat_1"),Q=H(t.params,"rlon_2"),te=H(t.params,"rlat_2"),(e(ee-te)<=Z||(i=e(ee))<=Z||e(i-k)<=Z||e(e(t.phi0)-k)<=Z||e(e(te)-k)<=Z)&&q(-33)),s=f(t.one_es),e(t.phi0)>L?(b=n(t.phi0),d=r(t.phi0),i=1-t.es*b*b,O=d*d,O=f(1+t.es*O*O/t.one_es),C=O*t.k0*s/i,(m=(g=O*s/(d*f(i)))*g-1)<=0?m=0:(m=f(m),t.phi0<0&&(m=-m)),N=m+=g,N*=l(mn(t.phi0,b,t.e),O)):(O=1/s,C=t.k0,N=g=m=1),E||M?(E?(A=o(n(ne)/g),M||(Y=ne)):ne=o(g*n(A=Y)),t.lam0=X-o(.5*(m-1/m)*a(A))/O):(y=l(mn(ee,n(ee),t.e),O),v=l(mn(te,n(te),t.e),O),m=N/y,_=(v-y)/(v+y),S=((S=N*N)-v*y)/(S+v*y),(i=K-Q)<-w?Q-=P:i>w&&(Q+=P),t.lam0=Ie(.5*(K+Q)-u(S*a(.5*O*(K-Q))/_)/O),A=u(2*n(O*Ie(K-t.lam0))/(m-1/m)),Y=ne=o(g*n(A))),D=n(A),j=r(A),F=n(Y),G=r(Y),z=1/(T=C*(R=1/O)),re?J=0:(J=e(T*u(f(g*g-1)/r(ne))),t.phi0<0&&(J=-J)),V=T*p(a(I-(m=.5*A))),$=T*p(a(I+m)),t.fwd=function(i,a){var o,s,u,f,h,d,g,m;e(e(i.phi)-k)>L?(o=.5*((h=N/l(mn(i.phi,n(i.phi),t.e),O))-(d=1/h)),s=.5*(h+d),f=n(O*i.lam),e(e(u=(o*D-f*j)/s)-1)<L&&U(),m=.5*T*p((1-u)/(1+u)),d=r(O*i.lam),g=e(d)<Z?C*i.lam:T*c(o*j+f*D,d)):(m=i.phi>0?V:$,g=T*i.phi),W?(a.x=g,a.y=m):(g-=J,a.x=m*G+g*F,a.y=g*G-m*F)},t.inv=function(i,a){var o,s,u,p,d,g,m;W?(s=i.y,o=i.x):(s=i.x*G-i.y*F,o=i.y*G+i.x*F+J),p=.5*((u=h(-z*s))-1/u),d=.5*(u+1/u),g=n(z*o),e(e(m=(g*j+p*D)/d)-1)<L?(a.lam=0,a.phi=m<0?-k:k):(a.phi=N/f((1+m)/(1-m)),(a.phi=yn(l(a.phi,1/O),t.e))==x&&B(),a.lam=-R*c(p*j-g*D,r(z*o)))}},"omerc","Oblique Mercator","Cyl, Sph&Ell no_rot\nalpha= [gamma=] [no_off] lonc= or\nlon_1= lat_1= lon_2= lat_2="),ee(function(t){var i=1e-10,a={};e(e(t.phi0)-k)<=i?a.mode=t.phi0<0?1:0:e(t.phi0)>i?(a.mode=3,a.sinph0=n(t.phi0),a.cosph0=r(t.phi0)):a.mode=2,t.fwd=function(o,s){var u,c,f;switch(c=r(o.phi),u=r(o.lam),a.mode){case 2:c*u<-1e-10&&U(),s.y=n(o.phi);break;case 3:a.sinph0*(f=n(o.phi))+a.cosph0*c*u<-1e-10&&U(),s.y=a.cosph0*f-a.sinph0*c*u;break;case 0:u=-u;case 1:e(o.phi-t.phi0)-i>k&&U(),s.y=c*u}s.x=c*n(o.lam)},t.inv=function(n,r){var u,l,h;if((h=u=d(n.x,n.y))>1&&(h-1>i&&B(),h=1),l=f(1-h*h),e(u)<=i)r.phi=t.phi0,r.lam=0;else{switch(a.mode){case 0:n.y=-n.y,r.phi=s(h);break;case 1:r.phi=-s(h);break;case 2:case 3:2==a.mode?(r.phi=n.y*h/u,n.x*=h,n.y=l*u):(r.phi=l*a.sinph0+n.y*h*a.cosph0/u,n.y=(l-a.sinph0*r.phi)*u,n.x*=h*a.cosph0),e(r.phi)>=1?r.phi=r.phi<0?-k:k:r.phi=o(r.phi)}r.lam=0!=n.y||3!=a.mode&&2!=a.mode?c(n.x,n.y):0==n.x?0:n.x<0?-k:k}},t.es=0},"ortho","Orthographic","Azi, Sph."),ee(function(t){var n=1.0148,r=.23185,i=-.14499,a=.02406,o=n,s=5*r,u=7*i,c=908571831.7;t.es=0,t.fwd=function(e,t){var o=e.phi*e.phi;t.x=e.lam,t.y=e.phi*(n+o*o*(r+o*(i+a*o)))},t.inv=function(t,f){var l,h,p,d;for(l=t.y,t.y>c?t.y=c:t.y<-c&&(t.y=-c),d=100;d&&(l-=h=(l*(n+(p=l*l)*p*(r+p*(i+a*p)))-t.y)/(o+p*p*(s+p*(u+.21654*p))),!(e(h)<1e-11));--d);f.phi=l,f.lam=t.x}},"patterson","Patterson Cylindrical","Cyl., Sph."),ee(function(t){var i,s,u=1e-10,c=1e-12;t.es?(s=Yt(t.es),i=Ht(t.phi0,n(t.phi0),r(t.phi0),s),t.fwd=function(a,o){var c,f,l;e(a.phi)<=u?(o.x=a.lam,o.y=-i):(f=n(a.phi),c=e(l=r(a.phi))>u?Wt(f,l,t.es)/f:0,o.x=c*n(a.lam*=f),o.y=Ht(a.phi,f,l,s)-i+c*(1-r(a.lam)))},t.inv=function(l,h){var p,d,g,m,y,v,b,_,x,w,S=l.x,A=l.y;if(e(A+=i)<=u)h.lam=S,h.phi=0;else{for(p=A*A+S*S,h.phi=A,w=20;w>0&&(y=(g=n(h.phi))*(m=r(h.phi)),e(m)<c&&B(),d=g*(_=f(1-t.es*g*g))/m,b=(v=Ht(h.phi,g,m,s))*v+p,_=t.one_es/(_*_*_),h.phi+=x=(v+v+d*b-2*A*(d*v+1))/(t.es*y*(b-2*A*v)/d+2*(A-v)*(d*_-1/y)-_-_),!(e(x)<=c));--w);w||B(),d=n(h.phi),h.lam=o(S*a(h.phi)*f(1-t.es*d*d))/n(h.phi)}}):(i=-t.phi0,t.fwd=function(o,s){var c,f;e(o.phi)<=u?(s.x=o.lam,s.y=i):(c=1/a(o.phi),s.x=n(f=o.lam*n(o.phi))*c,s.y=o.phi-t.phi0+c*(1-r(f)))},t.inv=function(r,i){var s,c,f,l;if(e(r.y=t.phi0+r.y)<=u)i.lam=r.x,i.phi=0;else{i.phi=r.y,s=r.x*r.x+r.y*r.y,l=10;do{f=a(i.phi),i.phi-=c=(r.y*(i.phi*f+1)-i.phi-.5*(i.phi*i.phi+s)*f)/((i.phi-r.y)/f-1)}while(e(c)>1e-10&&--l);l||B(),i.lam=o(r.x*a(i.phi))/n(i.phi)}})},"poly","Polyconic (American)","Conic, Sph&Ell"),ee(function(t){var i=1.8949,a=1.71848,o=.6141848493043784,s=1.0471975511965976;t.es=0,t.fwd=function(t,u){var c,f,l,h,p;for(c=o*n(t.phi),l=t.phi*t.phi,t.phi*=.615709+l*(.00909953+.0046292*l),p=10;p&&(f=r(t.phi),l=n(t.phi),t.phi-=h=(t.phi+l*(f-1)-c)/(1+f*(f-1)-l*l),!(e(h)<1e-10));--p);p||(t.phi=t.phi<0?-s:s),u.x=i*t.lam*(r(t.phi)-.5),u.y=a*n(t.phi)},t.inv=function(e,t){var s;t.phi=Kt(e.y/a),t.lam=e.x/(i*((s=r(t.phi))-.5)),t.phi=Kt((t.phi+n(t.phi)*(s-1))/o)}},"putp2","Putnins P2","PCyl., Sph."),ee(wn,"putp3","Putnins P3","PCyl., Sph."),ee(function(e){wn(e,!0)},"putp3p","Putnins P3'","PCyl., Sph."),ee(function(e){Sn(e,.874038744,3.883251825)},"putp4p","Putnins P4'","PCyl., Sph."),ee(function(e){Sn(e,1,4.442882938)},"weren","Werenskiold I","PCyl., Sph."),ee(An,"putp5","Putnins P5","PCyl., Sph."),ee(function(e){An(e,!0)},"putp5p","Putnins P5'","PCyl., Sph."),ee(En,"putp6","Putnins P6","PCyl., Sph."),ee(function(e){En(e,!0)},"putp6p","Putnins P6'","PCyl., Sph."),ee(function(t){var i,o,l,h;function p(t,n,r){var i,a;return t<1e-10?(i=0,a=0):(a=c(n,r),e(a)<=I?i=0:a>I&&a<=k+I?(i=1,a-=k):a>k+I||a<=-(k+I)?(i=2,a=a>=0?a-w:a+w):(i=3,a+=k)),{area:i,theta:a}}function d(e,t){var n=e+t;return n<-w?n+=P:n>+w&&(n-=P),n}i=t.phi0>=k-I/2?4:t.phi0<=-(k-I/2)?5:e(t.lam0)<=I?0:e(t.lam0)<=k+I?t.lam0>0?1:3:2,0!==t.es&&(t.a,t.a,o=t.a*f(1-t.es),l=1-(t.a-o)/t.a,h=l*l),t.fwd=function(e,o){var c,l,g,m,y,v,b,_,x,S,A,E,M,P;c=0!==t.es?u(h*a(e.phi)):e.phi,l=e.lam,4==i?(m=k-c,l>=I&&l<=k+I?(b=0,g=l-k):l>k+I||l<=-(k+I)?(b=1,g=l>0?l-w:l+w):l>-(k+I)&&l<=-I?(b=2,g=l+k):(b=3,g=l)):5==i?(m=k+c,l>=I&&l<=k+I?(b=0,g=-l+k):l<I&&l>=-I?(b=1,g=-l):l<-I&&l>=-(k+I)?(b=2,g=-l-k):(b=3,g=l>0?-l+w:-l-w)):(1==i?l=d(l,+k):2==i?l=d(l,+w):3==i&&(l=d(l,-k)),A=n(c),E=r(c),M=n(l),_=E*r(l),x=E*M,S=A,0==i?P=p(m=s(_),S,x):1==i?P=p(m=s(x),S,-_):2==i?P=p(m=s(-_),S,-x):3==i?P=p(m=s(-x),S,_):(m=0,P={area:0,theta:0}),g=P.theta,b=P.area),v=u(12/w*(g+s(n(g)*r(I))-k)),y=f((1-r(m))/(r(v)*r(v))/(1-r(u(1/r(g))))),1==b?v+=k:2==b?v+=w:3==b&&(v+=C),o.x=y*r(v),o.y=y*n(v)},t.inv=function(p,g){var m,y,v,b,_,x,S,A,E,M,I,C,P;if(y=u(f(p.x*p.x+p.y*p.y)),m=c(p.y,p.x),p.x>=0&&p.x>=e(p.y)?M=0:p.y>=0&&p.y>=e(p.x)?(M=1,m-=k):p.x<0&&-p.x>=e(p.y)?(M=2,m=m<0?m+w:m-w):(M=3,m+=k),E=w/12*a(m),_=n(E)/(r(E)-1/f(2)),x=u(_),(S=1-(v=r(m))*v*(b=a(y))*b*(1-r(u(1/r(x)))))<-1?S=-1:S>1&&(S=1),4==i)A=s(S),g.phi=k-A,g.lam=0==M?x+k:1==M?x<0?x+w:x-w:2==M?x-k:x;else if(5==i)A=s(S),g.phi=A-k,g.lam=0==M?-x+k:1==M?-x:2==M?-x-k:x<0?-x-w:-x+w;else{var O,N,T;E=(O=S)*O,N=(E+=(T=E>=1?0:f(1-E)*n(x))*T)>=1?0:f(1-E),1==M?(E=N,N=-T,T=E):2==M?(N=-N,T=-T):3==M&&(E=N,N=T,T=-E),1==i?(E=O,O=-N,N=E):2==i?(O=-O,N=-N):3==i&&(E=O,O=N,N=-E),g.phi=s(-T)-k,g.lam=c(N,O),1==i?g.lam=d(g.lam,-k):2==i?g.lam=d(g.lam,-w):3==i&&(g.lam=d(g.lam,+k))}0!==t.es&&(I=g.phi<0?1:0,C=a(g.phi),P=o/f(C*C+h),g.phi=u(f(t.a*t.a-P*P)/(l*P)),I&&(g.phi=-g.phi))}},"qsc","Quadrilateralized Spherical Cube","Azi, Sph."),ee(function(n){var r=c([[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.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,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.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]]),i=c([[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]]),a=.8487,o=1.3523;function s(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))}function u(e,t){return e[1]+t*(e[2]+e[2]+3*t*e[3])}function c(e){return e.map(function(e){return new Float32Array(e)})}n.es=0,n.fwd=function(n,u){var c,f;(c=t(11.459155902616464*(f=e(n.phi))))<0&&U(),c>=18&&(c=17),f=S*(f-.08726646259971647*c),u.x=s(r[c],f)*a*n.lam,u.y=s(i[c],f)*o,n.phi<0&&(u.y=-u.y)},n.inv=function(n,c){var f,l,h,p;if(c.lam=n.x/a,c.phi=e(n.y/o),c.phi>=1)c.phi>1.000001?B():(c.phi=n.y<0?-k:k,c.lam/=r[18][0]);else{if((p=t(18*c.phi))<0||p>=18)return B();for(;;)if(i[p][0]>c.phi)--p;else{if(!(i[p+1][0]<=c.phi))break;++p}for(h=new Float32Array(i[p]),f=5*(c.phi-h[0])/(i[p+1][0]-h[0]),h[0]-=c.phi;f-=l=s(h,f)/u(h,f),!(e(l)<1e-8););c.phi=(5*p+f)*A,n.y<0&&(c.phi=-c.phi),c.lam/=s(r[p],f)}}},"robin","Robinson","PCyl., Sph."),ee(Mn("EULER"),"euler","Euler","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD1"),"murd1","Murdoch I","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD2"),"murd2","Murdoch II","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD3"),"murd3","Murdoch III","Conic, Sph\nlat_1= and lat_2="),ee(Mn("PCONIC"),"pconic","Perspective Conic","Conic, Sph\nlat_1= and lat_2="),ee(Mn("TISSOT"),"tissot","Tissot","Conic, Sph\nlat_1= and lat_2="),ee(Mn("VITK1"),"vitk1","Vitkovsky I","Conic, Sph\nlat_1= and lat_2="),ee(function(t){var i,o,s,c,l,d,g,m,y;s=.5*t.e,g=r(t.phi0),g*=g,o=f(1+t.es*g*g*t.rone_es),y=n(t.phi0),l=r(m=Kt(d=y/o)),y*=t.e,i=p(a(I+.5*m))-o*(p(a(I+.5*t.phi0))-s*p((1+y)/(1-y))),c=t.k0*f(t.one_es)/(1-y*y),t.inv=function(f,g){var m,y,v,b,_,x,w,S,A;for(v=2*(u(h(f.y/c))-I),b=f.x/c,_=r(v),m=Kt(l*n(v)+d*_*r(b)),y=Kt(_*n(b)/r(m)),w=(i-p(a(I+.5*m)))/o,A=6;A&&(x=t.e*n(m),m-=S=(w+p(a(I+.5*m))-s*p((1+x)/(1-x)))*(1-x*x)*r(m)*t.rone_es,!(e(S)<1e-10));--A);A?(g.phi=m,g.lam=y/o):B()},t.fwd=function(e,f){var g,m,y,v,b,_;b=t.e*n(e.phi),g=2*u(h(o*(p(a(I+.5*e.phi))-s*p((1+b)/(1-b)))+i))-k,m=o*e.lam,_=r(g),y=Kt(l*n(g)-d*_*r(m)),v=Kt(_*n(m)/r(y)),f.x=c*v,f.y=c*p(a(I+.5*y))}},"somerc","Swiss. Obl. Mercator","Cyl, Ell\nFor CH1903"),ee(function(e){var t=H(e.params,"tlat_ts")?H(e.params,"rlat_ts"):k;In(e,t)},"stere","Stereographic","Azi, Sph&Ell\nlat_ts="),ee(function(e){e.phi0=H(e.params,"bsouth")?-k:k,e.k0=.994,e.x0=2e6,e.y0=2e6,e.lam0=0,e.es||q(-34),In(e,k)},"ups","Universal Polar Stereographic","Azi, Sph&Ell\nsouth"),ee(function(t){var i,s,h,p,g,m,y,v,b,_=(i=t.e,s=t.phi0,h=i*i,p=n(s),g=r(s),m=f(1-h)/(1-h*p*p),y=f(1+h*g*g*g*g/(1-h)),v=o(p/y),b=.5*y*i,{e:i,K:a(.5*v+I)/(l(a(.5*s+I),y)*kn(i*p,b)),C:y,chi:v,ratexp:b,rc:m}),x=_.chi,w=2*_.rc,S=n(x),A=r(x);t.fwd=function(e,i){var o,s,c,f;e=function(e,t){return{phi:2*u(t.K*l(a(.5*e.phi+I),t.C)*kn(t.e*n(e.phi),t.ratexp))-k,lam:t.C*e.lam}}(e,_),s=n(e.phi),o=r(e.phi),c=r(e.lam),f=t.k0*w/(1+S*s+A*o*c),i.x=f*o*n(e.lam),i.y=f*(A*s-S*o*c)},t.inv=function(i,s){var f,h,p,g,m=i.x/t.k0,y=i.y/t.k0;(f=d(m,y))?(h=2*c(f,w),p=n(h),g=r(h),s.phi=o(g*S+y*p*A/f),s.lam=c(m*p,f*A*g-y*S*p)):(s.phi=x,s.lam=0),function(t,r){t.phi;var i,o,s=l(a(.5*t.phi+I)/r.K,1/r.C);for(t.lam/=r.C,i=20;i>0&&(o=2*u(s*kn(r.e*n(t.phi),-.5*r.e))-k,!(e(o-t.phi)<1e-14));--i)t.phi=o;i||F(-17)}(s,_)}},"sterea","Oblique Stereographic Alternative","Azimuthal, Sph&Ell"),ee(function(e){Cn(e,1.50488,1.35439,!1)},"kav5","Kavraisky V","PCyl., Sph."),ee(function(e){Cn(e,2,2,!1)},"qua_aut","Quartic Authalic","PCyl., Sph."),ee(function(e){Cn(e,2,2,!0)},"fouc","Foucaut","PCyl., Sph."),ee(function(e){Cn(e,1.48875,1.36509,!1)},"mbt_s","McBryde-Thomas Flat-Polar Sine (No. 1)","PCyl., Sph."),ee(function(e){e.es=0,e.fwd=function(t,i){i.x=r(t.phi)*n(t.lam)/e.k0,i.y=e.k0*(c(a(t.phi),r(t.lam))-e.phi0)},e.inv=function(t,i){var a;t.y=t.y/e.k0+e.phi0,t.x*=e.k0,a=f(1-t.x*t.x),i.phi=o(a*n(t.y)),i.lam=c(t.x,a*r(t.y))}},"tcea","Transverse Cylindrical Equal Area","Cyl, Sph"),ee(function(e){e.es=0,e.fwd=function(e,t){var r=a(e.phi/2),i=n(I*r);t.x=e.lam*(.74482-.34588*i*i),t.y=1.70711*r},e.inv=function(e,t){var r=e.y/1.70711,i=n(I*r);t.lam=e.x/(.74482-.34588*i*i),t.phi=2*u(r)}},"times","Times","Cyl, Sph"),ee(function(t){H(t.params,"bapprox")?Pn(t):function(t){if(0===t.es)return Pn(t);un(t);var n=t.fwd,r=t.inv;Pn(t);var i=t.fwd,a=t.inv;t.fwd=function(t,r){e(t.lam)>3*A?n(t,r):i(t,r)},t.inv=function(t,n){e(t.x)>.053-.022*t.y*t.y?r(t,n):a(t,n)}}(t)},"tmerc","Transverse Mercator","Cyl, Sph&Ell"),ee(function(e){var n;e.es||q(-34),e.y0=H(e.params,"bsouth")?1e7:0,e.x0=5e5,H(e.params,"tzone")?(n=H(e.params,"izone"))>0&&n<=60?--n:q(-35):(n=t(30*(Ie(e.lam0)+w)/w))<0?n=0:n>=60&&(n=59),e.lam0=(n+.5)*w/30-w,e.k0=.9996,e.phi0=0,un(e)},"utm","Universal Transverse Mercator (UTM)","Cyl, Sph\nzone= south"),ee(function(e){var t,i,o,s,u,f,l,h,p,g,m,y,v,b,_,x,w,S,A,E,M,I,C;E=H(e.params,"rlat_1"),S=H(e.params,"rlon_1"),M=H(e.params,"rlat_2"),A=H(e.params,"rlon_2"),E==M&&S==A&&q(-25),e.lam0=Ie(.5*(S+A)),g=Ie(A-S),t=r(E),o=r(M),i=n(E),s=n(M),f=t*s,l=i*o,u=t*o*n(g),p=Qt(i*s+t*o*r(g)),m=.5*p,I=c(o*n(g),t*s-i*o*r(g)),b=r(C=Kt(t*n(I))),_=n(C),x=Ie(c(t*r(I),i)-m),g*=.5,w=k-c(n(I)*i,r(I))-g,y=a(m),v=.5/n(m),h=.5/p,p*=p,e.fwd=function(e,a){var c,d,m,y,v,b,_;b=n(e.phi),_=r(e.phi),d=Qt(i*b+t*_*r(y=e.lam+g)),m=Qt(s*b+o*_*r(v=e.lam-g)),d*=d,m*=m,a.x=h*(c=d-m),c=p-c,a.y=h*en(4*p*m-c*c),u*b-_*(f*n(y)-l*n(v))<0&&(a.y=-a.y)},e.inv=function(e,t){var i,a,o,s,u,f;o=(i=r(d(e.y,e.x+m)))+(a=r(d(e.y,e.x-m))),s=i-a,t.lam=-c(s,o*y),t.phi=Qt(d(y*o,s)*v),e.y<0&&(t.phi=-t.phi),f=n(t.phi),u=r(t.phi),t.phi=Kt(_*f+b*u*(o=r(t.lam-=x))),t.lam=c(u*n(t.lam),_*u*o-b*f)+w},e.es=0},"tpeqd","Two Point Equidistant","Misc Sph\nlat_1= lon_1= lat_2= lon_2="),ee(function(e){var t,i,a,o,s,u;(o=H(e.params,"dn"))>0&&o<=1==0&&q(-40),a=H(e.params,"dq")/3,s=H(e.params,"ralpha"),u=o*n(s),t=r(s)/f(1-u*u),i=1/(t*o),e.fwd=function(e,s){var u=e.phi=Kt(o*n(e.phi));s.x=t*e.lam*r(e.phi),u*=u,s.y=e.phi*(1+u*a)*i},e.es=0},"urm5","Urmaev V","PCyl., Sph., no inv.\nn= q= alpha="),ee(function(e){var t=H(e.params,"dn");(t<=0||t>1)&&q(-40),On(e,t)},"urmfps","Urmaev Flat-Polar Sinusoidal","PCyl, Sph.\nn="),ee(function(e){On(e,.8660254037844386)},"wag1","Wagner I (Kavraisky VI)","PCyl, Sph."),ee(function(t){var n=1e-10,i=.3333333333333333,u=9.869604401089358,c=19.739208802178716,l=4.934802200544679;t.fwd=function(t,r){var i,s,u,c,l;(l=e(t.phi/k))-n>1&&U(),l>1&&(l=1),e(t.phi)<=n?(r.x=t.lam,r.y=0):e(t.lam)<=n||e(l-1)<n?(r.x=0,r.y=w*a(.5*o(l)),t.phi<0&&(r.y=-r.y)):(s=(i=.5*e(w/t.lam-t.lam/w))*i,u=f(1-l*l),c=(u/=l+u-1)*u,l=u*(2/l-1),l*=l,r.x=u-l,u=l+s,r.x=w*(i*r.x+f(s*r.x*r.x-u*(c-l)))/u,t.lam<0&&(r.x=-r.x),r.y=e(r.x/w),r.y=1-r.y*(r.y+2*i),r.y<-n&&U(),r.y<0?r.y=0:r.y=f(r.y)*(t.phi<0?-w:w))},t.inv=function(t,a){var o,h,p,d,g,m,y,v,b,_,x,S,A;if(S=t.x*t.x,(x=e(t.y))<n)return a.phi=0,o=S*S+c*(S+l),a.lam=e(t.x)<=n?0:.5*(S-u+f(o))/t.x,a;A=t.y*t.y,d=(p=-w*x*((v=S+A)+u))+u*(v-3*A),h=w*x,b=2*f(-i*(m=p/(g=(y=v*v)+P*(x*v+w*(A+w*(x+k))))-i*(d/=g)*d)),(o=e(_=3*(_=.07407407407407407*d*d*d+(h*h-i*d*p)/g)/(m*b)))-n<=1?(_=o>1?_>0?0:w:s(_),a.phi=w*(b*r(_*i+4.188790204786391)-i*d),t.y<0&&(a.phi=-a.phi),o=y+c*(S-A+l),a.lam=e(t.x)<=n?0:.5*(v-u+(o<=0?0:f(o)))/t.x):B()}},"vandg","van der Grinten (I)","Misc Sph"),ee(function(e){Nn(e,!1)},"vandg2","van der Grinten II","Misc Sph, no inv."),ee(function(e){Nn(e,!0)},"vandg3","van der Grinten III","Misc Sph, no inv."),ee(function(t){t.es=0,t.fwd=function(t,n){var r,i,a,o,s,u,c,l,h=1e-10;e(t.phi)<h?(n.x=t.lam,n.y=0):e(t.lam)<h||e(e(t.phi)-k)<h?(n.x=0,n.y=t.phi):(u=(o=.5*((a=e(O*t.phi))*(8-a*(2+(s=a*a)))-5)/(s*(a-1)))*o,c=O*t.lam,c=f((c+=1/c)*c-4),e(t.lam)-k<0&&(c=-c),r=a+o,r=(c*((r*=r)+u-1)+2*f(r*(s+u*(l=c*c)-1)+(1-s)*(s*((i=a+3*o)*i+4*u)+u*(12*a*o+4*u))))/(4*r+l),n.x=k*r,n.y=k*f(1+c*e(r)-r*r),t.lam<0&&(n.x=-n.x),t.phi<0&&(n.y=-n.y))}},"vandg4","van der Grinten IV","Misc Sph, no inv."),ee(function(e){var t=.92483,i=1.38725,a=.88022,o=.8855;e.fwd=function(e,s){e.phi=Kt(a*n(o*e.phi)),s.x=t*e.lam*r(e.phi),s.y=i*e.phi},e.inv=function(e,s){s.phi=e.y/i,s.lam=e.x/(t*r(s.phi)),s.phi=Kt(n(s.phi)/a)/o}},"wag2","Wagner II","PCyl., Sph."),ee(function(e){var t=.6666666666666666,n=H(e.params,"rlat_ts"),i=r(n)/r(2*n/3);e.es=0,e.fwd=function(e,n){n.x=i*e.lam*r(t*e.phi),n.y=e.phi},e.inv=function(e,n){n.phi=e.y,n.lam=e.x/(i*r(t*n.phi))}},"wag3","Wagner III","PCyl., Sph.\nlat_ts="),ee(function(e){e.es=0,e.fwd=function(e,t){var i,a,s;i=o(t.y=.9063077870366499*n(e.phi)),t.x=2.66723*(a=r(i))*n(e.lam/=3),t.y*=1.24104*(s=1/f(.5*(1+a*r(e.lam)))),t.x*=s}},"wag7","Wagner VII","Misc Sph, no inv."),ee(function(e){var t=r(H(e.params,"rlat_ts"));e.fwd=function(e,n){n.x=.5*e.lam*(t+r(e.phi)),n.y=e.phi},e.inv=function(e,n){n.phi=e.y,n.lam=2*e.x/(t+r(n.phi))},e.es=0},"wink1","Winkel I","PCyl., Sph.\nlat_ts="),ee(function(t){var i=r(H(t.params,"rlat_1"));t.fwd=function(t,a){var o,s,u,c=t.phi;for(a.y=c*O,o=w*n(c),c*=1.8,u=10;u&&(c-=s=(c+n(c)-o)/(1+r(c)),!(e(s)<1e-7));--u);u?c*=.5:c=c<0?-k:k,a.x=.5*t.lam*(r(c)+i),a.y=I*(n(c)+a.y)},t.inv=null,t.es=0},"wink2","Winkel II","PCyl., Sph., no inv.\nlat_1=");var Tn=Oe;Tn.pj_init=me,Tn.pj_fwd=ke,Tn.pj_inv=Ce,Tn.pj_transform=Se,Tn.pj_add=ee,Tn.pj_fwd_deg=function(e,t){return ke({lam:e.lam*A,phi:e.phi*A},t)},Tn.pj_inv_deg=function(e,t){var n=Ce(e,t);return{lam:n.lam*S,phi:n.phi*S}},Tn.pj_transform_point=we,Tn.internal={dmstod:W,dmstor:J,get_rtodms:function(e,t,n,r){var i=Pe(e,t,n,r);return function(e){return i(e*S)}},get_dtodms:Pe,get_proj_defn:re,pj_latlong_from_proj:function(e){return me("+proj=latlong"+ne(e))},pj_get_params:X,pj_datums:ae,pj_list:Q,pj_ellps:ue,pj_units:fe,pj_read_init_opts:ge,find_datum:se,DEG_TO_RAD:A,RAD_TO_DEG:S,wkt_parse:Ft,wkt_unpack:Ut,convert_wkt_quotes:Bt,wkt_to_proj4:function(e){var t,n,r=Ft(e);return r.PROJCS?t=je(n=r.PROJCS)(n):r.GEOGCS?t="+proj=longlat "+We(r.GEOGCS):r.GEOCCS?Ve("geocentric coordinates are not supported"):Ve("missing a supported WKT CS type"),t},wkt_from_proj4:function(e){return e.length&&(e=me(e)),Rt(te(e)?{GEOGCS:Ke(e)}:at(e))},wkt_make_projcs:at,wkt_get_geogcs_name:tt,wkt_stringify:Rt,mproj_insert_libcache:function(e,t){pe[e]=t},mproj_search_libcache:de,GeographicLib:$t},v.exports=Tn}();var x=r.exports,w=e({__proto__:null,default:t(x)},[x]);let S=class{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(e,t){let n=this.length++;for(;n>0;){const e=n-1>>1,r=this.values[e];if(t>=r)break;this.ids[n]=this.ids[e],this.values[n]=r,n=e}this.ids[n]=e,this.values[n]=t}pop(){if(0===this.length)return;const e=this.ids,t=this.values,n=e[0],r=--this.length;if(r>0){const n=e[r],i=t[r];let a=0;const o=r>>1;for(;a<o;){const n=1+(a<<1),o=n+1,s=n+(+(o<r)&+(t[o]<t[n]));if(t[s]>=i)break;e[a]=e[s],t[a]=t[s],a=s}e[a]=n,t[a]=i}return n}peek(){return this.length>0?this.ids[0]:void 0}peekValue(){return this.length>0?this.values[0]:void 0}shrink(){this.ids.length=this.values.length=this.length}};const A=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];function E(e,t){let n=0,r=t.length-1;for(;n<r;){const i=n+r>>1;t[i]>e?r=i:n=i+1}return t[n]}function M(e,t,n,r,i,a){if(Math.floor(r/a)>=Math.floor(i/a))return;const o=e[r],s=e[r+i>>1],u=e[i];let c=u;const f=Math.max(o,s);u>f?c=f:f===o?c=Math.max(s,u):f===s&&(c=Math.max(o,u));let l=r-1,h=i+1;for(;;){do{l++}while(e[l]<c);do{h--}while(e[h]>c);if(l>=h)break;I(e,t,n,l,h)}M(e,t,n,r,h,a),M(e,t,n,h+1,i,a)}function I(e,t,n,r,i){const a=e[r];e[r]=e[i],e[i]=a;const o=4*r,s=4*i,u=t[o],c=t[o+1],f=t[o+2],l=t[o+3];t[o]=t[s],t[o+1]=t[s+1],t[o+2]=t[s+2],t[o+3]=t[s+3],t[s]=u,t[s+1]=c,t[s+2]=f,t[s+3]=l;const h=n[r];n[r]=n[i],n[i]=h}function k(e,t){let n=e^t,r=65535^n,i=65535^(e|t),a=e&(65535^t),o=n|r>>1,s=n>>1^n,u=i>>1^r&a>>1^i,c=n&i>>1^a>>1^a;n=o,r=s,i=u,a=c,o=n&n>>2^r&r>>2,s=n&r>>2^r&(n^r)>>2,u^=n&i>>2^r&a>>2,c^=r&i>>2^(n^r)&a>>2,n=o,r=s,i=u,a=c,o=n&n>>4^r&r>>4,s=n&r>>4^r&(n^r)>>4,u^=n&i>>4^r&a>>4,c^=r&i>>4^(n^r)&a>>4,n=o,r=s,i=u,a=c,u^=n&i>>8^r&a>>8,c^=r&i>>8^(n^r)&a>>8,n=u^u>>1,r=c^c>>1;let f=e^t,l=r|65535^(f|n);return f=16711935&(f|f<<8),f=252645135&(f|f<<4),f=858993459&(f|f<<2),f=1431655765&(f|f<<1),l=16711935&(l|l<<8),l=252645135&(l|l<<4),l=858993459&(l|l<<2),l=1431655765&(l|l<<1),(l<<1|f)>>>0}const C=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class P{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const i=C[15&n];if(!i)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new P(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const i=C.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return O(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],u=[];for(;s.length;){const c=s.pop()||0,f=s.pop()||0,l=s.pop()||0;if(f-l<=o){for(let o=l;o<=f;o++){const s=a[2*o],c=a[2*o+1];s>=e&&s<=n&&c>=t&&c<=r&&u.push(i[o])}continue}const h=l+f>>1,p=a[2*h],d=a[2*h+1];p>=e&&p<=n&&d>=t&&d<=r&&u.push(i[h]),(0===c?e<=p:t<=d)&&(s.push(l),s.push(h-1),s.push(1-c)),(0===c?n>=p:r>=d)&&(s.push(h+1),s.push(f),s.push(1-c))}return u}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],u=n*n;for(;o.length;){const c=o.pop()||0,f=o.pop()||0,l=o.pop()||0;if(f-l<=a){for(let n=l;n<=f;n++)z(i[2*n],i[2*n+1],e,t)<=u&&s.push(r[n]);continue}const h=l+f>>1,p=i[2*h],d=i[2*h+1];z(p,d,e,t)<=u&&s.push(r[h]),(0===c?e-n<=p:t-n<=d)&&(o.push(l),o.push(h-1),o.push(1-c)),(0===c?e+n>=p:t+n>=d)&&(o.push(h+1),o.push(f),o.push(1-c))}return s}}function O(e,t,n,r,i,a){if(i-r<=n)return;const o=r+i>>1;N(e,t,o,r,i,a),O(e,t,n,r,o-1,1-a),O(e,t,n,o+1,i,1-a)}function N(e,t,n,r,i,a){for(;i>r;){if(i-r>600){const o=i-r+1,s=n-r+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);N(e,t,n,Math.max(r,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),a)}const o=t[2*n+a];let s=r,u=i;for(T(e,t,r,n),t[2*i+a]>o&&T(e,t,r,i);s<u;){for(T(e,t,s,u),s++,u--;t[2*s+a]<o;)s++;for(;t[2*u+a]>o;)u--}t[2*r+a]===o?T(e,t,r,u):(u++,T(e,t,u,i)),u<=n&&(r=u+1),n<=u&&(i=u-1)}}function T(e,t,n,r){L(e,n,r),L(t,2*n,2*r),L(t,2*n+1,2*r+1)}function L(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function z(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}var R={exports:{}};!function(e){var t,n,r,i;(i={}).Constants={},i.Math={},i.Accumulator={},(t=i.Constants).WGS84={a:6378137,f:1/298.257223563},t.version={major:2,minor:2,patch:0},t.version_string="2.2.0",(n=i.Math).digits=53,n.epsilon=Math.pow(.5,n.digits-1),n.degree=Math.PI/180,n.sq=function(e){return e*e},n.hypot=function(e,t){return Math.sqrt(e*e+t*t)},n.cbrt=Math.cbrt||function(e){var t=Math.pow(Math.abs(e),1/3);return e>0?t:e<0?-t:e},n.log1p=Math.log1p||function(e){var t=1+e,n=t-1;return 0===n?e:e*Math.log(t)/n},n.atanh=Math.atanh||function(e){var t=Math.abs(e);return t=n.log1p(2*t/(1-t))/2,e>0?t:e<0?-t:e},n.copysign=function(e,t){return Math.abs(e)*(t<0||0===t&&1/t<0?-1:1)},n.sum=function(e,t){var n=e+t,r=n-t,i=n-r;return r-=e,{s:n,t:n?0-(r+(i-=t)):n}},n.polyval=function(e,t,n,r){for(var i=e<0?0:t[n++];--e>=0;)i=i*r+t[n++];return i},n.AngRound=function(e){var t=1/16,r=Math.abs(e);return r=r<t?t-(t-r):r,n.copysign(r,e)},n.remainder=function(e,t){return(e%=t)<-t/2?e+t:e<t/2?e:e-t},n.AngNormalize=function(e){var t=n.remainder(e,360);return 180===Math.abs(t)?n.copysign(180,e):t},n.LatFix=function(e){return Math.abs(e)>90?NaN:e},n.AngDiff=function(e,t){var r,i,a=n.sum(n.remainder(-e,360),n.remainder(t,360));return r=(a=n.sum(n.remainder(a.s,360),a.t)).s,i=a.t,0!==r&&180!==Math.abs(r)||(r=n.copysign(r,0===i?t-e:-i)),{d:r,e:i}},n.sincosd=function(e){var t,r,i,a,o,s,u;switch(t=e%360,r=(t-=90*(i=Math.round(t/90)))*this.degree,a=Math.sin(r),o=Math.cos(r),45===Math.abs(t)?(o=Math.sqrt(.5),a=n.copysign(o,r)):30===Math.abs(t)&&(o=Math.sqrt(.75),a=n.copysign(.5,r)),3&i){case 0:s=a,u=o;break;case 1:s=o,u=-a;break;case 2:s=-a,u=-o;break;default:s=-o,u=a}return u+=0,0===s&&(s=n.copysign(s,e)),{s:s,c:u}},n.sincosde=function(e,t){var r,i,a,o,s,u,c;switch(r=e%360,a=Math.round(r/90),i=(r=n.AngRound(r-90*a+t))*this.degree,o=Math.sin(i),s=Math.cos(i),45===Math.abs(r)?(s=Math.sqrt(.5),o=n.copysign(s,i)):30===Math.abs(r)&&(s=Math.sqrt(.75),o=n.copysign(.5,i)),3&a){case 0:u=o,c=s;break;case 1:u=s,c=-o;break;case 2:u=-o,c=-s;break;default:u=-s,c=o}return c+=0,0===u&&(u=n.copysign(u,e+t)),{s:u,c:c}},n.atan2d=function(e,t){var r,i=0;switch(Math.abs(e)>Math.abs(t)&&([e,t]=[t,e],i=2),n.copysign(1,t)<0&&(t=-t,++i),r=Math.atan2(e,t)/this.degree,i){case 1:r=n.copysign(180,e)-r;break;case 2:r=90-r;break;case 3:r=-90+r}return r},function(e,t){e.Accumulator=function(e){this.Set(e)},e.Accumulator.prototype.Set=function(t){t||(t=0),t.constructor===e.Accumulator?(this._s=t._s,this._t=t._t):(this._s=t,this._t=0)},e.Accumulator.prototype.Add=function(e){var n=t.sum(e,this._t),r=t.sum(n.s,this._s);n=n.t,this._s=r.s,this._t=r.t,0===this._s?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(t){var n;return t?((n=new e.Accumulator(this)).Add(t),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(e){this._s=t.remainder(this._s,e),this.Add(0)}}(i.Accumulator,i.Math),i.Geodesic={},i.GeodesicLine={},i.PolygonArea={},function(e,t,n,r,i){var a,o,s,u,c,f,l,h,p,d,g,m=20+r.digits+10,y=r.epsilon,v=200*y,b=Math.sqrt(y),_=y,x=1e3*b;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=6,e.nC1p_=6,e.nC2_=6,e.nC3_=6,e.nC4_=6,a=e.nC3_*(e.nC3_-1)/2,o=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=32671,e.LONG_UNROLL=32768,e.OUT_MASK=32640|e.LONG_UNROLL,e.SinCosSeries=function(e,t,n,r){var i=r.length,a=i-(e?1:0),o=2*(n-t)*(n+t),s=1&a?r[--i]:0,u=0;for(a=Math.floor(a/2);a--;)s=o*(u=o*s-u+r[--i])-s+r[--i];return e?2*t*n*s:n*(s-u)},s=function(e,t){var n,i,a,o,s,u,c,f,l,h,p,d,g=r.sq(e),m=r.sq(t),y=(g+m-1)/6;return 0===m&&y<=0?n=0:(u=y,(s=(i=g*m/4)*(i+2*(o=y*(a=r.sq(y)))))>=0?(c=i+o,c+=c<0?-Math.sqrt(s):Math.sqrt(s),u+=(f=r.cbrt(c))+(0!==f?a/f:0)):(l=Math.atan2(Math.sqrt(-s),-(i+o)),u+=2*y*Math.cos(l/3)),h=Math.sqrt(r.sq(u)+m),d=((p=u<0?m/(h-u):u+h)-m)/(2*h),n=p/(Math.sqrt(p+r.sq(d))+d)),n},u=[1,4,64,0,256],e.A1m1f=function(e){var t=Math.floor(3);return(r.polyval(t,u,0,r.sq(e))/u[t+1]+e)/(1-e)},c=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1_;++i)a=Math.floor((e.nC1_-i)/2),n[i]=s*r.polyval(a,c,u,o)/c[u+a+1],u+=a+2,s*=t},f=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1p_;++i)a=Math.floor((e.nC1p_-i)/2),n[i]=s*r.polyval(a,f,u,o)/f[u+a+1],u+=a+2,s*=t},l=[-11,-28,-192,0,256],e.A2m1f=function(e){var t=Math.floor(3);return(r.polyval(t,l,0,r.sq(e))/l[t+1]-e)/(1+e)},h=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC2_;++i)a=Math.floor((e.nC2_-i)/2),n[i]=s*r.polyval(a,h,u,o)/h[u+a+1],u+=a+2,s*=t},e.Geodesic=function(e,t){if(this.a=e,this.f=t,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/r.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(r.sq(this.a)+r.sq(this._b)*(0===this._e2?1:(this._e2>0?r.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*b/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(6),this._C3x=new Array(a),this._C4x=new Array(o),this.A3coeff(),this.C3coeff(),this.C4coeff()},p=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var e,t,n=0,i=0;for(e=5;e>=0;--e)t=Math.min(6-e-1,e),this._A3x[i++]=r.polyval(t,p,n,this._n)/p[n+t+1],n+=t+2},d=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var t,n,i,a=0,o=0;for(t=1;t<e.nC3_;++t)for(n=e.nC3_-1;n>=t;--n)i=Math.min(e.nC3_-n-1,n),this._C3x[o++]=r.polyval(i,d,a,this._n)/d[a+i+1],a+=i+2},g=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var t,n,i,a=0,o=0;for(t=0;t<e.nC4_;++t)for(n=e.nC4_-1;n>=t;--n)i=e.nC4_-n-1,this._C4x[o++]=r.polyval(i,g,a,this._n)/g[a+i+1],a+=i+2},e.Geodesic.prototype.A3f=function(e){return r.polyval(5,this._A3x,0,e)},e.Geodesic.prototype.C3f=function(t,n){var i,a,o=1,s=0;for(i=1;i<e.nC3_;++i)a=e.nC3_-i-1,o*=t,n[i]=o*r.polyval(a,this._C3x,s,t),s+=a+1},e.Geodesic.prototype.C4f=function(t,n){var i,a,o=1,s=0;for(i=0;i<e.nC4_;++i)a=e.nC4_-i-1,n[i]=o*r.polyval(a,this._C4x,s,t),s+=a+1,o*=t},e.Geodesic.prototype.Lengths=function(t,n,r,i,a,o,s,u,c,f,l,h,p){var d,g,m,y,v={},b=0,_=0,x=0,w=0;if((l&=e.OUT_MASK)&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(x=e.A1m1f(t),e.C1f(t,h),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(w=e.A2m1f(t),e.C2f(t,p),b=x-w,w=1+w),x=1+x),l&e.DISTANCE)d=e.SinCosSeries(!0,o,s,h)-e.SinCosSeries(!0,r,i,h),v.s12b=x*(n+d),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(_=b*n+(x*d-w*(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))));else if(l&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(g=1;g<=e.nC2_;++g)p[g]=x*h[g]-w*p[g];_=b*n+(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))}return l&e.REDUCEDLENGTH?(v.m0=b,v.m12b=u*(i*o)-a*(r*s)-i*s*_):v.m12b=NaN,l&e.GEODESICSCALE&&(m=i*s+r*o,y=this._ep2*(c-f)*(c+f)/(a+u),v.M12=m+(y*o-s*_)*r/a,v.M21=m-(y*r-i*_)*o/u),v},e.Geodesic.prototype.InverseStart=function(t,n,i,a,o,u,c,f,l,h,p){var d,g,m,y,b,_,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R={},D=a*n-o*t,j=o*n+a*t;return R.sig12=-1,d=a*n,d+=o*t,(g=j>=0&&D<.5&&o*c<.5)?(y=r.sq(t+a),y/=y+r.sq(n+o),R.dnm=Math.sqrt(1+this._ep2*y),m=c/(this._f1*R.dnm),b=Math.sin(m),_=Math.cos(m)):(b=f,_=l),R.salp1=o*b,R.calp1=_>=0?D+o*t*r.sq(b)/(1+_):d-o*t*r.sq(b)/(1-_),S=r.hypot(R.salp1,R.calp1),A=t*a+n*o*_,g&&S<this._etol2?(R.salp2=n*b,R.calp2=D-n*a*(_>=0?r.sq(b)/(1+_):1-_),w=r.hypot(R.salp2,R.calp2),R.salp2/=w,R.calp2/=w,R.sig12=Math.atan2(S,A)):Math.abs(this._n)>.1||A>=0||S>=6*Math.abs(this._n)*Math.PI*r.sq(n)||(z=Math.atan2(-f,-l),this.f>=0?(C=(k=r.sq(t)*this._ep2)/(2*(1+Math.sqrt(1+k))+k),E=z/(I=this.f*n*this.A3f(C)*Math.PI),M=d/(I*n)):(P=o*n-a*t,O=Math.atan2(d,P),M=c/(I=((E=(N=this.Lengths(this._n,Math.PI+O,t,-n,i,a,o,u,n,o,e.REDUCEDLENGTH,h,p)).m12b/(n*o*N.m0*Math.PI)-1)<-.01?d/E:-this.f*r.sq(n)*Math.PI)/n)),M>-v&&E>-1-x?this.f>=0?(R.salp1=Math.min(1,-E),R.calp1=-Math.sqrt(1-r.sq(R.salp1))):(R.calp1=Math.max(E>-v?0:-1,E),R.salp1=Math.sqrt(1-r.sq(R.calp1))):(T=s(E,M),L=I*(this.f>=0?-E*T/(1+T):-M*(1+T)/T),b=Math.sin(L),_=-Math.cos(L),R.salp1=o*b,R.calp1=d-o*t*r.sq(b)/(1-_))),R.salp1<=0?(R.salp1=1,R.calp1=0):(w=r.hypot(R.salp1,R.calp1),R.salp1/=w,R.calp1/=w),R},e.Geodesic.prototype.Lambda12=function(t,n,i,a,o,s,u,c,f,l,h,p,d,g){var m,y,v,b,_,x,w,S,A,E,M,I,k,C={};return 0===t&&0===c&&(c=-e.tiny_),y=u*n,v=r.hypot(c,u*t),C.ssig1=t,b=y*t,C.csig1=_=c*n,m=r.hypot(C.ssig1,C.csig1),C.ssig1/=m,C.csig1/=m,C.salp2=o!==n?y/o:u,C.calp2=o!==n||Math.abs(a)!==-t?Math.sqrt(r.sq(c*n)+(n<-t?(o-n)*(n+o):(t-a)*(t+a)))/o:Math.abs(c),C.ssig2=a,x=y*a,C.csig2=w=C.calp2*o,m=r.hypot(C.ssig2,C.csig2),C.ssig2/=m,C.csig2/=m,C.sig12=Math.atan2(Math.max(0,C.csig1*C.ssig2-C.ssig1*C.csig2),C.csig1*C.csig2+C.ssig1*C.ssig2),S=Math.max(0,_*x-b*w),A=_*w+b*x,M=Math.atan2(S*l-A*f,A*l+S*f),I=r.sq(v)*this._ep2,C.eps=I/(2*(1+Math.sqrt(1+I))+I),this.C3f(C.eps,g),E=e.SinCosSeries(!0,C.ssig2,C.csig2,g)-e.SinCosSeries(!0,C.ssig1,C.csig1,g),C.domg12=-this.f*this.A3f(C.eps)*y*(C.sig12+E),C.lam12=M+C.domg12,h&&(0===C.calp2?C.dlam12=-2*this._f1*i/t:(k=this.Lengths(C.eps,C.sig12,C.ssig1,C.csig1,i,C.ssig2,C.csig2,s,n,o,e.REDUCEDLENGTH,p,d),C.dlam12=k.m12b,C.dlam12*=this._f1/(C.calp2*o))),C},e.Geodesic.prototype.Inverse=function(t,n,i,a,o){var s,u;return o||(o=e.STANDARD),o===e.LONG_UNROLL&&(o|=e.STANDARD),o&=e.OUT_MASK,u=(s=this.InverseInt(t,n,i,a,o)).vals,o&e.AZIMUTH&&(u.azi1=r.atan2d(s.salp1,s.calp1),u.azi2=r.atan2d(s.salp2,s.calp2)),u},e.Geodesic.prototype.InverseInt=function(t,n,i,a,o){var s,u,c,f,l,h,p,d,g,v,x,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R,D,j,F,U,B,G,q,V,$,J,W,Z,Y,H,X,K,Q,ee,te,ne,re,ie,ae,oe,se,ue,ce,fe,le,he,pe,de,ge,me,ye,ve,be,_e,xe,we={};if(we.lat1=t=r.LatFix(t),we.lat2=i=r.LatFix(i),t=r.AngRound(t),i=r.AngRound(i),u=(s=r.AngDiff(n,a)).e,s=s.d,o&e.LONG_UNROLL?(we.lon1=n,we.lon2=n+s+u):(we.lon1=r.AngNormalize(n),we.lon2=r.AngNormalize(a)),u*=c=r.copysign(1,s),E=(s*=c)*r.degree,M=(f=r.sincosde(s,u)).s,I=f.c,u=180-s-u,(l=Math.abs(t)<Math.abs(i)||isNaN(i)?-1:1)<0&&(c*=-1,[i,t]=[t,i]),t*=h=r.copysign(1,-t),i*=h,f=r.sincosd(t),p=this._f1*f.s,d=f.c,p/=f=r.hypot(p,d),d/=f,d=Math.max(e.tiny_,d),f=r.sincosd(i),g=this._f1*f.s,v=f.c,g/=f=r.hypot(g,v),v/=f,v=Math.max(e.tiny_,v),d<-p?v===d&&(g=r.copysign(p,g)):Math.abs(g)===-p&&(v=d),S=Math.sqrt(1+this._ep2*r.sq(p)),A=Math.sqrt(1+this._ep2*r.sq(g)),T=new Array(e.nC1_+1),L=new Array(e.nC2_+1),z=new Array(e.nC3_),(R=-90===t||0===M)&&(P=M,N=0,j=p,F=(C=I)*d,U=g,B=(O=1)*v,k=Math.atan2(Math.max(0,F*U-j*B),F*B+j*U),x=(D=this.Lengths(this._n,k,j,F,S,U,B,A,d,v,o|e.DISTANCE|e.REDUCEDLENGTH,T,L)).s12b,w=D.m12b,o&e.GEODESICSCALE&&(we.M12=D.M12,we.M21=D.M21),k<b||w>=0?((k<3*e.tiny_||k<y&&(x<0||w<0))&&(k=w=x=0),w*=this._b,x*=this._b,we.a12=k/r.degree):R=!1),pe=2,!R&&0===p&&(this.f<=0||u>=180*this.f))C=O=0,P=N=1,x=this.a*E,k=q=E/this._f1,w=this._b*Math.sin(k),o&e.GEODESICSCALE&&(we.M12=we.M21=Math.cos(k)),we.a12=s/this._f1;else if(!R)if(k=(D=this.InverseStart(p,d,S,g,v,A,E,M,I,T,L)).sig12,P=D.salp1,C=D.calp1,k>=0)N=D.salp2,O=D.calp2,V=D.dnm,x=k*this._b*V,w=r.sq(V)*this._b*Math.sin(k/V),o&e.GEODESICSCALE&&(we.M12=we.M21=Math.cos(k/V)),we.a12=k/r.degree,q=E/(this._f1*V);else{for($=0,J=e.tiny_,W=1,Z=e.tiny_,Y=-1,H=!1,X=!1;K=(D=this.Lambda12(p,d,S,g,v,A,P,C,M,I,$<20,T,L,z)).lam12,N=D.salp2,O=D.calp2,k=D.sig12,j=D.ssig1,F=D.csig1,U=D.ssig2,B=D.csig2,G=D.eps,ge=D.domg12,Q=D.dlam12,!X&&Math.abs(K)>=(H?8:1)*y&&$!=m;++$)K>0&&($<20||C/P>Y/Z)?(Z=P,Y=C):K<0&&($<20||C/P<W/J)&&(J=P,W=C),$<20&&Q>0&&(ee=-K/Q,Math.abs(ee)<Math.PI&&(te=Math.sin(ee),(re=P*(ne=Math.cos(ee))+C*te)>0))?(C=C*ne-P*te,P=re,P/=f=r.hypot(P,C),C/=f,H=Math.abs(K)<=16*y):(P=(J+Z)/2,C=(W+Y)/2,P/=f=r.hypot(P,C),C/=f,H=!1,X=Math.abs(J-P)+(W-C)<_||Math.abs(P-Z)+(C-Y)<_);ie=o|(o&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),x=(D=this.Lengths(G,k,j,F,S,U,B,A,d,v,ie,T,L)).s12b,w=D.m12b,o&e.GEODESICSCALE&&(we.M12=D.M12,we.M21=D.M21),w*=this._b,x*=this._b,we.a12=k/r.degree,o&e.AREA&&(_e=Math.sin(ge),pe=M*(xe=Math.cos(ge))-I*_e,de=I*xe+M*_e)}return o&e.DISTANCE&&(we.s12=0+x),o&e.REDUCEDLENGTH&&(we.m12=0+w),o&e.AREA&&(ae=P*d,0!==(oe=r.hypot(C,P*p))&&0!==ae?(j=p,F=C*d,U=g,B=O*v,G=(ue=r.sq(oe)*this._ep2)/(2*(1+Math.sqrt(1+ue))+ue),ce=r.sq(this.a)*oe*ae*this._e2,j/=f=r.hypot(j,F),F/=f,U/=f=r.hypot(U,B),B/=f,fe=new Array(e.nC4_),this.C4f(G,fe),le=e.SinCosSeries(!1,j,F,fe),he=e.SinCosSeries(!1,U,B,fe),we.S12=ce*(he-le)):we.S12=0,R||2!=pe||(pe=Math.sin(q),de=Math.cos(q)),!R&&de>-.7071&&g-p<1.75?(ge=1+de,me=1+d,ye=1+v,se=2*Math.atan2(pe*(p*ye+g*me),ge*(p*g+me*ye))):(be=O*C+N*P,0===(ve=N*C-O*P)&&be<0&&(ve=e.tiny_*C,be=-1),se=Math.atan2(ve,be)),we.S12+=this._c2*se,we.S12*=l*c*h,we.S12+=0),l<0&&([N,P]=[P,N],[O,C]=[C,O],o&e.GEODESICSCALE&&([we.M21,we.M12]=[we.M12,we.M21])),{vals:we,salp1:P*=l*c,calp1:C*=l*h,salp2:N*=l*c,calp2:O*=l*h}},e.Geodesic.prototype.GenDirect=function(n,r,i,a,o,s){return s?s===e.LONG_UNROLL&&(s|=e.STANDARD):s=e.STANDARD,a||(s|=e.DISTANCE_IN),new t.GeodesicLine(this,n,r,i,s).GenPosition(a,o,s)},e.Geodesic.prototype.Direct=function(e,t,n,r,i){return this.GenDirect(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirect=function(e,t,n,r,i){return this.GenDirect(e,t,n,!0,r,i)},e.Geodesic.prototype.Line=function(e,n,r,i){return new t.GeodesicLine(this,e,n,r,i)},e.Geodesic.prototype.DirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!0,r,i)},e.Geodesic.prototype.GenDirectLine=function(n,r,i,a,o,s){var u;return s||(s=e.STANDARD|e.DISTANCE_IN),a||(s|=e.DISTANCE_IN),(u=new t.GeodesicLine(this,n,r,i,s)).GenSetDistance(a,o),u},e.Geodesic.prototype.InverseLine=function(n,i,a,o,s){var u,c,f;return s||(s=e.STANDARD|e.DISTANCE_IN),u=this.InverseInt(n,i,a,o,e.ARC),f=r.atan2d(u.salp1,u.calp1),s&e.OUT_MASK&e.DISTANCE_IN&&(s|=e.DISTANCE),(c=new t.GeodesicLine(this,n,i,f,s,u.salp1,u.calp1)).SetArc(u.vals.a12),c},e.Geodesic.prototype.Polygon=function(e){return new n.PolygonArea(this,e)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)}(i.Geodesic,i.GeodesicLine,i.PolygonArea,i.Math,i.Constants),function(e,t,n){t.GeodesicLine=function(t,r,i,a,o,s,u){var c,f,l,h,p,d;o||(o=e.STANDARD|e.DISTANCE_IN),this.a=t.a,this.f=t.f,this._b=t._b,this._c2=t._c2,this._f1=t._f1,this.caps=o|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=n.LatFix(r),this.lon1=i,void 0===s||void 0===u?(this.azi1=n.AngNormalize(a),c=n.sincosd(n.AngRound(this.azi1)),this.salp1=c.s,this.calp1=c.c):(this.azi1=a,this.salp1=s,this.calp1=u),c=n.sincosd(n.AngRound(this.lat1)),l=this._f1*c.s,f=c.c,l/=c=n.hypot(l,f),f/=c,f=Math.max(e.tiny_,f),this._dn1=Math.sqrt(1+t._ep2*n.sq(l)),this._salp0=this.salp1*f,this._calp0=n.hypot(this.calp1,this.salp1*l),this._ssig1=l,this._somg1=this._salp0*l,this._csig1=this._comg1=0!==l||0!==this.calp1?f*this.calp1:1,c=n.hypot(this._ssig1,this._csig1),this._ssig1/=c,this._csig1/=c,this._k2=n.sq(this._calp0)*t._ep2,h=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(h),this._C1a=new Array(e.nC1_+1),e.C1f(h,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),p=Math.sin(this._B11),d=Math.cos(this._B11),this._stau1=this._ssig1*d+this._csig1*p,this._ctau1=this._csig1*d-this._ssig1*p),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(h,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(h),this._C2a=new Array(e.nC2_+1),e.C2f(h,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),t.C3f(h,this._C3a),this._A3c=-this.f*this._salp0*t.A3f(h),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),t.C4f(h,this._C4a),this._A4=n.sq(this.a)*this._calp0*this._salp0*t._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(t,r,i){var a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P,O={};return i?i===e.LONG_UNROLL&&(i|=e.STANDARD):i=e.STANDARD,i&=this.caps&e.OUT_MASK,O.lat1=this.lat1,O.azi1=this.azi1,O.lon1=i&e.LONG_UNROLL?this.lon1:n.AngNormalize(this.lon1),t?O.a12=r:O.s12=r,t||this.caps&e.DISTANCE_IN&e.OUT_MASK?(u=0,c=0,t?(a=r*n.degree,o=(I=n.sincosd(r)).s,s=I.c):(h=r/(this._b*(1+this._A1m1)),p=Math.sin(h),d=Math.cos(h),a=h-((u=-e.SinCosSeries(!0,this._stau1*d+this._ctau1*p,this._ctau1*d-this._stau1*p,this._C1pa))-this._B11),o=Math.sin(a),s=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,u=e.SinCosSeries(!0,f,l,this._C1a),a-=((1+this._A1m1)*(a+(u-this._B11))-r/this._b)/Math.sqrt(1+this._k2*n.sq(f)),o=Math.sin(a),s=Math.cos(a))),f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,S=Math.sqrt(1+this._k2*n.sq(f)),i&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((t||Math.abs(this.f)>.01)&&(u=e.SinCosSeries(!0,f,l,this._C1a)),c=(1+this._A1m1)*(u-this._B11)),y=this._calp0*f,0===(v=n.hypot(this._salp0,this._calp0*l))&&(v=l=e.tiny_),x=this._salp0,w=this._calp0*l,t&&i&e.DISTANCE&&(O.s12=this._b*((1+this._A1m1)*a+c)),i&e.LONGITUDE&&(b=this._salp0*f,_=l,m=n.copysign(1,this._salp0),g=((i&e.LONG_UNROLL?m*(a-(Math.atan2(f,l)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(m*b,_)-Math.atan2(m*this._somg1,this._comg1))):Math.atan2(b*this._comg1-_*this._somg1,_*this._comg1+b*this._somg1))+this._A3c*(a+(e.SinCosSeries(!0,f,l,this._C3a)-this._B31)))/n.degree,O.lon2=i&e.LONG_UNROLL?this.lon1+g:n.AngNormalize(n.AngNormalize(this.lon1)+n.AngNormalize(g))),i&e.LATITUDE&&(O.lat2=n.atan2d(y,this._f1*v)),i&e.AZIMUTH&&(O.azi2=n.atan2d(x,w)),i&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(A=e.SinCosSeries(!0,f,l,this._C2a),E=(1+this._A2m1)*(A-this._B21),M=(this._A1m1-this._A2m1)*a+(c-E),i&e.REDUCEDLENGTH&&(O.m12=this._b*(S*(this._csig1*f)-this._dn1*(this._ssig1*l)-this._csig1*l*M)),i&e.GEODESICSCALE&&(I=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+S),O.M12=s+(I*f-l*M)*this._ssig1/this._dn1,O.M21=s-(I*this._ssig1-this._csig1*M)*f/S)),i&e.AREA&&(k=e.SinCosSeries(!1,f,l,this._C4a),0===this._calp0||0===this._salp0?(C=x*this.calp1-w*this.salp1,P=w*this.calp1+x*this.salp1):(C=this._calp0*this._salp0*(s<=0?this._csig1*(1-s)+o*this._ssig1:o*(this._csig1*o/(1+s)+this._ssig1)),P=n.sq(this._salp0)+n.sq(this._calp0)*this._csig1*l),O.S12=this._c2*Math.atan2(C,P)+this._A4*(k-this._B41)),t||(O.a12=a/n.degree),O):(O.a12=NaN,O)},t.GeodesicLine.prototype.Position=function(e,t){return this.GenPosition(!1,e,t)},t.GeodesicLine.prototype.ArcPosition=function(e,t){return this.GenPosition(!0,e,t)},t.GeodesicLine.prototype.GenSetDistance=function(e,t){e?this.SetArc(t):this.SetDistance(t)},t.GeodesicLine.prototype.SetDistance=function(t){var n;this.s13=t,n=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+n.a12},t.GeodesicLine.prototype.SetArc=function(t){var n;this.a13=t,n=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+n.s12}}(i.Geodesic,i.GeodesicLine,i.Math),function(e,t,n,r){var i,a,o,s;i=function(e,t){var r=n.AngDiff(e,t).d;return e=n.AngNormalize(e),t=n.AngNormalize(t),r>0&&(e<0&&t>=0||e>0&&0===t)?1:r<0&&e>=0&&t<0?-1:0},a=function(e,t){return(0<=(t%=720)&&t<360||t<-360?0:1)-(0<=(e%=720)&&e<360||e<-360?0:1)},o=function(e,t,n,r,i){return e.Remainder(t),1&n&&e.Add((e.Sum()<0?1:-1)*t/2),r||e.Negate(),i?e.Sum()>t/2?e.Add(-t):e.Sum()<=-t/2&&e.Add(+t):e.Sum()>=t?e.Add(-t):e.Sum()<0&&e.Add(+t),0+e.Sum()},s=function(e,t,r,i,a){return e=n.remainder(e,t),1&r&&(e+=(e<0?1:-1)*t/2),i||(e*=-1),a?e>t/2?e-=t:e<=-t/2&&(e+=t):e>=t?e-=t:e<0&&(e+=t),0+e},e.PolygonArea=function(e,n){this._geod=e,this.a=this._geod.a,this.f=this._geod.f,this._area0=4*Math.PI*e._c2,this.polyline=n||!1,this._mask=t.LATITUDE|t.LONGITUDE|t.DISTANCE|(this.polyline?t.NONE:t.AREA|t.LONG_UNROLL),this.polyline||(this._areasum=new r.Accumulator(0)),this._perimetersum=new r.Accumulator(0),this.Clear()},e.PolygonArea.prototype.Clear=function(){this.num=0,this._crossings=0,this.polyline||this._areasum.Set(0),this._perimetersum.Set(0),this._lat0=this._lon0=this.lat=this.lon=NaN},e.PolygonArea.prototype.AddPoint=function(e,t){var n;0===this.num?(this._lat0=this.lat=e,this._lon0=this.lon=t):(n=this._geod.Inverse(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(n.s12),this.polyline||(this._areasum.Add(n.S12),this._crossings+=i(this.lon,t)),this.lat=e,this.lon=t),++this.num},e.PolygonArea.prototype.AddEdge=function(e,t){var n;this.num&&(n=this._geod.Direct(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(t),this.polyline||(this._areasum.Add(n.S12),this._crossings+=a(this.lon,n.lon2)),this.lat=n.lat2,this.lon=n.lon2),++this.num},e.PolygonArea.prototype.Compute=function(e,t){var n,a,s={number:this.num};return this.num<2?(s.perimeter=0,this.polyline||(s.area=0),s):this.polyline?(s.perimeter=this._perimetersum.Sum(),s):(n=this._geod.Inverse(this.lat,this.lon,this._lat0,this._lon0,this._mask),s.perimeter=this._perimetersum.Sum(n.s12),(a=new r.Accumulator(this._areasum)).Add(n.S12),s.area=o(a,this._area0,this._crossings+i(this.lon,this._lon0),e,t),s)},e.PolygonArea.prototype.TestPoint=function(e,t,n,r){var a,o,u,c,f={number:this.num+1};if(0===this.num)return f.perimeter=0,this.polyline||(f.area=0),f;for(f.perimeter=this._perimetersum.Sum(),o=this.polyline?0:this._areasum.Sum(),u=this._crossings,c=0;c<(this.polyline?1:2);++c)a=this._geod.Inverse(0===c?this.lat:e,0===c?this.lon:t,0!==c?this._lat0:e,0!==c?this._lon0:t,this._mask),f.perimeter+=a.s12,this.polyline||(o+=a.S12,u+=i(0===c?this.lon:t,0!==c?this._lon0:t));return this.polyline||(f.area=s(o,this._area0,u,n,r)),f},e.PolygonArea.prototype.TestEdge=function(e,t,n,r){var o,u,c,f={number:this.num?this.num+1:0};return 0===this.num||(f.perimeter=this._perimetersum.Sum()+t,this.polyline||(u=this._areasum.Sum(),c=this._crossings,u+=(o=this._geod.Direct(this.lat,this.lon,e,t,this._mask)).S12,c+=a(this.lon,o.lon2),c+=i(o.lon2,this._lon0),o=this._geod.Inverse(o.lat2,o.lon2,this._lat0,this._lon0,this._mask),f.perimeter+=o.s12,u+=o.S12,f.area=s(u,this._area0,c,n,r))),f}}(i.PolygonArea,i.Geodesic,i.Math,i.Accumulator),r=i,e.exports?e.exports=r:window.geodesic=r}(R);var D=R.exports,j=e({__proto__:null,default:t(D)},[D]);const F=globalThis;"undefined"==typeof window&&(F.window=F.window||{},F.window.document||(F.window.document={}));const U=F.window.modules=F.window.modules||{};U.mproj=w,U.flatbush=class e{static from(t,n=0){if(n%8!=0)throw new Error("byteOffset must be 8-byte aligned.");if(!t||void 0===t.byteLength||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[r,i]=new Uint8Array(t,n+0,2);if(251!==r)throw new Error("Data does not appear to be in a Flatbush format.");const a=i>>4;if(3!==a)throw new Error(`Got v${a} data when expected v3.`);const o=A[15&i];if(!o)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,n+2,1),[u]=new Uint32Array(t,n+4,1);return new e(u,s,o,void 0,t,n)}constructor(e,t=16,n=Float64Array,r=ArrayBuffer,i,a=0){if(void 0===e)throw new Error("Missing required argument: numItems.");if(isNaN(e)||e<=0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.byteOffset=a;let o=e,s=o;this._levelBounds=[4*o];do{o=Math.ceil(o/this.nodeSize),s+=o,this._levelBounds.push(4*s)}while(1!==o);this.ArrayType=n,this.IndexArrayType=s<16384?Uint16Array:Uint32Array;const u=A.indexOf(n),c=4*s*n.BYTES_PER_ELEMENT;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this._boxes=new n(i,a+8,4*s),this._indices=new this.IndexArrayType(i,a+8+c,s),this._pos=4*s,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1];else{const i=this.data=new r(8+c+s*this.IndexArrayType.BYTES_PER_ELEMENT);this._boxes=new n(i,8,4*s),this._indices=new this.IndexArrayType(i,8+c,s),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(i,0,2).set([251,48+u]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}this._queue=new S}add(e,t,n=e,r=t){const i=this._pos>>2,a=this._boxes;return this._indices[i]=i,a[this._pos++]=e,a[this._pos++]=t,a[this._pos++]=n,a[this._pos++]=r,e<this.minX&&(this.minX=e),t<this.minY&&(this.minY=t),n>this.maxX&&(this.maxX=n),r>this.maxY&&(this.maxY=r),i}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);const e=this._boxes;if(this.numItems<=this.nodeSize)return e[this._pos++]=this.minX,e[this._pos++]=this.minY,e[this._pos++]=this.maxX,void(e[this._pos++]=this.maxY);const t=this.maxX-this.minX||1,n=this.maxY-this.minY||1,r=new Uint32Array(this.numItems);for(let i=0,a=0;i<this.numItems;i++){const o=e[a++],s=e[a++],u=e[a++],c=e[a++],f=Math.floor(65535*((o+u)/2-this.minX)/t),l=Math.floor(65535*((s+c)/2-this.minY)/n);r[i]=k(f,l)}M(r,e,this._indices,0,this.numItems-1,this.nodeSize);for(let t=0,n=0;t<this._levelBounds.length-1;t++){const r=this._levelBounds[t];for(;n<r;){const t=n;let i=e[n++],a=e[n++],o=e[n++],s=e[n++];for(let t=1;t<this.nodeSize&&n<r;t++)i=Math.min(i,e[n++]),a=Math.min(a,e[n++]),o=Math.max(o,e[n++]),s=Math.max(s,e[n++]);this._indices[this._pos>>2]=t,e[this._pos++]=i,e[this._pos++]=a,e[this._pos++]=o,e[this._pos++]=s}}}search(e,t,n,r,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=[],s=[];for(;void 0!==a;){const u=Math.min(a+4*this.nodeSize,E(a,this._levelBounds));for(let c=a;c<u;c+=4){const u=this._boxes[c];if(n<u)continue;const f=this._boxes[c+1];if(r<f)continue;const l=this._boxes[c+2];if(e>l)continue;const h=this._boxes[c+3];if(t>h)continue;const p=0|this._indices[c>>2];a>=4*this.numItems?o.push(p):(void 0===i||i(p,u,f,l,h))&&s.push(p)}a=o.pop()}return s}neighbors(e,t,n=1/0,r=1/0,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=this._queue,s=[],u=r*r;e:for(;void 0!==a;){const r=Math.min(a+4*this.nodeSize,E(a,this._levelBounds));for(let n=a;n<r;n+=4){const r=0|this._indices[n>>2],s=this._boxes[n],c=this._boxes[n+1],f=this._boxes[n+2],l=this._boxes[n+3],h=e<s?s-e:e>f?e-f:0,p=t<c?c-t:t>l?t-l:0,d=h*h+p*p;d>u||(a>=4*this.numItems?o.push(r<<1,d):(void 0===i||i(r))&&o.push(1+(r<<1),d))}for(;o.length&&1&o.peek();){if(o.peekValue()>u)break e;if(s.push(o.pop()>>1),s.length===n)break e}a=o.length?o.pop()>>1:void 0}return o.clear(),s}},U.kdbush=P,U["geographiclib-geodesic"]=j;var B="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},G=[],q=[],V="undefined"!=typeof Uint8Array?Uint8Array:Array,$=!1;function J(){$=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)G[t]=e[t],q[e.charCodeAt(t)]=t;q["-".charCodeAt(0)]=62,q["_".charCodeAt(0)]=63}function W(e){return G[e>>18&63]+G[e>>12&63]+G[e>>6&63]+G[63&e]}function Z(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(W(r));return i.join("")}function Y(e){var t;$||J();for(var n=e.length,r=n%3,i="",a=[],o=16383,s=0,u=n-r;s<u;s+=o)a.push(Z(e,s,s+o>u?u:s+o));return 1===r?(t=e[n-1],i+=G[t>>2],i+=G[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=G[t>>10],i+=G[t>>4&63],i+=G[t<<2&63],i+="="),a.push(i),a.join("")}function H(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,c=u>>1,f=-7,l=n?i-1:0,h=n?-1:1,p=e[t+l];for(l+=h,a=p&(1<<-f)-1,p>>=-f,f+=s;f>0;a=256*a+e[t+l],l+=h,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=r;f>0;o=256*o+e[t+l],l+=h,f-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=c}return(p?-1:1)*o*Math.pow(2,a-r)}function X(e,t,n,r,i,a){var o,s,u,c=8*a-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=f?(s=0,o=f):o+l>=1?(s=(t*u-1)*Math.pow(2,i),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[n+p]=255&o,p+=d,o/=256,c-=8);e[n+p-d]|=128*g}var K={}.toString,Q=Array.isArray||function(e){return"[object Array]"==K.call(e)};function ee(){return ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function te(e,t){if(ee()<t)throw new RangeError("Invalid typed array length");return ne.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=ne.prototype:(null===e&&(e=new ne(t)),e.length=t),e}function ne(e,t,n){if(!(ne.TYPED_ARRAY_SUPPORT||this instanceof ne))return new ne(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ae(this,e)}return re(this,e,t,n)}function re(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);ne.TYPED_ARRAY_SUPPORT?(e=t).__proto__=ne.prototype:e=oe(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!ne.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|ce(t,n);e=te(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(ue(t)){var n=0|se(t.length);return 0===(e=te(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?te(e,0):oe(e,t);if("Buffer"===t.type&&Q(t.data))return oe(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function ie(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ae(e,t){if(ie(t),e=te(e,t<0?0:0|se(t)),!ne.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function oe(e,t){var n=t.length<0?0:0|se(t.length);e=te(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function se(e){if(e>=ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ee().toString(16)+" bytes");return 0|e}function ue(e){return!(null==e||!e._isBuffer)}function ce(e,t){if(ue(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Re(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return De(e).length;default:if(r)return Re(e).length;t=(""+t).toLowerCase(),r=!0}}function fe(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ee(this,t,n);case"utf8":case"utf-8":return xe(this,t,n);case"ascii":return Se(this,t,n);case"latin1":case"binary":return Ae(this,t,n);case"base64":return _e(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Me(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function le(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function he(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=ne.from(t,r)),ue(t))return 0===t.length?-1:pe(e,t,n,r,i);if("number"==typeof t)return t&=255,ne.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):pe(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function pe(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(a=n;a<s;a++)if(c(e,a)===c(t,-1===f?0:a-f)){if(-1===f&&(f=a),a-f+1===u)return f*o}else-1!==f&&(a-=a-f),f=-1}else for(n+u>s&&(n=s-u),a=n;a>=0;a--){for(var l=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){l=!1;break}if(l)return a}return-1}function de(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function ge(e,t,n,r){return je(Re(t,e.length-n),e,n,r)}function me(e,t,n,r){return je(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function ye(e,t,n,r){return me(e,t,n,r)}function ve(e,t,n,r){return je(De(t),e,n,r)}function be(e,t,n,r){return je(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function _e(e,t,n){return 0===t&&n===e.length?Y(e):Y(e.slice(t,n))}function xe(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(f=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=l}return function(e){var t=e.length;if(t<=we)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=we));return n}(r)}ne.TYPED_ARRAY_SUPPORT=void 0===B.TYPED_ARRAY_SUPPORT||B.TYPED_ARRAY_SUPPORT,ee(),ne.poolSize=8192,ne._augment=function(e){return e.__proto__=ne.prototype,e},ne.from=function(e,t,n){return re(null,e,t,n)},ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&ne[Symbol.species]),ne.alloc=function(e,t,n){return function(e,t,n,r){return ie(t),t<=0?te(e,t):void 0!==n?"string"==typeof r?te(e,t).fill(n,r):te(e,t).fill(n):te(e,t)}(null,e,t,n)},ne.allocUnsafe=function(e){return ae(null,e)},ne.allocUnsafeSlow=function(e){return ae(null,e)},ne.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Fe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Fe(e.slice(0,0))}(e))},ne.compare=function(e,t){if(!ue(e)||!ue(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},ne.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ne.concat=function(e,t){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return ne.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=ne.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!ue(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},ne.byteLength=ce,ne.prototype._isBuffer=!0,ne.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)le(this,t,t+1);return this},ne.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)le(this,t,t+3),le(this,t+1,t+2);return this},ne.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)le(this,t,t+7),le(this,t+1,t+6),le(this,t+2,t+5),le(this,t+3,t+4);return this},ne.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?xe(this,0,e):fe.apply(this,arguments)},ne.prototype.equals=function(e){if(!ue(e))throw new TypeError("Argument must be a Buffer");return this===e||0===ne.compare(this,e)},ne.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},ne.prototype.compare=function(e,t,n,r,i){if(!ue(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(r,i),c=e.slice(t,n),f=0;f<s;++f)if(u[f]!==c[f]){a=u[f],o=c[f];break}return a<o?-1:o<a?1:0},ne.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},ne.prototype.indexOf=function(e,t,n){return he(this,e,t,n,!0)},ne.prototype.lastIndexOf=function(e,t,n){return he(this,e,t,n,!1)},ne.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return de(this,e,t,n);case"utf8":case"utf-8":return ge(this,e,t,n);case"ascii":return me(this,e,t,n);case"latin1":case"binary":return ye(this,e,t,n);case"base64":return ve(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var we=4096;function Se(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function Ae(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Ee(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=ze(e[a]);return i}function Me(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function Ie(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function ke(e,t,n,r,i,a){if(!ue(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Ce(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Pe(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Oe(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ne(e,t,n,r,i){return i||Oe(e,0,n,4),X(e,t,n,r,23,4),n+4}function Te(e,t,n,r,i){return i||Oe(e,0,n,8),X(e,t,n,r,52,8),n+8}ne.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),ne.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=ne.prototype;else{var i=t-e;n=new ne(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},ne.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},ne.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},ne.prototype.readUInt8=function(e,t){return t||Ie(e,1,this.length),this[e]},ne.prototype.readUInt16LE=function(e,t){return t||Ie(e,2,this.length),this[e]|this[e+1]<<8},ne.prototype.readUInt16BE=function(e,t){return t||Ie(e,2,this.length),this[e]<<8|this[e+1]},ne.prototype.readUInt32LE=function(e,t){return t||Ie(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},ne.prototype.readUInt32BE=function(e,t){return t||Ie(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},ne.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},ne.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},ne.prototype.readInt8=function(e,t){return t||Ie(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},ne.prototype.readInt16LE=function(e,t){t||Ie(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},ne.prototype.readInt16BE=function(e,t){t||Ie(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},ne.prototype.readInt32LE=function(e,t){return t||Ie(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},ne.prototype.readInt32BE=function(e,t){return t||Ie(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},ne.prototype.readFloatLE=function(e,t){return t||Ie(e,4,this.length),H(this,e,!0,23,4)},ne.prototype.readFloatBE=function(e,t){return t||Ie(e,4,this.length),H(this,e,!1,23,4)},ne.prototype.readDoubleLE=function(e,t){return t||Ie(e,8,this.length),H(this,e,!0,52,8)},ne.prototype.readDoubleBE=function(e,t){return t||Ie(e,8,this.length),H(this,e,!1,52,8)},ne.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||ke(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},ne.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||ke(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},ne.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,1,255,0),ne.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},ne.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,65535,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ce(this,e,t,!0),t+2},ne.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,65535,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ce(this,e,t,!1),t+2},ne.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,4294967295,0),ne.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Pe(this,e,t,!0),t+4},ne.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,4294967295,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Pe(this,e,t,!1),t+4},ne.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ke(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},ne.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ke(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},ne.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,1,127,-128),ne.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},ne.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,32767,-32768),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ce(this,e,t,!0),t+2},ne.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,32767,-32768),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ce(this,e,t,!1),t+2},ne.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,2147483647,-2147483648),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Pe(this,e,t,!0),t+4},ne.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Pe(this,e,t,!1),t+4},ne.prototype.writeFloatLE=function(e,t,n){return Ne(this,e,t,!0,n)},ne.prototype.writeFloatBE=function(e,t,n){return Ne(this,e,t,!1,n)},ne.prototype.writeDoubleLE=function(e,t,n){return Te(this,e,t,!0,n)},ne.prototype.writeDoubleBE=function(e,t,n){return Te(this,e,t,!1,n)},ne.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!ne.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},ne.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!ne.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=ue(e)?e:Re(new ne(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Le=/[^+\/0-9A-Za-z-_]/g;function ze(e){return e<16?"0"+e.toString(16):e.toString(16)}function Re(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function De(e){return function(e){var t,n,r,i,a,o;$||J();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new V(3*s/4-a),r=a>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=q[e.charCodeAt(t)]<<18|q[e.charCodeAt(t+1)]<<12|q[e.charCodeAt(t+2)]<<6|q[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=q[e.charCodeAt(t)]<<2|q[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=q[e.charCodeAt(t)]<<10|q[e.charCodeAt(t+1)]<<4|q[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Le,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function je(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Fe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Ue(){throw new Error("setTimeout has not been defined")}function Be(){throw new Error("clearTimeout has not been defined")}var Ge=Ue,qe=Be;function Ve(e){if(Ge===setTimeout)return setTimeout(e,0);if((Ge===Ue||!Ge)&&setTimeout)return Ge=setTimeout,setTimeout(e,0);try{return Ge(e,0)}catch(t){try{return Ge.call(null,e,0)}catch(t){return Ge.call(this,e,0)}}}"function"==typeof B.setTimeout&&(Ge=setTimeout),"function"==typeof B.clearTimeout&&(qe=clearTimeout);var $e,Je=[],We=!1,Ze=-1;function Ye(){We&&$e&&(We=!1,$e.length?Je=$e.concat(Je):Ze=-1,Je.length&&He())}function He(){if(!We){var e=Ve(Ye);We=!0;for(var t=Je.length;t;){for($e=Je,Je=[];++Ze<t;)$e&&$e[Ze].run();Ze=-1,t=Je.length}$e=null,We=!1,function(e){if(qe===clearTimeout)return clearTimeout(e);if((qe===Be||!qe)&&clearTimeout)return qe=clearTimeout,clearTimeout(e);try{return qe(e)}catch(t){try{return qe.call(null,e)}catch(t){return qe.call(this,e)}}}(e)}}function Xe(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Je.push(new Ke(e,t)),1!==Je.length||We||Ve(He)}function Ke(e,t){this.fun=e,this.array=t}Ke.prototype.run=function(){this.fun.apply(null,this.array)};function Qe(){}var et=Qe,tt=Qe,nt=Qe,rt=Qe,it=Qe,at=Qe,ot=Qe;var st=B.performance||{},ut=st.now||st.mozNow||st.msNow||st.oNow||st.webkitNow||function(){return(new Date).getTime()};var ct=new Date;var ft,lt,ht={nextTick:Xe,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:et,addListener:tt,once:nt,off:rt,removeListener:it,removeAllListeners:at,emit:ot,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ut.call(st),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ct)/1e3}},pt={exports:{}};function dt(){}function gt(){gt.init.call(this)}function mt(e){return void 0===e._maxListeners?gt.defaultMaxListeners:e._maxListeners}function yt(e,t,n,r){var i,a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new dt,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=mt(e))&&i>0&&o.length>i){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else o=a[t]=n,++e._eventsCount;return e}function vt(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function bt(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function _t(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}dt.prototype=Object.create(null),gt.EventEmitter=gt,gt.usingDomains=!1,gt.prototype.domain=void 0,gt.prototype._events=void 0,gt.prototype._maxListeners=void 0,gt.defaultMaxListeners=10,gt.init=function(){this.domain=null,gt.usingDomains&&(!ft.active||this instanceof ft.Domain||(this.domain=ft.active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new dt,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},gt.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},gt.prototype.getMaxListeners=function(){return mt(this)},gt.prototype.emit=function(e){var t,n,r,i,a,o,s,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=o[e]))return!1;var f="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=_t(e,r),a=0;a<r;++a)i[a].call(n)}(n,f,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=_t(e,i),o=0;o<i;++o)a[o].call(n,r)}(n,f,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=_t(e,a),s=0;s<a;++s)o[s].call(n,r,i)}(n,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=_t(e,o),u=0;u<o;++u)s[u].call(n,r,i,a)}(n,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=_t(e,i),o=0;o<i;++o)a[o].apply(n,r)}(n,f,this,i)}return!0},gt.prototype.addListener=function(e,t){return yt(this,e,t,!1)},gt.prototype.on=gt.prototype.addListener,gt.prototype.prependListener=function(e,t){return yt(this,e,t,!0)},gt.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,vt(this,e,t)),this},gt.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,vt(this,e,t)),this},gt.prototype.removeListener=function(e,t){var n,r,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0===--this._eventsCount?this._events=new dt:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0===--this._eventsCount)return this._events=new dt,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},gt.prototype.off=function(e,t){return this.removeListener(e,t)},gt.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new dt,this._eventsCount=0):n[e]&&(0===--this._eventsCount?this._events=new dt:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),a=0;a<i.length;++a)"removeListener"!==(r=i[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new dt,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},gt.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},gt.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):bt.call(e,t)},gt.prototype.listenerCount=bt,gt.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},lt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var xt=/%[sdj%]/g;function wt(e){if(!Lt(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Mt(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,a=String(e).replace(xt,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),o=r[n];n<i;o=r[++n])Tt(o)||!Dt(o)?a+=" "+o:a+=" "+Mt(o);return a}function St(e,t){if(zt(B.process))return function(){return St(e,t).apply(this,arguments)};if(!0===ht.noDeprecation)return e;var n=!1;return function(){if(!n){if(ht.throwDeprecation)throw new Error(t);ht.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var At,Et={};function Mt(e,t){var n={seen:[],stylize:kt};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Nt(t)?n.showHidden=t:t&&function(e,t){if(!t||!Dt(t))return e;var n=Object.keys(t),r=n.length;for(;r--;)e[n[r]]=t[n[r]]}(n,t),zt(n.showHidden)&&(n.showHidden=!1),zt(n.depth)&&(n.depth=2),zt(n.colors)&&(n.colors=!1),zt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=It),Ct(n,e,n.depth)}function It(e,t){var n=Mt.styles[t];return n?"["+Mt.colors[n][0]+"m"+e+"["+Mt.colors[n][1]+"m":e}function kt(e,t){return e}function Ct(e,t,n){if(e.customInspect&&t&&Ut(t.inspect)&&t.inspect!==Mt&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Lt(r)||(r=Ct(e,r,n)),r}var i=function(e,t){if(zt(t))return e.stylize("undefined","undefined");if(Lt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(Nt(t))return e.stylize(""+t,"boolean");if(Tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var a=Object.keys(t),o=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),Ft(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Pt(t);if(0===a.length){if(Ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Rt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(jt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ft(t))return Pt(t)}var u,c,f="",l=!1,h=["{","}"];(u=t,Array.isArray(u)&&(l=!0,h=["[","]"]),Ut(t))&&(f=" [Function"+(t.name?": "+t.name:"")+"]");return Rt(t)&&(f=" "+RegExp.prototype.toString.call(t)),jt(t)&&(f=" "+Date.prototype.toUTCString.call(t)),Ft(t)&&(f=" "+Pt(t)),0!==a.length||l&&0!=t.length?n<0?Rt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=l?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)Gt(t,String(o))?a.push(Ot(e,t,n,r,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(Ot(e,t,n,r,i,!0))}),a}(e,t,n,o,a):a.map(function(r){return Ot(e,t,n,o,r,l)}),e.seen.pop(),function(e,t,n){var r=e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(r>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,f,h)):h[0]+f+h[1]}function Pt(e){return"["+Error.prototype.toString.call(e)+"]"}function Ot(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Gt(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=Tt(n)?Ct(e,u.value,null):Ct(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),zt(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function Nt(e){return"boolean"==typeof e}function Tt(e){return null===e}function Lt(e){return"string"==typeof e}function zt(e){return void 0===e}function Rt(e){return Dt(e)&&"[object RegExp]"===Bt(e)}function Dt(e){return"object"==typeof e&&null!==e}function jt(e){return Dt(e)&&"[object Date]"===Bt(e)}function Ft(e){return Dt(e)&&("[object Error]"===Bt(e)||e instanceof Error)}function Ut(e){return"function"==typeof e}function Bt(e){return Object.prototype.toString.call(e)}function Gt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qt(){this.head=null,this.tail=null,this.length=0}Mt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Mt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},qt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},qt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},qt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},qt.prototype.clear=function(){this.head=this.tail=null,this.length=0},qt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},qt.prototype.concat=function(e){if(0===this.length)return ne.alloc(0);if(1===this.length)return this.head.data;for(var t=ne.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Vt=ne.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $t(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Vt(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Wt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Zt;break;default:return void(this.write=Jt)}this.charBuffer=new ne(6),this.charReceived=0,this.charLength=0}function Jt(e){return e.toString(this.encoding)}function Wt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Zt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}$t.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},$t.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},$t.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},Xt.ReadableState=Ht;var Yt=function(e){if(zt(At)&&(At=ht.env.NODE_DEBUG||""),e=e.toUpperCase(),!Et[e])if(new RegExp("\\b"+e+"\\b","i").test(At)){Et[e]=function(){var t=wt.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Et[e]=function(){};return Et[e]}("stream");function Ht(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Mn&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new qt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new $t(e.encoding),this.encoding=e.encoding)}function Xt(e){if(!(this instanceof Xt))return new Xt(e);this._readableState=new Ht(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),gt.call(this)}function Kt(e,t,n,r,i){var a=function(e,t){var n=null;ne.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(a)e.emit("error",a);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,tn(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&tn(e))),function(e,t){t.readingMore||(t.readingMore=!0,Xe(rn,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}lt(Xt,gt),Xt.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=ne.from(e,t),t=""),Kt(this,n,e,t,!1)},Xt.prototype.unshift=function(e){return Kt(this,this._readableState,e,"",!0)},Xt.prototype.isPaused=function(){return!1===this._readableState.flowing},Xt.prototype.setEncoding=function(e){return this._readableState.decoder=new $t(e),this._readableState.encoding=e,this};var Qt=8388608;function en(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=Qt?e=Qt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function tn(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Yt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Xe(nn,e):nn(e))}function nn(e){Yt("emit readable"),e.emit("readable"),sn(e)}function rn(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Yt("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function an(e){Yt("readable nexttick read 0"),e.read(0)}function on(e,t){t.reading||(Yt("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),sn(e),t.flowing&&!t.reading&&e.read(0)}function sn(e){var t=e._readableState;for(Yt("flow",t.flowing);t.flowing&&null!==e.read(););}function un(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;e-=i.length;for(;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=ne.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function cn(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Xe(fn,t,e))}function fn(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function ln(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function hn(){}function pn(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function dn(e,t){Object.defineProperty(this,"buffer",{get:St(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Mn&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?Xe(i,r):i(r);e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var a=bn(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||vn(e,n),r?Xe(yn,e,n,a,i):yn(e,n,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new wn(this)}function gn(e){if(!(this instanceof gn||this instanceof Mn))return new gn(e);this._writableState=new dn(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),gt.call(this)}function mn(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function yn(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),xn(e,t)}function vn(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var o=0;n;)i[o]=n,n=n.next,o+=1;mn(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new wn(t)}else{for(;n;){var s=n.chunk,u=n.encoding,c=n.callback;if(mn(e,t,!1,t.objectMode?1:s.length,s,u,c),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function bn(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _n(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function xn(e,t){var n=bn(t);return n&&(0===t.pendingcb?(_n(e,t),t.finished=!0,e.emit("finish")):_n(e,t)),n}function wn(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}Xt.prototype.read=function(e){Yt("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Yt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?cn(this):tn(this),null;if(0===(e=en(e,t))&&t.ended)return 0===t.length&&cn(this),null;var r,i=t.needReadable;return Yt("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&Yt("length less than watermark",i=!0),t.ended||t.reading?Yt("reading or ended",i=!1):i&&(Yt("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=en(n,t))),null===(r=e>0?un(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&cn(this)),null!==r&&this.emit("data",r),r},Xt.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Xt.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Yt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?o:c;function a(e){Yt("onunpipe"),e===n&&c()}function o(){Yt("onend"),e.end()}r.endEmitted?Xe(i):n.once("end",i),e.on("unpipe",a);var s=function(e){return function(){var t=e._readableState;Yt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,sn(e))}}(n);e.on("drain",s);var u=!1;function c(){Yt("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",o),n.removeListener("end",c),n.removeListener("data",l),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function l(t){Yt("ondata"),f=!1,!1!==e.write(t)||f||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==ln(r.pipes,e))&&!u&&(Yt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,f=!0),n.pause())}function h(t){Yt("onerror",t),g(),e.removeListener("error",h),0===function(e,t){return e.listeners(t).length}(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){Yt("onfinish"),e.removeListener("close",p),g()}function g(){Yt("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",n),r.flowing||(Yt("pipe resume"),n.resume()),e},Xt.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var a=ln(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},Xt.prototype.on=function(e,t){var n=gt.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&tn(this):Xe(an,this))}return n},Xt.prototype.addListener=Xt.prototype.on,Xt.prototype.resume=function(){var e=this._readableState;return e.flowing||(Yt("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Xe(on,e,t))}(this,e)),this},Xt.prototype.pause=function(){return Yt("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Yt("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Xt.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",function(){if(Yt("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){(Yt("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i)||(t.objectMode||i&&i.length)&&(r.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}(["error","close","destroy","pause","resume"],function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){Yt("wrapped _read",t),n&&(n=!1,e.resume())},r},Xt._fromList=un,gn.WritableState=dn,lt(gn,gt),dn.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},gn.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},gn.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),ne.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=hn),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),Xe(t,n)}(this,n):function(e,t,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):ne.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Xe(r,a),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=ne.from(t,n));return t}(t,n,r),ne.isBuffer(n)&&(r="buffer");var a=t.objectMode?1:n.length;t.length+=a;var o=t.length<t.highWaterMark;o||(t.needDrain=!0);if(t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new pn(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else mn(e,t,!1,a,n,r,i);return o}(this,r,e,t,n)),i},gn.prototype.cork=function(){this._writableState.corked++},gn.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||vn(this,e))},gn.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},gn.prototype._write=function(e,t,n){n(new Error("not implemented"))},gn.prototype._writev=null,gn.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,xn(e,t),n&&(t.finished?Xe(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},lt(Mn,Xt);for(var Sn=Object.keys(gn.prototype),An=0;An<Sn.length;An++){var En=Sn[An];Mn.prototype[En]||(Mn.prototype[En]=gn.prototype[En])}function Mn(e){if(!(this instanceof Mn))return new Mn(e);Xt.call(this,e),gn.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",In)}function In(){this.allowHalfOpen||this._writableState.ended||Xe(kn,this)}function kn(e){e.end()}function Cn(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n);i(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Pn(e){if(!(this instanceof Pn))return new Pn(e);Mn.call(this,e),this._transformState=new Cn(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e){On(t,e)}):On(t)})}function On(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Nn(e){if(!(this instanceof Nn))return new Nn(e);Pn.call(this,e)}function Tn(){gt.call(this)}lt(Pn,Mn),Pn.prototype.push=function(e,t){return this._transformState.needTransform=!1,Mn.prototype.push.call(this,e,t)},Pn.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Pn.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Pn.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},lt(Nn,Pn),Nn.prototype._transform=function(e,t,n){n(null,e)},lt(Tn,gt),Tn.Readable=Xt,Tn.Writable=gn,Tn.Duplex=Mn,Tn.Transform=Pn,Tn.PassThrough=Nn,Tn.Stream=Tn,Tn.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",o),n.on("close",s));var a=!1;function o(){a||(a=!0,e.end())}function s(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===gt.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",o),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",u),e.on("error",u),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e};var Ln={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function zn(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Rn(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]}var Dn=Uint8Array,jn=Uint16Array,Fn=Int32Array;function Un(e){for(var t=e.length;--t>=0;)e[t]=0}var Bn=256,Gn=286,qn=30,Vn=15,$n=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Jn=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Wn=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Zn=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Yn=new Array(576);Un(Yn);var Hn=new Array(60);Un(Hn);var Xn=new Array(512);Un(Xn);var Kn=new Array(256);Un(Kn);var Qn=new Array(29);Un(Qn);var er,tr,nr,rr=new Array(qn);function ir(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function ar(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function or(e){return e<256?Xn[e]:Xn[256+(e>>>7)]}function sr(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ur(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,sr(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function cr(e,t,n){ur(e,n[2*t],n[2*t+1])}function fr(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function lr(e,t,n){var r,i,a=new Array(16),o=0;for(r=1;r<=Vn;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=fr(a[s]++,s))}}function hr(e){var t;for(t=0;t<Gn;t++)e.dyn_ltree[2*t]=0;for(t=0;t<qn;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function pr(e){e.bi_valid>8?sr(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function dr(e,t,n,r){var i=2*t,a=2*n;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function gr(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&dr(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!dr(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function mr(e,t,n){var r,i,a,o,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===r?cr(e,i,t):(cr(e,(a=Kn[i])+Bn+1,t),0!==(o=$n[a])&&ur(e,i-=Qn[a],o),cr(e,a=or(--r),n),0!==(o=Jn[a])&&ur(e,r-=rr[a],o))}while(s<e.last_lit);cr(e,256,t)}function yr(e,t){var n,r,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==a[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):a[2*n+1]=0;for(;e.heap_len<2;)a[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;n>=1;n--)gr(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],gr(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,gr(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,c=t.max_code,f=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=Vn;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(a=u[2*u[2*(r=e.heap[n])+1]+1]+1)>d&&(a=d,g++),u[2*r+1]=a,r>c||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),l&&(e.static_len+=s*(f[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>c||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),lr(a,c,e.bl_count)}function vr(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s<u&&i===o||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=i,0===o?(u=138,c=3):i===o?(u=6,c=3):(u=7,c=4))}function br(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++s<u&&i===o)){if(s<c)do{cr(e,i,e.bl_tree)}while(0!==--s);else 0!==i?(i!==a&&(cr(e,i,e.bl_tree),s--),cr(e,16,e.bl_tree),ur(e,s-3,2)):s<=10?(cr(e,17,e.bl_tree),ur(e,s-3,3)):(cr(e,18,e.bl_tree),ur(e,s-11,7));s=0,a=i,0===o?(u=138,c=3):i===o?(u=6,c=3):(u=7,c=4)}}Un(rr);var _r=!1;function xr(e){_r||(!function(){var e,t,n,r,i,a=new Array(16);for(n=0,r=0;r<28;r++)for(Qn[r]=n,e=0;e<1<<$n[r];e++)Kn[n++]=r;for(Kn[n-1]=r,i=0,r=0;r<16;r++)for(rr[r]=i,e=0;e<1<<Jn[r];e++)Xn[i++]=r;for(i>>=7;r<qn;r++)for(rr[r]=i<<7,e=0;e<1<<Jn[r]-7;e++)Xn[256+i++]=r;for(t=0;t<=Vn;t++)a[t]=0;for(e=0;e<=143;)Yn[2*e+1]=8,e++,a[8]++;for(;e<=255;)Yn[2*e+1]=9,e++,a[9]++;for(;e<=279;)Yn[2*e+1]=7,e++,a[7]++;for(;e<=287;)Yn[2*e+1]=8,e++,a[8]++;for(lr(Yn,287,a),e=0;e<qn;e++)Hn[2*e+1]=5,Hn[2*e]=fr(e,5);er=new ir(Yn,$n,257,Gn,Vn),tr=new ir(Hn,Jn,0,qn,Vn),nr=new ir(new Array(0),Wn,0,19,7)}(),_r=!0),e.l_desc=new ar(e.dyn_ltree,er),e.d_desc=new ar(e.dyn_dtree,tr),e.bl_desc=new ar(e.bl_tree,nr),e.bi_buf=0,e.bi_valid=0,hr(e)}function wr(e,t,n,r){ur(e,0+(r?1:0),3),function(e,t,n){pr(e),sr(e,n),sr(e,~n),Rn(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}function Sr(e){ur(e,2,3),cr(e,256,Yn),function(e){16===e.bi_valid?(sr(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}function Ar(e,t,n,r){var i,a,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Bn;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),yr(e,e.l_desc),yr(e,e.d_desc),o=function(e){var t;for(vr(e,e.dyn_ltree,e.l_desc.max_code),vr(e,e.dyn_dtree,e.d_desc.max_code),yr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Zn[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=i&&(i=a)):i=a=n+5,n+4<=i&&-1!==t?wr(e,t,n,r):4===e.strategy||a===i?(ur(e,2+(r?1:0),3),mr(e,Yn,Hn)):(ur(e,4+(r?1:0),3),function(e,t,n,r){var i;for(ur(e,t-257,5),ur(e,n-1,5),ur(e,r-4,4),i=0;i<r;i++)ur(e,e.bl_tree[2*Zn[i]+1],3);br(e,e.dyn_ltree,t-1),br(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),mr(e,e.dyn_ltree,e.dyn_dtree)),hr(e),r&&pr(e)}function Er(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Kn[n]+Bn+1)]++,e.dyn_dtree[2*or(t)]++),e.last_lit===e.lit_bufsize-1}function Mr(e,t,n,r){for(var i=65535&e,a=e>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16}var Ir=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();function kr(e,t,n,r){var i=Ir,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}var Cr,Pr=-2,Or=258,Nr=262,Tr=103,Lr=113,zr=666;function Rr(e,t){return e.msg=Ln[t],t}function Dr(e){return(e<<1)-(e>4?9:0)}function jr(e){for(var t=e.length;--t>=0;)e[t]=0}function Fr(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(Rn(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function Ur(e,t){Ar(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fr(e.strm)}function Br(e,t){e.pending_buf[e.pending++]=t}function Gr(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function qr(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,Rn(t,e.input,e.next_in,i,n),1===e.state.wrap?e.adler=Mr(e.adler,t,i,n):2===e.state.wrap&&(e.adler=kr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function Vr(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-Nr?e.strstart-(e.w_size-Nr):0,c=e.window,f=e.w_mask,l=e.prev,h=e.strstart+Or,p=c[a+o-1],d=c[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(n=t)+o]===d&&c[n+o-1]===p&&c[n]===c[a]&&c[++n]===c[a+1]){a+=2,n++;do{}while(c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&a<h);if(r=Or-(h-a),a=h-Or,r>o){if(e.match_start=t,o=r,r>=s)break;p=c[a+o-1],d=c[a+o]}}}while((t=l[t&f])>u&&0!==--i);return o<=e.lookahead?o:e.lookahead}function $r(e){var t,n,r,i,a,o=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-Nr)){Rn(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=o?r-o:0}while(--n);t=n=o;do{r=e.prev[--t],e.prev[t]=r>=o?r-o:0}while(--n);i+=o}if(0===e.strm.avail_in)break;if(n=qr(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+3-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Nr&&0!==e.strm.avail_in)}function Jr(e,t){for(var n,r;;){if(e.lookahead<Nr){if($r(e),e.lookahead<Nr&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Nr&&(e.match_length=Vr(e,n)),e.match_length>=3)if(r=Er(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}function Wr(e,t){for(var n,r,i;;){if(e.lookahead<Nr){if($r(e),e.lookahead<Nr&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Nr&&(e.match_length=Vr(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Er(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Ur(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=Er(e,0,e.window[e.strstart-1]))&&Ur(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Er(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}function Zr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function Yr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new jn(1146),this.dyn_dtree=new jn(122),this.bl_tree=new jn(78),jr(this.dyn_ltree),jr(this.dyn_dtree),jr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new jn(16),this.heap=new jn(573),jr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new jn(573),jr(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Hr(e){var t,n=function(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:Lr,e.adler=2===t.wrap?0:1,t.last_flush=0,xr(t),0):Rr(e,Pr)}(e);return 0===n&&((t=e.state).window_size=2*t.w_size,jr(t.head),t.max_lazy_match=Cr[t.level].max_lazy,t.good_match=Cr[t.level].good_length,t.nice_match=Cr[t.level].nice_length,t.max_chain_length=Cr[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function Xr(e,t){var n,r,i,a;if(!e||!e.state||t>5||t<0)return e?Rr(e,Pr):Pr;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===zr&&4!==t)return Rr(e,0===e.avail_out?-5:Pr);if(r.strm=e,n=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Br(r,31),Br(r,139),Br(r,8),r.gzhead?(Br(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Br(r,255&r.gzhead.time),Br(r,r.gzhead.time>>8&255),Br(r,r.gzhead.time>>16&255),Br(r,r.gzhead.time>>24&255),Br(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Br(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Br(r,255&r.gzhead.extra.length),Br(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=kr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Br(r,0),Br(r,0),Br(r,0),Br(r,0),Br(r,0),Br(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Br(r,3),r.status=Lr);else{var o=8+(r.w_bits-8<<4)<<8;o|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=Lr,Gr(r,o),0!==r.strstart&&(Gr(r,e.adler>>>16),Gr(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending!==r.pending_buf_size));)Br(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Br(r,a)}while(0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Br(r,a)}while(0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.status=Tr)}else r.status=Tr;if(r.status===Tr&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Fr(e),r.pending+2<=r.pending_buf_size&&(Br(r,255&e.adler),Br(r,e.adler>>8&255),e.adler=0,r.status=Lr)):r.status=Lr),0!==r.pending){if(Fr(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&Dr(t)<=Dr(n)&&4!==t)return Rr(e,-5);if(r.status===zr&&0!==e.avail_in)return Rr(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==zr){var s=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&($r(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var n,r,i,a,o=e.window;;){if(e.lookahead<=Or){if($r(e),e.lookahead<=Or&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=o[i=e.strstart-1])===o[++i]&&r===o[++i]&&r===o[++i]){a=e.strstart+Or;do{}while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Or-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Er(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}(r,t):Cr[r.level].func(r,t);if(3!==s&&4!==s||(r.status=zr),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?Sr(r):5!==t&&(wr(r,0,0,!1),3===t&&(jr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Fr(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Br(r,255&e.adler),Br(r,e.adler>>8&255),Br(r,e.adler>>16&255),Br(r,e.adler>>24&255),Br(r,255&e.total_in),Br(r,e.total_in>>8&255),Br(r,e.total_in>>16&255),Br(r,e.total_in>>24&255)):(Gr(r,e.adler>>>16),Gr(r,65535&e.adler)),Fr(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)}Cr=[new Zr(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if($r(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Ur(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-Nr&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Ur(e,!1),e.strm.avail_out),1)}),new Zr(4,4,8,4,Jr),new Zr(4,5,16,8,Jr),new Zr(4,6,32,32,Jr),new Zr(4,4,16,16,Wr),new Zr(8,16,32,32,Wr),new Zr(8,16,128,128,Wr),new Zr(8,32,128,256,Wr),new Zr(32,128,258,1024,Wr),new Zr(32,258,258,4096,Wr)];function Kr(e,t){var n,r,i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M;n=e.state,r=e.next_in,E=e.input,i=r+(e.avail_in-5),a=e.next_out,M=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,l=n.wnext,h=n.window,p=n.hold,d=n.bits,g=n.lencode,m=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;e:do{d<15&&(p+=E[r++]<<d,d+=8,p+=E[r++]<<d,d+=8),b=g[p&y];t:for(;;){if(p>>>=_=b>>>24,d-=_,0===(_=b>>>16&255))M[a++]=65535&b;else{if(!(16&_)){if(64&_){if(32&_){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}b=g[(65535&b)+(p&(1<<_)-1)];continue t}for(x=65535&b,(_&=15)&&(d<_&&(p+=E[r++]<<d,d+=8),x+=p&(1<<_)-1,p>>>=_,d-=_),d<15&&(p+=E[r++]<<d,d+=8,p+=E[r++]<<d,d+=8),b=m[p&v];;){if(p>>>=_=b>>>24,d-=_,16&(_=b>>>16&255)){if(w=65535&b,d<(_&=15)&&(p+=E[r++]<<d,(d+=8)<_&&(p+=E[r++]<<d,d+=8)),(w+=p&(1<<_)-1)>u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=_,d-=_,w>(_=a-o)){if((_=w-_)>f&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(S=0,A=h,0===l){if(S+=c-_,_<x){x-=_;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}}else if(l<_){if(S+=c+l-_,(_-=l)<x){x-=_;do{M[a++]=h[S++]}while(--_);if(S=0,l<x){x-=_=l;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}}}else if(S+=l-_,_<x){x-=_;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}for(;x>2;)M[a++]=A[S++],M[a++]=A[S++],M[a++]=A[S++],x-=3;x&&(M[a++]=A[S++],x>1&&(M[a++]=A[S++]))}else{S=a-w;do{M[a++]=M[S++],M[a++]=M[S++],M[a++]=M[S++],x-=3}while(x>2);x&&(M[a++]=M[S++],x>1&&(M[a++]=M[S++]))}break}if(64&_){e.msg="invalid distance code",n.mode=30;break e}b=m[(65535&b)+(p&(1<<_)-1)]}}break}}while(r<i&&a<s);r-=x=d>>3,p&=(1<<(d-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=a<s?s-a+257:257-(a-s),n.hold=p,n.bits=d}var Qr=15,ei=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ti=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],ni=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],ri=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function ii(e,t,n,r,i,a,o,s){var u,c,f,l,h,p,d,g,m,y=s.bits,v=0,b=0,_=0,x=0,w=0,S=0,A=0,E=0,M=0,I=0,k=null,C=0,P=new jn(16),O=new jn(16),N=null,T=0;for(v=0;v<=Qr;v++)P[v]=0;for(b=0;b<r;b++)P[t[n+b]]++;for(w=y,x=Qr;x>=1&&0===P[x];x--);if(w>x&&(w=x),0===x)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(_=1;_<x&&0===P[_];_++);for(w<_&&(w=_),E=1,v=1;v<=Qr;v++)if(E<<=1,(E-=P[v])<0)return-1;if(E>0&&(0===e||1!==x))return-1;for(O[1]=0,v=1;v<Qr;v++)O[v+1]=O[v]+P[v];for(b=0;b<r;b++)0!==t[n+b]&&(o[O[t[n+b]]++]=b);if(0===e?(k=N=o,p=19):1===e?(k=ei,C-=257,N=ti,T-=257,p=256):(k=ni,N=ri,p=-1),I=0,b=0,v=_,h=a,S=w,A=0,f=-1,l=(M=1<<w)-1,1===e&&M>852||2===e&&M>592)return 1;for(;;){d=v-A,o[b]<p?(g=0,m=o[b]):o[b]>p?(g=N[T+o[b]],m=k[C+o[b]]):(g=96,m=0),u=1<<v-A,_=c=1<<S;do{i[h+(I>>A)+(c-=u)]=d<<24|g<<16|m}while(0!==c);for(u=1<<v-1;I&u;)u>>=1;if(0!==u?(I&=u-1,I+=u):I=0,b++,0===--P[v]){if(v===x)break;v=t[n+o[b]]}if(v>w&&(I&l)!==f){for(0===A&&(A=w),h+=_,E=1<<(S=v-A);S+A<x&&!((E-=P[S+A])<=0);)S++,E<<=1;if(M+=1<<S,1===e&&M>852||2===e&&M>592)return 1;i[f=I&l]=w<<24|S<<16|h-a}}return 0!==I&&(i[h+I]=v-A<<24|64<<16),s.bits=w,0}var ai=-2,oi=12,si=30;function ui(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ci(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new jn(320),this.work=new jn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function fi(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Fn(852),t.distcode=t.distdyn=new Fn(592),t.sane=1,t.back=-1,0):ai}(e)):ai}function li(e,t){var n,r;return e?(r=new ci,e.state=r,r.window=null,n=function(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ai:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,fi(e))):ai}(e,t),0!==n&&(e.state=null),n):ai}var hi,pi,di=!0;function gi(e){if(di){var t;for(hi=new Fn(512),pi=new Fn(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ii(1,e.lens,0,288,hi,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ii(2,e.lens,0,32,pi,0,e.work,{bits:5}),di=!1}e.lencode=hi,e.lenbits=9,e.distcode=pi,e.distbits=5}function mi(e,t){var n,r,i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M=0,I=new Dn(4),k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return ai;(n=e.state).mode===oi&&(n.mode=13),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,f=n.bits,l=s,h=u,S=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(2&n.wrap&&35615===c){n.check=0,I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0),c=0,f=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=si;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=si;break}if(f-=4,w=8+(15&(c>>>=4)),0===n.wbits)n.wbits=w;else if(w>n.wbits){e.msg="invalid window size",n.mode=si;break}n.dmax=1<<w,e.adler=n.check=1,n.mode=512&c?10:oi,c=0,f=0;break;case 2:for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(n.flags=c,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=si;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=si;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0,n.mode=3;case 3:for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.head&&(n.head.time=c),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,I[2]=c>>>16&255,I[3]=c>>>24&255,n.check=kr(n.check,I,4,0)),c=0,f=0,n.mode=4;case 4:for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0,n.mode=5;case 5:if(1024&n.flags){for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((p=n.length)>s&&(p=s),p&&(n.head&&(w=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Rn(n.head.extra,r,a,p,w)),512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;p=0;do{w=r[a+p++],n.head&&w&&n.length<65536&&(n.head.name+=String.fromCharCode(w))}while(w&&p<s);if(512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,w)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;p=0;do{w=r[a+p++],n.head&&w&&n.length<65536&&(n.head.comment+=String.fromCharCode(w))}while(w&&p<s);if(512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,w)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=si;break}c=0,f=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=oi;break;case 10:for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}e.adler=n.check=ui(c),c=0,f=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,2;e.adler=n.check=1,n.mode=oi;case oi:if(5===t||6===t)break e;case 13:if(n.last){c>>>=7&f,f-=7&f,n.mode=27;break}for(;f<3;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}switch(n.last=1&c,f-=1,3&(c>>>=1)){case 0:n.mode=14;break;case 1:if(gi(n),n.mode=20,6===t){c>>>=2,f-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=si}c>>>=2,f-=2;break;case 14:for(c>>>=7&f,f-=7&f;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=si;break}if(n.length=65535&c,c=0,f=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(p=n.length){if(p>s&&(p=s),p>u&&(p=u),0===p)break e;Rn(i,r,a,p,o),s-=p,a+=p,u-=p,o+=p,n.length-=p;break}n.mode=oi;break;case 17:for(;f<14;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(n.nlen=257+(31&c),c>>>=5,f-=5,n.ndist=1+(31&c),c>>>=5,f-=5,n.ncode=4+(15&c),c>>>=4,f-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=si;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;f<3;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.lens[k[n.have++]]=7&c,c>>>=3,f-=3}for(;n.have<19;)n.lens[k[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},S=ii(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,S){e.msg="invalid code lengths set",n.mode=si;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;y=(M=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(v<16)c>>>=m,f-=m,n.lens[n.have++]=v;else{if(16===v){for(E=m+2;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c>>>=m,f-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=si;break}w=n.lens[n.have-1],p=3+(3&c),c>>>=2,f-=2}else if(17===v){for(E=m+3;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}f-=m,w=0,p=3+(7&(c>>>=m)),c>>>=3,f-=3}else{for(E=m+7;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}f-=m,w=0,p=11+(127&(c>>>=m)),c>>>=7,f-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=si;break}for(;p--;)n.lens[n.have++]=w}}if(n.mode===si)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=si;break}if(n.lenbits=9,A={bits:n.lenbits},S=ii(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,S){e.msg="invalid literal/lengths set",n.mode=si;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},S=ii(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,S){e.msg="invalid distances set",n.mode=si;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,Kr(e,h),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,f=n.bits,n.mode===oi&&(n.back=-1);break}for(n.back=0;y=(M=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(y&&!(240&y)){for(b=m,_=y,x=v;y=(M=n.lencode[x+((c&(1<<b+_)-1)>>b)])>>>16&255,v=65535&M,!(b+(m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}c>>>=b,f-=b,n.back+=b}if(c>>>=m,f-=m,n.back+=m,n.length=v,0===y){n.mode=26;break}if(32&y){n.back=-1,n.mode=oi;break}if(64&y){e.msg="invalid literal/length code",n.mode=si;break}n.extra=15&y,n.mode=22;case 22:if(n.extra){for(E=n.extra;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,f-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;y=(M=n.distcode[c&(1<<n.distbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(!(240&y)){for(b=m,_=y,x=v;y=(M=n.distcode[x+((c&(1<<b+_)-1)>>b)])>>>16&255,v=65535&M,!(b+(m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}c>>>=b,f-=b,n.back+=b}if(c>>>=m,f-=m,n.back+=m,64&y){e.msg="invalid distance code",n.mode=si;break}n.offset=v,n.extra=15&y,n.mode=24;case 24:if(n.extra){for(E=n.extra;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,f-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=si;break}n.mode=25;case 25:if(0===u)break e;if(p=h-u,n.offset>p){if((p=n.offset-p)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=si;break}p>n.wnext?(p-=n.wnext,d=n.wsize-p):d=n.wnext-p,p>n.length&&(p=n.length),g=n.window}else g=i,d=o-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do{i[o++]=g[d++]}while(--p);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;i[o++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;f<32;){if(0===s)break e;s--,c|=r[a++]<<f,f+=8}if(h-=u,e.total_out+=h,n.total+=h,h&&(e.adler=n.check=n.flags?kr(n.check,i,h,o-h):Mr(n.check,i,h,o-h)),h=u,(n.flags?c:ui(c))!==n.check){e.msg="incorrect data check",n.mode=si;break}c=0,f=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=si;break}c=0,f=0}n.mode=29;case 29:S=1;break e;case si:S=-3;break e;case 31:return-4;default:return ai}return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,(n.wsize||h!==e.avail_out&&n.mode<si&&(n.mode<27||4!==t))&&function(e,t,n,r){var i,a=e.state;null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Dn(a.wsize)),r>=a.wsize?(Rn(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>r&&(i=r),Rn(a.window,t,n-r,i,a.wnext),(r-=i)?(Rn(a.window,t,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i)))}(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,n.total+=h,n.wrap&&h&&(e.adler=n.check=n.flags?kr(n.check,i,h,e.next_out-h):Mr(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===oi?128:0)+(20===n.mode||15===n.mode?256:0),(0===l&&0===h||4===t)&&0===S&&(S=-5),S}var yi;function vi(e){if(e<1||e>7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function bi(e,t){for(var n=0;n<e.length;n++)this[t+n]=e[n]}vi.prototype.init=function(e,t,n,r,i){var a;switch(this.windowBits=e,this.level=t,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),7===this.mode&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new zn,this.mode){case 1:case 3:case 5:a=function(e,t,n,r,i,a){if(!e)return Pr;var o=1;if(-1===t&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||8!==n||r<8||r>15||t<0||t>9||a<0||a>4)return Rr(e,Pr);8===r&&(r=9);var s=new Yr;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Dn(2*s.w_size),s.head=new jn(s.hash_size),s.prev=new jn(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Dn(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,Hr(e)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:a=li(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===a?(this.write_in_progress=!1,this.init_done=!0):this._error(a)},vi.prototype.params=function(){throw new Error("deflateParams Not supported")},vi.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},vi.prototype.write=function(e,t,n,r,i,a,o){this._writeCheck(),this.write_in_progress=!0;var s=this;return ht.nextTick(function(){s.write_in_progress=!1;var u=s._write(e,t,n,r,i,a,o);s.callback(u[0],u[1]),s.pending_close&&s.close()}),this},vi.prototype.writeSync=function(e,t,n,r,i,a,o){return this._writeCheck(),this._write(e,t,n,r,i,a,o)},vi.prototype._write=function(e,t,n,r,i,a,o){if(this.write_in_progress=!0,0!==e&&1!==e&&2!==e&&3!==e&&4!==e&&5!==e)throw new Error("Invalid flush value");null==t&&(t=new ne(0),r=0,n=0),i._set?i.set=i._set:i.set=bi;var s,u=this.strm;switch(u.avail_in=r,u.input=t,u.next_in=n,u.avail_out=o,u.output=i,u.next_out=a,this.mode){case 1:case 3:case 5:s=Xr(u,e);break;case 7:case 2:case 4:case 6:s=mi(u,e);break;default:throw new Error("Unknown mode "+this.mode)}return this._checkError(s,u,e)||this._error(s),this.write_in_progress=!1,[u.avail_in,u.avail_out]},vi.prototype._checkError=function(e,t,n){switch(e){case 0:case-5:if(0!==t.avail_out&&4===n)return!1;break;case 1:break;default:return!1}return!0},vi.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,1===this.mode||3===this.mode||5===this.mode?function(e){var t;e&&e.state&&(42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==Tr&&t!==Lr&&t!==zr?Rr(e,Pr):(e.state=null,t===Lr&&Rr(e,-3)))}(this.strm):function(e){if(!e||!e.state)return ai;var t=e.state;t.window&&(t.window=null),e.state=null}(this.strm),this.mode=0)},vi.prototype.reset=function(){switch(this.mode){case 1:case 5:yi=Hr(this.strm);break;case 2:case 6:yi=fi(this.strm)}0!==yi&&this._error(yi)},vi.prototype._error=function(e){this.onerror(Ln[e]+": "+this.strm.msg,e),this.write_in_progress=!1,this.pending_close&&this.close()};var _i=Object.freeze({__proto__:null,DEFLATE:1,DEFLATERAW:5,GUNZIP:4,GZIP:3,INFLATE:2,INFLATERAW:6,NONE:0,UNZIP:7,Z_BEST_COMPRESSION:9,Z_BEST_SPEED:1,Z_BINARY:0,Z_BLOCK:5,Z_BUF_ERROR:-5,Z_DATA_ERROR:-3,Z_DEFAULT_COMPRESSION:-1,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8,Z_ERRNO:-1,Z_FILTERED:1,Z_FINISH:4,Z_FIXED:4,Z_FULL_FLUSH:3,Z_HUFFMAN_ONLY:2,Z_NEED_DICT:2,Z_NO_COMPRESSION:0,Z_NO_FLUSH:0,Z_OK:0,Z_PARTIAL_FLUSH:1,Z_RLE:3,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_SYNC_FLUSH:2,Z_TEXT:1,Z_TREES:6,Z_UNKNOWN:2,Zlib:vi});var xi={};Object.keys(_i).forEach(function(e){xi[e]=_i[e]}),xi.Z_MIN_WINDOWBITS=8,xi.Z_MAX_WINDOWBITS=15,xi.Z_DEFAULT_WINDOWBITS=15,xi.Z_MIN_CHUNK=64,xi.Z_MAX_CHUNK=1/0,xi.Z_DEFAULT_CHUNK=16384,xi.Z_MIN_MEMLEVEL=1,xi.Z_MAX_MEMLEVEL=9,xi.Z_DEFAULT_MEMLEVEL=8,xi.Z_MIN_LEVEL=-1,xi.Z_MAX_LEVEL=9,xi.Z_DEFAULT_LEVEL=xi.Z_DEFAULT_COMPRESSION;var wi={Z_OK:xi.Z_OK,Z_STREAM_END:xi.Z_STREAM_END,Z_NEED_DICT:xi.Z_NEED_DICT,Z_ERRNO:xi.Z_ERRNO,Z_STREAM_ERROR:xi.Z_STREAM_ERROR,Z_DATA_ERROR:xi.Z_DATA_ERROR,Z_MEM_ERROR:xi.Z_MEM_ERROR,Z_BUF_ERROR:xi.Z_BUF_ERROR,Z_VERSION_ERROR:xi.Z_VERSION_ERROR};function Si(e){return new Ji(e)}function Ai(e){return new Wi(e)}function Ei(e){return new Hi(e)}function Mi(e){return new Xi(e)}function Ii(e){return new Zi(e)}function ki(e){return new Yi(e)}function Ci(e){return new Ki(e)}function Pi(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Ji(t),e,n)}function Oi(e,t){return $i(new Ji(t),e)}function Ni(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Zi(t),e,n)}function Ti(e,t){return $i(new Zi(t),e)}function Li(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Hi(t),e,n)}function zi(e,t){return $i(new Hi(t),e)}function Ri(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Ki(t),e,n)}function Di(e,t){return $i(new Ki(t),e)}function ji(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Wi(t),e,n)}function Fi(e,t){return $i(new Wi(t),e)}function Ui(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Yi(t),e,n)}function Bi(e,t){return $i(new Yi(t),e)}function Gi(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Xi(t),e,n)}function qi(e,t){return $i(new Xi(t),e)}function Vi(e,t,n){var r=[],i=0;function a(){for(var t;null!==(t=e.read());)r.push(t),i+=t.length;e.once("readable",a)}function o(){var t=ne.concat(r,i);r=[],n(null,t),e.close()}e.on("error",function(t){e.removeListener("end",o),e.removeListener("readable",a),n(t)}),e.on("end",o),e.end(t),a()}function $i(e,t){if("string"==typeof t&&(t=new ne(t)),!ne.isBuffer(t))throw new TypeError("Not a string or buffer");var n=xi.Z_FINISH;return e._processChunk(t,n)}function Ji(e){if(!(this instanceof Ji))return new Ji(e);Qi.call(this,e,xi.DEFLATE)}function Wi(e){if(!(this instanceof Wi))return new Wi(e);Qi.call(this,e,xi.INFLATE)}function Zi(e){if(!(this instanceof Zi))return new Zi(e);Qi.call(this,e,xi.GZIP)}function Yi(e){if(!(this instanceof Yi))return new Yi(e);Qi.call(this,e,xi.GUNZIP)}function Hi(e){if(!(this instanceof Hi))return new Hi(e);Qi.call(this,e,xi.DEFLATERAW)}function Xi(e){if(!(this instanceof Xi))return new Xi(e);Qi.call(this,e,xi.INFLATERAW)}function Ki(e){if(!(this instanceof Ki))return new Ki(e);Qi.call(this,e,xi.UNZIP)}function Qi(e,t){if(this._opts=e=e||{},this._chunkSize=e.chunkSize||xi.Z_DEFAULT_CHUNK,Pn.call(this,e),e.flush&&e.flush!==xi.Z_NO_FLUSH&&e.flush!==xi.Z_PARTIAL_FLUSH&&e.flush!==xi.Z_SYNC_FLUSH&&e.flush!==xi.Z_FULL_FLUSH&&e.flush!==xi.Z_FINISH&&e.flush!==xi.Z_BLOCK)throw new Error("Invalid flush flag: "+e.flush);if(this._flushFlag=e.flush||xi.Z_NO_FLUSH,e.chunkSize&&(e.chunkSize<xi.Z_MIN_CHUNK||e.chunkSize>xi.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<xi.Z_MIN_WINDOWBITS||e.windowBits>xi.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<xi.Z_MIN_LEVEL||e.level>xi.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<xi.Z_MIN_MEMLEVEL||e.memLevel>xi.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=xi.Z_FILTERED&&e.strategy!=xi.Z_HUFFMAN_ONLY&&e.strategy!=xi.Z_RLE&&e.strategy!=xi.Z_FIXED&&e.strategy!=xi.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!ne.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new xi.Zlib(t);var n=this;this._hadError=!1,this._binding.onerror=function(e,t){n._binding=null,n._hadError=!0;var r=new Error(e);r.errno=t,r.code=wi[t],n.emit("error",r)};var r=xi.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(r=e.level);var i=xi.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(i=e.strategy),this._binding.init(e.windowBits||xi.Z_DEFAULT_WINDOWBITS,r,e.memLevel||xi.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new ne(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(wi).forEach(function(e){wi[wi[e]]=e}),lt(Qi,Pn),Qi.prototype.params=function(e,t,n){if(e<xi.Z_MIN_LEVEL||e>xi.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=xi.Z_FILTERED&&t!=xi.Z_HUFFMAN_ONLY&&t!=xi.Z_RLE&&t!=xi.Z_FIXED&&t!=xi.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var r=this;this.flush(xi.Z_SYNC_FLUSH,function(){r._binding.params(e,t),r._hadError||(r._level=e,r._strategy=t,n&&n())})}else ht.nextTick(n)},Qi.prototype.reset=function(){return this._binding.reset()},Qi.prototype._flush=function(e){this._transform(new ne(0),"",e)},Qi.prototype.flush=function(e,t){var n=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=xi.Z_FULL_FLUSH),n.ended)t&&ht.nextTick(t);else if(n.ending)t&&this.once("end",t);else if(n.needDrain){var r=this;this.once("drain",function(){r.flush(t)})}else this._flushFlag=e,this.write(new ne(0),"",t)},Qi.prototype.close=function(e){if(e&&ht.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;ht.nextTick(function(){t.emit("close")})}},Qi.prototype._transform=function(e,t,n){var r,i=this._writableState,a=(i.ending||i.ended)&&(!e||i.length===e.length);if(null===!e&&!ne.isBuffer(e))return n(new Error("invalid input"));a?r=xi.Z_FINISH:(r=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||xi.Z_NO_FLUSH)),this._processChunk(e,r,n)},Qi.prototype._processChunk=function(e,t,n){var r=e&&e.length,i=this._chunkSize-this._offset,a=0,o=this,s="function"==typeof n;if(!s){var u,c=[],f=0;this.on("error",function(e){u=e});do{var l=this._binding.writeSync(t,e,a,r,this._buffer,this._offset,i)}while(!this._hadError&&d(l[0],l[1]));if(this._hadError)throw u;var h=ne.concat(c,f);return this.close(),h}var p=this._binding.write(t,e,a,r,this._buffer,this._offset,i);function d(u,l){if(!o._hadError){var h=i-l;if(function(e,t){if(!e)throw new Error(t)}(h>=0,"have should not go down"),h>0){var p=o._buffer.slice(o._offset,o._offset+h);o._offset+=h,s?o.push(p):(c.push(p),f+=p.length)}if((0===l||o._offset>=o._chunkSize)&&(i=o._chunkSize,o._offset=0,o._buffer=new ne(o._chunkSize)),0===l){if(a+=r-u,r=u,!s)return!0;var g=o._binding.write(t,e,a,r,o._buffer,o._offset,o._chunkSize);return g.callback=d,void(g.buffer=e)}if(!s)return!1;n()}}p.buffer=e,p.callback=d},lt(Ji,Qi),lt(Wi,Qi),lt(Zi,Qi),lt(Yi,Qi),lt(Hi,Qi),lt(Xi,Qi),lt(Ki,Qi);var ea,ta={codes:wi,createDeflate:Si,createInflate:Ai,createDeflateRaw:Ei,createInflateRaw:Mi,createGzip:Ii,createGunzip:ki,createUnzip:Ci,deflate:Pi,deflateSync:Oi,gzip:Ni,gzipSync:Ti,deflateRaw:Li,deflateRawSync:zi,unzip:Ri,unzipSync:Di,inflate:ji,inflateSync:Fi,gunzip:Ui,gunzipSync:Bi,inflateRaw:Gi,inflateRawSync:qi,Deflate:Ji,Inflate:Wi,Gzip:Zi,Gunzip:Yi,DeflateRaw:Hi,InflateRaw:Xi,Unzip:Ki,Zlib:Qi},na=n(Object.freeze({__proto__:null,Deflate:Ji,DeflateRaw:Hi,Gunzip:Yi,Gzip:Zi,Inflate:Wi,InflateRaw:Xi,Unzip:Ki,Zlib:Qi,codes:wi,createDeflate:Si,createDeflateRaw:Ei,createGunzip:ki,createGzip:Ii,createInflate:Ai,createInflateRaw:Mi,createUnzip:Ci,default:ta,deflate:Pi,deflateRaw:Li,deflateRawSync:zi,deflateSync:Oi,gunzip:Ui,gunzipSync:Bi,gzip:Ni,gzipSync:Ti,inflate:ji,inflateRaw:Gi,inflateRawSync:qi,inflateSync:Fi,unzip:Ri,unzipSync:Di}));function ra(){if(void 0===ea){var e=new ArrayBuffer(2),t=new Uint8Array(e),n=new Uint16Array(e);if(t[0]=1,t[1]=2,258===n[0])ea="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");ea="LE"}}return ea}function ia(){return void 0!==B.location?B.location.hostname:""}function aa(){return[]}function oa(){return 0}function sa(){return Number.MAX_VALUE}function ua(){return Number.MAX_VALUE}function ca(){return[]}function fa(){return"Browser"}function la(){return void 0!==B.navigator?B.navigator.appVersion:""}function ha(){return{}}function pa(){return{}}function da(){return"javascript"}function ga(){return"browser"}function ma(){return"/tmp"}var ya=ma;function va(){return"$HOME"}var ba={homedir:va,EOL:"\n",arch:da,platform:ga,tmpdir:ya,tmpDir:ma,networkInterfaces:ha,getNetworkInterfaces:pa,release:la,type:fa,cpus:ca,totalmem:ua,freemem:sa,uptime:oa,loadavg:aa,hostname:ia,endianness:ra},_a=n(Object.freeze({__proto__:null,EOL:"\n",arch:da,cpus:ca,default:ba,endianness:ra,freemem:sa,getNetworkInterfaces:pa,homedir:va,hostname:ia,loadavg:aa,networkInterfaces:ha,platform:ga,release:la,tmpDir:ma,tmpdir:ya,totalmem:ua,type:fa,uptime:oa}));class xa{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(e,t){let n=this.length++;for(this.ids[n]=e,this.values[n]=t;n>0;){const e=n-1>>1,r=this.values[e];if(t>=r)break;this.ids[n]=this.ids[e],this.values[n]=r,n=e}this.ids[n]=e,this.values[n]=t}pop(){if(0===this.length)return;const e=this.ids[0];if(this.length--,this.length>0){const e=this.ids[0]=this.ids[this.length],t=this.values[0]=this.values[this.length],n=this.length>>1;let r=0;for(;r<n;){let e=1+(r<<1);const n=e+1;let i=this.ids[e],a=this.values[e];const o=this.values[n];if(n<this.length&&o<a&&(e=n,i=this.ids[n],a=o),a>=t)break;this.ids[r]=i,this.values[r]=a,r=e}this.ids[r]=e,this.values[r]=t}return e}peek(){if(0!==this.length)return this.ids[0]}peekValue(){if(0!==this.length)return this.values[0]}}const wa=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Sa{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(251!==t)throw new Error("Data does not appear to be in a Flatbush format.");if(n>>4!=3)throw new Error(`Got v${n>>4} data when expected v3.`);const[r]=new Uint16Array(e,2,1),[i]=new Uint32Array(e,4,1);return new Sa(i,r,wa[15&n],e)}constructor(e,t=16,n=Float64Array,r){if(void 0===e)throw new Error("Missing required argument: numItems.");if(isNaN(e)||e<=0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535);let i=e,a=i;this._levelBounds=[4*i];do{i=Math.ceil(i/this.nodeSize),a+=i,this._levelBounds.push(4*a)}while(1!==i);this.ArrayType=n||Float64Array,this.IndexArrayType=a<16384?Uint16Array:Uint32Array;const o=wa.indexOf(this.ArrayType),s=4*a*this.ArrayType.BYTES_PER_ELEMENT;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this._boxes=new this.ArrayType(this.data,8,4*a),this._indices=new this.IndexArrayType(this.data,8+s,a),this._pos=4*a,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1]):(this.data=new ArrayBuffer(8+s+a*this.IndexArrayType.BYTES_PER_ELEMENT),this._boxes=new this.ArrayType(this.data,8,4*a),this._indices=new this.IndexArrayType(this.data,8+s,a),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(this.data,0,2).set([251,48+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e),this._queue=new xa}add(e,t,n,r){const i=this._pos>>2;return this._indices[i]=i,this._boxes[this._pos++]=e,this._boxes[this._pos++]=t,this._boxes[this._pos++]=n,this._boxes[this._pos++]=r,e<this.minX&&(this.minX=e),t<this.minY&&(this.minY=t),n>this.maxX&&(this.maxX=n),r>this.maxY&&(this.maxY=r),i}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);if(this.numItems<=this.nodeSize)return this._boxes[this._pos++]=this.minX,this._boxes[this._pos++]=this.minY,this._boxes[this._pos++]=this.maxX,void(this._boxes[this._pos++]=this.maxY);const e=this.maxX-this.minX||1,t=this.maxY-this.minY||1,n=new Uint32Array(this.numItems);for(let r=0;r<this.numItems;r++){let i=4*r;const a=this._boxes[i++],o=this._boxes[i++],s=this._boxes[i++],u=this._boxes[i++],c=Math.floor(65535*((a+s)/2-this.minX)/e),f=Math.floor(65535*((o+u)/2-this.minY)/t);n[r]=ka(c,f)}Ma(n,this._boxes,this._indices,0,this.numItems-1,this.nodeSize);for(let e=0,t=0;e<this._levelBounds.length-1;e++){const n=this._levelBounds[e];for(;t<n;){const e=t;let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e=0;e<this.nodeSize&&t<n;e++)r=Math.min(r,this._boxes[t++]),i=Math.min(i,this._boxes[t++]),a=Math.max(a,this._boxes[t++]),o=Math.max(o,this._boxes[t++]);this._indices[this._pos>>2]=e,this._boxes[this._pos++]=r,this._boxes[this._pos++]=i,this._boxes[this._pos++]=a,this._boxes[this._pos++]=o}}}search(e,t,n,r,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=[],s=[];for(;void 0!==a;){const u=Math.min(a+4*this.nodeSize,Ea(a,this._levelBounds));for(let c=a;c<u;c+=4){const u=0|this._indices[c>>2];n<this._boxes[c]||(r<this._boxes[c+1]||e>this._boxes[c+2]||t>this._boxes[c+3]||(a<4*this.numItems?(void 0===i||i(u))&&s.push(u):o.push(u)))}a=o.pop()}return s}neighbors(e,t,n=1/0,r=1/0,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=this._queue,s=[],u=r*r;for(;void 0!==a;){const r=Math.min(a+4*this.nodeSize,Ea(a,this._levelBounds));for(let n=a;n<r;n+=4){const r=0|this._indices[n>>2],s=Aa(e,this._boxes[n],this._boxes[n+2]),u=Aa(t,this._boxes[n+1],this._boxes[n+3]),c=s*s+u*u;a<4*this.numItems?(void 0===i||i(r))&&o.push(1+(r<<1),c):o.push(r<<1,c)}for(;o.length&&1&o.peek();){if(o.peekValue()>u)return o.clear(),s;if(s.push(o.pop()>>1),s.length===n)return o.clear(),s}a=o.pop()>>1}return o.clear(),s}}function Aa(e,t,n){return e<t?t-e:e<=n?0:e-n}function Ea(e,t){let n=0,r=t.length-1;for(;n<r;){const i=n+r>>1;t[i]>e?r=i:n=i+1}return t[n]}function Ma(e,t,n,r,i,a){if(Math.floor(r/a)>=Math.floor(i/a))return;const o=e[r+i>>1];let s=r-1,u=i+1;for(;;){do{s++}while(e[s]<o);do{u--}while(e[u]>o);if(s>=u)break;Ia(e,t,n,s,u)}Ma(e,t,n,r,u,a),Ma(e,t,n,u+1,i,a)}function Ia(e,t,n,r,i){const a=e[r];e[r]=e[i],e[i]=a;const o=4*r,s=4*i,u=t[o],c=t[o+1],f=t[o+2],l=t[o+3];t[o]=t[s],t[o+1]=t[s+1],t[o+2]=t[s+2],t[o+3]=t[s+3],t[s]=u,t[s+1]=c,t[s+2]=f,t[s+3]=l;const h=n[r];n[r]=n[i],n[i]=h}function ka(e,t){let n=e^t,r=65535^n,i=65535^(e|t),a=e&(65535^t),o=n|r>>1,s=n>>1^n,u=i>>1^r&a>>1^i,c=n&i>>1^a>>1^a;n=o,r=s,i=u,a=c,o=n&n>>2^r&r>>2,s=n&r>>2^r&(n^r)>>2,u^=n&i>>2^r&a>>2,c^=r&i>>2^(n^r)&a>>2,n=o,r=s,i=u,a=c,o=n&n>>4^r&r>>4,s=n&r>>4^r&(n^r)>>4,u^=n&i>>4^r&a>>4,c^=r&i>>4^(n^r)&a>>4,n=o,r=s,i=u,a=c,u^=n&i>>8^r&a>>8,c^=r&i>>8^(n^r)&a>>8,n=u^u>>1,r=c^c>>1;let f=e^t,l=r|65535^(f|n);return f=16711935&(f|f<<8),f=252645135&(f|f<<4),f=858993459&(f|f<<2),f=1431655765&(f|f<<1),l=16711935&(l|l<<8),l=252645135&(l|l<<4),l=858993459&(l|l<<2),l=1431655765&(l|l<<1),(l<<1|f)>>>0}var Ca=n(Object.freeze({__proto__:null,default:Sa}));!function(e){!function(){var t=Object.freeze({__proto__:null,get addThousandsSep(){return ve},get addslashes(){return C},get arrayToIndex(){return te},get clamp(){return d},get cleanNumericString(){return it},get contains(){return G},get copyElements(){return We},get countValues(){return K},get createBuffer(){return Ve},get default(){return t},get defaults(){return T},get difference(){return F},get endsWith(){return fe},get every(){return V},get expandoBuffer(){return Je},get extend(){return L},get extendBuffer(){return Ze},get find(){return $},get findMedian(){return De},get findQuantile(){return je},get findRankByValue(){return Le},get findStringPrefix(){return He},get findValueByPct(){return ze},get findValueByRank(){return Re},get forEach(){return re},get forEachProperty(){return ie},get format(){return Ue},get formatDateISO(){return M},get formatIntlNumber(){return xe},get formatNumber(){return _e},get formatNumberForDisplay(){return we},get formatVersionedName(){return Ke},get formatter(){return Ge},get genericSort(){return Me},get getArrayBounds(){return Y},get getGenericComparator(){return Oe},get getKeyComparator(){return Pe},get getSortedIds(){return Ie},get getUniqueName(){return f},get groupBy(){return ee},get htmlEscape(){return N},get indexOf(){return B},get indexOn(){return Q},get inherit(){return z},get initializeArray(){return ae},get intersection(){return U},get isArray(){return g},get isArrayLike(){return k},get isBoolean(){return E},get isDate(){return A},get isEven(){return x},get isFiniteNumber(){return v},get isFunction(){return l},get isInteger(){return _},get isNonNegNumber(){return b},get isNumber(){return m},get isObject(){return p},get isOdd(){return w},get isPromise(){return h},get isString(){return S},get isValidNumber(){return y},get lpad(){return le},get ltrim(){return ge},get mean(){return Fe},get merge(){return j},get mergeNames(){return Ye},get numToStr(){return be},get parseIntlNumber(){return nt},get parseNumber(){return tt},get parsePercent(){return Xe},get parseString(){return et},get pickOne(){return Ae},get pluck(){return X},get pluralSuffix(){return ce},get promisify(){return R},get quicksort(){return Ne},get quicksortPartition(){return Te},get range(){return J},get reduceAsync(){return D},get regexEscape(){return P},get reorderArray(){return Ce},get repeat(){return W},get repeatString(){return se},get replaceArray(){return oe},get rpad(){return he},get rtrim(){return ye},get shuffle(){return Se},get some(){return q},get sortArrayIndex(){return ke},get sortOn(){return Ee},get splitLines(){return ue},get sum(){return Z},get toArray(){return I},get toBuffer(){return $e},get trim(){return pe},get trimQuotes(){return ot},get uniq(){return H},get uniqifyNames(){return Qe},get wildcardToRegExp(){return qe}}),n={};function r(e,t){e in n&&vt("Tried to replace a stashed variable:",e),n[e]=t}function i(e){if(e in n!=!1)return n[e]}function a(){n={}}var o=Object.freeze({__proto__:null,clearStash:a,getStashedVar:i,stashVar:r}),s="function"==typeof require?require:"object"==typeof window&&window.modules?function(e){return window.modules[e]}:function(){},u=void 0!==ne?ne:s("buffer").Buffer,c=0;function f(e){return(e||"__id_")+ ++c}function l(e){return"function"==typeof e}function h(e){return!!e&&l(e.then)}function p(e){return e===Object(e)}function d(e,t,n){return e<t?t:e>n?n:e}function g(e){return Array.isArray(e)}function m(e){return null!=e&&e.constructor==Number}function y(e){return m(e)&&!isNaN(e)}function v(e){return y(e)&&e!==1/0&&e!==-1/0}function b(e){return m(e)&&e>=0}function _(e){return m(e)&&(0|e)===e}function x(e){return e%2==0}function w(e){return e%2==1}function S(e){return null!=e&&e.toString===String.prototype.toString}function A(e){return!!e&&e.getTime===Date.prototype.getTime}function E(e){return!0===e||!1===e}function M(e){return A(e)?e.toISOString().replace(":00.000Z","Z"):""}function I(e){var t;k(e)||vt("toArray() requires an array-like object");try{t=Array.prototype.slice.call(e,0)}catch(i){t=[];for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}return t}function k(e){return!!e&&(!!g(e)||!S(e)&&(0===e.length||e.length>0))}function C(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")}function P(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var O={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function N(e){return String(e).replace(/[&<>"'/]/g,function(e){return O[e]})}function T(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t]||{};for(var i in r)i in e==!1&&r.hasOwnProperty(i)&&(e[i]=r[i])}return e}function L(e){var t,n,r,i=e||{},a=arguments.length;for(n=1;n<a;n++)for(t in r=arguments[n]||{})r.hasOwnProperty(t)&&(i[t]=r[t]);return i}function z(e,t){var n=function(){this.__super__==n&&(this.__super__=t.prototype.__super__,t.apply(this,arguments),delete this.__super__)};n.prototype=t.prototype||t,e.prototype=L(new n,e.prototype),e.prototype.constructor=e,e.prototype.__super__=n}function R(e){return function(){var t=I(arguments);return new Promise((n,r)=>{t.push(function(e,t){e?r(e):n(t)}),e.apply(this,t)})}}function D(e,t,n,r){var i="undefined"==typeof setImmediate?setTimeout:setImmediate,a=0;!function t(o,s){if(o)return r(o,null);i(function(){a<e.length==!1?r(null,s):n(s,e[a++],t)},0)}(null,t)}function j(e,t){g(e)&&g(t)||vt("Usage: merge(destArray, srcArray);");for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e}function F(e,t){var n=te(t);return e.filter(function(e){return!Object.prototype.hasOwnProperty.call(n,e)})}function U(e,t){return e.filter(function(e){return t.includes(e)})}function B(e,t){for(var n=t!=t,r=0,i=e.length||0;r<i;r++){if(e[r]===t)return r;if(n&&e[r]!=e[r])return r}return-1}function G(e,t){return S(e)?-1!=e.indexOf(t):k(e)?-1!=B(e,t):void vt("Expected Array or String argument")}function q(e,t){return e.reduce(function(e,n){return e||t(n)},!1)}function V(e,t){return e.reduce(function(e,n){return e&&t(n)},!0)}function $(e,t,n){var r=e.filter(t,n);return 0===r.length?null:r[0]}function J(e,t,n){for(var r=[],i=void 0===t?0:t,a=void 0===n?1:n;e--;)r.push(i),i+=a;return r}function W(e,t){for(var n,r=[],i=0;i<e;i++)void 0!==(n=t(i))&&(r[i]=n);return r.length>0?r:void 0}function Z(e,t){k(e)||vt("sum() expects an array, received:",e);for(var n,r=0,i=0,a=0,o=e.length;a<o;a++)(n=e[a])?r+=n:isNaN(n)&&i++;return t&&(t.nan=i),r}function Y(e){for(var t,n=1/0,r=-1/0,i=0,a=0,o=e.length;a<o;a++)(t=e[a])!=t&&i++,t<n&&(n=t),t>r&&(r=t);return{min:n,max:r,nan:i}}function H(e){for(var t,n=new Set,r=[],i=0,a=e.length;i<a;i++)t=e[i],n.has(t)||(r.push(t),n.add(t));return r}function X(e,t){return e.map(function(e){return e[t]})}function K(e){return e.reduce(function(e,t){return e[t]=t in e?e[t]+1:1,e},{})}function Q(e,t){return e.reduce(function(e,n){return e[n[t]]=n,e},{})}function ee(e,t){return e.reduce(function(e,n){var r=n[t];return r in e?e[r].push(n):e[r]=[n],e},{})}function te(e,t){var n=arguments.length>1;return e.reduce(function(e,r){return e[r]=!n||t,e},{})}function re(e,t,n){if(!k(e))throw new Error("#forEach() takes an array-like argument. "+e);for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r)}function ie(e,t,n){Object.keys(e).forEach(function(r){t.call(n,e[r],r)})}function ae(e,t){for(var n=0,r=e.length;n<r;n++)e[n]=t;return e}function oe(e,t){e.splice(0,e.length);for(var n=0,r=t.length;n<r;n++)e.push(t[n])}function se(e,t){for(var n="",r=0;r<t;r++)n+=e;return n}function ue(e){return e.split(/\r?\n/)}function ce(e){return 1!=e?"s":""}function fe(e,t){return-1!==e.indexOf(t,e.length-t.length)}function le(e,t,n){return se(n=n||" ",t-(e=String(e)).length)+e}function he(e,t,n){return n=n||" ",(e=String(e))+se(n,t-e.length)}function pe(e){return ge(ye(e))}var de=/^\s+/;function ge(e){return e.replace(de,"")}var me=/\s+$/;function ye(e){return e.replace(me,"")}function ve(e){for(var t="",n="-"==e[0]?1:0,r=e.indexOf("."),i=e.length,a=(-1==r?i:r)-3;a>n;)t=","+e.substring(a,i)+t,i=a,a-=3;return e.substring(0,i)+t}function be(e,t){return t>=0?e.toFixed(t):String(e)}function _e(e){return e+""}function xe(e){return'"'+_e(e).replace(".",",")+'"'}function we(e,t,n,r){var i;return isNaN(e)?i=n||"-":(i=ve(i=be(e,t)),r&&parseFloat(i)>0&&(i="+"+i)),i}function Se(e){var t,n,r;for(n=e.length-1;n>0;n--)r=Math.floor(Math.random()*(n+1)),t=e[n],e[n]=e[r],e[r]=t}function Ae(e){return e[Math.floor(Math.random()*e.length)]}function Ee(e){for(var t=[],n=1;n<arguments.length;n+=2)t.push(Pe(arguments[n],arguments[n+1]));return e.sort(function(e,n){for(var r=0,i=0,a=t.length;i<a&&0===r;)r=t[i](e,n),i++;return r}),e}function Me(e,t){var n=Oe(t);return Array.prototype.sort.call(e,n),e}function Ie(e,t){var n=J(e.length);return ke(n,e,t),n}function ke(e,t,n){var r=Oe(n);e.sort(function(e,n){var i=r(t[e],t[n]);return i>0||0===i&&e>n?1:-1})}function Ce(e,t){for(var n=t.length,r=[],i=0;i<n;i++){var a=t[i];(a<0||a>=n)&&vt("Out-of-bounds array idx"),r[i]=e[a]}oe(e,r)}function Pe(e,t){var n=Oe(t);return function(t,r){return n(t[e],r[e])}}function Oe(e){return e=!1!==e&&"descending"!=e,function(t,n){var r=0;return null==n?r=null==t?0:-1:null==t?r=1:t<n?r=e?-1:1:t>n?r=e?1:-1:t!=t?r=1:n!=n&&(r=-1),r}}function Ne(e,t){return Te(e,0,e.length-1),!1===t&&Array.prototype.reverse.call(e),e}function Te(e,t,n){for(var r,i,a=t,o=n;a<n;){for(r=e[t+n>>1];a<=o;){for(;e[a]<r;)a++;for(;e[o]>r;)o--;a<=o&&(i=e[a],e[a]=e[o],e[o]=i,a++,o--)}t<o&&Te(e,t,o),t=a,o=n}}function Le(e,t){if(isNaN(t))return e.length;for(var n=1,r=0,i=e.length;r<i;r++)t>e[r]&&n++;return n}function ze(e,t){return Re(e,Math.ceil((1-t)*e.length))}function Re(e,t){(!e.length||t<1||t>e.length)&&vt("[findValueByRank()] invalid input");for(var n,r,i,a,o=(t=d(0|t,1,e.length))-1,s=0,u=e.length-1;s<u;){i=e[o],n=s,r=u;do{for(;e[n]<i;)n++;for(;i<e[r];)r--;n<=r&&(a=e[n],e[n]=e[r],e[r]=a,n++,r--)}while(n<=r);r<o&&(s=n),o<n&&(u=r)}return e[o]}function De(e){return je(e,.5)}function je(e,t){var n=e.length,r=Math.floor((n-1)*t),i=Math.ceil((n-1)*t);if(r<0||i>=n)return NaN;var a=Re(e,r+1);return r==i?a:(a*(i/(n-1)-t)+Re(e,i+1)*(t-r/(n-1)))*(n-1)}function Fe(e){for(var t,n=0,r=NaN,i=0,a=e.length;i<a;i++)t=e[i],isNaN(t)||(r=1==++n?t:t/n+(n-1)/n*r);return r}function Ue(e){return Ge(e).apply(null,Array.prototype.slice.call(arguments,1))}function Be(e,t){var n,r,i,a=t[1],o=t[2],s=t[3]?parseInt(t[3].substr(1)):void 0,u=t[4],c="s"==u,f="x"==u||"X"==u,l=!c,h="",p=0,d=!1,g=!1;if(c?n=String(e):f?(n=e.toString(16),"X"==u&&(n=n.toUpperCase())):l&&("-"==(n=be(e,s))[0]&&(g=!0,n=n.substr(1)),d=0==parseFloat(n),-1==a.indexOf("'")&&-1==a.indexOf(",")||(n=ve(n)),d||(g?h="−":-1!=a.indexOf("+")&&(h="+"))),o){var m=n.length+h.length,y=parseInt(o,10);m<y&&(p=y-m,i=se(r=-1==a.indexOf("0")?" ":"0",p))}return n=0==p?h+n:"0"==r?h+i+n:i+h+n}function Ge(e){for(var t,n=/%([',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g,r=[],i=[],a=0,o="",s=n.exec(e);s;)t=e.substring(a,n.lastIndex-s[0].length),"%%"==s[0]?o+=t+"%":(r.push(o+t),o="",i.push(s)),a=n.lastIndex,s=n.exec(e);return r.push(o+e.substr(a)),function(){var t=r[0],n=arguments.length;n!=i.length&&vt("[format()] Data does not match format string; format:",e,"data:",arguments);for(var a=0;a<n;a++)t+=Be(arguments[a],i[a])+r[a+1];return t}}function qe(e){var t=e.split("*").map(function(e){return P(e)}).join(".*");return new RegExp("^"+t+"$")}function Ve(e,t){return _(e)?u.allocUnsafe?u.allocUnsafe(e):new u(e):u.from&&u.allocUnsafe?u.from(e,t):new u(e,t)}function $e(e){return e instanceof u?e:e instanceof ArrayBuffer?u.from(e):e instanceof Uint8Array?u.from(e.buffer,e.byteOffset,e.byteLength):void vt("Unexpected argument type")}function Je(e,t){var n,r=0,i=t>=1?t:1.2;return function(t){return t>r&&(r=Math.ceil(t*i),n=e?new e(r):Ve(r)),n}}function We(e,t,n,r,i,a){var o,s=e==n||e.buffer&&e.buffer==n.buffer,u=1,c=0;if(a&&(s&&vt("copy error"),u=-1,c=i-1),s&&r>t)for(o=i-1;o>=0;o--)n[r+o]=e[t+o];else for(o=0;o<i;o++,c+=u)n[o+r]=e[t+c]}function Ze(e,t,n){var r=Math.max(e.length,t),i=n||e.length,a=new e.constructor(r);return We(e,0,a,0,i),a}function Ye(e,t){var n;return e&&t&&(n=He(e,t).replace(/[-_]$/,"")),n||""}function He(e,t){for(var n=0,r=e.length;n<r&&e[n]===t[n];n++);return e.substr(0,n)}function Xe(e){var t,n=String(e);return(t=n.indexOf("%")>0?Number(n.replace("%",""))/100:Number(n))>=0&&t<=1||bt(Ue("Invalid percentage: %s",n)),t}function Ke(e,t){var n=String(t);return/[0-9]$/.test(e)&&(n="-"+n),e+n}function Qe(e,t){var n=K(e),r=t||Ke,i=[];return e.forEach(function(e){for(var t,a=0,o=e;i.indexOf(o)>-1||o==e&&n[o]>1||o!=e&&n[o]>0;){if(a++,!(t=r(e,a))||t==o)throw new Error("Naming error");o=t}i.push(o)}),i}function et(e){return e||""}function tt(e){return rt(e,it)}function nt(e){return rt(e,at)}function rt(e,t){var n=String(e).trim(),r=n?Number(t(n)):NaN;return isNaN(r)?null:r}function it(e){return e.indexOf(",")>0?e.replace(/,([0-9]{3})/g,"$1"):e}function at(e){return(e=e.replace(/[ .]([0-9]{3})/g,"$1")).replace(",",".")}function ot(e){var t,n,r=e.length;return r>=2&&(t=e.charAt(0),n=e.charAt(r-1),('"'==t&&'"'==n&&!/[^\\]"./.test(e)||"'"==t&&"'"==n&&!/[^\\]'./.test(e))&&(e=(e=e.substr(1,r-2)).replace('"'==t?/\\(?=")/g:/\\(?=')/g,""))),e}var st,ut,ct,ft,lt=!1,pt=!1,dt=function(){throw new Lt(Dt(arguments))};function gt(){function e(){Ft(arguments)}St(e,function(){var e=t.toArray(arguments).join(" ");throw new Error(e)},function(){throw new Tt(Dt(arguments))},e)}function mt(){lt=!0}function yt(){return!!lt}function vt(){st.apply(null,t.toArray(arguments))}function bt(){ut.apply(null,jt(arguments))}function _t(){dt.apply(null,t.toArray(arguments))}function xt(){ct.apply(null,jt(arguments))}function wt(){ft.apply(null,jt(arguments))}function St(e,t,n,r){ct=e,st=t,ut=n,ft=r}function At(e){var t="string"==typeof e.stack?e.stack.split(/\n\s*\n/):[];return t.length,"\nError details:\n"+t[0]}function Et(){pt=!0,ct(t.toArray(arguments)),pt=!1}function Mt(){It()&&xt.apply(null,arguments)}function It(){return i("VERBOSE")}function kt(){return i("DEBUG")}function Ct(){kt()&&Ft(arguments)}function Pt(e){kt()&&console.time(e)}function Ot(e){kt()&&console.timeEnd(e)}function Nt(e){var n;lt&&(t.isString(e)&&(e=new Tt(e)),"NonFatalError"==e.name?console.error(jt([e.message]).join(" ")):"UserError"==e.name?(n=e.message,/Error/.test(n)||(n="Error: "+n),console.error(jt([n]).join(" ")),console.error("Run mapshaper -h to view help")):console.error(e))}function Tt(e){var t=new Error(e);return t.name="UserError",t}function Lt(e){var t=new Error(e);return t.name="NonFatalError",t}function zt(e,t){var n=e.reduce(function(e,t){return t.map(function(t,n){return e?Math.max(e[n],t.length):t.length})},null);return e.map(function(e){return e=e.map(function(e,r){return(t&&"right"==t[r]?e.padStart:e.padEnd).bind(e)(n[r]," ")})," "+e.join(" ")}).join("\n")}function Rt(e,n){var r=e.reduce(function(e,t){return Math.max(e,t.length)},0)+2,i=Math.floor((n||80)/r)||1;return e.reduce(function(e,n,a){var o=a%i;return a>0&&0===o&&(e+="\n"),o<i-1&&(n=t.rpad(n,r-2," ")),e+" "+n},"")}function Dt(e){return t.toArray(e).join(" ")}function jt(e){var n=t.toArray(e),r=i("current_command");return r&&"help"!=r&&n.unshift("["+r+"]"),n}function Ft(e){if(lt&&!i("QUIET")&&t.isArrayLike(e)){var n=Dt(e);pt?console.log(n):console.error(n)}}function Ut(e,t){return t=t||80,e.length>t&&(e=e.substring(0,t-3).trimEnd()+"..."),e}gt();var Bt=Object.freeze({__proto__:null,NonFatalError:Lt,UserError:Tt,debug:Ct,enableLogging:mt,error:vt,formatColumns:zt,formatLogArgs:Dt,formatStringsAsGrid:Rt,getErrorDetail:At,getLoggingSetter:function(){var e=st,t=ut,n=ct,r=ft;return function(){St(n,e,t,r)}},interrupt:_t,logArgs:Ft,loggingEnabled:yt,message:xt,print:Et,printError:Nt,setLoggingForCLI:gt,setLoggingFunctions:St,stop:bt,time:Pt,timeEnd:Ot,truncateString:Ut,useDebug:kt,useVerbose:It,verbose:Mt,warn:wt});function Gt(){this.mx=this.my=1,this.bx=this.by=0}function qt(){arguments.length>0&&this.setBounds.apply(this,arguments)}function Vt(e){new qt;for(var t,n,r,i=1/0,a=1/0,o=-1/0,s=-1/0,u=0,c=e.length;u<c;u++)for(var f=0,l=(t=e[u])?t.length:0;f<l;f++)(n=t[f][0])>o&&(o=n),n<i&&(i=n),(r=t[f][1])>s&&(s=r),r<a&&(a=r);return t?new qt(i,a,o,s):new qt}function $t(e,t){var n,r=e?e.length:0;t||(t=new qt);for(var i=0;i<r;i++)n=e[i],t.mergePoint(n[0],n[1]);return t}function Jt(e){var t=[];return Wt(e.shapes,function(e){t.push(e)}),t}function Wt(e,t){var n,r,i,a,o;for(n=0,r=e.length;n<r;n++)for(i=0,a=(o=e[n])?o.length:0;i<a;i++)t(o[i],n)}Gt.prototype.isNull=function(){return!this.mx||!this.my||isNaN(this.bx)||isNaN(this.by)},Gt.prototype.invert=function(){var e=new Gt;return e.mx=1/this.mx,e.my=1/this.my,e.bx=-this.bx/this.mx,e.by=-this.by/this.my,e},Gt.prototype.transform=function(e,t,n){return(n=n||[])[0]=e*this.mx+this.bx,n[1]=t*this.my+this.by,n},Gt.prototype.toString=function(){return JSON.stringify(Object.assign({},this))},qt.from=function(){var e=new qt;return e.setBounds.apply(e,arguments)},qt.prototype.toString=function(){return JSON.stringify({xmin:this.xmin,xmax:this.xmax,ymin:this.ymin,ymax:this.ymax})},qt.prototype.toArray=function(){return this.hasBounds()?[this.xmin,this.ymin,this.xmax,this.ymax]:[]},qt.prototype.hasBounds=function(){return this.xmin<=this.xmax&&this.ymin<=this.ymax},qt.prototype.sameBounds=qt.prototype.equals=function(e){return e&&this.xmin===e.xmin&&this.xmax===e.xmax&&this.ymin===e.ymin&&this.ymax===e.ymax},qt.prototype.width=function(){return this.xmax-this.xmin||0},qt.prototype.height=function(){return this.ymax-this.ymin||0},qt.prototype.area=function(){return this.width()*this.height()||0},qt.prototype.empty=function(){return this.xmin=this.ymin=this.xmax=this.ymax=void 0,this},qt.prototype.setBounds=function(e,n,r,i){return 1==arguments.length&&(t.isArrayLike(e)?(n=e[1],r=e[2],i=e[3],e=e[0]):(n=e.ymin,r=e.xmax,i=e.ymax,e=e.xmin)),this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i,(e>r||n>i)&&this.update(),this},qt.prototype.centerX=function(){return.5*(this.xmin+this.xmax)},qt.prototype.centerY=function(){return.5*(this.ymax+this.ymin)},qt.prototype.containsPoint=function(e,t){return e>=this.xmin&&e<=this.xmax&&t<=this.ymax&&t>=this.ymin},qt.prototype.containsBufferedPoint=qt.prototype.containsCircle=function(e,t,n){return e+n>this.xmin&&e-n<this.xmax&&t-n<this.ymax&&t+n>this.ymin},qt.prototype.intersects=function(e){return e.xmin<=this.xmax&&e.xmax>=this.xmin&&e.ymax>=this.ymin&&e.ymin<=this.ymax},qt.prototype.contains=function(e){return e.xmin>=this.xmin&&e.ymax<=this.ymax&&e.xmax<=this.xmax&&e.ymin>=this.ymin},qt.prototype.shift=function(e,t){this.setBounds(this.xmin+e,this.ymin+t,this.xmax+e,this.ymax+t)},qt.prototype.padBounds=function(e,t,n,r){this.xmin-=e,this.ymin-=t,this.xmax+=n,this.ymax+=r},qt.prototype.scale=function(e,t){var n=.5*(this.xmax-this.xmin),r=.5*(this.ymax-this.ymin),i=e-1,a=void 0===t?i:t-1;return this.xmin-=n*i,this.ymin-=r*a,this.xmax+=n*i,this.ymax+=r*a,this},qt.prototype.cloneBounds=qt.prototype.clone=function(){return new qt(this.xmin,this.ymin,this.xmax,this.ymax)},qt.prototype.clearBounds=function(){this.setBounds(new qt)},qt.prototype.mergePoint=function(e,t){void 0===this.xmin?this.setBounds(e,t,e,t):(e<this.xmin?this.xmin=e:e>this.xmax&&(this.xmax=e),t<this.ymin?this.ymin=t:t>this.ymax&&(this.ymax=t))},qt.prototype.fillOut=function(e,t,n){arguments.length<3&&(t=.5,n=.5);var r,i=this.width(),a=this.height(),o=i/a;return isNaN(e)||e<=0||(o<e?(r=a*e-i,this.xmin-=(1-t)*r,this.xmax+=t*r):(r=i/e-a,this.ymin-=(1-n)*r,this.ymax+=n*r)),this},qt.prototype.update=function(){var e;this.xmin>this.xmax&&(e=this.xmin,this.xmin=this.xmax,this.xmax=e),this.ymin>this.ymax&&(e=this.ymin,this.ymin=this.ymax,this.ymax=e)},qt.prototype.transform=function(e){return this.xmin=this.xmin*e.mx+e.bx,this.xmax=this.xmax*e.mx+e.bx,this.ymin=this.ymin*e.my+e.by,this.ymax=this.ymax*e.my+e.by,this.update(),this},qt.prototype.getTransform=function(e,t){var n=new Gt;return n.mx=e.width()/this.width()||1,n.bx=e.xmin-n.mx*this.xmin,t?(n.my=-e.height()/this.height()||1,n.by=e.ymax-n.my*this.ymin):(n.my=e.height()/this.height()||1,n.by=e.ymin-n.my*this.ymin),n},qt.prototype.mergeCircle=function(e,t,n){n<0&&(n=-n),this.mergeBounds([e-n,t-n,e+n,t+n])},qt.prototype.mergeBounds=function(e){var t,n,r,i;return e instanceof qt?(t=e.xmin,n=e.ymin,r=e.xmax,i=e.ymax):4==arguments.length?(t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3]):4==e.length?(t=e[0],n=e[1],r=e[2],i=e[3]):vt("Bounds#mergeBounds() invalid argument:",e),void 0===this.xmin?this.setBounds(t,n,r,i):(t<this.xmin&&(this.xmin=t),n<this.ymin&&(this.ymin=n),r>this.xmax&&(this.xmax=r),i>this.ymax&&(this.ymax=i)),this};var Zt=Object.freeze({__proto__:null,countPointsInLayer:function(e){var t=0;return Si(e)&&Wt(e.shapes,function(){t++}),t},forEachPoint:Wt,getPointBounds:Vt,getPointFeatureBounds:$t,getPointsInLayer:Jt});function Yt(e){return e>=0?e:~e}function Ht(e,t,n,r){var i,a,o,s,u,c,f=0|n,l=isNaN(r)?e.length-f:r+f;for(l>0&&(o=u=e[f],s=c=t[f]),f++;f<l;f++)(i=e[f])<o&&(o=i),i>u&&(u=i),(a=t[f])<s&&(s=a),a>c&&(c=a);return[o,s,u,c]}function Xt(e,t){for(var n,r=0,i=t.length-1;r<i;)e<t[n=Math.ceil((r+i)/2)]?i=n-1:r=n;return r}function Kt(e,n,r){var i,a,o,s=e.getVertexData(),u=s.nn,c=s.xx.length,f=0;if(s.xx.buffer.byteLength>=8*s.xx.length+8?(i=new Float64Array(s.xx.buffer,0,c+1),a=new Float64Array(s.yy.buffer,0,c+1)):(i=new Float64Array(new ArrayBuffer(8*(c+50)),0,c+1),a=new Float64Array(new ArrayBuffer(8*(c+50)),0,c+1)),e.isFlat()||(o=new Float64Array(new ArrayBuffer(8*(c+1)),0,c+1)),n<0||n>c)vt("Out-of-range vertex insertion index:",n);else if(n==c)u[u.length-1]++;else for(var l=0;l<u.length;l++)if((f+=u[l])>=n){u[l]=u[l]+1;break}t.copyElements(s.xx,0,i,0,n),t.copyElements(s.yy,0,a,0,n),t.copyElements(s.xx,n,i,n+1,c-n),t.copyElements(s.yy,n,a,n+1,c-n),i[n]=r[0],a[n]=r[1],o&&(o[n]=1/0,t.copyElements(s.zz,0,o,0,n),t.copyElements(s.zz,n,o,n+1,c-n)),e.updateVertexData(u,i,a,o)}function Qt(e,t){for(var n=0,r=0,i=e.length;r<i;r++)e[r]>=t&&n++;return n}function en(e,t){e.zz||vt("Expected simplification data");for(var n,r=e.xx,i=e.yy,a=e.zz,o=Qt(a,t),s=e.nn.length,u=new Float64Array(o),c=new Float64Array(o),f=new Float64Array(o),l=new Int32Array(s),h=0,p=0,d=0;d<s;d++){n=0;for(var g=h+e.nn[d];h<g;h++)a[h]>=t&&(u[p]=r[h],c[p]=i[h],f[p]=a[h],p++,n++);1==n&&vt("Collapsed arc"),l[d]=n}return{xx:u,yy:c,zz:f,nn:l}}var tn=Object.freeze({__proto__:null,absArcId:Yt,appendEmptyArc:function(e){var n=e.getVertexData(),r=t.extendBuffer(n.nn,n.nn.length+1,n.nn.length);e.updateVertexData(r,n.xx,n.yy,n.zz)},appendVertex:function(e,t){var n=e.getPointCount();Kt(e,n,t)},calcArcBounds:Ht,countFilteredVertices:Qt,deleteLastArc:function(e){var t=e.getVertexData(),n=e.size()-1,r=t.nn[n],i=t.xx.length,a=e.getRetainedInterval(),o=new Float64Array(t.xx.buffer,0,i-r),s=new Float64Array(t.yy.buffer,0,i-r),u=new Int32Array(t.nn.buffer,0,e.size()-1),c=e.isFlat()?null:new Float64Array(t.zz.buffer,0,i-r);e.updateVertexData(u,o,s,c),e.setRetainedInterval(a)},deleteVertex:function(e,n){for(var r=e.getVertexData(),i=r.nn,a=r.xx.length,o=new Float64Array(r.xx.buffer,0,a-1),s=new Float64Array(r.yy.buffer,0,a-1),u=e.isFlat()?null:new Float64Array(r.zz.buffer,0,a-1),c=e.getRetainedInterval(),f=0,l=!1,h=0;h<i.length;h++)(f+=i[h])>=n&&!l&&(i[h]=i[h]-1,l=!0);t.copyElements(r.xx,0,o,0,n),t.copyElements(r.yy,0,s,0,n),t.copyElements(r.xx,n+1,o,n,a-n-1),t.copyElements(r.yy,n+1,s,n,a-n-1),u&&(t.copyElements(r.zz,0,u,0,n),t.copyElements(r.zz,n+1,u,n,a-n-1)),e.updateVertexData(i,o,s,u),e.setRetainedInterval(c)},filterVertexData:en,findArcIdFromVertexId:Xt,getUnfilteredArcCoords:function(e,t){for(var n=t.getVertexData(),r=[],i=n.ii[e],a=n.nn[e],o=0;o<a;o++)r.push([n.xx[i+o],n.yy[i+o]]);return r},getUnfilteredArcLength:function(e,t){return t.getVertexData().nn[e]},insertVertex:Kt}),nn=6378137,rn=nn,an=Math.PI/180,on=180/Math.PI;function sn(e,t,n,r,i,a){var o=e-r,s=t-i,u=n-a;return Math.sqrt(o*o+s*s+u*u)}function un(e,t,n,r){var i=e-n,a=t-r;return i*i+a*a}function cn(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}function fn(e,t,n,r,i,a){var o=e-r,s=t-i,u=n-a;return o*o+s*s+u*u}function ln(e){for(var t=2*Math.PI;e<0;)e+=t;for(;e>=t;)e-=t;return e}function hn(e,t,n,r){var i=Math.PI/180;e*=i,n*=i,t*=i,r*=i;var a=Math.sin(n-e)*Math.cos(r),o=Math.cos(t)*Math.sin(r)-Math.sin(t)*Math.cos(r)*Math.cos(n-e);return Math.atan2(a,o)}function pn(e,t,n){var r;e*=an,t*=an,r=Math.cos(t),n[0]=Math.cos(e)*r*rn,n[1]=Math.sin(e)*r*rn,n[2]=Math.sin(t)*rn}function dn(e,t,n,r){var i=n-e,a=r-t,o=Math.sin(a/2)*Math.sin(a/2)+Math.cos(t)*Math.cos(r)*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))}function gn(e,t,n,r){var i=Math.PI/180;return dn(e*i,t*i,n*i,r*i)*rn}function mn(e,t,n,r,i,a){var o=e*r-e*a+n*a-n*t+i*t-i*r;return o*o}function yn(e,t,n){var r;if(0===n)r=e;else if(e>=t+n)r=t;else if(t>=e+n)r=e;else{var i=e+n-t;r=e-i*i/n*.25}return r<0&&(r=0),r}function vn(e,t,n,r,i,a){var o=un(n,r,i,a),s=((e-n)*(i-n)+(t-r)*(a-r))/o;return 0===o?un(e,t,n,r):(s<0&&(s=0),s>1&&(s=1),un(e,t,n+s*(i-n),r+s*(a-r)))}var bn,_n=Object.freeze({__proto__:null,D2R:an,R:rn,R2D:on,bearing:hn,bearing2D:function(e,t,n,r){var i=Math.PI/2-Math.atan2(r-t,n-e);return i>Math.PI?i-2*Math.PI:i},containsBounds:function(e,t){return e[0]<=t[0]&&e[2]>=t[2]&&e[1]<=t[1]&&e[3]>=t[3]},convLngLatToSph:function(e,t,n,r,i){for(var a=[],o=0,s=e.length;o<s;o++)pn(e[o],t[o],a),n[o]=a[0],r[o]=a[1],i[o]=a[2]},cosine:function(e,t,n,r,i,a){var o=cn(e,t,n,r)*cn(n,r,i,a),s=0;return o>0&&((s=((e-n)*(i-n)+(t-r)*(a-r))/o)>1?s=1:s<-1&&(s=-1)),s},cosine3D:function(e,t,n,r,i,a,o,s,u){var c=sn(e,t,n,r,i,a)*sn(r,i,a,o,s,u),f=0;return c>0&&((f=((e-r)*(o-r)+(t-i)*(s-i)+(n-a)*(u-a))/c)>1?f=1:f<-1&&(f=-1)),f},degreesToMeters:function(e){return e*an*rn},distance2D:cn,distance3D:sn,distanceSq:un,distanceSq3D:fn,greatCircleDistance:gn,innerAngle2:function(e,t,n,r,i,a){var o=Math.atan2(t-r,e-n),s=Math.atan2(a-r,i-n),u=Math.abs(o-s);return u>Math.PI&&(u=2*Math.PI-u),u},lngLatToXYZ:pn,pointSegDistSq:function(e,t,n,r,i,a){return yn(un(e,t,n,r),un(e,t,i,a),un(n,r,i,a))},pointSegDistSq2:vn,pointSegDistSq3D:function(e,t,n,r,i,a,o,s,u){return yn(fn(e,t,n,r,i,a),fn(e,t,n,o,s,u),fn(r,i,a,o,s,u))},signedAngle:function(e,t,n,r,i,a){if(e==n&&t==r||n==i&&r==a)return NaN;var o=e-n,s=t-r,u=i-n,c=a-r,f=o*u+s*c,l=o*c-s*u;return ln(Math.atan2(l,f))},signedAngleSph:function(e,t,n,r,i,a){if(e==n&&t==r||n==i&&r==a)return NaN;var o=hn(n,r,e,t),s=hn(n,r,i,a);return ln(2*Math.PI+o-s)},sphericalDistance:dn,standardAngle:ln,triangleArea:function(e,t,n,r,i,a){return Math.abs(((t-a)*(n-i)+(r-a)*(i-e))/2)},triangleArea3D:function(e,t,n,r,i,a,o,s,u){return.5*Math.sqrt(mn(e,t,r,i,o,s)+mn(e,n,r,a,o,u)+mn(t,n,i,a,s,u))},xyzToLngLat:function(e,t,n,r){var i=sn(0,0,0,e,t,n),a=Math.asin(n/i)/an,o=Math.atan2(t/i,e/i)/an;r[0]=o,r[1]=a}});function xn(e,t,n,r){var i,a,o,s,u,c,f,l,h,p,d=r.getShapeIter(n),g=1/0;for(d.hasNext()&&(a=c=l=d.x,o=f=h=d.y);d.hasNext();)(p=vn(e,t,a,o,s=d.x,u=d.y))<g&&(g=p,i=d._ids[d._i],c=a,f=o,l=s,h=u),a=s,o=u;return g==1/0?{distance:1/0}:{segment:[[c,f],[l,h]],distance:Math.sqrt(g),arcId:i}}function wn(e,t,n,r){return(n||[]).reduce(function(n,i){var a=xn(e,t,i,r);return!n||a.distance<n.distance?a:n},null)||{distance:1/0,arcId:-1,segment:null}}function Sn(e,t){var n=t.getShapeIter(e);if(!n.hasNext())return null;for(var r=n.x,i=n.y,a=0,o=0,s=0;n.hasNext();)a++,o+=n.x,s+=n.y;return 0!==a&&n.x===r&&n.y===i||(o+=r,s+=i,a++),{x:o/a,y:s/a}}function An(e,t){var n=0;return(e||[]).reduce(function(e,r){var i=t.getSimpleShapeBounds(r).area();return i>n&&(n=i,e=r),e},null)}bn=function(){var e,t;function n(n,r,i,a){e+=t(i[n],a[n],i[r],a[r])}return function(r,i,a){a&&i.isPlanar()&&vt("Expected lat-long coordinates"),t=a?gn:cn,e=0;for(var o=0,s=r.length;o<s;o++)i.forEachArcSegment(r[o],n);return e}}();var En=Object.freeze({__proto__:null,get calcPathLen(){return bn},countVerticesInPath:function(e,t){for(var n=t.getShapeIter(e),r=0;n.hasNext();)r++;return r},getAvgPathXY:Sn,getMaxPath:An,getPathBounds:function(e){for(var t=new qt,n=0,r=e.length;n<r;n++)t.mergePoint(e[n][0],e[n][1]);return t},getPointToPathDistance:function(e,t,n,r){return xn(e,t,n,r).distance},getPointToPathInfo:xn,getPointToShapeDistance:function(e,t,n,r){var i=wn(e,t,n,r);return i?i.distance:1/0},getPointToShapeInfo:wn,pathIsClosed:function(e,t){var n=e[0],r=e[e.length-1],i=t.getVertex(n,0),a=t.getVertex(r,-1);return i.x===a.x&&i.y===a.y}});function Mn(e,t){var n,r,i,a,o,s,u,c,f=t.getShapeIter(e),l=0,h=0,p=0;if(!f.hasNext())return null;for(i=0,a=0,n=-f.x,r=-f.y;f.hasNext();)o=i,s=a,i=f.x+n,l+=u=o*(a=f.y+r)-s*i,h+=u*(o+i),p+=u*(s+a);return 0===(c=l/2)?Sn(e,t):{x:h/(6*c)-n,y:p/(6*c)-r}}var In=Object.freeze({__proto__:null,getPathCentroid:Mn,getShapeCentroid:function(e,t){var n=An(e,t);return n?Mn(n,t):null}});function kn(e,t,n){if(!t||!Cn(e.xmin,e.ymin,t,n))return!1;var r=!0;return t.forEach(function(t){xr(t,n,function(t,n,i,a){r=r&&!function(e,t,n){return!!n.containsPoint(e[0],e[1])||!!(fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmin,n.ymin,n.xmin,n.ymax)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmin,n.ymax,n.xmax,n.ymax)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmax,n.ymax,n.xmax,n.ymin)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmax,n.ymin,n.xmin,n.ymin))}([i[t],a[t]],[i[n],a[n]],e)})}),r}function Cn(e,t,n,r){var i=!1,a=!1;return!!n&&(n.forEach(function(n){var o=Pn(e,t,n,r);1==o?i=!i:-1==o&&(a=!0)}),a||i)}function Pn(e,t,n,r){var i=!1,a=!1;return xr(n,r,function(n,r,o,s){var u=On(e,t,o[n],s[n],o[r],s[r]);1==u?i=!i:isNaN(u)&&(a=!0)}),a?-1:i?1:0}function On(e,t,n,r,i,a){var o=Nn(e,t,n,r,i,a);return o!=o?NaN:o==-1/0?0:1}function Nn(e,t,n,r,i,a){var o,s=-1/0;return e<n&&e<i||e>n&&e>i||t>r&&t>a||(e===n||e===i?e===n&&e===i?t!=r&&t!=a&&t>r==t>a||(s=NaN):e===n?t===r?s=NaN:i<n&&t<r&&(s=r):t===a?s=NaN:n<i&&t<a&&(s=a):(o=function(e,t,n,r,i){return n+(e-t)*(i-n)/(r-t)}(e,n,r,i,a),o>t?s=o:o==t&&(s=NaN))),s}function Tn(e,t){return(t.isPlanar()?Rn:Ln)(e,t)}function Ln(e,t,n){return zn(t.getShapeIter(e),n)}function zn(e,t){var n,r,i,a,o=0,s=!1,u=Math.PI/180;for(t=t||nn;e.hasNext();)n=e.x*u,r=Math.sin(e.y*u),s?o+=(n-i)*(2+r+a):s=!0,i=n,a=r;return o/2*t*t}function Rn(e,t){var n,r,i,a,o,s,u=t.getShapeIter(e),c=0;if(u.hasNext())for(n=0,r=0,o=-u.x,s=-u.y;u.hasNext();)i=n,a=r,c+=(n=u.x+o)*a-i*(r=u.y+s);return c/2}function Dn(e,t){return(t.isPlanar()?jn:Fn)(e,t)}function jn(e,t){return bn(e,t,!1)}function Fn(e,t){return bn(e,t,!0)}var Un=Object.freeze({__proto__:null,calcPolsbyPopperCompactness:function(e,t){return t<=0?0:Math.abs(e)*Math.PI*4/(t*t)},calcSchwartzbergCompactness:function(e,t){return t<=0?0:2*Math.PI*Math.sqrt(Math.abs(e)/Math.PI)/t},getPathArea:Tn,getPathPerimeter:Dn,getPathWinding:function(e,t){var n=Tn(e,t);return(n>0?1:n<0&&-1)||0},getPlanarPathArea:Rn,getPlanarPathArea2:function(e){for(var t,n,r,i,a,o,s,u=0,c=0,f=e.length;c<f;c++)s=e[c],0===c?(t=0,n=0,a=-s[0],o=-s[1]):u+=(t=s[0]+a)*i-r*(n=s[1]+o),r=t,i=n;return u/2},getPlanarPathPerimeter:jn,getPlanarShapeArea:function(e,t){return(e||[]).reduce(function(e,n){return e+Rn(n,t)},0)},getRayIntersection:Nn,getShapeArea:function(e,t){return(e||[]).reduce(function(e,n){return e+Tn(n,t)},0)},getShapePerimeter:function(e,t){return(e||[]).reduce(function(e,n){return e+Dn(n,t)},0)},getSphericalPathArea:Ln,getSphericalPathArea2:zn,getSphericalPathPerimeter:Fn,getSphericalShapeArea:function(e,t,n){return t.isPlanar()&&vt("[getSphericalShapeArea()] Function requires decimal degree coordinates"),(e||[]).reduce(function(e,r){return e+Ln(r,t,n)},0)},getSphericalShapePerimeter:function(e,t){return t.isPlanar()&&vt("[getSphericalShapePerimeter()] Function requires decimal degree coordinates"),(e||[]).reduce(function(e,n){return e+Fn(n,t)},0)},testBoundsInPolygon:kn,testPointInPolygon:Cn,testPointInRing:Pn,testRayIntersection:On});function Bn(e){var t=Math.max.apply(null,e.map(Math.abs));return(t<=1?1:2**Math.ceil(Math.log2(t)))/2**51}function Gn(e,n){var r=lr(e),i=.0025*r;n>0&&(i=n,xt(t.format("Applying snapping threshold of %s -- %.6f times avg. segment length",n,n/r)));var a=qn(e,i);a>0&&e.dedupCoords(),xt(t.format("Snapped %s point%s",a,t.pluralSuffix(a)))}function qn(e,t){return t>0==!1?0:$n(Jn(e),e,t)}function Vn(e,t){return t>0==!1?0:$n(Wn(e),e,t)}function $n(e,t,n){var r=0,i=e.length,a=t.getVertexData();Zn(a.xx,e,0,i-1);for(var o=0;o<i;o++)r+=s(o,n,e,a.xx,a.yy);return r;function s(e,t,n,r,i){for(var a,o,s,u=e,c=n.length,f=r[n[e]],l=i[n[e]],h=0;++u<c&&!((o=r[a=n[u]]-f)>t);)s=i[a]-l,0===o&&0===s||o*o+s*s>t*t||(r[a]=f,i[a]=l,h++);return h}}function Jn(e){for(var t=e.getVertexData().xx.length,n=new Uint32Array(t),r=0;r<t;r++)n[r]=r;return n}function Wn(e){var t=0,n=[];return e.getVertexData().nn.forEach(function(e){e>0!=!1&&(n.push(t,t+e-1),t+=e)}),n}function Zn(e,t,n,r){if(r-n>24){for(var i,a=e[t[n+r>>1]],o=n,s=r;o<=s;){for(;e[t[o]]<a;)o++;for(;e[t[s]]>a;)s--;o<=s&&(i=t[o],t[o]=t[s],t[s]=i,o++,s--)}s>n&&Zn(e,t,n,s),o<r&&Zn(e,t,o,r)}else!function(e,t,n,r){var i,a,o;for(o=n+1;o<=r;o++){for(i=t[o],a=o-1;a>=n&&e[i]<e[t[a]];a--)t[a+1]=t[a];t[a+1]=i}}(e,t,n,r)}var Yn=Object.freeze({__proto__:null,getCoordinateIds:Jn,getEndpointIds:Wn,getHighPrecisionSnapInterval:Bn,getHighPrecisionSnapInterval_old:function(e){return 1e-14*Math.max.apply(null,e.map(Math.abs))},snapCoords:Gn,snapCoordsByInterval:qn,snapEndpointsByInterval:Vn});function Hn(e,t){var n=Math.abs(e),r=e!=n,i=(n<1e-6?n.toFixed(t):String(n)).split("."),a="0"==i[0]?"":i[0],o=2==i.length?i[1]:"";o.length<t?o=o.padEnd(t,"0"):o.length>t&&(o=o.slice(0,t));for(var s=a+o;0==s[0]&&s.length>1;)s=s.slice(1);return r&&(s="-"+s),s}function Xn(e,t){var n,r,i="-"==e[0],a=i?e.slice(1):e;return n=(r=a.length)>t?a.slice(0,r-t)+"."+a.slice(-t):r==t?"0."+a:"0."+a.padStart(t,"0"),i&&(n="-"+n),Number(n)}function Kn(){for(var e,t=1/0,n=0,r=0,i=arguments.length;r<i;r++)t=Math.min(t,Math.abs(arguments[r]));if(t>=1)n=(e=t.toFixed(1)).indexOf(".");else if(0!==t)for(e=t.toFixed(10).slice(2);"0"===e[0];)n--,e=e.slice(1);return 17-n}function Qn(e,t,n,r,i,a,o,s,u){var c,f,l=u>0?u:Bn([e,t,n,r,i,a,o,s]),h=l*l;return c=function(e,t,n,r,i,a,o,s,u){var c=[];if(tr(c,e,t,n,a,o,s,u),tr(c,e,r,i,a,o,s,u),tr(c,e,a,o,t,n,r,i),tr(c,e,s,u,t,n,r,i),0===c.length)return null;c.length>4&&Ct("Intersection detection error");return c}(h,e,t,n,r,i,a,o,s),!c&&function(e,t,n,r,i,a,o,s,u){return un(t,n,a,o)<=e||un(t,n,s,u)<=e||un(r,i,a,o)<=e||un(r,i,s,u)<=e}(h,e,t,n,r,i,a,o,s)?null:(c||(f=function(e,t,n,r,i,a,o,s,u){var c;if(u>0&&!ur(e,t,n,r,i,a,o,s))return null;if(0===u&&!function(e,t,n,r,i,a,o,s){var u=Kn(e,t,n,r,i,a,o,s),c=BigInt(Hn(e,u)),f=BigInt(Hn(t,u)),l=BigInt(Hn(n,u)),h=BigInt(Hn(r,u)),p=BigInt(Hn(i,u)),d=BigInt(Hn(a,u)),g=BigInt(Hn(o,u)),m=BigInt(Hn(s,u));return ur(c,f,l,h,p,d,g,m)}(e,t,n,r,i,a,o,s))return null;c=function(e,t,n,r,i,a,o,s){if(function(e,t,n,r,i,a,o,s){var u=n-e,c=r-t,f=o-i,l=s-a,h=u*f+c*l,p=u*u+c*c,d=f*f+l*l;if(0===p||0===d)return 0;var g,m=h/Math.sqrt(p*d);g=m>1-1e-14?0:m<1e-14-1?Math.PI:Math.acos(m);g>=Math.PI/2&&(g=Math.PI-g);return g}(e,t,n,r,i,a,o,s)<.1)return!0;var u=cn(e,t,n,r),c=cn(i,a,o,s);return(u<c?u/c:c/u||0)<.001}(e,t,n,r,i,a,o,s)?er(e,t,n,r,i,a,o,s):function(e,t,n,r,i,a,o,s){var u=ar(n-e,r-t,o-i,s-a),c=or(i,a,o,s,e,t)/u,f=[e+c*(n-e),t+c*(r-t)];if(Math.abs(u)<1e-25)return null;return f}(e,t,n,r,i,a,o,s);if(!c)return null;u>0&&function(e,t,n,r,i,a,o,s,u,c){var f=e[0],l=e[1],h=c;h=nr(e,h,f,l,t,n),h=nr(e,h,f,l,r,i),h=nr(e,h,f,l,a,o),h=nr(e,h,f,l,s,u)}(c,e,t,n,r,i,a,o,s,u);return function(e,t,n,r,i,a,o,s,u){var c=e[0],f=e[1],l=!1,h=!1;rr(c,t,r)&&(c=ir(c,t,r),l=!0);rr(c,a,s)&&(c=ir(c,a,s),h=!0);rr(f,n,i)&&(f=ir(f,n,i),l=!0);rr(f,o,u)&&(f=ir(f,o,u),h=!0);(l||h)&&Ct("Clamping a segment intersection point");e[0]=c,e[1]=f}(c,e,t,n,r,i,a,o,s),c}(e,t,n,r,i,a,o,s,l)),c||f||null)}function er(e,t,n,r,i,a,o,s){var u=Kn(e,t,n,r,i,a,o,s),c=10000000000000000n,f=BigInt(Hn(e,u)),l=BigInt(Hn(t,u)),h=BigInt(Hn(n,u)),p=BigInt(Hn(r,u)),d=BigInt(Hn(i,u)),g=BigInt(Hn(a,u)),m=BigInt(Hn(o,u)),y=BigInt(Hn(s,u)),v=ar(h-f,p-l,m-d,y-g);if(0n===v)return Ct('DIV0 error - should have been identified as collinear "touch" intersection.'),null;var b=or(d,g,m,y,f,l)*c/v,_=l*c+b*(p-l);return[Xn((f*c+b*(h-f)).toString(),u+16),Xn(_.toString(),u+16)]}function tr(e,t,n,r,i,a,o,s){if(!(vn(n,r,i,a,o,s)>t)){var u=un(i,a,n,r),c=un(o,s,n,r);u<=t||c<=t||e.push(n,r)}}function nr(e,t,n,r,i,a){var o=cn(n,r,i,a);return o<t&&(t=o,e[0]=i,e[1]=a),t}function rr(e,t,n){return t<n?e<t||e>n:t>n?e>t||e<n:e!=t}function ir(e,t,n){var r=Math.abs(e-t)<Math.abs(e-n)?t:n,i=Math.abs(e-r);return i>1e-15&&Ct("[clampToClosestEndpoint()] large clamping interval:",i),r}function ar(e,t,n,r){return e*r-t*n}function or(e,t,n,r,i,a){return ar(e-i,t-a,n-i,r-a)}function sr(e,t,n,r,i,a){var o=Kn(e,t,n,r,i,a);return Xn(or(BigInt(Hn(e,o)),BigInt(Hn(t,o)),BigInt(Hn(n,o)),BigInt(Hn(r,o)),BigInt(Hn(i,o)),BigInt(Hn(a,o))).toString(),o)}function ur(e,t,n,r,i,a,o,s){return or(e,t,n,r,i,a)*or(e,t,n,r,o,s)<=0&&or(i,a,o,s,e,t)*or(i,a,o,s,n,r)<=0}var cr=Object.freeze({__proto__:null,findClosestPointOnSeg:function(e,t,n,r,i,a,o){var s=i-n,u=a-r,c=s*s+u*u,f=0===c?-1:((e-n)*s+(t-r)*u)/c,l=o>=0?o:.1;return f<=l?[n,r]:f>=1-l?[i,a]:[n+f*s,r+f*u]},findCrossIntersection_robust:er,orient2D:or,orient2D_robust:sr,segmentHit_fast:ur,segmentIntersection:Qn,segmentTurn:function(e,t,n,r){var i=e[0],a=e[1],o=t[0],s=t[1],u=o-n[0],c=s-n[1],f=or(i,a,o,s,r[0]+u,r[1]+c);return f?f<0?1:-1:0}}),fr=Object.assign({},_n,Un,En,cr,In);function lr(e){var t=0,n=e.forEachSegment(function(e,n,r,i){var a=r[e]-r[n],o=i[e]-i[n];t+=Math.sqrt(a*a+o*o)});return t/n||0}function hr(e){var t=0,n=0,r=e.forEachSegment(function(e,r,i,a){t+=Math.abs(i[e]-i[r]),n+=Math.abs(a[e]-a[r])});return[t/r||0,n/r||0]}function pr(e,t){var n=new Uint8Array(t.size());return dr(e,n),function(e){return e<0&&(e=~e),n[e]>0}}function dr(e,t){wr(e,null,function(e){for(var n,r=e.arcs,i=0;i<r.length;i++)(n=r[i])<0&&(n=~n),t[n]++})}function gr(e,t){var n=new qt;return br(e,function(e){t.mergeArcBounds(e,n)}),n}function mr(e){e.reverse();for(var t=0,n=e.length;t<n;t++)e[t]=~e[t];return e}function yr(e,t){return t<=0?e=1/0:t>=1&&(e=0),e}function vr(e,t,n,r){var i,a,o=0,s=-1;n>r&&(i=n,n=r,r=i);for(var u=n+1;u<r;u++)(a=e[u])<t&&a>o&&(s=u,o=a);return s}function br(e,n){for(var r,i=0;i<e.length;i++)if(r=e[i],Array.isArray(r))br(r,n);else if(t.isInteger(r)){var a=n(r);void 0!==a&&(e[i]=a)}else r&&vt("Non-integer arc id in:",e)}function _r(e,t,n){for(var r=0,i=e?e.length:0;r<i;r++)xr(e[r],t,n)}function xr(e,t,n){for(var r=0,i=e.length;r<i;r++)t.forEachArcSegment(e[r],n)}function wr(e,t,n,r){var i=0;e.forEach(function(e,a){if(e&&0!==e.length){var o,s;r&&r(a);for(var u=0,c=e.length;u<c;u++)if(o=e[u],n&&n({i:u,shapeId:a,shape:e,arcs:o}),t)for(var f=0,l=o.length;f<l;f++,i++)s=o[f],t({i:f,shapeId:a,partId:u,arcId:s,segId:i})}})}function Sr(e,t){var n,r,i=t.getArcIter(e);if(i.hasNext())for(n=i.x,r=i.y;i.hasNext();)if(i.x!=n||i.y!=r)return!0;return!1}function Ar(e,t){if(!e)return null;var n=[];return e.forEach(function(e){for(var r=[],i=0;i<e.length;i++)Sr(e[i],t)&&r.push(e[i]);r.length>0&&n.push(r)}),n.length>0?n:null}function Er(e,t,n){for(var r,i=[],a=0,o=e&&e.length;a<o;a++)r=e[a],i.push({ids:r,area:"polygon"==n?fr.getPlanarPathArea(r,t):0,bounds:t.getSimpleShapeBounds(r)});return i}var Mr=Object.freeze({__proto__:null,clampIntervalByPct:yr,countArcsInShapes:dr,filterEmptyArcs:Ar,findNextRemovableVertex:vr,findShapesByArcId:function(e,t,n){var r=n?new Uint8Array(n):[],i=[];return t.forEach(function(e){r[Yt(e)]=1}),e.forEach(function(e,t){var n=!1;br(e||[],function(e){n=n||1==r[Yt(e)]}),n&&i.push(t)}),i},forEachArcId:br,forEachSegmentInPath:xr,forEachSegmentInShape:_r,getArcPresenceTest:pr,getAvgSegment:lr,getAvgSegment2:hr,getDirectedArcPresenceTest:function(e,t){var n=new Uint8Array(t);return br(e,function(e){var r=Yt(e);r<t==!1&&vt("index error"),n[r]|=e<0?2:1}),function(e){var t=Yt(e);return e<0?!(2&~n[t]):!(1&~n[t])}},getPathBounds:gr,getPathMetadata:Er,quantizeArcs:function(e,t){var n=e.getBounds(),r=new qt(0,0,t-1,t-1),i=n.getTransform(r),a=i.invert();e.transformPoints(function(e,t){var n=i.transform(e,t);return a.transform(Math.round(n[0]),Math.round(n[1]))})},reversePath:mr,traversePaths:wr});function Ir(e){return e?e.map(function(e){return e.concat()}):null}function kr(e){return t.isArray(e)?e.map(Ir):null}function Cr(e,t){Or(e,t)}function Pr(e,t){for(var n=0,r=e.length;n<r;n++)e[n]=Or(e[n],t,n)}function Or(e,n,r){if(!e)return null;t.isArray(e)||vt("Expected an array, received:",e);for(var i,a=0,o=e.length,s=0;s<o;s++)null===(i=n(e[s],s,e,r))?e[s]=null:t.isArray(i)&&(e[s]=i.length>0?i:null),null===e[s]&&a++;return a==o?null:a>0?e.filter(function(e){return!!e}):e}function Nr(e){for(var t,n=0,r=0,i=e.length;r<i;r++)(t=e[r])&&t.length>n&&(n=t.length);return n}var Tr=Object.freeze({__proto__:null,cloneShape:Ir,cloneShapes:kr,editShapeParts:Or,editShapes:Pr,findMaxPartCount:Nr,forEachShapePart:Cr}),Lr=s("iconv-lite"),zr=function(e){var n=null;if("utf8"!=(e=Gr(e)))return null;"undefined"!=typeof TextEncoder&&(n=new TextEncoder(e));return function(r){return n?u.from(n.encode(r).buffer):t.createBuffer(r,e)}}("utf8"),Rr=function(e){var t=null;if("utf8"!=(e=Gr(e)))return null;"undefined"!=typeof TextDecoder&&(t=new TextDecoder(e));return function(n){return t?t.decode(n):n.toString(e)}}("utf8");function Dr(){return Lr.encodingExists("ascii"),Object.keys(Lr.encodings)}function jr(e){return Jr(e)||bt("Unknown encoding:",e,"\nRun the -encodings command see a list of supported encodings"),e}function Fr(e){for(var t=0,n=e.length;t<n;t++)if(e.charCodeAt(t)>=128)return!1;return!0}function Ur(e){return!e||/^utf-?8$/i.test(String(e))}function Br(e){return!(e=Gr(e))||/^(win|latin|utf8|ascii|iso88|gb)/.test(e)}function Gr(e){return(e||"").toLowerCase().replace(/[_-]/g,"")}function qr(e,t,n,r){return n>=0&&(e=e.slice(n,r)),$r(e,t)}function Vr(e,t){return Ur(t)?zr(e):Lr.encode(e,t)}function $r(e,t){return Ur(t)?Rr(e):Lr.decode(e,t)}function Jr(e){var t=Gr(e);return Dr().includes(t)}function Wr(e){return 65279==e.charCodeAt(0)&&(e=e.substr(1)),e}function Zr(){var e=Dr().filter(function(e){return!/^(_|cs|internal|ibm|isoir|singlebyte|table|[0-9]|l[0-9]|windows)/.test(e)});e.sort(),Et("Supported encodings:\n"+Rt(e))}var Yr=Object.freeze({__proto__:null,bufferToString:qr,decodeString:$r,encodeString:Vr,encodingIsAsciiCompat:Br,encodingIsSupported:Jr,encodingIsUtf8:Ur,getEncodings:Dr,printEncodings:Zr,standardizeEncodingName:Gr,stringIsAscii:Fr,stringsAreAscii:function(e){return Fr(e.join(""))},trimBOM:Wr,validateEncoding:jr});function Hr(e){var n,r,i={};if(!e)return null;for(n in e)e.hasOwnProperty(n)&&((r=e[n])==e&&delete(r=t.extend({},r))[n],i[n]=r&&r.constructor===Object?Hr(r):r);return i}function Xr(e){var n=null;return null==e?n=null:t.isString(e)?n="string":t.isNumber(e)?n="number":t.isBoolean(e)?n="boolean":t.isDate(e)?n="date":t.isObject(e)&&(n="object"),n}function Kr(e){var t=function(e){var t,n,r,i={};for(t=0;t<e.length;t++)for(r=Object.keys(e[t]||{}),n=0;n<r.length;n++)i[r[n]]=1+(0|i[r[n]]);return Object.keys(i).filter(function(t){return i[t]<e.length})}(e);!function(e,t){var n,r,i,a;for(r=0;r<e.length;r++)for(n=e[r]||(e[r]={}),i=0;i<t.length;i++)(a=t[i])in n==!1&&(n[a]=void 0)}(e,t)}function Qr(e,n){return e.indexOf("*")>-1||0===t.difference(n,e).length}function ei(e,t){for(var n,r=null,i=0,a=t.length;i<a&&!(r=(n=t[i])?Xr(n[e]):null);i++);return r}function ti(e,t){e.getFields().forEach(function(n){t(n)&&e.deleteField(n)})}function ni(e){return/^\s*$/.test(e)}function ri(e,n,r){var i={};return e.map(function(a){var o,s=0;do{o=r&&"ascii"!=r?si(a,n,s,r):oi(a,n,s),s++}while(o in i||a!=o&&t.contains(e,o));return i[o]=!0,o})}function ii(e,t){return e.map(function(e){return e?e[t]:void 0})}function ai(e,t){var n={},r=[];return e.forEach(function(e){var i=e[t];i in n==!1&&(n[i]=!0,r.push(i))}),r}function oi(e,t,n){var r,i;return t=t||256,n?(1==(i=String(n)).length&&(i="_"+i),r=e.substr(0,t-i.length)+i):r=e.substr(0,t),r}function si(e,t,n,r){var i=e+(n?String(n):"");return Vr(i,r).length>(t||256)?si(e=e.substr(0,e.length-1),t,n,r):i}function ui(e,t){return"ascending"==t&&e.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1}),e}function ci(e){for(var t=0,n=e?e.length:0;t<n;t++)if(e[t])return e[t];return null}function fi(e,t){var n=ci(e);return ui(n?Object.keys(n):[],t)}function li(e){return hi[e||"multiple"]}var hi={date:function(e){var t=new Date(e);return isNaN(+t)?null:t},string:function(e){return e},number:function(e){var t=Number(e);return"NaN"==e?t=NaN:isNaN(t)&&(t=null),t},object:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t},boolean:function(e){var t=null;return"true"==e?t=!0:"false"==e&&(t=!1),t},multiple:function(e){var t=Number(e);return isNaN(t)?e:t}},pi=Object.freeze({__proto__:null,applyFieldOrder:ui,copyRecord:Hr,deleteFields:ti,fieldListContainsAll:Qr,findFieldNames:fi,fixInconsistentFields:Kr,getColumnType:ei,getFieldValues:ii,getFirstNonEmptyRecord:ci,getInputParser:li,getUniqFieldNames:ri,getUniqFieldValues:ai,getValueType:Xr,isInvalidFieldName:ni,parseUnknownType:function(e){var t=li("number")(e);return null!==t||null!==(t=li("object")(e))?t:e}});function di(e){var n;if(t.isArray(e))n=e;else if(n=[],t.isInteger(e))for(var r=0;r<e;r++)n.push({});else e&&vt("Invalid DataTable constructor argument:",e);this.getRecords=function(){return n},this.getReadOnlyRecordAt=function(e){return Hr(n[e])}}function gi(e,t){for(var n=t.getSimpleShapeBounds(e).toArray(),r=t.getShapeIter(e),i=0;r.hasNext();){if(r.x!=n[0]&&r.x!=n[2]||r.y!=n[1]&&r.y!=n[3])return!1;i++}return!(i<5)&&(n[2]>n[0]!=!1&&n[3]>n[1]!=!1)}function mi(e){return[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]]}di.prototype={fieldExists:function(e){return t.contains(this.getFields(),e)},toString:function(){return JSON.stringify(this)},toJSON:function(){return this.getRecords()},addField:function(e,n){var r=t.isFunction(n);t.isNumber(n)||t.isString(n)||r||vt("DataTable#addField() requires a string, number or function for initialization"),this.fieldExists(e)&&vt("DataTable#addField() tried to add a field that already exists:",e),this.getRecords().forEach(function(t,i){t[e]=r?n(t,i):n})},getRecordAt:function(e){return this.getRecords()[e]},addIdField:function(){this.addField("FID",function(e,t){return t})},deleteField:function(e){this.getRecords().forEach(function(t){delete t[e]})},getFields:function(){return fi(this.getRecords())},isEmpty:function(){return 0===this.getFields().length||0===this.size()},update:function(e){for(var t=this.getRecords(),n=0,r=t.length;n<r;n++)t[n]=e(t[n],n)},clone:function(){return new di(this.getRecords().map(Hr))},size:function(){return this.getRecords().length}};var yi=Object.freeze({__proto__:null,bboxToCoords:mi,pathIsRectangle:gi});function vi(e,t,n){for(var r,i,a=ki(e)||n.length,o=(e.data=e.data||new di(a)).getRecords(),s=0,u=o.length;s<u;s++)r=o[s],i=n[s],r||(r=o[s]={}),r[t]=void 0===i?null:i}function bi(e){var t=e.data;return t||(t=e.data=new di(e.shapes?e.shapes.length:0)),t}function _i(e){return!(!e.data||!ci(e.data.getRecords()))}function xi(e){return wi(e)||Si(e)}function wi(e){return("polygon"==e.geometry_type||"polyline"==e.geometry_type)&&Mi(e)}function Si(e){return"point"==e.geometry_type&&Mi(e)}function Ai(e,t){return Ei(e,t)&&1==e.shapes.length}function Ei(e,t){return!!wi(e)&&(!(qi(e)>0)&&e.shapes.every(function(e){return!e||gi(e[0],t)}))}function Mi(e){return t.some(e.shapes||[],function(e){return!!e})}function Ii(e,t){Si(e)&&Wt(e.shapes,function(e){var n=t(e[0],e[1]);e[0]=n[0],e[1]=n[1]})}function ki(e){var t=0;return e.data?t=e.data.size():e.shapes&&(t=e.shapes.length),t}function Ci(e){return 0==ki(e)}function Pi(e,t,n){var r=e.fieldExists?e:e.data;t||bt("Missing a field parameter"),r&&r.fieldExists(t)||bt(n||"Missing a field named:",t)}function Oi(e,n){if(n&&n.length){e||bt("Missing attribute data");var r=e.getFields(),i=t.difference(n,r);i.length>0&&bt("Table is missing one or more fields:\n",i,"\nExisting fields:","\n"+Rt(r))}}function Ni(e,n,r){var i;return r&&t.isString(r)?i=r:(i=n+", ",e&&e.geometry_type?i+="received a "+e.geometry_type+" layer":i+="received a layer with no geometry"),i}function Ti(e,t){e&&"point"===e.geometry_type||bt(Ni(e,"Expected a point layer",t))}function Li(e,t){Ti(e),qi(e)>0&&bt(t||"This command requires single points; layer contains multi-point features.")}function zi(e,t){e&&"polyline"===e.geometry_type||bt(Ni(e,"Expected a polyline layer",t))}function Ri(e,t){e&&"polygon"===e.geometry_type||bt(Ni(e,"Expected a polygon layer",t))}function Di(e,t){var n=t.info&&t.info.input_files;return n&&n[0]||""}function ji(e,n,r){var i=t.uniq(r).map(function(t){for(var i,a=[],o=[],s=0,u=0,c=e.length;u<c;u++)r[u]==t&&(t&&o.push(e[u]),i=n[u],a.push(i),i||s++);return{geometry_type:t,shapes:o,data:s<a.length?new di(a):null}});return i}function Fi(e,t){return t&&t.no_replace?{geometry_type:e.geometry_type}:e}function Ui(e,t,n,r){(r=r||{}).name?e.name=r.name:r.no_replace?e.name=n||void 0:e.name=t&&t.name||n||void 0}function Bi(e){var t=Gi(e);return t.data&&(t.data=t.data.clone()),t}function Gi(e){var n=t.extend({},e);return e.shapes&&(n.shapes=kr(e.shapes)),n}function qi(e){for(var t=0,n=0,r=e.length;n<r;n++)e[n]&&e[n].length>1&&t++;return t}function Vi(e,t){var n=$i(e,t);return function(e){return n[Yt(e)]>0}}function $i(e,t){var n=new Uint32Array(t.size());return e.filter(wi).forEach(function(e){dr(e.shapes,n)}),n}function Ji(e,t){var n=null;return"point"==e.geometry_type?n=Vt(e.shapes):"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type||(n=gr(e.shapes,t)),n}function Wi(e){e.data=new di(ki(e))}var Zi=Object.freeze({__proto__:null,copyLayer:Bi,copyLayerShapes:Gi,countArcsInLayers:$i,countMultiPartFeatures:qi,deleteFeatureById:function(e,t){e.shapes&&e.shapes.splice(t,1),e.data&&e.data.getRecords().splice(t,1)},divideFeaturesByType:ji,filterPathLayerByArcIds:function(e,n){var r=n.reduce(function(e,t){return e[t]=!0,e},{}),i=kr(e.shapes);return Pr(i,function(e){for(var t=0;t<e.length;t++)if(Yt(e[t])in r)return null;return e}),t.defaults({shapes:i},e)},getArcPresenceTest2:Vi,getFeatureCount:ki,getLayerBounds:Ji,getLayerDataTable:bi,getLayerSourceFile:Di,getOutputLayer:Fi,initDataTable:Wi,insertFieldValues:vi,isolateLayer:function(e,n){return t.defaults({layers:n.layers.filter(function(t){return t==e})},n)},layerHasAttributeData:function(e){return e.data&&e.data.getFields().length>0},layerHasGeometry:xi,layerHasNonNullData:_i,layerHasNonNullShapes:Mi,layerHasPaths:wi,layerHasPoints:Si,layerIsEmpty:Ci,layerIsGeometric:function(e){return!!e.geometry_type},layerIsRectangle:Ai,layerOnlyHasRectangles:Ei,layerTypeMessage:Ni,requireDataField:Pi,requireDataFields:Oi,requirePathLayer:function(e,t){e&&wi(e)||bt(Ni(e,"Expected a polygon or polyline layer",t))},requirePointLayer:Ti,requirePolygonLayer:Ri,requirePolylineLayer:zi,requireSinglePointLayer:Li,setOutputLayerName:Ui,transformPointsInLayer:Ii});function Yi(){this.a=1,this.c=0,this.tx=0,this.b=0,this.d=1,this.ty=0}Yi.prototype.transformXY=function(e,t,n){return(n=n||{}).x=e*this.a+t*this.c+this.tx,n.y=e*this.b+t*this.d+this.ty,n},Yi.prototype.translate=function(e,t){this.tx+=e,this.ty+=t},Yi.prototype.rotate=function(e,t,n){var r=Math.cos(e),i=Math.sin(e);t=t||0,n=n||0,this.a=r,this.c=-i,this.b=i,this.d=r,this.tx+=t-t*r+n*i,this.ty+=n-t*i-n*r},Yi.prototype.scale=function(e,t,n,r){n=n||0,r=r||0,this.a*=e,this.c*=e,this.b*=t,this.d*=t,this.tx-=n*(e-1),this.ty-=r*(t-1)};var Hi=s("mproj");function Xi(e,n){var r=s(e),i=r.crs,a=[r],o=function(e){e.internal.pj_list.mixed||e.pj_add(function(e){e.a=1},"mixed","Mapshaper Mixed Projection");return e.pj_init("+proj=mixed")}(Hi);function s(e){return{bounds:new qt(u(e.bbox)),crs:Hi.pj_init(e.proj)}}function u(e){var t=Math.PI/180;return e.map(function(e){return e*t})}return i.__mixed_crs=o,i.addFrame=function(e){var r,i,o,u=function(e,n){var r=n[e.name];return t.defaults(e,{scale:1,dx:0,dy:0,rotation:0}),r?(Object.keys(r).forEach(function(t){var n=r[t];t in e?e[t]=r[t]:e.proj=function(e,t,n){var r="+"+t+"=";return e.split(" ").map(function(e){return 0===e.indexOf(r)&&(e=e.substr(0,r.length)+n),e}).join(" ")}(e.proj,t,n)}),e):e}(e,n),c=s(u),f=new Yi,l=u.origin?(r=u.origin,i=c.crs,[(o=Hi.pj_fwd_deg({lam:r[0],phi:r[1]},i)).x,o.y]):[0,0],h=u.placement||[0,0],p=h[0]-l[0]+(+u.dx||0),d=h[1]-l[1]+(+u.dy||0);return u.rotation&&f.rotate(u.rotation*Math.PI/180,l[0],l[1]),u.scale&&f.scale(u.scale,u.scale,l[0],l[1]),f.translate(p,d),c.matrix=f,a.push(c),this},o.fwd=function(e,t){for(var n,r,i=0,o=a.length;i<o;i++)if((n=a[i]).bounds.containsPoint(e.lam,e.phi)){r=Hi.pj_fwd(e,n.crs),n.matrix&&n.matrix.transformXY(r.x,r.y,r);break}t.x=r?r.x:1/0,t.y=r?r.y:1/0},i}function Ki(e){var t=e.trim().split(/ +/),n=[],r=t.filter(function(e){return!/^\+/.test(e)||(n.push(e.substr(1)),!1)}),i=r[0],a=ea(n);return 1!=r.length?null:function(e,t){if("albersusa"==e)return new Qi(t);return null}(i,a)}function Qi(e){var t=e||{},n=new Xi({proj:"+proj=aea +lon_0=-96 +lat_0=37.5 +lat_1=29.5 +lat_2=45.5",bbox:[-129,23,-62,52]},t).addFrame({name:"AK",proj:"+proj=aea +lat_1=55 +lat_2=70 +lat_0=65 +lon_0=-148 +x_0=0 +y_0=0",bbox:[-172.26,50.89,-127,73.21],origin:[-152,63],placement:[-1882782,-969242],scale:.37}).addFrame({name:"HI",proj:"+proj=aea +lat_1=19 +lat_2=24 +lat_0=20.9 +lon_0=-156.5 +x_0=0 +y_0=0",bbox:[-160.5,18.72,-154.57,22.58],origin:[-157,21],placement:[-1050326,-1055362]});return t.PR&&n.addFrame({name:"PR",proj:"+proj=aea +lat_1=18 +lat_2=18.43 +lat_0=17.83 +lon_0=-66.43 +x_0=0 +y_0=0",bbox:[-68.092,17.824,-65.151,18.787],origin:[-66.431,18.228],placement:[1993101,-1254517]}),t.VI&&n.addFrame({name:"VI",proj:"+proj=aea +lat_1=18 +lat_2=18.43 +lat_0=17.83 +lon_0=-66.43 +x_0=0 +y_0=0",bbox:[-65.104,17.665,-64.454,18.505],origin:[-66.431,18.228],placement:[1993101,-1254517]}),n}function ea(e){var n={};return e.forEach(function(e){!function(e,n){var r=e.split("="),i=r[0].split("."),a=i.pop(),o=i.reduce(function(e,n){if(n in e==!1)e[n]={};else if(!t.isObject(e[n]))return{};return e[n]},n);r.length>1?o[a]=function(e){var n;if(e.indexOf(",")>0)return n=e.split(",").map(parseFloat);n=t.parseNumber(e),null===n&&(n=e);return n}(r[1]):a in o!=!1||i.length||(o[a]={})}(e,n)}),n}var ta=Object.freeze({__proto__:null,AlbersUSA:Qi,parseCustomParams:ea,parseCustomProjection:Ki});function ra(e){return[-180+(e=t.isFiniteNumber(e)?e:1e-10),-90+e,180-e,90-e]}function ia(e){var t=ra(-1),n=e instanceof qt?e.toArray():e;return fr.containsBounds(t,n)}function aa(e){var t=e instanceof qt?e.toArray():e;return(new qt).setBounds(Math.max(t[0],-180),Math.max(t[1],-90),Math.min(t[2],180),Math.min(t[3],90))}function oa(e){for(var t=e-180;t<=-180;)t+=360;return t}var sa=Object.freeze({__proto__:null,clampToWorldBounds:aa,getAntimeridian:oa,getWorldBounds:ra,probablyDecimalDegreeBounds:ia}),ua=s("mproj"),ca=null,fa={robinson:"+proj=robin +datum=WGS84",webmercator:"+proj=merc +a=6378137 +b=6378137",wgs84:"+proj=longlat +datum=WGS84",albersusa:Qi};async function la(e){ca&&await ca(e)}function ha(e,t){var n=[0],r=[0],i=e.is_latlong?ua.internal.DEG_TO_RAD:1,a=t.is_latlong?ua.internal.RAD_TO_DEG:1,o=Na(e);return function(s,u){var c;o&&(s<-180?s=-180:s>180&&(s=180)),n[0]=s*i,r[0]=u*i;try{t=t.__mixed_crs||t,ua.pj_transform(e,t,n,r),c=n[0]==1/0}catch(e){c=!0}return c?null:[n[0]*a,r[0]*a]}}function pa(e,t,n){return ya(t,n)?e.concat():ha(t,n)(e[0],e[1])}function da(e){var t,n;try{(t=Ia(e))&&(n=ga(t))}catch(e){}return n||"[unknown]"}function ga(e){return ua.internal.get_proj_defn(e)}function ma(e){var t;try{t=ua.internal.wkt_from_proj4(e)}catch(e){}return t}function ya(e,t){var n=ga(e);return!!n&&n==ga(t)}function va(e){return e in fa}function ba(e){var n;return e=e.replace(/(^| )([\w]+)($| )/,function(e,t,n,r){return n in ua.internal.pj_list?t+"+proj="+n+r:e}),xa(e)?n=e:va(e)?(n=fa[e],t.isFunction(n)&&(n=n())):n=function(e){return/^(esri|epsg|nad83|nad27):[0-9]+$/i.test(String(e))}(e)?"+init="+e.toLowerCase():e in(i("defs")||{})?i("defs")[e]:Ki(e),n||bt("Unknown projection definition:",e),n}function xa(e){return/^(\+[^ ]+ *)+$/.test(e)}function wa(e){return{crs_string:e,crs:Sa(e)}}function Sa(e){var n,r=ba(e);if(t.isString(r))try{n=ua.pj_init(r)}catch(e){bt("Unable to use projection",r,"("+e.message+")")}else n=r;return n||null}function Aa(e){Na(Ia(e))&&bt("Command requires a target with projected coordinates (not lat-long)")}function Ea(e,t){return t=t||{},e.info=e.info||{},e.info.crs=t.crs,e.info.prj=t.prj,e.info.crs_string=t.crs_string,e}function Ma(e){var t=e.info||{},n=t.crs,r=t.crs_string;return!n&&t.prj&&(n=Sa(za(t.prj))),n||ia(wo(e))&&(n=Sa(r="wgs84")),{crs:n||null,crs_string:r,prj:t.prj}}function Ia(e){return Ma(e).crs}function ka(e,t){e.reduce(function(e,n){var r=Ia(n);return e&&r&&Na(e)!=Na(r)&&bt(t||"Unable to combine projected and unprojected datasets"),r||e},null)}function Pa(e,t,n){var r=1/n.to_meter,i=ua.pj_inv_deg({x:e,y:t},n),a=ua.pj_inv_deg({x:e+r,y:t},n);return 1/fr.greatCircleDistance(i.lam,i.phi,a.lam,a.phi)}function Oa(e){return!Na(e)}function Na(e){return e&&e.is_latlong||!1}function Ta(e){return Na(Ia(e))}function La(){var e=ua.internal.pj_list,n="Proj4 projections\n";Object.keys(e).sort().forEach(function(r){n+=" "+t.rpad(r,7," ")+" "+e[r].name+"\n"}),n+="\nAliases",Object.keys(fa).sort().forEach(function(e){n+="\n "+e}),Et(n)}function za(e){var t;try{t=ua.internal.wkt_to_proj4(e)}catch(e){bt("Unusable .prj file ("+e.message+")")}return t}function Ra(e){return Sa(za(e))}var Da=Object.freeze({__proto__:null,crsAreEqual:ya,crsToPrj:ma,crsToProj4:ga,findProjLibs:function(e){var n=e.match(/\b(esri|epsg|nad83|nad27)(?=:[0-9]+\b)/gi)||[];return t.uniq(n.map(function(e){return e.toLowerCase()}))},getCrsInfo:wa,getDatasetCRS:Ia,getDatasetCrsInfo:Ma,getProjDefn:ba,getProjInfo:da,getProjTransform:function(e,t){var n=Na(e);return t=t.__mixed_crs||t,function(r,i){var a;return n&&(r<-180?r=-180:r>180&&(r=180)),a=[r,i],ua.pj_transform_point(e,t,a),a}},getProjTransform2:ha,getScaleFactorAtXY:Pa,initProjLibrary:la,isInvertibleCRS:function(e){return!(!e||!e.inv)},isLatLngCRS:Na,isLatLngDataset:Ta,isProjAlias:va,isProjectedCRS:Oa,isWGS84:function(e){return!!Na(e)&&ga(e).toLowerCase().includes("84")},isWebMercator:function(e){if(!e)return!1;var t=ga(e);return t.includes("+proj=merc")&&t.includes("+a=6378137")&&t.includes("+b=6378137")},looksLikeProj4String:xa,parseCrsString:Sa,parsePrj:Ra,printProjections:La,projectPoint:pa,requireDatasetsHaveCompatibleCRS:ka,requireProjectedDataset:Aa,setDatasetCrsInfo:Ea,setProjectionLoader:function(e){ca=e},toLngLat:function(e,t){return pa(e,t,Sa("wgs84"))},translatePrj:za});function ja(e){var t=e.length,n=0,r={x:0,y:0,hasNext:function(){return!(n>=t)&&(r.x=e[n][0],r.y=e[n][1],n++,!0)}};return r}function Fa(e,t){this._i=0,this._n=0,this._inc=1,this._xx=e,this._yy=t,this.i=0,this.x=0,this.y=0}function Ua(e,t,n){var r=0,i=0,a=1,o=0;this.init=function(e,t,n,s){return r=s||0,n?(i=e,a=1,o=e+t):(i=e+t-1,a=-1,o=e-1),this},this.hasNext=function(){var s=n,u=i,c=u,f=r,l=o,h=a;if(u==l)return!1;do{c+=h}while(c!=l&&s[c]<f);return i=c,this.x=e[u],this.y=t[u],this.i=u,!0}}function Ba(e){this._arcs=e,this._i=0,this._n=0,this.x=0,this.y=0}Fa.prototype.init=function(e,t,n){return n?(this._i=e,this._inc=1):(this._i=e+t-1,this._inc=-1),this._n=t,this},Fa.prototype.hasNext=function(){var e=this._i;return this._n>0&&(this._i=e+this._inc,this.x=this._xx[e],this.y=this._yy[e],this.i=e,this._n--,!0)},Ba.prototype.hasNext=function(){var e=this._arc;return this._i<this._n!=!1&&(e.hasNext()?(this.x=e.x,this.y=e.y,!0):(this.nextArc(),this.hasNext()))},Ba.prototype.init=function(e){return this._ids=e,this._n=e.length,this.reset(),this},Ba.prototype.nextArc=function(){var e=this._i+1;e<this._n&&(this._arc=this._arcs.getArcIter(this._ids[e]),e>0&&this._arc.hasNext()),this._i=e},Ba.prototype.reset=function(){this._i=-1,this.nextArc()};var Ga=Object.freeze({__proto__:null,ArcIter:Fa,FilteredArcIter:Ua,MultiShapeIter:function(e){},PointIter:ja,ShapeIter:Ba});function qa(e){var n=e.getPointCount(),r=Math.ceil(n/5e5),i=e.getRemovableThresholds(r);return t.quicksort(i,!0),function(e){var t=i.length,n=Va(e,i.length);return n<1?0:n>t?1/0:i[n-1]}}function Va(e,t){return 0===t||e>=1?0:e<=0?t+1:Math.floor((1-e)*(t+2))}function $a(e,n,r){var i=n.getRemovableThresholds(r),a=Va(e,i.length);return a<1?0:a>i.length?1/0:t.findValueByRank(i,a)}var Ja=Object.freeze({__proto__:null,getThresholdByPct:$a,getThresholdFunction:qa});function Wa(){var e,n,r,i,a,o,s,u,c,f=0;function l(e){var t=[],n=[],r=e.map(function(e){for(var r=e?e.length:0,i=0;i<r;i++)t.push(e[i][0]),n.push(e[i][1]);return r});h(r,t,n)}function h(t,o,s){var l=t.length;t instanceof Array&&(t=new Uint32Array(t)),o instanceof Array&&(o=new Float64Array(o)),s instanceof Array&&(s=new Float64Array(s)),e=o,n=s,i=t,a=null,f=0,c=null,r=new Uint32Array(l);for(var h=0,p=0;p<l;p++)r[p]=h,h+=t[p];return h==e.length&&e.length==n.length||vt("ArcCollection#initXYData() Counting error"),d(),u=new Fa(e,n),this}function p(t){t?(t.length!=e.length&&vt("ArcCollection#initZData() mismatched arrays"),t instanceof Array&&(t=new Float64Array(t)),c=new Ua(e,n,a=t)):(a=null,f=0,c=null)}function d(){var e=i.length;o=new Float64Array(4*e),s=new qt;for(var t=0;t<e;t++)g(t)}function g(t){var a=i[t],u=r[t],c=4*t,f=Ht(e,n,u,a);o[c++]=f[0],o[c++]=f[1],o[c++]=f[2],o[c]=f[3],s.mergeBounds(f)}function m(){return{xx:e,yy:n,zz:a,bb:o,nn:i,ii:r}}function y(){return en(m(),f)}1==arguments.length?l(arguments[0]):3==arguments.length?h.apply(this,arguments):0===arguments.length?l([]):vt("ArcCollection() Invalid arguments"),this.updateArcBounds=function(e){g(e)},this.updateVertexData=function(e,t,n,r){h(e,t,n),p(r||null)},this.getCopy=function(){var t=new Wa(new Int32Array(i),new Float64Array(e),new Float64Array(n));return a&&(t.setThresholds(new Float64Array(a)),t.setRetainedInterval(f)),t},this.getVertexData=m,this.getFilteredCopy=function(){if(!a||0===f)return this.getCopy();var e=y(),t=new Wa(e.nn,e.xx,e.yy);return t.setThresholds(e.zz),t},this.toArray=function(){var e=[];return this.forEach(function(t){for(var n=[];t.hasNext();)n.push([t.x,t.y]);e.push(n)}),e},this.toJSON=function(){return this.toArray()},this.forEachArcSegment=function(t,o){for(var s=t>=0,u=s?t:~t,c=this.getRetainedInterval(),f=i[u],l=s?1:-1,h=s?r[u]:r[u]+f-1,p=h,d=e,g=n,m=a,y=0,v=1;v<f;v++)p+=l,(0===c||m[p]>=c)&&(o(h,p,d,g),h=p,y++);return y},this.forEachSegment=function(e){for(var t=0,n=0,r=this.size();n<r;n++)t+=this.forEachArcSegment(n,e);return t},this.transformPoints=function(t){for(var r,a=e,o=n,s=-1,u=0,c=0,f=a.length;c<f;c++,u--){for(;0===u;)u=i[++s];(r=t(a[c],o[c],s))&&(a[c]=r[0],o[c]=r[1])}d()},this.forEach=function(e){for(var t=0,n=this.size();t<n;t++)e(this.getArcIter(t),t)},this.forEach2=function(t){for(var o=0,s=this.size();o<s;o++)t(o,r[o],i[o],e,n,a)},this.forEach3=function(t){for(var o,s,u,c,f,l=0,h=this.size();l<h;l++)s=(o=r[l])+i[l],u=e.subarray(o,s),c=n.subarray(o,s),a&&(f=a.subarray(o,s)),t(u,c,f,l)},this.filter=function(e){var t=function(t){return e(this.getArcIter(t),t)}.bind(this);return this.deleteArcs(t)},this.deleteArcs=function(o){for(var s=this.size(),u=new Int32Array(s),c=0,f=0;f<s;f++)o(f)?(u[f]=c++,i[f]):u[f]=-1;return c<s&&function(o){for(var s,u,c=0,f=0,l=t.copyElements,d=0,g=o.length;d<g;d++)s=o[d],u=i[d],s>-1&&(l(e,r[d],e,c,u),l(n,r[d],n,c,u),a&&l(a,r[d],a,c,u),i[s]=u,c+=u,f++);h(i.subarray(0,f),e.subarray(0,c),n.subarray(0,c)),a&&p(a.subarray(0,c))}(u),u},this.dedupCoords=function(){for(var t,r,o=0,s=0,u=0,c=this.size(),f=a;o<c;)r=Za(s,u,t=i[o],e,n,f),i[o]=r,s+=t,u+=r,o++;return s>u&&(h(i,e.subarray(0,u),n.subarray(0,u)),f&&p(f.subarray(0,u))),s-u},this.getVertex=function(t,r){var i=this.indexOfVertex(t,r);return{x:e[i],y:n[i]}},this.getVertex2=function(t){return[e[t],n[t]]},this.indexOfVertex=function(e,t){var n=e<0?~e:e,a=i[n];return t<0&&(t=a+t),n!=e&&(t=a-t-1),(t<0||t>=a)&&vt("[ArcCollection] out-of-range vertex id"),r[n]+t},this.arcIsClosed=function(t){var r=this.indexOfVertex(t,0),i=this.indexOfVertex(t,-1);return r!=i&&e[r]==e[i]&&n[r]==n[i]},this.arcIsLollipop=function(t){var r,i;return!(this.getArcLength(t)<=2||!this.arcIsClosed(t))&&(r=this.indexOfVertex(t,1),i=this.indexOfVertex(t,-2),e[r]==e[i]&&n[r]==n[i])},this.arcIsDegenerate=function(e){return this.arcHasZeroLength(e)||this.arcIsSpike(e)||this.arcIsSpike_v1(e)},this.arcIsSpike_v1=function(e){var t,n,r=this.getArcIter(e);return r.hasNext()&&(t=r.x,n=r.y),r.hasNext(),!(!r.hasNext()||r.x!=t||r.y!=n||r.hasNext())},this.arcIsSpike=function(t){t=Yt(t);for(var a=r[t],o=a+i[t]-1;o>a;){if(e[a]!=e[o]||n[a]!=n[o])return!1;o--,a++}return!0},this.arcHasZeroLength=function(e){for(var t,n,r=this.getArcIter(e),i=0;r.hasNext();){if(i>0&&(t!=r.x||n!=r.y))return!1;t=r.x,n=r.y,i++}return!0},this.getArcLength=function(e){return i[Yt(e)]},this.getArcIter=function(e){var t=e>=0,n=t?e:~e,o=a&&f?c:u;return n>=i.length&&vt("#getArcId() out-of-range arc id:",e),o.init(r[n],i[n],t,f)},this.getShapeIter=function(e){return new Ba(this).init(e)},this.setThresholds=function(e){var t=this.getPointCount(),n=null;return e&&(e.length==t?n=e:e.length==this.size()?n=function(e,t){var n=new Float64Array(t),r=0;e.forEach(function(e){for(var t=0,i=e.length;t<i;r++,t++)n[r]=e[t]}),r!=t&&vt("Mismatched thresholds");return n}(e,t):vt("Invalid threshold data")),p(n),this},this.flatten=function(){if(f>0){var e=y();this.updateVertexData(e.nn,e.xx,e.yy),f=0}else a=null},this.isFlat=function(){return!a},this.getRetainedInterval=function(){return f},this.setRetainedInterval=function(e){return f=e,this},this.getRetainedPct=function(){return this.getPctByThreshold(f)},this.setRetainedPct=function(e){return f=e>=1?0:yr(f=this.getThresholdByPct(e),e),this},this.getRemovableThresholds=function(e){a||vt("[arcs] Missing simplification data.");for(var t,n=1|e,r=new Float64Array(Math.ceil(a.length/n)),i=0,o=0,s=this.getPointCount();i<s;i+=n)(t=a[i])!=1/0&&(r[o++]=t);return r.subarray(0,o)},this.getArcThresholds=function(e){e>=0&&e<this.size()||vt("[arcs] Invalid arc id:",e);var t=r[e],n=t+i[e];return a.subarray(t,n)},this.getPctByThreshold=function(e,n){var r,i,a;return e>0?(r=this.getRemovableThresholds(n),i=t.findRankByValue(r,e),a=r.length>0?1-(i-1)/r.length:1):a=1,a},this.getThresholdByPct=function(e,t){return $a(e,this,t)},this.arcIntersectsBBox=function(e,t){var n=o,r=4*e;return n[r]<=t[2]&&n[r+2]>=t[0]&&n[r+3]>=t[1]&&n[r+1]<=t[3]},this.arcIsContained=function(e,t){var n=o,r=4*e;return n[r]>=t[0]&&n[r+2]<=t[2]&&n[r+1]>=t[1]&&n[r+3]<=t[3]},this.arcIsSmaller=function(e,t){var n=o,r=4*e;return n[r+2]-n[r]<t&&n[r+3]-n[r+1]<t},this.isPlanar=function(){return!ia(this.getBounds())},this.size=function(){return r&&r.length||0},this.getPointCount=function(){return e&&e.length||0},this.getFilteredPointCount=function(){return a&&f?Qt(a,f):this.getPointCount()},this.getBounds=function(){return s.clone()},this.getSimpleShapeBounds=function(e,t){t=t||new qt;for(var n=0,r=e.length;n<r;n++)this.mergeArcBounds(e[n],t);return t},this.getSimpleShapeBbox=function(e,t){var n,r=t||[],i=o;r[0]=r[1]=1/0,r[2]=r[3]=-1/0;for(var a=0,s=e.length;a<s;a++)i[n=4*Yt(e[a])]<r[0]&&(r[0]=i[n]),i[++n]<r[1]&&(r[1]=i[n]),i[++n]>r[2]&&(r[2]=i[n]),i[++n]>r[3]&&(r[3]=i[n]);return r[0]==1/0?[]:r},this.getMultiShapeBounds=function(e,t){if(t=t||new qt,e)for(var n=0,r=e.length;n<r;n++)this.getSimpleShapeBounds(e[n],t);return t},this.mergeArcBounds=function(e,t){e<0&&(e=~e);var n=4*e;i[e]>0&&t.mergeBounds(o[n],o[n+1],o[n+2],o[n+3])}}function Za(e,t,n,r,i,a){for(var o,s,u,c,f,l=0,h=0;l<n;)o=r[c=e+l],s=i[c],(f=o==o&&s==s&&(0===h||o!=r[c-1]||s!=i[c-1]))&&(r[u=t+h]=o,i[u]=s,h++),a&&h>0&&(f||a[c]>a[u])&&(a[u]=a[c]),l++;return h>1?h:0}function Ya(e){var t=new ArrayBuffer(16),n=new Float64Array(t),r=new Uint32Array(t),i=0|e;if(i>0==!1)throw new Error("Invalid size param: "+e);return function(e,t){var a,o=r;return n[0]=e,n[1]=t,(2147483647&(a=(a=o[0]^o[1])<<5^a>>7^o[2]^o[3]))%i}}function Ha(e){var n=Math.floor(.25*e+1),r=Ya(n),i=new Int32Array(n),a=[],o=[],s=0;function u(e,t,n,s,u){for(var c,f,l,h=u(n),p=r(e[n],t[n]),d=i[p];-1!=d;){if(c=o[d][0],f=o[d][1],l=c.length,c[0]===e[s]&&c[l-1]===e[n]&&c[l-2]===e[h]&&f[0]===t[s]&&f[l-1]===t[n]&&f[l-2]===t[h])return d;d=a[d]}return null}t.initializeArray(i,-1),this.addArc=function(e,t){var n=e.length-1,u=r(e[n],t[n]),c=i[u],f=o.length;return i[u]=f,o.push([e,t]),s+=e.length,a.push(c),f},this.findDuplicateArc=function(e,t,n,r,i,a){var o=u(e,t,n,r,i);return o=null===o?u(e,t,r,n,a):~o},this.getVertexData=function(){for(var e,n,r=new Float64Array(s),i=new Float64Array(s),a=new Uint32Array(o.length),u=0,c=0,f=o.length;c<f;c++)n=(e=o[c])[0].length,t.copyElements(e[0],0,r,u,n),t.copyElements(e[1],0,i,u,n),a[c]=n,u+=n;return{xx:r,yy:i,nn:a}}}function Xa(e,t){for(var n,r,i,a,o=function(e,t){var n,r,i,a,o,s=e.length,u=Math.floor(1.3*s)||1,c=Ya(u),f=new Int32Array(u),l=new Int32Array(s);for(i=0;i<s;i++)a=e[i],o=t[i],a!=a||o!=o?r=-1:(r=f[n=c(a,o)]-1,f[n]=i+1),l[i]=r>=0?r:i;return l}(e,t),s=e.length-1;s>=0;s--)if(!((r=o[s])>=s)){i=s,a=-1;do{r=o[n=r],t[n]==t[s]&&e[n]==e[s]?(o[n]=i,i=n):(a>-1&&(o[a]=n),a=n)}while(r<n);a>-1&&(o[a]=a),o[s]=i}return o}function Ka(e){if(e.arcs){var t=e.arcs.getVertexData(),n=Qa(t.nn,t.xx,t.yy);e.arcs.updateVertexData(n.nn,n.xx,n.yy),e.layers.forEach(function(e){"polyline"!=e.geometry_type&&"polygon"!=e.geometry_type||(e.shapes=function(e,t){return e.map(function(e){return n(e,t)});function n(e,t){return e?e.map(function(e){return r(e,t)}):null}function r(e,t){return e.reduce(function(e,n){var r=Yt(n),i=t[r];if(i){n<0&&mr(i=i.concat());for(var a=0,o=i.length;a<o;a++)e.push(i[a])}return e},[])}}(e.shapes,n.paths))})}}function Qa(e,t,n){var r,i,a=t.length,o=Xa(t,n),s=function(e,t){for(var n=new Int32Array(e),r=0,i=0,a=t.length;i<a;i++)for(var o=0,s=t[i];o<s;o++,r++)n[r]=i;return n}(a,e),u=new Ha(a),c=f()?t.subarray:Array.prototype.slice;return r=function(e){for(var t,n=[],r=0,i=0,a=e.length;i<a;i++)t=e[i],n.push(t<2?null:d(r,r+t-1)),r+=t;return n}(e),(i=u.getVertexData()).paths=r,i;function f(){return!(!t.subarray||!n.subarray)}function l(t){var n=s[t],r=t+1;if(r<a&&s[r]===n)return t+1;var i=e[n];return p(t,t-i+1)?t-i+2:-1}function h(t){var n=s[t],r=t-1;if(r>=0&&s[r]===n)return t-1;var i=e[n];return p(t,t+i-1)?t+i-2:-1}function p(e,r){return t[e]==t[r]&&n[e]==n[r]}function d(r,i){for(var a,c=[],f=-1,p=r;p<i;p++)g(p)&&(-1==f?f=p:c.push(v(a,p)),a=p);return-1==f?c.push(function(r,i){var a,c=o[r],f=s[r];for(;c!=r&&!(s[c]<f);)c=o[c];if(c==r)return v(r,i);for(var p=r;p<i;p++)if(null!==(a=u.findDuplicateArc(t,n,p,p,l,h)))return a;vt("Unmatched ring; id:",f,"len:",e[f])}(r,i)):f==r?(g(i)||vt("Topology error"),c.push(v(a,p))):c.push(function(e,r,i,a){var o=u.findDuplicateArc(t,n,e,a,l,h);null===o&&(o=u.addArc(y(t,e,r,i,a),y(n,e,r,i,a)));return o}(a,i,r+1,f)),c}function g(e){var t,n,r=o[e],i=h(e),a=l(e);if(-1==i||-1==a)return!0;for(;e!=r;){if(t=h(r),n=l(r),-1==t||-1==n||m(i,a,t,n))return!0;r=o[r]}return!1}function m(e,r,i,a){var o=t[e],s=t[r],u=t[i],c=t[a],f=n[e],l=n[r],h=n[i],p=n[a];return!(o==c&&s==u&&f==p&&l==h||o==u&&s==c&&f==h&&l==p)}function y(e,t,n,r,i){var a,o=n-t+i-r+2,s=new(f()?Float64Array:Array)(o),u=0;for(a=t;a<=n;a++)s[u++]=e[a];for(a=r;a<=i;a++)s[u++]=e[a];return s}function v(e,r){var i=u.findDuplicateArc(t,n,e,r,l,h);return null===i&&(i=u.addArc(c.call(t,e,r+1),c.call(n,e,r+1))),i}}var eo=Object.freeze({__proto__:null,buildPathTopology:Qa,buildTopology:Ka});function to(e,t){var n=io([e].concat(t)),r=t.reduce(function(e,t){return e.concat(t.layers)},[]);return e.arcs=n.arcs,r}function no(e){return io(e.map(function(e){return t.defaults({layers:e.layers.map(Gi)},e)}))}function ro(e,t){var n,r=[],i=[],a=0;return e.forEach(function(e){r=r.concat(e.layers),i=i.concat(e.dataset),e.dataset.arcs&&e.dataset.arcs.size()>0&&a++}),n=io(i),a>1&&Ka(n),i.forEach(t.removeDataset),t.addDataset(n),t.setDefaultTarget(r,n),[{layers:r,dataset:n}]}function io(e){var t=[],n=0,r={info:{},layers:[]};return ka(e),e.forEach(function(e){var i=e.arcs?e.arcs.size():0;i>0&&t.push(e.arcs),ao(r,e),e.layers.forEach(function(e){"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type||br(e.shapes,function(e){return e<0?e-n:e+n}),r.layers.push(e)}),n+=i}),t.length>0&&(r.arcs=oo(t),r.arcs.size()!=n&&vt("[mergeDatasets()] Arc indexing error")),r}function ao(e,n){var r=n.info||{},i=e.info||(e.info={});i.input_files=t.uniq((i.input_files||[]).concat(r.input_files||[])),i.input_formats=t.uniq((i.input_formats||[]).concat(r.input_formats||[])),t.defaults(i,r)}function oo(e){var n=e.map(function(e){return e.getRetainedInterval()>0&&(Mt("Baking-in simplification setting."),e.flatten()),e.getVertexData()}),r=so(t.pluck(n,"xx"),Float64Array),i=so(t.pluck(n,"yy"),Float64Array);return new Wa(so(t.pluck(n,"nn"),Int32Array),r,i)}function so(e,t){var n=function(e){return e.reduce(function(e,t){return e+(t.length||0)},0)}(e),r=new(t||Array)(n),i=0;return e.forEach(function(e){for(var t=e.length,n=0;n<t;n++)r[n+i]=e[n];i+=t}),r}var uo=Object.freeze({__proto__:null,mergeArcs:oo,mergeCommandTargets:ro,mergeDatasetInfo:ao,mergeDatasets:io,mergeDatasetsForExport:no,mergeDatasetsIntoDataset:to});function co(e,t){var n=new Uint8Array(t.size());function r(e){Cr(e,i)}function i(e){a(~e[0]),a(e[e.length-1])}function a(e){var t=Yt(e),r=t==e;n[t]|=r?1:2}return e.forEach(function(e){wi(e)&&e.shapes.forEach(r)}),function(e){var t=Yt(e),r=t==e,i=n[t];return r?!(1&~i):!(2&~i)}}var fo=Object.freeze({__proto__:null,getPathEndpointTest:co});function lo(e,n){Array.isArray(e)&&(e=new Wa(e));var r,i,a=e.getVertexData(),o=a.nn,s=a.xx,u=a.yy;function c(e){return f(e)?null:[r.xx[e],r.yy[e]]}function f(e){return isNaN(r.xx[e])}function l(e){var t=p(e),n=d(),i=n[t],a=function(e){var t=d(),n=e,r=t[e];for(;r!=e;)n=r,(r=t[r])==n&&vt("Node indexing error");return n}(t);r.xx[t]=NaN,r.yy[t]=NaN,n[t]=t,n[a]=i}function h(e){var t=e>>1;return!0&e?t:~t}function p(e){return e>=0?2*e+1:2*~e}function d(){return r||(r=function(e,t){var n=2*e.size(),r=new Float64Array(n),i=new Float64Array(n),a=new Int32Array(n);e.forEach2(function(e,n,o,s,u,c){var f=n,l=n+o-1,h=2*e,p=h+1,d=s[f],g=u[f],m=s[l],y=u[l];t&&!t(e)&&(d=g=m=y=NaN),r[h]=d,i[h]=g,a[h]=e,r[p]=m,i[p]=y,a[p]=e});var o=Xa(r,i);return{xx:r,yy:i,ids:a,chains:o}}(e,n),2*o.length!=r.chains.length&&vt("[NodeCollection] count error")),r.chains}function g(e,t){var n=t>=0?t:~t,r=o[e>=0?e:~e];return!(r<2)&&(r==o[n]&&!!(m(e,t,-1)&&m(e,t,1)&&m(e,t,-2)))}function m(t,n,r){var i=e.indexOfVertex(t,r),a=e.indexOfVertex(n,r);return s[i]==s[a]&&u[i]==u[a]}function y(e){var t=p(e),n=d(),r=n[t];return r>=0&&r<n.length||vt("out-of-range chain id"),h(r)}Object.defineProperty(this,"arcs",{value:e}),this.setArcFilter=function(e){i=e},this.toArray=function(){var e=d(),n=new Uint8Array(e.length),r=[];return t.forEach(e,function(t,i){var a,o;if(1!=n[i]&&(o=c(i)))for(a={coordinates:o,arcs:[]},r.push(a);1!=n[i];)a.arcs.push(h(i)),n[i]=1,i=e[i]}),r},this.size=function(){return this.toArray().length},this.findDanglingEndpoints=function(){for(var e,t=d(),n=[],r=0,i=t.length;r<i;r++)t[r]==r&&(e=c(r))&&n.push({point:e,arc:h(r)});return n},this.detachAcyclicArcs=function(){for(var e,t,n=d(),r=0,i=0,a=n.length;i<a;i+=2)e=i==n[i],t=i+1==n[i+1],!e&&!t||f(i)||(this.detachArc(h(i)),r++);return r>0&&(r+=this.detachAcyclicArcs()),r},this.detachArc=function(e){l(e),l(~e)},this.forEachConnectedArc=function(e,t){for(var n=y(e),r=0;n!=e;)t(n,r++),n=y(n)},this.getConnectedArcs=function(e,t){var n=[],r=y(e);if(i&&!i(e))return[];for(;r!=e;)t&&!t(r)||i&&!i(r)||n.push(r),r=y(r);return n},this.findDuplicateArc=function(e){for(var t=y(e),n=e;t!=e;)g(e,t)&&Yt(t)<Yt(n)&&(n=t),t=y(t);return n},this.internal={testArcMatch:g,testVertexMatch:m}}function ho(e){var n=e.arcs,r=e.layers.filter(wi);if(n&&r.length){var i=po(r,n),a=[],o=0,s=new Int32Array(n.size()),u=new Uint8Array(n.size());r.forEach(function(e){e.shapes=e.shapes.map(function(e,t){return Or(e&&e.concat(),c)})}),e.arcs=function(e,n,r){var i=new Uint32Array(n.length),a=new Float64Array(r),o=new Float64Array(r),s=e.getVertexData(),u=s.zz?new Float64Array(r):null,c=e.getRetainedInterval(),f=0;return n.forEach(function(e,t){e.forEach(function(e,n){l(e,t)})}),new Wa(i,a,o).setThresholds(u).setRetainedInterval(c);function l(e,n){var r=Yt(e),c=e<0,l=s.nn[r],h=s.ii[r],p=i[n];l>0&&(p>0&&(l--,c||h++),t.copyElements(s.xx,h,a,f,l,c),t.copyElements(s.yy,h,o,f,l,c),u&&t.copyElements(s.zz,h,u,f,l,c),i[n]+=l,f+=l)}}(n,a,o)}else e.arcs=null;function c(e){for(var t,r,c,f,l,h,p=0,d=[],g=0,m=e.length;g<m;g++)l=(r=e[g])===(c=Yt(r)),n.arcIsDegenerate(r)||(0!==u[c]?t=null:(f=n.getArcLength(r),t&&i(e[g-1],r)?(f>0&&f--,t.push(r),u[c]=1):(t=[r],s[c]=a.length,a.push(t),u[c]=l?2:3),p+=f)),u[c]>1&&(h=s[c],(l&&3==u[c]||!l&&2==u[c])&&(h=~h),d.push(h));return o+=p,d}}function po(e,t){var n,r,i=new lo(t,Vi(e,t)),a=co(e.filter(function(e){return"polyline"==e.geometry_type}),t);return function(e,t){return e==t||e==~t?(Mt("Unexpected arc sequence:",e,t),!1):(n=0,i.forEachConnectedArc(e,o),1==n&&r==~t&&!a(e)&&!a(~t))};function o(e,t){n++,r=e}}var go=Object.freeze({__proto__:null,dissolveArcs:ho,getArcDissolveTest:po});function mo(e){return e.layers.map(function(n){var r={arcs:e.arcs,layers:[n],info:t.extend({},e.info)};return ho(r),r})}function yo(e){var t=Object.assign({},e);return Array.isArray(e.input_files)&&(t.input_files=e.input_files.concat()),t}function vo(e,n){var r=[];return e.layers=e.layers.filter(function(i){if(!n.includes(i))return!0;var a={arcs:e.arcs,layers:[i],info:t.extend({},e.info)};return ho(a),r.push(a),!1}),e.layers.length&&(ho(e),r.push(e)),r}function bo(e){var n=t.extend({},e);return n.layers=n.layers.map(Bi),n.arcs&&(n.arcs=n.arcs.getFilteredCopy()),n}function _o(e){var n=t.extend({},e);return n.layers=n.layers.map(Gi),n.arcs&&(n.arcs=n.arcs.getFilteredCopy()),n}function xo(e){return t.defaults({layers:e.layers.map(function(e){return t.extend({},e)})},e)}function wo(e){var t=new qt;return e.layers.forEach(function(n){var r=Ji(n,e.arcs);r&&t.mergeBounds(r)}),t}function So(e){return e.layers.every(function(e){return Ci(e)})}function Ao(e){return t.some(e.layers,function(e){return xi(e)})}function Eo(e){return t.some(e.layers,function(e){return wi(e)})}function Mo(e){if(e.arcs&&!t.some(e.layers,wi))return e.arcs=null,!0}function Io(e){Mo(e),e.arcs&&ho(e)}function ko(e,n,r){var i=e.layers.concat();t.repeat(Math.max(n.length,r.length),function(e){var t=n[e],a=r[e],o=t?i.indexOf(t):i.length;t&&i.splice(o,1),a&&i.splice(o,0,a)}),e.layers=i}function Co(e,t,n){wi(Po(e,t,n,{}))&&Ka(t)}function Po(e,t,n,r){var i=Oo(e,t,n,r);return 1!=i.length&&vt("Expected 1 output layer, received:",i.length),i[0]}function Oo(e,t,n,r){n&&0!==n.layers.length||vt("Invalid source dataset"),!1===t.layers.includes(e)&&vt("Invalid target layer");var i=to(t,[n]),a=i[0];return!a.data&&e.data&&ki(a)==e.data.size()&&(a.data=r.no_replace?e.data.clone():e.data),a.name=r.name||e.name,r.no_replace||(i[0]=Object.assign(e,{data:null,shapes:null},a),wi(e)&&ho(t)),i}function No(e,t){e.arcs&&e.arcs.transformPoints(t),e.layers.forEach(function(e){Si(e)&&Ii(e,t)})}var To=Object.freeze({__proto__:null,cleanupArcs:Mo,copyDataset:bo,copyDatasetForExport:_o,copyDatasetForRenaming:xo,copyDatasetInfo:yo,datasetHasGeometry:Ao,datasetHasPaths:Eo,datasetIsEmpty:So,getDatasetBounds:wo,mergeDatasetInfo:function(e,n){var r=n.info||{},i=e.info||(e.info={});i.input_files=t.uniq((i.input_files||[]).concat(r.input_files||[])),i.input_formats=t.uniq((i.input_formats||[]).concat(r.input_formats||[])),t.defaults(i,r)},mergeOutputLayerIntoDataset:Po,mergeOutputLayersIntoDataset:Oo,pruneArcs:Io,replaceLayerContents:Co,replaceLayers:ko,splitApartLayers:vo,splitDataset:mo,transformPoints:No});function Lo(e){var t={filename:"",directory:"",basename:"",extension:""},n=function(e){return-1==e.indexOf("/")&&-1!=e.indexOf("\\")?"\\":"/"}(e),r=e.split(n),i=r.pop(),a=/\.([a-z][a-z0-9]*)$/i,o=a.test(i)?a.exec(i)[0]:"";return o||i.includes("*")?(t.filename=i,t.extension=o?o.slice(1):"",t.basename=i.slice(0,i.length-o.length),t.directory=r.join(n)):t.directory=i?e:r.join(n),t}function zo(e){return Lo(e).basename}function Ro(e){return Lo(e).extension}function Do(e){var t=Lo(e);return t.extension?e.slice(0,e.length-t.extension.length-1):e}function jo(e,t){var n=Do(e);return t?n+"."+t:n}function Fo(e){var t=Ro(e);return t?Do(e)+"."+t.toLowerCase():e}function Uo(e){return e.reduce(function(e,n,r){return e=0===r?zo(n):t.mergeNames(e,n)},"")}function Bo(e){var t=e.info&&e.info.input_files;return t&&Uo(t)||"output"}var Go,qo,Vo,$o=Object.freeze({__proto__:null,getCommonFileBase:Uo,getFileBase:zo,getFileExtension:Ro,getOutputFileBase:Bo,getPathBase:Do,parseLocalPath:Lo,replaceFileExtension:jo,toLowerCaseExtension:Fo});try{Go=new TextDecoder}catch(vt){}var Jo,Wo,Zo,Yo,Ho,Xo=0,Ko={},Qo=0,es=0,ts=[],ns={useRecords:!1,mapsAsObjects:!0};class rs{}const is=new rs;is.name="MessagePack 0xC1";var as=!1,os=2;try{new Function("")}catch(vt){os=1/0}class ss{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.sequential&&!1!==e.trusted&&(e.trusted=!0,e.structures||0==e.useRecords||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(qo)return Rs(()=>(Ds(),this?this.unpack(e,t):ss.prototype.unpack.call(ns,e,t)));e.buffer||e.constructor!==ArrayBuffer||(e=void 0!==ne?ne.from(e):new Uint8Array(e)),"object"==typeof t?(Vo=t.end||e.length,Xo=t.start||0):(Xo=0,Vo=t>-1?t:e.length),es=0,Wo=null,Zo=null,qo=e;try{Ho=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(qo=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof ss){if(Ko=this,this.structures)return Jo=this.structures,us();(!Jo||Jo.length>0)&&(Jo=[])}else Ko=ns,(!Jo||Jo.length>0)&&(Jo=[]);return us()}unpackMultiple(e,t){let n,r=0;try{as=!0;let i=e.length,a=this?this.unpack(e,i):Fs.unpack(e,i);if(!t){for(n=[a];Xo<i;)r=Xo,n.push(us());return n}if(!1===t(a,r,Xo))return;for(;Xo<i;)if(r=Xo,!1===t(us(),r,Xo))return}catch(e){throw e.lastPosition=r,e.values=n,e}finally{as=!1,Ds()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function us(e){try{if(!Ko.trusted&&!as){let e=Jo.sharedLength||0;e<Jo.length&&(Jo.length=e)}let e;if(Ko.randomAccessStructure&&qo[Xo]<64&&qo[Xo],e=fs(),Zo&&(Xo=Zo.postBundlePosition,Zo=null),as&&(Jo.restoreStructures=null),Xo==Vo)Jo&&Jo.restoreStructures&&cs(),Jo=null,qo=null,Yo&&(Yo=null);else{if(Xo>Vo)throw new Error("Unexpected end of MessagePack data");if(!as){let t;try{t=JSON.stringify(e,(e,t)=>"bigint"==typeof t?`${t}n`:t).slice(0,100)}catch(e){t="(JSON view not available "+e+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw Jo&&Jo.restoreStructures&&cs(),Ds(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||Xo>Vo)&&(e.incomplete=!0),e}}function cs(){for(let e in Jo.restoreStructures)Jo[e]=Jo.restoreStructures[e];Jo.restoreStructures=null}function fs(){let e=qo[Xo++];if(e<160){if(e<128){if(e<64)return e;{let t=Jo[63&e]||Ko.getStructures&&ds()[63&e];return t?(t.read||(t.read=hs(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Ko.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Cs();"__proto__"===e&&(e="__proto_"),t[e]=fs()}return t}{let t=new Map;for(let n=0;n<e;n++)t.set(fs(),fs());return t}}{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=fs();return Ko.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(es>=Xo)return Wo.slice(Xo-Qo,(Xo+=t)-Qo);if(0==es&&Vo<140){let e=t<16?As(t):Ss(t);if(null!=e)return e}return gs(t)}{let t;switch(e){case 192:return null;case 193:return Zo?(t=fs(),t>0?Zo[1].slice(Zo.position1,Zo.position1+=t):Zo[0].slice(Zo.position0,Zo.position0-=t)):is;case 194:return!1;case 195:return!0;case 196:if(t=qo[Xo++],void 0===t)throw new Error("Unexpected end of buffer");return Ms(t);case 197:return t=Ho.getUint16(Xo),Xo+=2,Ms(t);case 198:return t=Ho.getUint32(Xo),Xo+=4,Ms(t);case 199:return Is(qo[Xo++]);case 200:return t=Ho.getUint16(Xo),Xo+=2,Is(t);case 201:return t=Ho.getUint32(Xo),Xo+=4,Is(t);case 202:if(t=Ho.getFloat32(Xo),Ko.useFloat32>2){let e=js[(127&qo[Xo])<<1|qo[Xo+1]>>7];return Xo+=4,(e*t+(t>0?.5:-.5)|0)/e}return Xo+=4,t;case 203:return t=Ho.getFloat64(Xo),Xo+=8,t;case 204:return qo[Xo++];case 205:return t=Ho.getUint16(Xo),Xo+=2,t;case 206:return t=Ho.getUint32(Xo),Xo+=4,t;case 207:return"number"===Ko.int64AsType?(t=4294967296*Ho.getUint32(Xo),t+=Ho.getUint32(Xo+4)):"string"===Ko.int64AsType?t=Ho.getBigUint64(Xo).toString():"auto"===Ko.int64AsType?(t=Ho.getBigUint64(Xo),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ho.getBigUint64(Xo),Xo+=8,t;case 208:return Ho.getInt8(Xo++);case 209:return t=Ho.getInt16(Xo),Xo+=2,t;case 210:return t=Ho.getInt32(Xo),Xo+=4,t;case 211:return"number"===Ko.int64AsType?(t=4294967296*Ho.getInt32(Xo),t+=Ho.getUint32(Xo+4)):"string"===Ko.int64AsType?t=Ho.getBigInt64(Xo).toString():"auto"===Ko.int64AsType?(t=Ho.getBigInt64(Xo),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ho.getBigInt64(Xo),Xo+=8,t;case 212:if(t=qo[Xo++],114==t)return Os(63&qo[Xo++]);{let e=ts[t];if(e)return e.read?(Xo++,e.read(fs())):e.noBuffer?(Xo++,e()):e(qo.subarray(Xo,++Xo));throw new Error("Unknown extension "+t)}case 213:return t=qo[Xo],114==t?(Xo++,Os(63&qo[Xo++],qo[Xo++])):Is(2);case 214:return Is(4);case 215:return Is(8);case 216:return Is(16);case 217:return t=qo[Xo++],es>=Xo?Wo.slice(Xo-Qo,(Xo+=t)-Qo):ms(t);case 218:return t=Ho.getUint16(Xo),es>=(Xo+=2)?Wo.slice(Xo-Qo,(Xo+=t)-Qo):ys(t);case 219:return t=Ho.getUint32(Xo),es>=(Xo+=4)?Wo.slice(Xo-Qo,(Xo+=t)-Qo):vs(t);case 220:return t=Ho.getUint16(Xo),Xo+=2,_s(t);case 221:return t=Ho.getUint32(Xo),Xo+=4,_s(t);case 222:return t=Ho.getUint16(Xo),Xo+=2,xs(t);case 223:return t=Ho.getUint32(Xo),Xo+=4,xs(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}const ls=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function hs(e,t){function n(){if(n.count++>os){let n=e.read=new Function("r","return function(){return "+(Ko.freezeData?"Object.freeze":"")+"({"+e.map(e=>"__proto__"===e?"__proto_:r()":ls.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"})}")(fs);return 0===e.highByte&&(e.read=ps(t,e.read)),n()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];"__proto__"===n&&(n="__proto_"),r[n]=fs()}return Ko.freezeData?Object.freeze(r):r}return n.count=0,0===e.highByte?ps(t,n):n}const ps=(e,t)=>function(){let n=qo[Xo++];if(0===n)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=Jo[r]||ds()[r];if(!i)throw new Error("Record id is not defined for "+r);return i.read||(i.read=hs(i,e)),i.read()};function ds(){let e=Rs(()=>(qo=null,Ko.getStructures()));return Jo=Ko._mergeStructures(e,Jo)}var gs=bs,ms=bs,ys=bs,vs=bs;function bs(e){let t;if(e<16&&(t=As(e)))return t;if(e>64&&Go)return Go.decode(qo.subarray(Xo,Xo+=e));const n=Xo+e,r=[];for(t="";Xo<n;){const e=qo[Xo++];if(128&e)if(192==(224&e)){const t=63&qo[Xo++];r.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&qo[Xo++],n=63&qo[Xo++];r.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&qo[Xo++])<<12|(63&qo[Xo++])<<6|63&qo[Xo++];t>65535&&(t-=65536,r.push(t>>>10&1023|55296),t=56320|1023&t),r.push(t)}else r.push(e);else r.push(e);r.length>=4096&&(t+=ws.apply(String,r),r.length=0)}return r.length>0&&(t+=ws.apply(String,r)),t}function _s(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=fs();return Ko.freezeData?Object.freeze(t):t}function xs(e){if(Ko.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Cs();"__proto__"===e&&(e="__proto_"),t[e]=fs()}return t}{let t=new Map;for(let n=0;n<e;n++)t.set(fs(),fs());return t}}var ws=String.fromCharCode;function Ss(e){let t=Xo,n=new Array(e);for(let r=0;r<e;r++){const e=qo[Xo++];if((128&e)>0)return void(Xo=t);n[r]=e}return ws.apply(String,n)}function As(e){if(e<4){if(e<2){if(0===e)return"";{let e=qo[Xo++];return(128&e)>1?void(Xo-=1):ws(e)}}{let t=qo[Xo++],n=qo[Xo++];if((128&t)>0||(128&n)>0)return void(Xo-=2);if(e<3)return ws(t,n);let r=qo[Xo++];return(128&r)>0?void(Xo-=3):ws(t,n,r)}}{let t=qo[Xo++],n=qo[Xo++],r=qo[Xo++],i=qo[Xo++];if((128&t)>0||(128&n)>0||(128&r)>0||(128&i)>0)return void(Xo-=4);if(e<6){if(4===e)return ws(t,n,r,i);{let e=qo[Xo++];return(128&e)>0?void(Xo-=5):ws(t,n,r,i,e)}}if(e<8){let a=qo[Xo++],o=qo[Xo++];if((128&a)>0||(128&o)>0)return void(Xo-=6);if(e<7)return ws(t,n,r,i,a,o);let s=qo[Xo++];return(128&s)>0?void(Xo-=7):ws(t,n,r,i,a,o,s)}{let a=qo[Xo++],o=qo[Xo++],s=qo[Xo++],u=qo[Xo++];if((128&a)>0||(128&o)>0||(128&s)>0||(128&u)>0)return void(Xo-=8);if(e<10){if(8===e)return ws(t,n,r,i,a,o,s,u);{let e=qo[Xo++];return(128&e)>0?void(Xo-=9):ws(t,n,r,i,a,o,s,u,e)}}if(e<12){let c=qo[Xo++],f=qo[Xo++];if((128&c)>0||(128&f)>0)return void(Xo-=10);if(e<11)return ws(t,n,r,i,a,o,s,u,c,f);let l=qo[Xo++];return(128&l)>0?void(Xo-=11):ws(t,n,r,i,a,o,s,u,c,f,l)}{let c=qo[Xo++],f=qo[Xo++],l=qo[Xo++],h=qo[Xo++];if((128&c)>0||(128&f)>0||(128&l)>0||(128&h)>0)return void(Xo-=12);if(e<14){if(12===e)return ws(t,n,r,i,a,o,s,u,c,f,l,h);{let e=qo[Xo++];return(128&e)>0?void(Xo-=13):ws(t,n,r,i,a,o,s,u,c,f,l,h,e)}}{let p=qo[Xo++],d=qo[Xo++];if((128&p)>0||(128&d)>0)return void(Xo-=14);if(e<15)return ws(t,n,r,i,a,o,s,u,c,f,l,h,p,d);let g=qo[Xo++];return(128&g)>0?void(Xo-=15):ws(t,n,r,i,a,o,s,u,c,f,l,h,p,d,g)}}}}}function Es(){let e,t=qo[Xo++];if(t<192)e=t-160;else switch(t){case 217:e=qo[Xo++];break;case 218:e=Ho.getUint16(Xo),Xo+=2;break;case 219:e=Ho.getUint32(Xo),Xo+=4;break;default:throw new Error("Expected string")}return bs(e)}function Ms(e){return Ko.copyBuffers?Uint8Array.prototype.slice.call(qo,Xo,Xo+=e):qo.subarray(Xo,Xo+=e)}function Is(e){let t=qo[Xo++];if(ts[t]){let n;return ts[t](qo.subarray(Xo,n=Xo+=e),e=>{Xo=e;try{return fs()}finally{Xo=n}})}throw new Error("Unknown extension type "+t)}var ks=new Array(4096);function Cs(){let e=qo[Xo++];if(!(e>=160&&e<192))return Xo--,Ps(fs());if(e-=160,es>=Xo)return Wo.slice(Xo-Qo,(Xo+=e)-Qo);if(!(0==es&&Vo<180))return gs(e);let t,n=4095&(e<<5^(e>1?Ho.getUint16(Xo):e>0?qo[Xo]:0)),r=ks[n],i=Xo,a=Xo+e-3,o=0;if(r&&r.bytes==e){for(;i<a;){if(t=Ho.getUint32(i),t!=r[o++]){i=1879048192;break}i+=4}for(a+=3;i<a;)if(t=qo[i++],t!=r[o++]){i=1879048192;break}if(i===a)return Xo=i,r.string;a-=3,i=Xo}for(r=[],ks[n]=r,r.bytes=e;i<a;)t=Ho.getUint32(i),r.push(t),i+=4;for(a+=3;i<a;)t=qo[i++],r.push(t);let s=e<16?As(e):Ss(e);return r.string=null!=s?s:gs(e)}function Ps(e){if("string"==typeof e)return e;if("number"==typeof e)return e.toString();throw new Error("Invalid property type for record",typeof e)}const Os=(e,t)=>{let n=fs().map(Ps),r=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=Jo[e];return i&&(i.isShared||as)&&((Jo.restoreStructures||(Jo.restoreStructures=[]))[e]=i),Jo[e]=n,n.read=hs(n,r),n.read()};ts[0]=()=>{},ts[0].noBuffer=!0,ts[66]=e=>{let t=e.length,n=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=8n,n+=BigInt(e[r]);return n};let Ns={Error:Error,TypeError:TypeError,ReferenceError:ReferenceError};ts[101]=()=>{let e=fs();return(Ns[e[0]]||Error)(e[1])},ts[105]=e=>{if(!1===Ko.structuredClone)throw new Error("Structured clone extension is disabled");let t=Ho.getUint32(Xo-4);Yo||(Yo=new Map);let n,r=qo[Xo];n=r>=144&&r<160||220==r||221==r?[]:{};let i={target:n};Yo.set(t,i);let a=fs();return i.used?Object.assign(n,a):(i.target=a,a)},ts[112]=e=>{if(!1===Ko.structuredClone)throw new Error("Structured clone extension is disabled");let t=Ho.getUint32(Xo-4),n=Yo.get(t);return n.used=!0,n.target},ts[115]=()=>new Set(fs());const Ts=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");let Ls="object"==typeof globalThis?globalThis:window;ts[116]=e=>{let t=e[0],n=Ts[t];if(!n)throw new Error("Could not find typed array for code "+t);return new Ls[n](Uint8Array.prototype.slice.call(e,1).buffer)},ts[120]=()=>{let e=fs();return new RegExp(e[0],e[1])};const zs=[];function Rs(e){let t=Vo,n=Xo,r=Qo,i=es,a=Wo,o=Yo,s=Zo,u=new Uint8Array(qo.slice(0,Vo)),c=Jo,f=Jo.slice(0,Jo.length),l=Ko,h=as,p=e();return Vo=t,Xo=n,Qo=r,es=i,Wo=a,Yo=o,Zo=s,qo=u,as=h,(Jo=c).splice(0,Jo.length,...f),Ko=l,Ho=new DataView(qo.buffer,qo.byteOffset,qo.byteLength),p}function Ds(){qo=null,Yo=null,Jo=null}ts[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=Xo;return Xo+=t-e.length,Zo=zs,(Zo=[Es(),Es()]).position0=0,Zo.position1=0,Zo.postBundlePosition=Xo,Xo=n,fs()},ts[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");const js=new Array(147);for(let e=0;e<256;e++)js[e]=+("1e"+Math.floor(45.15-.30103*e));var Fs=new ss({useRecords:!1});const Us=Fs.unpack;Fs.unpackMultiple,Fs.unpack;let Bs,Gs,qs,Vs=new Float32Array(1);new Uint8Array(Vs.buffer,0,4);try{Bs=new TextEncoder}catch(vt){}const $s=void 0!==ne,Js=$s?function(e){return ne.allocUnsafeSlow(e)}:Uint8Array,Ws=$s?ne:Uint8Array,Zs=$s?4294967296:2144337920;let Ys,Hs,Xs,Ks,Qs=0,eu=null;const tu=/[\u0080-\uFFFF]/,nu=Symbol("record-id");function ru(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function iu(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=255&n}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function au(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=255&i):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=255&i)}return t[n++]=r,t.set(e,n),n+=i}function ou(e,t,n){if(eu.length>0){Xs.setUint32(eu.position+e,Qs+n-eu.position-e),eu.stringsPosition=Qs-e;let r=eu;eu=null,t(r[0]),t(r[1])}}qs=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,rs],Gs=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,4e6*e.getMilliseconds()+(r/1e3/4294967296|0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,1e6*e.getMilliseconds()),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?ru(e,16,t):iu($s?ne.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==Ws&&this.moreTypes?ru(e,Ts.indexOf(n.name),t):iu(e,t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];let su=new class extends ss{constructor(e){let t,n,r,i;super(e),this.offset=0;let a=Ws.prototype.utf8Write?function(e,t){return Ys.utf8Write(e,t,4294967295)}:!(!Bs||!Bs.encodeInto)&&function(e,t){return Bs.encodeInto(e,Ys.subarray(t)).written},o=this;e||(e={});let s=e&&e.sequential,u=e.structures||e.saveStructures,c=e.maxSharedStructures;if(null==c&&(c=u?32:0),c>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&null==e.moreTypes&&(this.moreTypes=!0);let f=e.maxOwnStructures;null==f&&(f=u?32:64),this.structures||0==e.useRecords||(this.structures=[]);let l=c>32||f+c>64,h=c+64,p=c+f+64;if(p>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let d=[],g=0,m=0;this.pack=this.encode=function(e,a){if(Ys||(Ys=new Js(8192),Xs=Ys.dataView||(Ys.dataView=new DataView(Ys.buffer,0,8192)),Qs=0),Ks=Ys.length-10,Ks-Qs<2048?(Ys=new Js(Ys.length),Xs=Ys.dataView||(Ys.dataView=new DataView(Ys.buffer,0,Ys.length)),Ks=Ys.length-10,Qs=0):Qs=Qs+7&2147483640,t=Qs,a&lu&&(Qs+=255&a),i=o.structuredClone?new Map:null,o.bundleStrings&&"string"!=typeof e?(eu=[],eu.size=1/0):eu=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>c)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||(n=i[r]=Object.create(null)),i=n}i[nu]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}let u;n&&(n=!1);try{o.randomAccessStructure&&e&&e.constructor&&e.constructor===Object?I(e):b(e);let n=eu;if(eu&&ou(t,b,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&-1===a&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(Xs.setUint32(n.position+t,Xs.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&Xs.setUint32(n.position+t,Xs.getUint32(n.position+t)+a),Qs+=6*e.length,Qs>Ks&&A(Qs),o.offset=Qs;let s=function(e,t){let n,r=6*t.length,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=255&a,i=t}return e}(Ys.subarray(t,Qs),e);return i=null,s}return o.offset=Qs,a&cu?(Ys.start=t,Ys.end=Qs,Ys):Ys.subarray(t,Qs)}catch(e){throw u=e,e}finally{if(r&&(y(),n&&o.saveStructures)){let n=r.sharedLength||0,i=Ys.subarray(t,Qs),s=function(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}(r,o);if(!u)return!1===o.saveStructures(s,s.isCompatible)?o.pack(e,a):(o.lastNamedStructuresLength=n,i)}a&fu&&(Qs=t)}};const y=()=>{m<10&&m++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),g>1e4)r.transitions=null,m=0,g=0,d.length>0&&(d=[]);else if(d.length>0&&!s){for(let e=0,t=d.length;e<t;e++)d[e][nu]=0;d=[]}},v=e=>{var t=e.length;t<16?Ys[Qs++]=144|t:t<65536?(Ys[Qs++]=220,Ys[Qs++]=t>>8,Ys[Qs++]=255&t):(Ys[Qs++]=221,Xs.setUint32(Qs,t),Qs+=4);for(let n=0;n<t;n++)b(e[n])},b=e=>{Qs>Ks&&(Ys=A(Qs));var n,r=typeof e;if("string"===r){let r,i=e.length;if(eu&&i>=4&&i<4096){if((eu.size+=i)>21760){let e,n,r=(eu[0]?3*eu[0].length+eu[1].length:0)+10;Qs+r>Ks&&(Ys=A(Qs+r)),eu.position?(n=eu,Ys[Qs]=200,Qs+=3,Ys[Qs++]=98,e=Qs-t,Qs+=4,ou(t,b,0),Xs.setUint16(e+t-3,Qs-t-e)):(Ys[Qs++]=214,Ys[Qs++]=98,e=Qs-t,Qs+=4),eu=["",""],eu.previous=n,eu.size=0,eu.position=e}let n=tu.test(e);return eu[n?0:1]+=e,Ys[Qs++]=193,void b(n?-i:i)}r=i<32?1:i<256?2:i<65536?3:5;let o=3*i;if(Qs+o>Ks&&(Ys=A(Qs+o)),i<64||!a){let t,a,o,s=Qs+r;for(t=0;t<i;t++)a=e.charCodeAt(t),a<128?Ys[s++]=a:a<2048?(Ys[s++]=a>>6|192,Ys[s++]=63&a|128):55296==(64512&a)&&56320==(64512&(o=e.charCodeAt(t+1)))?(a=65536+((1023&a)<<10)+(1023&o),t++,Ys[s++]=a>>18|240,Ys[s++]=a>>12&63|128,Ys[s++]=a>>6&63|128,Ys[s++]=63&a|128):(Ys[s++]=a>>12|224,Ys[s++]=a>>6&63|128,Ys[s++]=63&a|128);n=s-Qs-r}else n=a(e,Qs+r);n<32?Ys[Qs++]=160|n:n<256?(r<2&&Ys.copyWithin(Qs+2,Qs+1,Qs+1+n),Ys[Qs++]=217,Ys[Qs++]=n):n<65536?(r<3&&Ys.copyWithin(Qs+3,Qs+2,Qs+2+n),Ys[Qs++]=218,Ys[Qs++]=n>>8,Ys[Qs++]=255&n):(r<5&&Ys.copyWithin(Qs+5,Qs+3,Qs+3+n),Ys[Qs++]=219,Xs.setUint32(Qs,n),Qs+=4),Qs+=n}else if("number"===r)if(e>>>0===e)e<32||e<128&&!1===this.useRecords||e<64&&!this.randomAccessStructure?Ys[Qs++]=e:e<256?(Ys[Qs++]=204,Ys[Qs++]=e):e<65536?(Ys[Qs++]=205,Ys[Qs++]=e>>8,Ys[Qs++]=255&e):(Ys[Qs++]=206,Xs.setUint32(Qs,e),Qs+=4);else if((e|0)===e)e>=-32?Ys[Qs++]=256+e:e>=-128?(Ys[Qs++]=208,Ys[Qs++]=e+256):e>=-32768?(Ys[Qs++]=209,Xs.setInt16(Qs,e),Qs+=2):(Ys[Qs++]=210,Xs.setInt32(Qs,e),Qs+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let n;if(Ys[Qs++]=202,Xs.setFloat32(Qs,e),t<4||((n=e*js[(127&Ys[Qs])<<1|Ys[Qs+1]>>7])|0)===n)return void(Qs+=4);Qs--}Ys[Qs++]=203,Xs.setFloat64(Qs,e),Qs+=8}else if("object"===r||"function"===r)if(e){if(i){let n=i.get(e);if(n){if(!n.id){let e=i.idsToInsert||(i.idsToInsert=[]);n.id=e.push(n)}return Ys[Qs++]=214,Ys[Qs++]=112,Xs.setUint32(Qs,n.id),void(Qs+=4)}i.set(e,{offset:Qs-t})}let a=e.constructor;if(a===Object)S(e,!0);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)Ys[Qs++]=128;else{(n=e.size)<16?Ys[Qs++]=128|n:n<65536?(Ys[Qs++]=222,Ys[Qs++]=n>>8,Ys[Qs++]=255&n):(Ys[Qs++]=223,Xs.setUint32(Qs,n),Qs+=4);for(let[t,n]of e)b(t),b(n)}else{for(let t=0,n=Gs.length;t<n;t++){if(e instanceof qs[t]){let n=Gs[t];if(n.write){n.type&&(Ys[Qs++]=212,Ys[Qs++]=n.type,Ys[Qs++]=0);let t=n.write.call(this,e);return void(t===e?Array.isArray(e)?v(e):S(e):b(t))}let r,i=Ys,a=Xs,o=Qs;Ys=null;try{r=n.pack.call(this,e,e=>(Ys=i,i=null,Qs+=e,Qs>Ks&&A(Qs),{target:Ys,targetView:Xs,position:Qs-e}),b)}finally{i&&(Ys=i,Xs=a,Qs=o,Ks=Ys.length-10)}return void(r&&(r.length+Qs>Ks&&A(r.length+Qs),Qs=au(r,Ys,Qs,n.type)))}}if(Array.isArray(e))v(e);else{if(e.toJSON){const t=e.toJSON();if(t!==e)return b(t)}if("function"===r)return b(this.writeFunction&&this.writeFunction(e));S(e,!e.hasOwnProperty)}}}else Ys[Qs++]=192;else if("boolean"===r)Ys[Qs++]=e?195:194;else if("bigint"===r){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))Ys[Qs++]=211,Xs.setBigInt64(Qs,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)Ys[Qs++]=207,Xs.setBigUint64(Qs,e);else{if(!this.largeBigIntToFloat){if(this.useBigIntExtension&&e<2n**1023n&&e>-(2n**1023n)){Ys[Qs++]=199,Qs++,Ys[Qs++]=66;let t,n=[];do{let r=0xffn&e;t=(0x80n&r)==(e<0n?0x80n:0n),n.push(r),e>>=8n}while(0n!==e&&-1n!==e||!t);Ys[Qs-2]=n.length;for(let e=n.length;e>0;)Ys[Qs++]=Number(n[--e]);return}throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64")}Ys[Qs++]=203,Xs.setFloat64(Qs,Number(e))}Qs+=8}else{if("undefined"!==r)throw new Error("Unknown type: "+r);this.encodeUndefinedAsNil?Ys[Qs++]=192:(Ys[Qs++]=212,Ys[Qs++]=0,Ys[Qs++]=0)}},_=this.variableMapSize||this.coercibleKeyAsNumber?e=>{let t,n=Object.keys(e),r=n.length;if(r<16?Ys[Qs++]=128|r:r<65536?(Ys[Qs++]=222,Ys[Qs++]=r>>8,Ys[Qs++]=255&r):(Ys[Qs++]=223,Xs.setUint32(Qs,r),Qs+=4),this.coercibleKeyAsNumber)for(let i=0;i<r;i++){t=n[i];let r=Number(t);b(isNaN(r)?t:r),b(e[t])}else for(let i=0;i<r;i++)b(t=n[i]),b(e[t])}:(e,n)=>{Ys[Qs++]=222;let r=Qs-t;Qs+=2;let i=0;for(let t in e)(n||e.hasOwnProperty(t))&&(b(t),b(e[t]),i++);Ys[r+++t]=i>>8,Ys[r+t]=255&i},x=!1===this.useRecords?_:e.progressiveRecords&&!l?(e,n)=>{let i,a,o=r.transitions||(r.transitions=Object.create(null)),s=Qs++-t;for(let u in e)if(n||e.hasOwnProperty(u)){if(i=o[u],i)o=i;else{let n=Object.keys(e),c=o;o=r.transitions;let f=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];i=o[t],i||(i=o[t]=Object.create(null),f++),o=i}s+t+1==Qs?(Qs--,E(o,n,f)):M(o,n,s,f),a=!0,o=c[u]}b(e[u])}if(!a){let n=o[nu];n?Ys[s+t]=n:M(o,Object.keys(e),s,0)}}:(e,t)=>{let n,i=r.transitions||(r.transitions=Object.create(null)),a=0;for(let r in e)(t||e.hasOwnProperty(r))&&(n=i[r],n||(n=i[r]=Object.create(null),a++),i=n);let o=i[nu];o?o>=96&&l?(Ys[Qs++]=96+(31&(o-=96)),Ys[Qs++]=o>>5):Ys[Qs++]=o:E(i,i.__keys__||Object.keys(e),a);for(let n in e)(t||e.hasOwnProperty(n))&&b(e[n])},w="function"==typeof this.useRecords&&this.useRecords,S=w?(e,t)=>{w(e)?x(e,t):_(e,t)}:x,A=e=>{let n;if(e>16777216){if(e-t>Zs)throw new Error("Packed buffer would be larger than maximum buffer size");n=Math.min(Zs,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else n=1+(Math.max(e-t<<2,Ys.length-1)>>12)<<12;let r=new Js(n);return Xs=r.dataView||(r.dataView=new DataView(r.buffer,0,n)),e=Math.min(e,Ys.length),Ys.copy?Ys.copy(r,0,t,e):r.set(Ys.slice(t,e)),Qs-=t,t=0,Ks=r.length-10,Ys=r},E=(e,t,i)=>{let a=r.nextId;a||(a=64),a<h&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=h),r.nextOwnId=a+1):(a>=p&&(a=h),r.nextId=a+1);let o=t.highByte=a>=96&&l?a-96>>5:-1;e[nu]=a,e.__keys__=t,r[a-64]=t,a<h?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(Ys[Qs++]=96+(31&a),Ys[Qs++]=o):Ys[Qs++]=a):(o>=0?(Ys[Qs++]=213,Ys[Qs++]=114,Ys[Qs++]=96+(31&a),Ys[Qs++]=o):(Ys[Qs++]=212,Ys[Qs++]=114,Ys[Qs++]=a),i&&(g+=m*i),d.length>=f&&(d.shift()[nu]=0),d.push(e),b(t))},M=(e,n,r,i)=>{let a=Ys,o=Qs,s=Ks,u=t;Ys=Hs,Qs=0,t=0,Ys||(Hs=Ys=new Js(8192)),Ks=Ys.length-10,E(e,n,i),Hs=Ys;let c=Qs;if(Ys=a,Qs=o,Ks=s,t=u,c>1){let e=Qs+c-1;e>Ks&&A(e);let n=r+t;Ys.copyWithin(n+c,n+1,Qs),Ys.set(Hs.slice(0,c),n),Qs=e}else Ys[r+t]=Hs[0]},I=(e,i)=>{let a=(void 0)(e,Ys,t,Qs,r,A,(e,t,r)=>{if(r)return n=!0;Qs=t;let i=Ys;return b(e),y(),i!==Ys?{position:Qs,targetView:Xs,target:Ys}:Qs},this);if(0===a)return S(e,!0);Qs=a}}useBuffer(e){Ys=e,Xs=new DataView(Ys.buffer,Ys.byteOffset,Ys.byteLength),Qs=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}({useRecords:!1});const uu=su.pack;su.pack;const cu=512,fu=1024,lu=2048;var hu={},pu=Uint8Array,du=Uint16Array,gu=Int32Array,mu=new pu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yu=new pu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vu=new pu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bu=function(e,t){for(var n=new du(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new gu(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},_u=bu(mu,2),xu=_u.b,wu=_u.r;xu[28]=258,wu[258]=28;for(var Su=bu(yu,0),Au=Su.b,Eu=Su.r,Mu=new du(32768),Iu=0;Iu<32768;++Iu){var ku=(43690&Iu)>>1|(21845&Iu)<<1;ku=(61680&(ku=(52428&ku)>>2|(13107&ku)<<2))>>4|(3855&ku)<<4,Mu[Iu]=((65280&ku)>>8|(255&ku)<<8)>>1}var Cu=function(e,t,n){for(var r=e.length,i=0,a=new du(t);i<r;++i)e[i]&&++a[e[i]-1];var o,s=new du(t);for(i=1;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new du(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],l=s[e[i]-1]++<<f,h=l|(1<<f)-1;l<=h;++l)o[Mu[l]>>u]=c}else for(o=new du(r),i=0;i<r;++i)e[i]&&(o[i]=Mu[s[e[i]-1]++]>>15-e[i]);return o},Pu=new pu(288);for(Iu=0;Iu<144;++Iu)Pu[Iu]=8;for(Iu=144;Iu<256;++Iu)Pu[Iu]=9;for(Iu=256;Iu<280;++Iu)Pu[Iu]=7;for(Iu=280;Iu<288;++Iu)Pu[Iu]=8;var Ou=new pu(32);for(Iu=0;Iu<32;++Iu)Ou[Iu]=5;var Nu=Cu(Pu,9,0),Tu=Cu(Pu,9,1),Lu=Cu(Ou,5,0),zu=Cu(Ou,5,1),Ru=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Du=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},ju=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Fu=function(e){return(e+7)/8|0},Uu=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new pu(e.subarray(t,n))},Bu=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Gu=function(e,t,n){var r=new Error(t||Bu[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Gu),!n)throw r;return r},qu=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new pu(0);var o=!n,s=o||2!=t.i,u=t.i;o&&(n=new pu(3*i));var c=function(e){var t=n.length;if(e>t){var r=new pu(Math.max(2*t,e));r.set(n),n=r}},f=t.f||0,l=t.p||0,h=t.b||0,p=t.l,d=t.d,g=t.m,m=t.n,y=8*i;do{if(!p){f=Du(e,l,1);var v=Du(e,l+1,3);if(l+=3,!v){var b=e[(P=Fu(l)+4)-4]|e[P-3]<<8,_=P+b;if(_>i){u&&Gu(0);break}s&&c(h+b),n.set(e.subarray(P,_),h),t.b=h+=b,t.p=l=8*_,t.f=f;continue}if(1==v)p=Tu,d=zu,g=9,m=5;else if(2==v){var x=Du(e,l,31)+257,w=Du(e,l+10,15)+4,S=x+Du(e,l+5,31)+1;l+=14;for(var A=new pu(S),E=new pu(19),M=0;M<w;++M)E[vu[M]]=Du(e,l+3*M,7);l+=3*w;var I=Ru(E),k=(1<<I)-1,C=Cu(E,I,1);for(M=0;M<S;){var P,O=C[Du(e,l,k)];if(l+=15&O,(P=O>>4)<16)A[M++]=P;else{var N=0,T=0;for(16==P?(T=3+Du(e,l,3),l+=2,N=A[M-1]):17==P?(T=3+Du(e,l,7),l+=3):18==P&&(T=11+Du(e,l,127),l+=7);T--;)A[M++]=N}}var L=A.subarray(0,x),z=A.subarray(x);g=Ru(L),m=Ru(z),p=Cu(L,g,1),d=Cu(z,m,1)}else Gu(1);if(l>y){u&&Gu(0);break}}s&&c(h+131072);for(var R=(1<<g)-1,D=(1<<m)-1,j=l;;j=l){var F=(N=p[ju(e,l)&R])>>4;if((l+=15&N)>y){u&&Gu(0);break}if(N||Gu(2),F<256)n[h++]=F;else{if(256==F){j=l,p=null;break}var U=F-254;if(F>264){var B=mu[M=F-257];U=Du(e,l,(1<<B)-1)+xu[M],l+=B}var G=d[ju(e,l)&D],q=G>>4;G||Gu(3),l+=15&G;z=Au[q];if(q>3){B=yu[q];z+=ju(e,l)&(1<<B)-1,l+=B}if(l>y){u&&Gu(0);break}s&&c(h+131072);var V=h+U;if(h<z){var $=a-z,J=Math.min(z,V);for($+h<0&&Gu(3);h<J;++h)n[h]=r[$+h]}for(;h<V;++h)n[h]=n[h-z]}}t.l=p,t.p=j,t.b=h,t.f=f,p&&(f=1,t.m=g,t.d=d,t.n=m)}while(!f);return h!=n.length&&o?Uu(n,0,h):n.subarray(0,h)},Vu=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},$u=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Ju=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Qu,l:0};if(1==i){var o=new pu(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],u=n[1],c=0,f=1,l=2;for(n[0]={s:-1,f:s.f+u.f,l:s,r:u};f!=i-1;)s=n[n[c].f<n[l].f?c++:l++],u=n[c!=f&&n[c].f<n[l].f?c++:l++],n[f++]={s:-1,f:s.f+u.f,l:s,r:u};var h=a[0].s;for(r=1;r<i;++r)a[r].s>h&&(h=a[r].s);var p=new du(h+1),d=Wu(n[f-1],p,0);if(d>t){r=0;var g=0,m=d-t,y=1<<m;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(!(p[v]>t))break;g+=y-(1<<d-p[v]),p[v]=t}for(g>>=m;g>0;){var b=a[r].s;p[b]<t?g-=1<<t-p[b]++-1:++r}for(;r>=0&&g;--r){var _=a[r].s;p[_]==t&&(--p[_],++g)}d=t}return{t:new pu(p),l:d}},Wu=function(e,t,n){return-1==e.s?Math.max(Wu(e.l,t,n+1),Wu(e.r,t,n+1)):t[e.s]=n},Zu=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new du(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Yu=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Hu=function(e,t,n){var r=n.length,i=Fu(t+2);e[i]=255&r,e[i+1]=r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Xu=function(e,t,n,r,i,a,o,s,u,c,f){Vu(t,f++,n),++i[256];for(var l=Ju(i,15),h=l.t,p=l.l,d=Ju(a,15),g=d.t,m=d.l,y=Zu(h),v=y.c,b=y.n,_=Zu(g),x=_.c,w=_.n,S=new du(19),A=0;A<v.length;++A)++S[31&v[A]];for(A=0;A<x.length;++A)++S[31&x[A]];for(var E=Ju(S,7),M=E.t,I=E.l,k=19;k>4&&!M[vu[k-1]];--k);var C,P,O,N,T=c+5<<3,L=Yu(i,Pu)+Yu(a,Ou)+o,z=Yu(i,h)+Yu(a,g)+o+14+3*k+Yu(S,M)+2*S[16]+3*S[17]+7*S[18];if(u>=0&&T<=L&&T<=z)return Hu(t,f,e.subarray(u,u+c));if(Vu(t,f,1+(z<L)),f+=2,z<L){C=Cu(h,p,0),P=h,O=Cu(g,m,0),N=g;var R=Cu(M,I,0);Vu(t,f,b-257),Vu(t,f+5,w-1),Vu(t,f+10,k-4),f+=14;for(A=0;A<k;++A)Vu(t,f+3*A,M[vu[A]]);f+=3*k;for(var D=[v,x],j=0;j<2;++j){var F=D[j];for(A=0;A<F.length;++A){var U=31&F[A];Vu(t,f,R[U]),f+=M[U],U>15&&(Vu(t,f,F[A]>>5&127),f+=F[A]>>12)}}}else C=Nu,P=Pu,O=Lu,N=Ou;for(A=0;A<s;++A){var B=r[A];if(B>255){$u(t,f,C[(U=B>>18&31)+257]),f+=P[U+257],U>7&&(Vu(t,f,B>>23&31),f+=mu[U]);var G=31&B;$u(t,f,O[G]),f+=N[G],G>3&&($u(t,f,B>>5&8191),f+=yu[G])}else $u(t,f,C[B]),f+=P[B]}return $u(t,f,C[256]),f+P[256]},Ku=new gu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qu=new pu(0),ec=function(e,t,n,r,i,a){var o=a.z||e.length,s=new pu(r+o+5*(1+Math.ceil(o/7e3))+i),u=s.subarray(r,s.length-i),c=a.l,f=7&(a.r||0);if(t){f&&(u[0]=a.r>>3);for(var l=Ku[t-1],h=l>>13,p=8191&l,d=(1<<n)-1,g=a.p||new du(32768),m=a.h||new du(d+1),y=Math.ceil(n/3),v=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<v)&d},_=new gu(25e3),x=new du(288),w=new du(32),S=0,A=0,E=a.i||0,M=0,I=a.w||0,k=0;E+2<o;++E){var C=b(E),P=32767&E,O=m[C];if(g[P]=O,m[C]=P,I<=E){var N=o-E;if((S>7e3||M>24576)&&(N>423||!c)){f=Xu(e,u,0,_,x,w,A,M,k,E-k,f),M=S=A=0,k=E;for(var T=0;T<286;++T)x[T]=0;for(T=0;T<30;++T)w[T]=0}var L=2,z=0,R=p,D=P-O&32767;if(N>2&&C==b(E-D))for(var j=Math.min(h,N)-1,F=Math.min(32767,E),U=Math.min(258,N);D<=F&&--R&&P!=O;){if(e[E+L]==e[E+L-D]){for(var B=0;B<U&&e[E+B]==e[E+B-D];++B);if(B>L){if(L=B,z=D,B>j)break;var G=Math.min(D,B-2),q=0;for(T=0;T<G;++T){var V=E-D+T&32767,$=V-g[V]&32767;$>q&&(q=$,O=V)}}}D+=(P=O)-(O=g[P])&32767}if(z){_[M++]=268435456|wu[L]<<18|Eu[z];var J=31&wu[L],W=31&Eu[z];A+=mu[J]+yu[W],++x[257+J],++w[W],I=E+L,++S}else _[M++]=e[E],++x[e[E]]}}for(E=Math.max(E,I);E<o;++E)_[M++]=e[E],++x[e[E]];f=Xu(e,u,c,_,x,w,A,M,k,E-k,f),c||(a.r=7&f|u[f/8|0]<<3,f-=7,a.h=m,a.p=g,a.i=E,a.w=I)}else{for(E=a.w||0;E<o+c;E+=65535){var Z=E+65535;Z>=o&&(u[f/8|0]=c,Z=o),f=Hu(u,f+1,e.subarray(E,Z))}a.i=o}return Uu(s,0,r+Fu(f)+i)},tc=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),nc=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=tc[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},rc=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new pu(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ec(e,null==t.level?6:t.level,null==t.mem?i.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,n,r,i)},ic=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ac=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var s=r[o],u=a[o];if("function"==typeof s){t+=";"+u+"=";var c=s.toString();if(s.prototype)if(-1!=c.indexOf("[native code]")){var f=c.indexOf(" ",8)+1;t+=c.slice(f,c.indexOf("(",f))}else for(var l in t+=c,s.prototype)t+=";"+u+".prototype."+l+"="+s.prototype[l].toString();else t+=c}else n[u]=s}return t},oc=[],sc=function(e,t,n,r){if(!oc[n]){for(var i="",a={},o=e.length-1,s=0;s<o;++s)i=ac(e[s],i,a);oc[n]={c:ac(e[o],i,a),e:a}}var u=ic({},oc[n].e);return function(e,t,n,r,i){var a=new Worker(hu[t]||(hu[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=new Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}(oc[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,u,function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t}(u),r)},uc=function(){return[pu,du,gu,mu,yu,vu,xu,Au,Tu,zu,Mu,Bu,Cu,Ru,Du,ju,Fu,Uu,Gu,qu,Ac,hc,pc]},cc=function(){return[pu,du,gu,mu,yu,vu,wu,Eu,Nu,Pu,Lu,Ou,Mu,Ku,Qu,Cu,Vu,$u,Ju,Wu,Zu,Yu,Hu,Xu,Fu,Uu,ec,rc,Sc,hc]},fc=function(){return[bc,wc,vc,nc,tc]},lc=function(){return[_c,xc]},hc=function(e){return postMessage(e,[e.buffer])},pc=function(e){return e&&{out:e.size&&new pu(e.size),dictionary:e.dictionary}},dc=function(e,t,n,r,i,a){var o=sc(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},gc=function(e,t){return e[t]|e[t+1]<<8},mc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yc=function(e,t){return mc(e,t)+4294967296*mc(e,t+4)},vc=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},bc=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&vc(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},_c=function(e){31==e[0]&&139==e[1]&&8==e[2]||Gu(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)},xc=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},wc=function(e){return 10+(e.filename?e.filename.length+1:0)};function Sc(e,t){return rc(e,t||{},0,0)}function Ac(e,t){return qu(e,{i:2},t&&t.out,t&&t.dictionary)}function Ec(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[cc,fc,function(){return[Mc]}],function(e){return hc(Mc(e.data[0],e.data[1]))},2,n)}function Mc(e,t){t||(t={});var n=nc(),r=e.length;n.p(e);var i=rc(e,t,wc(t),8),a=i.length;return bc(i,t),vc(i,a-8,n.d()),vc(i,a-4,r),i}function Ic(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[uc,lc,function(){return[kc]}],function(e){return hc(kc(e.data[0],e.data[1]))},3,n)}function kc(e,t){var n=_c(e);return n+8>e.length&&Gu(6,"invalid gzip data"),qu(e.subarray(n,-8),{i:2},t&&t.out||new pu(xc(e)),t&&t.dictionary)}var Cc=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=ic(r,a[1]),a=a[0]),a instanceof pu?n[o]=[a,s]:(n[o+="/"]=[new pu(0),s],Cc(a,o,n,r))}},Pc="undefined"!=typeof TextEncoder&&new TextEncoder,Oc="undefined"!=typeof TextDecoder&&new TextDecoder;try{Oc.decode(Qu,{stream:!0})}catch(gx){}function Nc(e,t){if(Pc)return Pc.encode(e);for(var n=e.length,r=new pu(e.length+(e.length>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new pu(i+8+(n-o<<1));s.set(r),r=s}var u=e.charCodeAt(o);u<128||t?a(u):u<2048?(a(192|u>>6),a(128|63&u)):u>55295&&u<57344?(a(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++o))>>18),a(128|u>>12&63),a(128|u>>6&63),a(128|63&u)):(a(224|u>>12),a(128|u>>6&63),a(128|63&u))}return Uu(r,0,i)}function Tc(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Oc)return Oc.decode(e);var i=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Uu(e,n-1)};i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=i.s;return(n=i.r).length&&Gu(8),a}var Lc=function(e,t){return t+30+gc(e,t+26)+gc(e,t+28)},zc=function(e,t,n){var r=gc(e,t+28),i=Tc(e.subarray(t+46,t+46+r),!(2048&gc(e,t+8))),a=t+46+r,o=mc(e,t+20),s=n&&4294967295==o?Rc(e,a):[o,mc(e,t+24),mc(e,t+42)],u=s[0],c=s[1],f=s[2];return[gc(e,t+10),u,c,i,a+gc(e,t+30)+gc(e,t+32),f]},Rc=function(e,t){for(;1!=gc(e,t);t+=4+gc(e,t+2));return[yc(e,t+12),yc(e,t+4),yc(e,t+20)]},Dc=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Gu(9),t+=r+4}return t},jc=function(e,t,n,r,i,a,o,s){var u=r.length,c=n.extra,f=s&&s.length,l=Dc(c);vc(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8;var h=new Date(null==n.mtime?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&Gu(10),vc(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,-1!=a&&(vc(e,t,n.crc),vc(e,t+4,a<0?-a-2:a),vc(e,t+8,n.size)),vc(e,t+12,u),vc(e,t+14,l),t+=16,null!=o&&(vc(e,t,f),vc(e,t+6,n.attrs),vc(e,t+10,o),t+=14),e.set(r,t),t+=u,l)for(var d in c){var g=c[d],m=g.length;vc(e,t,+d),vc(e,t+2,m),e.set(g,t+4),t+=4+m}return f&&(e.set(s,t),t+=f),t},Fc=function(e,t,n,r,i){vc(e,t,101010256),vc(e,t+8,n),vc(e,t+10,n),vc(e,t+12,r),vc(e,t+16,i)};function Uc(e,t,n){n||(n=t,t={}),"function"!=typeof n&&Gu(7);var r={};Cc(e,"",r,t);var i=Object.keys(r),a=i.length,o=0,s=0,u=a,c=new Array(a),f=[],l=function(){for(var e=0;e<f.length;++e)f[e]()},h=function(e,t){Bc(function(){n(e,t)})};Bc(function(){h=n});var p=function(){var e=new pu(s+22),t=o,n=s-o;s=0;for(var r=0;r<u;++r){var i=c[r];try{var a=i.c.length;jc(e,s,i,i.f,i.u,a);var f=30+i.f.length+Dc(i.extra),l=s+f;e.set(i.c,l),jc(e,o,i,i.f,i.u,a,s,i.m),o+=16+f+(i.m?i.m.length:0),s=l+a}catch(e){return h(e,null)}}Fc(e,o,c.length,n,t),h(null,e)};a||p();for(var d=function(e){var t=i[e],n=r[t],u=n[0],d=n[1],g=nc(),m=u.length;g.p(u);var y=Nc(t),v=y.length,b=d.comment,_=b&&Nc(b),x=_&&_.length,w=Dc(d.extra),S=0==d.level?0:8,A=function(n,r){if(n)l(),h(n,null);else{var i=r.length;c[e]=ic(d,{size:m,crc:g.d(),c:r,f:y,m:_,u:v!=t.length||_&&b.length!=x,compression:S}),o+=30+v+w+i,s+=76+2*(v+w)+(x||0)+i,--a||p()}};if(v>65535&&A(Gu(11,0,1),null),S)if(m<16e4)try{A(null,Sc(u,d))}catch(e){A(e,null)}else f.push(function(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[cc],function(e){return hc(Sc(e.data[0],e.data[1]))},0,n)}(u,d,A));else A(null,u)},g=0;g<u;++g)d(g);return l}var Bc="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()};function Gc(e,t,n){n||(n=t,t={}),"function"!=typeof n&&Gu(7);var r=[],i=function(){for(var e=0;e<r.length;++e)r[e]()},a={},o=function(e,t){Bc(function(){n(e,t)})};Bc(function(){o=n});for(var s=e.length-22;101010256!=mc(e,s);--s)if(!s||e.length-s>65558)return o(Gu(13,0,1),null),i;var u=gc(e,s+8);if(u){var c=u,f=mc(e,s+16),l=4294967295==f||65535==c;if(l){var h=mc(e,s-12);(l=101075792==mc(e,h))&&(c=u=mc(e,h+32),f=mc(e,h+48))}for(var p=t&&t.filter,d=function(t){var n=zc(e,f,l),s=n[0],c=n[1],h=n[2],d=n[3],g=n[4],m=n[5],y=Lc(e,m);f=g;var v=function(e,t){e?(i(),o(e,null)):(t&&(a[d]=t),--u||o(null,a))};if(!p||p({name:d,size:c,originalSize:h,compression:s}))if(s)if(8==s){var b=e.subarray(y,y+c);if(h<524288||c>.8*h)try{v(null,Ac(b,{out:new pu(h)}))}catch(e){v(e,null)}else r.push(function(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[uc],function(e){return hc(Ac(e.data[0],pc(e.data[1])))},1,n)}(b,{size:h},v))}else v(Gu(14,"unknown compression type "+s,1),null);else v(null,Uu(e,y,y+c));else v(null,null)},g=0;g<c;++g)d()}else o(null,{});return i}function qc(){return"undefined"!=typeof window&&void 0!==window.document}var Vc=Object.freeze({__proto__:null,runningInBrowser:qc});function $c(e){return e.length>2&&e.buffer instanceof ArrayBuffer&&31==e[0]&&139==e[1]}function Jc(e,t){return"string"==typeof e&&(e=Nc(e)),qc()?Mc(e,t):na.gzipSync(e,t)}async function Wc(e,n){return"string"==typeof e&&(e=Nc(e)),(qc()?t.promisify(Ec):t.promisify(na.gzip))(e,n)}async function Zc(e,n){e instanceof ArrayBuffer&&(e=new Uint8Array(e)),n=n||{};var r=qc()?t.promisify(Ic):t.promisify(na.gunzip),i=await r(e,n);return n.filename&&!Af(n.filename)&&(i=Tc(i)),i}function Yc(e,t){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n=kc(e);return t&&!Af(t)&&(n=Tc(n)),n}var Hc=Object.freeze({__proto__:null,gunzipAsync:Zc,gunzipSync:Yc,gzipAsync:Wc,gzipSync:Jc,isGzipped:$c});async function Xc(e){var t=e.getFields(),n=e.getRecords(),r=[],i=await Promise.all(t.map(function(e){var t=ei(e,n);return r.push(t),async function(e,t,n){if("number"==t||"string"==t)return Wc(JSON.stringify(ii(n,e)),{level:2,consume:!0});return ii(n,e)}(e,t,n)}));return{fields:t,types:r,data:i,size:n.length}}function Kc(e){return t=e,Array.isArray(t.fields)&&Array.isArray(t.types)&&Array.isArray(t.data)&&t.fields.length==t.types.length&&t.fields.length==t.data.length&&t.size>=0?function(e){for(var t=e.size,n=[],r=0;r<t;r++)n[r]={};for(var i=0,a=e.fields.length;i<a;i++)Qc(e.fields[i],e.types[i],e.data[i],n),e.data[i]=null;return n}(e):$c(e)?JSON.parse(Tc(Yc(e))):Array.isArray(e)?e:void vt("Unknown packed table format");var t}function Qc(e,t,n,r){var i;$c(n)?i=JSON.parse(Tc(Yc(n))):Array.isArray(n)?i=n:vt("Unexpected packed table format");for(var a=0,o=r.length;a<o;a++)r[a][e]=i[a]}var ef="msx";async function tf(e,t){return[{content:nf(await rf(e,t)),filename:t.file||"mapshaper_snapshot."+ef}]}function nf(e){return uu(e,{})}async function rf(e,t){return{version:1,created:(new Date).toISOString(),datasets:await Promise.all(e.map(e=>af(e,t)))}}async function af(e,t){var n=e.arcs,r=null;n&&((r=n.getVertexData()).zlimit=n.getRetainedInterval(),r=await of(r,t));var i=e.layers.map(e=>async function(e,t){var n=null;e.data&&(n=await Xc(e.data));return{name:e.name||null,geometry_type:e.geometry_type||null,shapes:e.shapes||null,data:n,menu_order:e.menu_order||null,pinned:e.pinned||t.show_all||!1,active:!(!e.active&&e!=t.active_layer)}}(e,t));return{arcs:r,info:e.info?uf(e.info):null,layers:await Promise.all(i)}}async function of(e,t){var n;t.compact&&e.zz&&((n=e).zz&&n.zlimit&&delete(n=en(n,n.zlimit)).zz,e=n);var r={nn:sf(e.nn),xx:sf(e.xx),yy:sf(e.yy),zz:e.zz?sf(e.zz):null,zlimit:e.zlimit||0};return t.compact&&e.zz&&await async function(e,t){var n=Object.assign({level:1,consume:!1},t),r=[Wc(e.nn,n),Wc(e.xx,n),Wc(e.yy,n)];e.zz&&r.push(Wc(e.zz,n));var i=await Promise.all(r);e.nn=i.shift(),e.xx=i.shift(),e.yy=i.shift(),e.zz&&(e.zz=i.shift())}(r),r}function sf(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function uf(e){return!(e=Object.assign({},e)).crs||e.crs_string||e.prj||(e.crs_string=ga(e.crs)),delete e.crs,e}var cf=Object.freeze({__proto__:null,PACKAGE_EXT:ef,compressSnapshotForExport:async function(e){var t=e.datasets.map(e=>{!async function(e){if(!e.arcs)return;var t=function(e){return{nn:new Uint32Array(e.nn.buffer,0,e.nn.length/4),xx:new Float64Array(e.xx.buffer,0,e.xx.length/8),yy:new Float64Array(e.yy.buffer,0,e.yy.length/8),zz:e.zz?new Float64Array(e.zz.buffer,0,e.zz.length/8):null,zlimit:e.zlimit||0}}(e.arcs);e.arcs=await of(t,{compact:!0})}(e)});await Promise.all(t)},exportDataset:af,exportDatasetsToPack:rf,exportInfo:uf,exportPackedDatasets:tf,pack:nf});function ff(e){var t=Ro(e||"").toLowerCase(),n=null;return"dbf"==t||"shp"==t||"kml"==t||lf(t)?n=t:/json$/.test(t)?n="json":"csv"==t||"tsv"==t||"txt"==t||"tab"==t?n="text":t==ef&&(n=ef),n}function lf(e){return"prj"==e||"shx"==e||"cpg"==e}function hf(e){var n=null;return t.isString(e)?n=(df(e)?"json":gf(e)&&"kml")||"text":(t.isObject(e)&&e.type||t.isArray(e))&&(n="json"),n}function pf(e,t){return ff(e)||hf(t)}function df(e){return/^\s*[{[]/.test(String(e))}function gf(e){return(e=String(e)).includes("<kml ")&&e.includes('xmlns="http://www.opengis.net/kml/')}function mf(e){var t=Ro(e).toLowerCase();return/csv|tsv|txt$/.test(t)}function yf(e){var t=ff(e);return!!t&&"gz"!=t&&"zip"!=t}function vf(e){return e.endsWith("."+ef)}function bf(e){return/\.zip$/i.test(e)}function _f(e){return/\.kmz$/i.test(e)}function xf(e){return/\.gz$/i.test(e)}function wf(e){return["geojson","topojson","json","dsv","dbf","shapefile","svg","kml",ef].indexOf(e)>-1}function Sf(e){var t=Ro(e).toLowerCase();return"shp"==t||"shx"==t||"dbf"==t||t==ef}function Af(e){var t=ff(e);return Sf(e)||bf(e)||xf(e)||_f(e)||vf(e)||"json"==t||"text"==t}function Ef(e){return/\.(shx|prj|xls|xlsx|gdb|sbn|sbx|xml)$/i.test(e)}var Mf=Object.freeze({__proto__:null,couldBeDsvFile:mf,filenameIsUnsupportedOutputType:Ef,getFormatName:function(e){return{geojson:"GeoJSON",topojson:"TopoJSON",json:"JSON records",dsv:"CSV",dbf:"DBF",kml:"KML",kmz:"KMZ",[ef]:"Snapshot file",shapefile:"Shapefile",svg:"SVG"}[e]||""},guessInputContentType:hf,guessInputFileType:ff,guessInputType:pf,isAuxiliaryInputFileType:lf,isGzipFile:xf,isImportableAsBinary:Af,isKmzFile:_f,isPackageFile:vf,isSupportedBinaryInputType:Sf,isSupportedOutputFormat:wf,isZipFile:bf,looksLikeContentFile:yf,looksLikeImportableFile:function(e){return!!ff(e)||Af(e)},stringLooksLikeJSON:df,stringLooksLikeKML:gf});function If(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!qc())return function(e){var t=new require("adm-zip")(e),n={};return t.getEntries().forEach(function(e){var t=Fo(e.name);Of(t)&&(n[t]=e.getData())}),n}(e);var t=function(e,t){for(var n={},r=e.length-22;101010256!=mc(e,r);--r)(!r||e.length-r>65558)&&Gu(13);var i=gc(e,r+8);if(!i)return{};var a=mc(e,r+16),o=4294967295==a||65535==i;if(o){var s=mc(e,r-12);(o=101075792==mc(e,s))&&(i=mc(e,s+32),a=mc(e,s+48))}for(var u=t&&t.filter,c=0;c<i;++c){var f=zc(e,a,o),l=f[0],h=f[1],p=f[2],d=f[3],g=f[4],m=f[5],y=Lc(e,m);a=g,u&&!u({name:d,size:h,originalSize:p,compression:l})||(l?8==l?n[d]=Ac(e.subarray(y,y+h),{out:new pu(p)}):Gu(14,"unknown compression type "+l):n[d]=Uu(e,y,y+h))}return n}(e,{filter:Cf});return Pf(t)}function kf(e){return qc()?function(e,t){t||(t={});var n={},r=[];Cc(e,"",n,t);var i=0,a=0;for(var o in n){var s=n[o],u=s[0],c=s[1],f=0==c.level?0:8,l=(S=Nc(o)).length,h=c.comment,p=h&&Nc(h),d=p&&p.length,g=Dc(c.extra);l>65535&&Gu(11);var m=f?Sc(u,c):u,y=m.length,v=nc();v.p(u),r.push(ic(c,{size:u.length,crc:v.d(),c:m,f:S,m:p,u:l!=o.length||p&&h.length!=d,o:i,compression:f})),i+=30+l+g+y,a+=76+2*(l+g)+(d||0)+y}for(var b=new pu(a+22),_=i,x=a-i,w=0;w<r.length;++w){var S=r[w];jc(b,S.o,S,S.f,S.u,S.c.length);var A=30+S.f.length+Dc(S.extra);b.set(S.c,S.o+A),jc(b,i,S,S.f,S.u,S.c.length,S.o,S.m),i+=16+A+(S.m?S.m.length:0)}return Fc(b,i,r.length,x,_),b}(Nf(e)):function(e){var t=new require("adm-zip")();return e.forEach(function(e){var n=e.content;n instanceof ArrayBuffer?n=new Uint8Array(n):n instanceof ne||n instanceof Uint8Array||(n=ne.from(e.content)),t.addFile(e.filename,n)}),t.toBuffer()}(e)}function Cf(e){return Of(e.name)}function Pf(e){return Object.keys(e).reduce(function(t,n){var r=Lo(n).filename,i=e[n];return Af(r)||(i=Tc(i)),t[r]=i,t},{})}function Of(e){var t=Lo(e);return yf(e)&&!/^__MACOSX/.test(e)&&"."!=t.filename[0]}function Nf(e){var t={};return e.forEach(function(e){"string"==typeof e.content?e.content=Nc(e.content):e.content instanceof ArrayBuffer&&(e.content=new Uint8Array(e.content)),t[e.filename]=e.content}),t}var Tf=Object.freeze({__proto__:null,isImportableZipPath:Of,unzipAsync:function(e,t){qc()||vt("Async unzipping only supported in the browser"),e instanceof ArrayBuffer&&(e=new Uint8Array(e)),Gc(e,{filter:Cf},function(e,n){e&&t(e),t(null,Pf(n))})},unzipSync:If,zipAsync:function(e,t){Uc(Nf(e),{},t)},zipSync:kf}),Lf={};async function zf(e,t){return Rf(e,t)}Lf.isFile=function(e,t){if(t&&e in t)return!0;if(qc())return!1;var n=Lf.statSync(e);return n&&n.isFile()||!1},Lf.isDirectory=function(e){if(qc())return!1;var t=Lf.statSync(e);return t&&t.isDirectory()||!1},Lf.readFile=function(e,t,n){var r;return n&&e in n?(r=n[e],delete n[e]):"/dev/stdin"==e?r=s("rw").readFileSync(e):((i("input_files")||[]).push(e),r=s("fs").readFileSync(e)),t&&u.isBuffer(r)&&(r=Wr($r(r,t))),r},Lf.createDirIfNeeded=function(e){var t=Lo(e).directory;if(t&&!Lf.isDirectory(t)&&"/dev/stdout"!=e)try{s("fs").mkdirSync(t,{recursive:!0}),xt("Created output directory:",t)}catch(e){bt("Unable to create output directory:",t)}},Lf.writeFileSync=function(e,n){Lf.createDirIfNeeded(e),t.isString(n)?s("fs").writeFileSync(e,n):Lf.writeFileInChunks(e,n,1e7)},Lf.writeFileInChunks=function(e,t,n){var r,i,a=s("fs"),o=a.openSync(e,"w"),u=0,c=t.length;do{i=Math.min(n,c-u),u+=r=a.writeSync(o,t,u,i)}while(r>0&&u<c);a.closeSync(o)},Lf.convertArrayBuffer=function(e){for(var n=new Uint8Array(e),r=t.createBuffer(n.length),i=0,a=n.length;i<a;i++)r[i]=n[i];return r},Lf.expandDirectoryName=function(e){var n=Lo(e);if(!n.filename.includes("*"))return[e];var r=t.wildcardToRegExp(n.filename),i=[];return s("fs").readdirSync(n.directory||".").forEach(function(e){var t=n.directory?s("path").join(n.directory,e):e;r.test(e)&&Lf.isDirectory(t)&&i.push(t)}),i},Lf.expandFileName=function(e){var n=Lo(e),r=t.wildcardToRegExp(n.filename),i=Lf.expandDirectoryName(n.directory||"."),a=[];try{i.forEach(function(e){s("fs").readdirSync(e).forEach(function(t){var n=s("path").join(e,t);r.test(t)&&Lf.isFile(n)&&a.push(n)})})}catch(e){}return 0===a.length&&bt("No files matched ("+e+")"),a},Lf.expandInputFiles=function(e){return e.reduce(function(e,t){return t.indexOf("*")>-1?e=e.concat(Lf.expandFileName(t)):e.push(t),e},[])},Lf.validateOutputDir=function(e){Lf.isDirectory(e)||qc()||vt("Output directory not found:",e)},Lf.checkFileExists=function(e,t){Lf.isFile(e,t)||"/dev/stdin"==e||bt("File not found ("+e+")")},Lf.statSync=function(e){var t=null;try{t=s("fs").statSync(e)}catch(e){}return t};var Rf=function(e,n){if(e.length>0==!1)xt("No files to save");else if(n.dry_run);else if(n.stdout)s("rw").writeFile("/dev/stdout",e[0].content,function(){});else{n.zip&&(e=[{filename:n.zipfile||"output.zip",content:kf(e)}]);var r=Df(t.pluck(e,"filename"),n),a=i("input_files");e.forEach(function(e,t){var i=r[t];e.content instanceof ArrayBuffer&&(e.content=Lf.convertArrayBuffer(e.content)),n.output?n.output.push({filename:i,content:e.content}):(!n.force&&a.indexOf(i)>-1&&bt('Need to use the "-o force" option to overwrite input files.'),Lf.writeFileSync(i,e.content),xt("Wrote "+i))})}};function Df(e,t){var n=t.directory;return n&&(e=e.map(function(e){return s("path").join(n,e)})),e}var jf=Object.freeze({__proto__:null,getOutputPaths:Df,replaceWriteFiles:function(e){Rf=e},writeFiles:zf});function Ff(e){var t,n;if(!e.length)return function(){return[]};function r(t){return e[t]}return n=s("flatbush"),t=new n(e.length),e.forEach(function(e){var n=e.bounds;t.add(n.xmin,n.ymin,n.xmax,n.ymax)}),t.finish(),function(e,n,i,a){return t.search(e,n,i,a).map(r)}}function Uf(e,t){!function(e,t){function n(e,n){var r=t[e];t[e]=t[n],t[n]=r}for(var r=0,i=t.length;r<i;r+=2)e[t[r]]>e[t[r+1]]&&n(r,r+1)}(e,t),Gf(e,t,0,t.length-2)}function Bf(e,t,n,r){for(var i,a,o=n+2;o<=r;o+=2){i=t[o],a=t[o+1];for(var s=o-2;s>=n&&e[i]<e[t[s]];s-=2)t[s+2]=t[s],t[s+3]=t[s+1];t[s+2]=i,t[s+3]=a}}function Gf(e,t,n,r){for(var i,a,o=n,s=r;o<r;){for(i=e[t[n+r>>2<<1]];o<=s;){for(;e[t[o]]<i;)o+=2;for(;e[t[s]]>i;)s-=2;o<=s&&(a=t[o],t[o]=t[s],t[s]=a,a=t[o+1],t[o+1]=t[s+1],t[s+1]=a,o+=2,s-=2)}if(s-n<40?Bf(e,t,n,s):Gf(e,t,n,s),r-o<40)return void Bf(e,t,o,r);n=o,s=r}}function qf(e,t,n){var r,i,a,o,s,u,c=t.getVertexData(),f=t.getMultiShapeBounds(e);function l(e,t,n){var r,u,f,l=s[n],h=0,p=c.xx,d=c.yy;r=n==o?i.length-l:s[n+1]-l;for(var g=0;g<r;g++)u=i[g+l],f=a[g+l],h+=fr.testRayIntersection(e,t,p[u],d[u],p[f],d[f]);return h}function h(e){var t=Math.floor((e-r)/u);return t<0&&(t=0),t>=o&&(t=o-1),t}!function(){var n,f,l,p,d,g,m,y,v,b,_=c.xx,x=0,w=0,S=-1;_r(e,t,function(){x++}),f=new Uint32Array(2*x),m=0,_r(e,t,function(e,t,n,r){f[m++]=e,f[m++]=t}),Uf(_,f),i=new Uint32Array(x),a=new Uint32Array(x),o=function(e){var t=Math.pow(e,.75)/10;return Math.ceil(t)}(x),s=new Uint32Array(o+1),r=_[f[0]],u=(_[f[f.length-2]]-r)/o,l=0,p=x-1;for(;w<x;){for(d=f[y=2*w],g=f[y+1],v=_[d],b=_[g],n=S,S=h(v);S>n;)n++,s[n]=l;b-v>=0==!1&&vt("Invalid segment"),h(b)-S>1?(i[p]=d,a[p]=g,p--):(i[l]=d,a[l]=g,l++),w++}s[o]=l,l!=p+1&&vt("Segment indexing error")}(),this.pointInPolygon=function(e,t){if(!f.containsPoint(e,t))return!1;var n=h(e),r=l(e,t,n);return n>0&&(r+=l(e,t,n-1)),r+=l(e,t,o),isNaN(r)?-1:r%2==1?1:0}}function Vf(e,n){var r=Ff(function(e,t){var n=[];return e.forEach(function(e,r){for(var i=e?e.length:0,a=0;a<i;a++)n.push({ids:e[a],id:r,bounds:t.getSimpleShapeBounds(e[a])})}),n}(e,n)),i=gr(e,n).area();function a(e,t){return!!t.bounds.containsPoint(e[0],e[1])&&(!t.index&&t.bounds.area()>.01*i&&(t.index=new qf([t.ids],n)),t.index?t.index.pointInPolygon(e[0],e[1]):fr.testPointInRing(e[0],e[1],t.ids,n))}function o(e,t){var n=!1,r=!1;return t.forEach(function(t){var i=a(e,t);-1==i?n=!0:1==i&&(r=!r)}),n||r}function s(e){var t,n,r=[];if(e.length>0){e.sort(function(e,t){return e.id-t.id});for(var i=0;i<e.length;i++)n=e[i],0!==i&&n.id==e[i-1].id||r.push(t=[]),t.push(n)}return r}function u(e,t){var n=t>0?t:0;return e[0],e[1],r(e[0]-n,e[1]-n,e[0]+n,e[1]+n)}function c(e){var t=e[0],r=n.getVertex(t,0),i=n.getVertex(t,1);return[(r.x+i.x)/2,(r.y+i.y)/2]}this.findEnclosingShapes=function(e){var t=[];return s(u(e)).forEach(function(n){o(e,n)&&t.push(n[0].id)}),t},this.findEnclosingShape=function(e){var t=-1;return s(u(e)).forEach(function(n){o(e,n)&&(t=n[0].id)}),t},this.findShapesEnclosingArc=function(e){var t=c([e]);return this.findEnclosingShapes(t)},this.findPointEnclosureCandidates=function(e,n){var r=u(e,n);return t.pluck(r,"id")},this.pointIsEnclosed=function(e){return o(e,u(e))},this.findSmallestEnclosingPolygon=function(e){var t,r=n.getSimpleShapeBounds(e),i=c(e);return u(i).forEach(function(e){!e.bounds.contains(r)||e.bounds.sameBounds(r)||t&&t.bounds.area()<e.bounds.area()||a(i,e)&&(t=e)}),t?t.id:-1},this.arcIsEnclosed=function(e){return this.pointIsEnclosed(c([e]))},this.pathIsEnclosed=function(e){return this.pointIsEnclosed(c(e))},this.findEnclosedPaths=function(e){var t,i=n.getSimpleShapeBounds(e),a=r(i.xmin,i.ymin,i.xmax,i.ymax),o=[];return a.length>6&&(t=new qf([e],n)),a.forEach(function(r){var a=c(r.ids);i.containsPoint(a[0],a[1])&&i.contains(r.bounds)&&(t?t.pointInPolygon(a[0],a[1]):fr.testPointInRing(a[0],a[1],e,n))&&o.push(r.ids)}),o.length>0?o:null},this.findPathsInsideShape=function(e){var t=[];return e.forEach(function(e){var n=this.findEnclosedPaths(e);n&&(t=function(e,t){var n,r=[];for(n=0;n<e.length;n++)-1==t.indexOf(e[n])&&r.push(e[n]);for(n=0;n<t.length;n++)-1==e.indexOf(t[n])&&r.push(t[n]);return r}(t,n))},this),t.length>0?t:null}}function $f(e,t){e.shapes=e.shapes.map(function(e){return e?function(e,t){var n=Er(e,t,"polygon");return n.sort(function(e,t){return Math.abs(t.area)-Math.abs(e.area)}),n.forEach(function(e,r){for(var i,a,o,s=!0,u=r;--u>=0;)if(Jf(e,i=n[u],t)){s=!(i.area>0);break}o=s,(a=e).area>0!=o&&(a.area=-a.area,mr(a.ids))}),n.map(function(e){return e.ids})}(e,t):null})}function Jf(e,t,n){if(!1===t.bounds.contains(e.bounds))return!1;var r=function(e,t){var n=t.getVertex(e,0),r=t.getVertex(e,1);return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}(e.ids[0],n);return 1==fr.testPointInRing(r.x,r.y,t.ids,n)}function Wf(e,t,n){var r,i=[],a=[],o=n?-1:1;return(e||[]).forEach(function(e){e.area*o>0?a.push([e]):e.area*o<0&&i.push(e)}),0===i.length||(r=Ff(a.map(function(e,t){return{bounds:e[0].bounds,idx:t}})),i.forEach(function(e){for(var n,i,s,u,c=-1,f=0,l=e.area*-o,h=e.bounds,p=r(h.xmin,h.ymin,h.xmax,h.ymax),d=0,g=p.length;d<g;d++)i=p[d].idx,s=(n=a[i][0]).area*o,(u=n.bounds.contains(e.bounds)&&s>l)&&p.length>1&&!Jf(e,n,t)||u&&(0===f||s<f)&&(f=s,c=i);-1==c?Ct("[groupPolygonRings()] polygon hole is missing a containing ring, dropping."):a[c].push(e)})),a}function Zf(e){var t;return e&&0!==e.length?{bounds:(t={points:e,pointCount:e.length,bounds:fr.getPathBounds(e)}).bounds,pathData:[t],partCount:1,pointCount:t.pointCount}:{partCount:0,pointCount:0}}function Yf(e,t,n){if("point"==n)return Zf(e);var r=0,i=new qt,a=[];return!e||"polyline"!=n&&"polygon"!=n||e.forEach(function(e,o){var s=function(e){var t,n,r,i,a=[],o=0;for(;e.hasNext();)t=e.x,n=e.y,0!==o&&r==t&&i==n||(a.push([t,n]),o++),r=t,i=n;return{points:a,pointCount:a.length}}(t.getShapeIter(e)),u=!0;s.ids=e,"polygon"==n?(s.area=fr.getPlanarPathArea2(s.points),u=s.pointCount>3&&0!==s.area):"polyline"==n&&(u=s.pointCount>1),u?(r+=s.pointCount,s.bounds=fr.getPathBounds(s.points),i.mergeBounds(s.bounds),a.push(s)):Mt("Skipping a collapsed",n,"path")}),{pointCount:r,pathData:a,pathCount:a.length,bounds:i}}var Hf=Object.freeze({__proto__:null,exportPathData:Yf,exportPointData:Zf});function Xf(e){return JSON.stringify(e).replace(/\n/g,"\n").replace(/\r/g,"\r")}function Kf(e){var n=t.arrayToIndex(e),r="က⿕̐",i=new RegExp('"က⿕̐|က⿕̐"',"g");function a(e,i){if(e in n&&t.isArray(i)){var a=JSON.stringify(i);if(a.indexOf(!1))return r+a.replace(/,/g,", ")+r}return i}return function(e){return JSON.stringify(e,a," ").replace(i,"")}}var Qf=Object.freeze({__proto__:null,getFormattedStringify:Kf,stringifyAsNDJSON:Xf});function el(e,t,n){for(var r=n.getVertexData(),i=r.xx,a=r.yy,o=[],s=0,u=i.length;s<u;s++)i[s]==e&&a[s]==t&&o.push(s);return o}function tl(e,t){var n=t.getVertexData();return[n.xx[e],n.yy[e]]}function nl(e,t){for(var n=t.getVertexData(),r=n.ii,i=n.nn,a=0,o=r.length;a<o;a++)if(e===r[a]+i[a]-1)return!0;return!1}function rl(e,t){return il(e,t)||nl(e,t)}function il(e,t){for(var n=t.getVertexData().ii,r=0,i=n.length;r<i;r++)if(e===n[r])return!0;return!1}function al(e,t){if(e<0)return al(~e,t).reverse();var n=t.getVertexData(),r=n.ii[e],i=n.nn[e];return[[n.xx[r],n.yy[r]],[n.xx[r+i-1],n.yy[r+i-1]]]}function ol(e,t,n,r){var i=r.getVertexData();i.xx[n]=e,i.yy[n]=t}function sl(e,t,n,r,i){for(var a,o,s,u,c=i?fr.greatCircleDistance:fr.distance2D,f=1/0,l=0;l<n.length;l++)for(u=r.getShapeIter(n[l]);u.hasNext();)(s=c(e,t,u.x,u.y))<f&&(f=s,a=u.x,o=u.y);return f<1/0?{x:a,y:o}:null}var ul=Object.freeze({__proto__:null,findNearestVertex:sl,findNearestVertices:function(e,t,n){var r=sl(e[0],e[1],t,n);return el(r.x,r.y,n)},findVertexIds:el,getArcEndCoords:function(e,t){return al(e,t)[1]},getArcEndpointCoords:al,getArcStartCoords:function(e,t){return al(e,t)[0]},getVertexCoords:tl,setVertexCoords:ol,snapPointToArcEndpoint:function(e,t,n){var r,i,a;t.forEach(function(e){il(e,n)?r=tl(e+1,n):nl(e,n)&&(r=tl(e-1,n))}),r&&(i=r[0]-e[0],a=r[1]-e[1],Math.abs(i)>Math.abs(a)?e[1]=r[1]:e[0]=r[0])},snapVerticesToPoint:function(e,t,n){var r=n.getVertexData();e.forEach(function(e){ol(t[0],t[1],e,n),n.updateArcBounds(Xt(e,r.ii))})},vertexIsArcEnd:nl,vertexIsArcEndpoint:rl,vertexIsArcStart:il});function cl(e,t){var n=["orange","blue","green","red","magenta","grey"],r=e.map(function(e,r){return function(e,t,n){return JSON.stringify({type:"Feature",properties:n,geometry:_d.exportLineGeom([[e]],t)})}(e,t,{arcId:e,stroke:n[r]||"black"})});Ct('{"type": "FeatureCollection", "features": ['+r.join(",")+"]}")}function fl(e,t){return t.getArcLength(e)>=2!=!1}function ll(e,t,n){var r=t.arcs,i=r.getVertexData(),a=i.xx,o=i.yy,s=t.getConnectedArcs(e),u=e;if(n&&(s=s.filter(n)),!fl(e,r)||0===s.length)return e;var c,f,l,h,p,d=r.indexOfVertex(e,-1),g=a[d],m=o[d],y=r.indexOfVertex(e,-2),v=a[y],b=o[y];for(p=0;p<s.length;p++)fl(f=s[p],r)?(l=r.indexOfVertex(f,-2),u!=e?(h=hl(v,b,g,m,a[c],o[c],a[l],o[l]),a[c]==a[l]&&o[c]==o[l]&&(Ct("Pathfinder warning: duplicate segments: i:",c,"j:",l,"ids:",[e].concat(s)),kt()&&cl(s,t.arcs)),2==h&&(c=l,u=f)):(c=l,u=f)):Ct("skipping one arc:",f,"out of:",s.length,s);return u==e&&vt("Pathfinder error",u,e),u}function hl(e,t,n,r,i,a,o,s){var u,c=fr.signedAngle(e,t,n,r,i,a),f=fr.signedAngle(e,t,n,r,o,s);return c<=0||f<=0?(Ct("[chooseRighthandPath()] 0 angle(s):",c,f),u=c>0?1:f>0?2:0):c<f-.001?u=1:f<c-.001?u=2:isNaN(c)||isNaN(f)?vt("Invalid node geometry"):u=pl(n,r,i,a,o,s),u}function pl(e,t,n,r,i,a){var o=sr(n,r,e,t,i,a);return o>0?2:o<0?1:0}var dl=Object.freeze({__proto__:null,chooseBetweenClosePaths:pl,getRightmostArc:ll});function gl(e,t,n){return e&~n|t&n}function ml(e,t,n){var r,i=Yt(t);i==t?r=-4:(r=-49,e<<=4),n[i]&=e|r}function yl(e,t){var n=Yt(e),r=t[n];return n!=e&&(r>>=4),7&r}function vl(e,t){br(e,function(e){e<0?t[~e]|=128:t[e]|=8})}function bl(e,t,n,r,i,a,o){br(e,function(e){var s=e<0,u=s?~e:e,c=n[u],f=s?i:r,l=s?r:i,h=c;t.arcIsLollipop(e)?(Ct("lollipop"),h=0):(f&&(h|=3),l&&(h|=48),o>0&&(h|=o),!a||34&~h||(h&=-18)),n[u]=h})}function _l(e,t,n,r,i,a){br(e,function(e){var t=e<0,o=t?~e:e,s=n[o],u=255;(t?i:r)&&(a&&(u&=-2),u^=2),(t?r:i)&&(a&&(u&=-17),u^=32),n[o]=s&u})}function xl(e,t,n){var r=null;function i(t){return~ll(t,e,r)}return n&&(r=function(e){return n(~e)}),function(n){var r,a,o=[],s=n;if(a=n,e.arcs.getArcLength(a)>1==0)return null;do{if(!t(s))return null;if(o.push(s),(s=i(r=s))==~r)return Ct("Pathfinder warning: dead-end path"),null}while(s!=n);return 0===o.length?null:o}}function wl(e,t){var n=e.arcs,r=xl(e,function(e){var n=yl(e,t),r=!1;3==n&&(r=!0,ml(1,e,t));return r},function(e){var n=yl(e,t);return!(1&~n)});return t=t||new Uint8Array(n.size()),function(e,i){var a,o="dissolve"==i,s=!0,u="flatten"==i;return e.length>0?(a=[],bl(e,n,t,s,u,o),Cr(e,function(e){for(var t,n=0,i=e.length;n<i;n++)(t=r(e[n]))&&a.push(t)}),_l(e,0,t,s,u,!0)):a=e,a}}var Sl,Al=Object.freeze({__proto__:null,andBits:function(e,t,n){return e&(~n|t)},closeArcRoutes:_l,getPathFinder:xl,getRingIntersector:wl,getRouteBits:yl,markPathsAsUsed:vl,openArcRoutes:bl,setBits:gl,setRouteBits:ml});function El(e){var t=new Uint8Array(e);this.setId=function(e){t[e]=1},this.hasId=function(e){return 1===t[e]}}function Ml(e){var t=new Uint8Array(e),n=[];this.setId=function(e){this.hasId(e)||n.push(e),e<0?t[~e]|=2:t[e]|=1},this.clear=function(){var e=this;n.forEach(function(t){e.clearId(t)}),n=[]},this.hasId=function(e){return e<0?!(2&~t[~e]):!(1&~t[e])},this.clearId=function(e){e<0?t[~e]&=1:t[e]&=2},this.getIds=function(){return n},this.setIds=function(e){for(var t=0;t<e.length;t++)this.setId(e[t])}}function Il(e,n){var r=t.extend({},n),i=e.getBounds();!e.isPlanar()&&fr.containsBounds(ra(),i.toArray());var a,o,s=i.ymin,u=i.ymax-s,c=r.stripes||Nl(e),f=new Uint32Array(c),l=c>1&&u>0?function(e){return Math.floor((c-1)*(e-s)/u)}:function(e){return 0};r.tolerance>=0==!1&&(r.tolerance=Bn(i.toArray())),e.forEachSegment(function(e,t,n,r){for(var i=l(r[e]),a=l(r[t]);f[i]=f[i]+2,i!=a;)i+=a>i?1:-1});var h,p,d=(h=t.sum(f),p=4*h,(!Sl||Sl.byteLength<p)&&(Sl=new ArrayBuffer(p)),new Uint32Array(Sl,0,h)),g=0,m=[];t.forEach(f,function(e){var t=g;g+=e,m.push(d.subarray(t,g))}),t.initializeArray(f,0),e.forEachSegment(function(e,t,n,r){for(var i,a,o=l(r[e]),s=l(r[t]);i=f[o],f[o]=i+2,(a=m[o])[i]=e,a[i+1]=t,o!=s;)o+=s>o?1:-1});var y,v=e.getVertexData(),b=[];for(a=0;a<c;a++)for(y=Tl(m[a],v.xx,v.yy,r),o=0;o<y.length;o++)b.push(y[o]);return kl(b,r.unique?Pl:null)}function kl(e,t){var n={},r=t||Cl;return e.filter(function(e){var t=r(e);return!(t in n)&&(n[t]=!0,!0)})}function Cl(e){return e.a.join(",")+";"+e.b.join(",")}function Pl(e){return e.x+","+e.y}function Ol(e){var t=e.getFilteredPointCount()-e.size(),n=2*Math.pow(t,.4);return Math.ceil(n)||1}function Nl(e){var t=e.getFilteredPointCount()-e.size(),n=Math.ceil(Math.pow(10*t,.6)/40);return n>0?n:1}function Tl(e,t,n,r){var i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x=e.length-2,w=[],S=(r||{}).tolerance;for(Uf(t,e),b=0;b<x;){for(i=e[b],a=e[b+1],u=t[i],c=t[a],h=n[i],p=n[a],_=b;_<x&&!(c<(f=t[o=e[_+=2]]));){if(d=n[o],l=t[s=e[_+1]],g=n[s],h>=d){if(h>g&&p>d&&p>g)continue}else if(h<g&&p<d&&p<g)continue;i!=o&&i!=s&&a!=o&&a!=s&&(m=Qn(u,h,c,p,f,d,l,g,S))&&(y=[i,a],v=[o,s],w.push(Ll(m,y,v,t,n)),4==m.length&&w.push(Ll(m.slice(2),y,v,t,n)))}b+=2}return w}function Ll(e,t,n,r,i){var a,o=e[0],s=e[1];return t=zl(o,s,t[0],t[1],r,i),n=zl(o,s,n[0],n[1],r,i),{x:o,y:s,a:a=t[0]<n[0]?t:n,b:a==t?n:t}}function zl(e,t,n,r,i,a){return i[n]==e&&a[n]==t?[n,n]:i[r]==e&&a[r]==t?[r,r]:n<r?[n,r]:[r,n]}var Rl=Object.freeze({__proto__:null,calcSegmentIntersectionStripeCount:Nl,calcSegmentIntersectionStripeCount2:Ol,dedupIntersections:kl,findSegmentIntersections:Il,formatIntersectingSegment:zl,formatIntersection:Ll,getIntersectionLayer:function(e,t,n){var r=n.getVertexData().ii,i=new El(n.size());br(t.shapes,e=>{i.setId(Yt(e))});var a=[];return e.forEach(e=>{var t=Xt(e.a[0],r),n=Xt(e.b[0],r);i.hasId(t)&&i.hasId(n)&&a.push([e.x,e.y])}),{geometry_type:"point",shapes:[a]}},getIntersectionPoints:function(e){return e.map(function(e){return[e.x,e.y]})},intersectSegments:Tl,sortIntersections:function(e){e.sort(function(e,t){return e.x-t.x||e.y-t.y})}});function Dl(e){var t=e.getCopy();return function(e){!function(e,t){var n=Il(t);if(n.length>0)return void xt("Original layer contains intersections -- unable to repair.");for(var r=Il(e),i=10,a=r.length,o=0;o<i&&r.length>0;o++)jl(r,e,t),r=Il(e);var s=r.length;s>0?xt("Unable to remove",s,"intersection"+(s>1?"s":"")):a>0&&xt("Fix-geometry removed",a,"intersection"+(a>1?"s":""))}(e,t)}}function jl(e,t,n){e.forEach(function(e){Fl(e.a[0],t,n),Fl(e.a[1],t,n),Fl(e.b[0],t,n),Fl(e.b[1],t,n)})}function Fl(e,t,n){var r=t.getVertexData(),i=n.getVertexData(),a=[e];rl(e,t)&&(a=a.concat(function(e,t){for(var n,r,i=t.ii,a=t.nn,o=t.xx,s=t.yy,u=o[e],c=s[e],f=[],l=0;l<i.length;l++)r=(n=i[l])+a[l]-1,n!=e&&o[n]==u&&s[n]==c&&f.push(n),r!=e&&o[r]==u&&s[r]==c&&f.push(r);return f}(e,r))),a.forEach(function(e){r.xx[e]=i.xx[e],r.yy[e]=i.yy[e]})}function Ul(e,t){return+e.toPrecision(t)}function Bl(e,t){return+e.toFixed(t)}function Gl(e,t){var n=1;if(!e&&0!==e)return e;for(t|=0;t-- >0;)n*=10;return Math.round(e*n)/n}function ql(e){return Math.round(10*e)/10}function Vl(e){t.isNumber(e)&&0!==e||vt("Rounding increment must be a non-zero number.");var n=1/e;return n>1&&(n=Math.round(n)),function(e){return Math.round(e*n)/n}}function $l(e){var t=(Math.abs(e[2]-e[0])+Math.abs(e[3]-e[1]))/2+1e-8;return Math.max(0,Math.round(3-Math.log10(t)))}function Jl(e,t){return e.map(function(e){return e.toFixed(t)}).join(",")}const Wl=(Zl=new Float32Array(1),function(e){return Zl[0]=e,Zl[0]});var Zl;const Yl=Math.fround||Wl;function Hl(e,t,n){var r=Vl(t),i=e.arcs&&n?Dl(e.arcs):null;return No(e,function(e,t){return[r(e),r(t)]}),i&&i(e.arcs),e}var Xl=Object.freeze({__proto__:null,fround:Yl,fround2:Wl,getBinaryRoundingFunction:function(e){!1==(e>=1&&e<=32)&&vt("Invalid bits argument:",e);var t="LE"==_a.endianness(),n=new Float64Array(1),r=new Uint32Array(n.buffer,t?0:4,1),i=2**32-2**e;return function(e){return n[0]=e,r[0]=r[0]&i,n[0]}},getBoundsPrecisionForDisplay:$l,getRoundedCoordString:Jl,getRoundedCoords:function(e,t){return Jl(e,t).split(",").map(parseFloat)},getRoundingFunction:Vl,roundPoints:function(e,t){Wt(e.shapes,function(e){e[0]=t(e[0]),e[1]=t(e[1])})},roundToDigits:Bl,roundToDigits2:Gl,roundToSignificantDigits:Ul,roundToTenths:ql,setCoordinatePrecision:Hl}),Kl={m:"meters",meter:"meters",meters:"meters",mi:"miles",mile:"miles",miles:"miles",km:"kilometers",ft:"feet",feet:"feet"},Ql={meters:1,kilometers:1e3,feet:.3048,miles:1609.344};function eh(e){var t=String(e),n=parseFloat(t),r=(/px|pix/.test(t)?"px":/pt|point/.test(t)&&"pt")||/in/.test(t)&&"in"||/cm/.test(t)&&"cm"||!isNaN(+t)&&"px"||null,i="in"==r&&72*n||"cm"==r&&Math.round(28.3465*n)||n;return i>=0!=!1&&r||bt("Invalid size:",t),i}function th(e,t){var n,r=0,i=0;return t&&(t.is_latlong?i=1:t.to_meter>0?i=t.to_meter:vt("Invalid CRS")),e&&((r=Ql[e])||vt("Unknown units:",e)),r&&i?n=r/i:r||i?r&&!i?bt("Unable to convert",e,"to unknown coordinates"):!r&&i&&(n=1/i):n=1,n}function nh(e){var t=rh(e);return isNaN(t.value)&&bt("Invalid parameter:",e),t}function rh(e){var n=t.isString(e)?e:"",r=/(sq|)([a-z]+)(2|)$/i.exec(n),i={};return t.isNumber(e)?i.value=e:""===n?i.value=NaN:r?(i.units=Kl[r[2].toLowerCase()],i.areal=!(!r[1]&&!r[3]),i.value=Number(n.substring(0,n.length-r[0].length)),i.units||isNaN(i.value)||bt("Unknown units: "+r[0])):i.value=Number(n),i}function ih(e,t){var n=nh(e),r=th(n.units,t);return n.value*r*r}function ah(e,t){var n=nh(e),r=th(n.units,t);return n.areal&&bt("Expected a distance, received an area:",e),n.value*r}function oh(e,t){var n=nh(e),r=th(n.units,t);return n.units&&t&&t.is_latlong&&bt("Parameter does not support distance units with latlong datasets"),n.areal&&bt("Expected a distance, received an area:",e),n.value*r}function sh(e,t){var n,r;return Array.isArray(e)&&2==e.length||bt("Expected two distance parameters, received",e),n=nh(e[0]),r=nh(e[1]),(n.units&&!r.units||r.units&&!n.units)&&bt("Both parameters should have units:",e),[oh(e[0],t),oh(e[1],t)]}function uh(e,t,n){var r=e.includes(",")?e.split(","):e.split(" ");return 1==r.length?r=[r[0],r[0],r[0],r[0]]:4!=r.length&&bt("Expected a distance parameter or a list of four params"),r.map(function(e,r){return e.indexOf("%")>0?(parseFloat(e)/100||0)*(1==r||3==r?n.height():n.width()):oh(e,t)})}function ch(e,t){var n=t&&t.to_meter?e*t.to_meter*t.to_meter:e,r=n/1e6;return r<.01?Math.round(n)+" sqm":r+" sqkm"}var fh=Object.freeze({__proto__:null,convertAreaParam:ih,convertDistanceParam:ah,convertFourSides:uh,convertIntervalPair:sh,convertIntervalParam:oh,getAreaLabel:ch,getIntervalConversionFactor:th,parseMeasure:nh,parseMeasure2:rh,parseSizeParam:eh});function lh(e,t,n){var r=n.min_gap_area||n.min_area||n.gap_fill_area;if(0==+r)return{filter:function(){return!1},threshold:0};var i=n.sliver_control>=0?n.sliver_control:0,a=Ia(t),o=r&&"auto"!=r?ih(r,a):dh(e,t.arcs),s=i>0?hh(t.arcs,o,i):function(e,t){var n=t.arcs.isPlanar()?fr.getPlanarPathArea:fr.getSphericalPathArea;return function(r){var i=n(r,t.arcs);return Math.abs(i)<e}}(o,t),u=function(e,t){t&&(e=e.replace(" ","+ ")+" variable");return e+" threshold"}(ch(o,a),i>0);return n.keep_shapes&&(s=function(e){var t;return function(n,r,i){return 0===r&&(t=i.map(t=>e(t))),t.length>0&&t.every(Boolean)&&(t[0]=!1),t[r]}}(s)),{threshold:o,filter:s,label:u}}function hh(e,t,n){n>=0==!1&&(n=1),(n>1||t>=0==!1)&&vt("Invalid parameter");var r=ph(e,n);return function(e){return Math.abs(r(e))<t}}function ph(e,t){var n=Math.sqrt(t);return function(t){var r=fr.getPathArea(t,e),i=fr.getPathPerimeter(t,e),a=fr.calcPolsbyPopperCompactness(r,i);return r*(n*a+1-n)}}function dh(e,t){var n=0,r=t.isPlanar()?fr.distance2D:fr.greatCircleDistance,i=0,a=0,o=function(e,t,n,o){var s=r(n[e],o[e],n[t],o[t]);a++,i+=(s-i)/a};Pr(e.shapes,function(e){n++,xr(e,t,o)});var s=a/n||0,u=Math.pow(s,.75),c=i*i/50*u;return c=Ul(c,2)}var gh=Object.freeze({__proto__:null,calcMaxSliverArea:function(e){var t=e.getBounds().width()/2,n=e.getBounds().height()/2,r=0,i=0;return e.forEachSegment(function(e,a,o,s){var u=Math.abs(o[e]-o[a]),c=Math.abs(s[e]-s[a]);u<t&&c<n&&(i+=(Math.sqrt(u*u+c*c)-i)/++r)}),i*i},getDefaultSliverThreshold:dh,getSliverAreaFunction:ph,getSliverFilter:lh,getSliverTest:hh});var mh={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},yh=/^rgba?\(([^)]+)\)/,vh=/^#([a-f0-9]{3,8})/i;function bh(e){e=e?String(e):"";var t,n,r=vh.test(e)?e:mh[e.toLowerCase().replace(/[ -]+/g,"")],i=null;return r?i=function(e){var t=vh.exec(e)[1];3!=t.length&&4!=t.length||(t=t.split("").map(function(e){return e+e}));return 6!=t.length&&8!=t.length?null:{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8==t.length?parseInt(t.substr(7,2),16)/255:1}}(r):yh.test(e)&&(i=function(e){var t=yh.exec(e)[1],n=t.split(",").map(function(e){return parseFloat(e)});return{r:n[0],g:n[1],b:n[2],a:n[3]>=0?n[3]:1}}(e)),!i||(t=i)&&xh(t.r)&&xh(t.g)&&xh(t.b)&&((n=t.a)>=0&&n<=1)||(i=null),i}function _h(e){return bh(e)||bt("Unsupported color:",e),!0}function xh(e){return e>=0&&e<256}function wh(e){return e.a<1?function(e){var n=Sh(e.r)+","+Sh(e.g)+","+Sh(e.b);return e.a<1?"rgba("+n+","+(r=e.a,r=+r||0,r=Math.round(1e3*r)/1e3,t.clamp(r,0,1)+")"):"rgb("+n+")";var r}(e):function(e){return"#"+Ah(e.r)+Ah(e.g)+Ah(e.b)}(e)}function Sh(e){return Math.round(t.clamp(+e||0,0,255))}function Ah(e){return Sh(e).toString(16).padStart(2,"0")}function Eh(e,n){var r,i,a;if(Array.isArray(e))r=e,i=n;else{r=[],i=[],a=Array.from(arguments);for(var o=0;o<a.length;o+=2)r.push(a[o]),i.push(a[o+1])}if(i=function(e){var n=t.sum(e);if(n>0==!1)return null;return e.map(function(e){return e/n})}(i),!i)return"#eee";var s=r.reduce(function(e,t,n){var r=_h(t)&&bh(t),a=+i[n]||0;return e.r+=r.r*a,e.g+=r.g*a,e.b+=r.b*a,e},{r:0,g:0,b:0});return wh(s)}function Mh(e,t){var n=t?function(e){if(e in Ih)return Ih[e];var t=e;t=t.replace("[-]","(?<prefix>-)?"),t=t.replace(/\[[NSEW, +-]{2,}\]/,"(?<prefix>$&)"),t=t.replace(/D+(\.D+)?/,(e,t)=>{var n="[0-9]+";return t&&(n+="\\.[0-9]+"),`(?<d>${n})`}),t=t.replace(/(MM?)(\.M+)?/,(e,t,n)=>{var r=1==t.length?"[0-9]+":"[0-9][0-9]";return n&&(r+="\\.[0-9]+"),`(?<m>${r})`}),t=t.replace(/(SS?)(\.S+)?/,(e,t,n)=>{var r=1==t.length?"[0-9]+":"[0-9][0-9]";return n&&(r+="\\.[0-9]+"),`(?<s>${r})`}),t="^"+t+"$";try{Ih[e]=new RegExp(t)}catch(t){bt("Invalid DMS format string:",e)}return Ih[e]}(t):/^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)[m'′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i,r=n.exec(e.trim()),i=NaN;return r&&(i=+(r.groups.d||"0")+ +(r.groups.m||"0")/60+ +(r.groups.s||"0")/3600,(/[sw-]/i.test(r.groups.prefix||"")||/[sw]/i.test(r.groups.suffix||""))&&(i=-i)),i}var Ih={};function kh(e,t){t||(t="[-]D°M'S.SSS");var n,r,i,a=t,o=/(D+)[^M]*(M+)?[^S[\]]*(S+)?/.exec(t),s=o&&!!o[3],u=o&&!!o[2];(!o||s&&!u)&&bt("Invalid DMS format string:",t);var c=s&&o[3].length||u&&o[2].length||o[1].length,f=s&&/S\.(S+)/||u&&/M\.(M+)/||/D\.(D+)/,l=f.test(t)?f.exec(t)[1].length:0;if(u){var h=Math.pow(10,l),p=s?3600*h:60*h,d=Math.floor(Math.abs(e)*p+.5),g=function(e,t,n){var r=e.toFixed(n),i=r.split(".");return i.length>0&&(i[0]=i[0].padStart(t,"0"),r=i.join(".")),r}(d/h%60,c,l);s?(d=Math.floor(d/(60*h)),i=g,r=String(d%60).padStart(o[2].length,"0")):(d=Math.floor(d/h),r=g),n=String(Math.floor(d/60)).padStart(o[1].length,"0")}else n=Math.abs(e).toFixed(l);return a=(a=(a=(a=(a=a.replace(/\[-\]/,t=>e<0?"-":"")).replace(/\[[+-]+\]/,t=>e<0?"-":"+")).replace(/\[[NS, ]+\]/,t=>e<0?"S":"N")).replace(/\[[EW, ]+\]/,t=>e<0?"W":"E")).replace(/D+(\.D+)?/,n),u&&(a=a.replace(/M+(\.M+)?/,r)),s&&(a=a.replace(/S+(\.S+)?/,i)),a}function Ch(e,t){!0!==e&&!1!==e&&bt(t||"Filter expression must return true or false")}function Ph(e,n){if(!e||!n||e.length!=n.length-1)return null;for(var r,i,a,o=t.sum(e),s=Math.floor(o/2),u=0,c=1;c<n.length;c++){if(i=n[c-1],a=n[c],s<=(r=u+e[c-1]))return i+(s-u)/(r-u)*(a-i);u=r}return null}function Oh(e,t){Object.keys(t).forEach(function(n){var r=t[n],i="function"==typeof r?{get:r}:{value:r,writable:!1};Object.defineProperty(e,n,i)})}function Nh(e,t,n){if(!e||!n)return null;var r=[],i=[],a=[],o=[];return e.forEach(function(e){for(var s=Th(e,t,n,r,i);s<4&&s>0;)r.pop(),i.pop(),s--;s>0&&(o.push([a.length]),a.push(s))}),{shape:o.length>0?o:null,arcs:new Wa(a,r,i)}}function Th(e,t,n,r,i){for(var a,o,s,u,c=t.getShapeIter(e),f=0;c.hasNext();)s=c.x,u=c.y,(0===f||fr.distance2D(s,u,a,o)>n)&&(r.push(s),i.push(u),a=s,o=u,f++);return s==a&&u==o||(r.push(s),i.push(u),f++),f}var Lh=Object.freeze({__proto__:null,simplifyArcsFast:function(e,t){for(var n,r=[],i=[],a=[],o=0,s=e.size();o<s;o++)1==(n=Th([o],e,t,r,i))&&(n=0,r.pop(),i.pop()),a.push(n);return new Wa(a,r,i)},simplifyPolygonFast:Nh});function zh(e,t){var n,r=e&&fr.getMaxPath(e,t),i=r&&t.getSimpleShapeBounds(r);return i&&i.hasBounds()&&0!==i.area()&&(n=Nh(e,t,.01*Math.sqrt(i.area()))).shape?function(e,t){var n,r,i,a,o,s,u,c=fr.getMaxPath(e,t),f=t.getSimpleShapeBounds(c),l=fr.getPathCentroid(c,t),h=function(e,t){var n=Math.max(t.width(),t.height())/2;return function(t,r){var i=fr.distance2D(e.x,e.y,t,r);return 1-Math.min(.6*i/n,.25)}}(l,f),p=fr.getPlanarPathArea(c,t);1==e.length&&1.2*p>f.area()?(a=5,i=.2):1==e.length&&1.7*p>f.area()?(a=7,i=.4):(a=11,i=.5);n=f.width()*i,r=l.x-n/2,o=n/a,s=Dh(e,t,r,r+n,a,h),s?(u=Dh(e,t,s.x-o/2,s.x+o/2,2,h)).distance>s.distance&&(s=u):(Mt("[points inner] failed, falling back to centroid"),s=l);return s}(n.shape,n.arcs):null}function Rh(e,n,r){var i=n.getBounds().ymin-1;return r.reduce(function(r,a){var o=function(e,n,r,i){var a,o,s,u=function(e,t,n,r){return n?n.reduce(function(n,i){var a=function(e,t,n,r){var i=[];xr(n,r,function(n,r,a,o){var s=fr.getRayIntersection(e,t,a[n],o[n],a[r],o[r]);s>-1/0&&i.push(s)}),i.length%2==1&&(i=[]);return i}(e,t,i,r);return n.concat(a)},[]):[]}(e,n,r,i),c=[];t.genericSort(u);for(var f=0;f<u.length;f+=2)a=u[f],(s=((o=u[f+1])-a)/2)>0&&c.push({y:(a+o)/2,x:e,interval:s});return c}(a,i,e,n);return r.concat(o)},[])}function Dh(e,t,n,r,i,a){var o,s,u,c=function(e,t,n){for(var r=(t-e)/(n+1),i=[],a=1;a<=n;a++)i.push(e+r*a);return i}(n,r,i),f=(r-n)/i,l=Rh(e,t,c);l.forEach(function(e){e.interval*=a(e.x,e.y)}),l.sort(function(e,t){return t.interval-e.interval});for(var h=0;h<l.length&&(u=l[h],!(o&&o.distance>u.interval));h++)s=jh(u.x,u.y,e,t,f,a),(!o||s.distance>o.distance)&&(o=s);return o}function jh(e,t,n,r,i,a){var o={x:e,y:t,distance:fr.getPointToShapeDistance(e,t,n,r)*a(e,t)};return Fh(o,n,r,i,a),Fh(o,n,r,-i,a),o}function Fh(e,t,n,r,i){for(var a,o=e.x,s=e.y,u=e.distance;s+=r,(a=fr.getPointToShapeDistance(o,s,t,n)*i(o,s))>.9*u&&fr.testPointInPolygon(o,s,t,n);)a>u&&(e.distance=u=a,e.y=s)}var Uh=Object.freeze({__proto__:null,findAnchorPoint:zh});function Bh(e,t){var n=new Uint8Array(e.size());br(t,function(e){e<0?n[~e]|=2:n[e]|=1}),this.isInnerArc=function(e){var t=Yt(e);return 3==n[t]}}function Gh(e){return e.reduce(function(e,t){return t.layers.forEach(function(n){e.push({layer:n,dataset:t.dataset})}),e},[])}function qh(e,t,n){var r=$h(e,t,!0);return n&&(r=r.filter(function(e){return e.layer.geometry_type==n})),e.forEach(function(e){e.layer.target_id=-1}),r.forEach(function(e,t){e.layer.target_id=t}),Vh(r)}function Vh(e){var t=[],n=[];return e.forEach(function(e){var r=t.indexOf(e.dataset);-1==r?(t.push(e.dataset),n.push({layers:[e.layer],dataset:e.dataset})):n[r].layers.push(e.layer)}),n}function $h(e,n,r){var i=[],a=[],o={};return n.split(",").forEach(function(t,n){var r=Jh(t),s=!1;e.forEach(function(e,t){t in o?s=!0:r(e.layer,t+1)&&(i.push(e),o[t]=!0,s=!0)}),0==s&&a.push(t)}),r&&a.length&&bt(t.format("Missing layer%s: %s",1==a.length?"":"s",a.join(","))),i}function Jh(e){var n=t.isInteger(Number(e)),r=n?null:t.wildcardToRegExp(e);return function(t,i){return n?String(i)==e:r.test(t.name||"")}}function Wh(e){return e.reduce(function(e,t){return e+t.layers.length},0)}var Zh=Object.freeze({__proto__:null,countTargetLayers:Wh,expandCommandTargets:Gh,findCommandTargets:qh,findMatchingLayers:$h,getLayerMatch:Jh,getLayerTargetId:function(e,t){var n,r=0;return t.name,e.getLayers().forEach(function(e,i){t.name&&e.layer.name==t.name&&r++,t==e.layer&&(n=String(i+1))}),n||vt("Layer not found"),1==r?t.name:n},groupLayersByDataset:Vh});function Yh(e,t){var n={},r=e.data?e.data.getRecords():null;return Oh(n,{name:e.name,data:r,type:e.geometry_type,size:ki(e),empty:0===ki(e),bbox:Xh(n,e,t)}),n.field_exists=function(t){return!(!e.data||!e.data.fieldExists(t))},n.field_type=function(t){return e.data&&ei(t,e.data.getRecords())||null},n.field_includes=function(t,n){return!!e.data&&e.data.getRecords().some(function(e){return e&&e[t]===n})},n}function Hh(e,t,n){var r;return Oh(e,{layer_name:t.name||"",layer:function(){return r||(r=Yh(t,n)),r}}),e}function Xh(e,t,n){var r;return function(){return r||(r=function(e,t){var n=Ji(e,t);if(!n)return null;var r=n.toArray();return Object.assign(r,{cx:n.centerX(),cy:n.centerY(),height:n.height(),width:n.width(),left:n.xmin,bottom:n.ymin,top:n.ymax,right:n.xmax}),r}(t,n)),r}}function Kh(e,n,r){var i,a,o,s,u,c,f,l=r||{},h=Si(e),p=n&&wi(e),d=e.data?e.data.getRecords():null,g=p&&n.isPlanar(),m={};function y(){var t=e.shapes[f];u||(u=t&&t[0]||null)}function v(){return o=o||fr.getShapeCentroid(c,n)}function b(){return s=s||zh(c,n)}function _(){return a||(a=p?n.getMultiShapeBounds(c):h?$t(e.shapes[f]):new qt)}return Oh(m,{id:function(){return f}}),Hh(m,e,n),l.geojson_editor&&(Object.defineProperty(m,"geojson",{set:function(e){l.geojson_editor.set(e,f)},get:function(){return l.geojson_editor.get(f)}}),Object.defineProperty(m,"feature",{set:function(e){l.geojson_editor.set(e,f)},get:function(){return l.geojson_editor.get(f)}}),Object.defineProperty(m,"geometry",{set:function(e){l.geojson_editor.setGeometry(e,f)},get:function(){return l.geojson_editor.getGeometry(f)}})),d&&Object.defineProperty(m,"properties",{set:function(e){t.isObject(e)?d[f]=e:bt("Can't assign non-object to $.properties")},get:function(){var e=d[f];return e||(e=d[f]={}),e}}),(p||h)&&Oh(m,{partCount:function(){var t=e.shapes[f];return t?t.length:0},isNull:function(){return 0===m.partCount},bounds:function(){return _().toArray()},bbox:function(){return _().toArray()},height:function(){return _().height()},width:function(){return _().width()}}),p?(m.bboxContainsPoint=function(e,t){return n.getMultiShapeBounds(c).containsPoint(e,t)},m.bboxIntersectsRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c);return qt.from(e,t,r,i).intersects(a)},m.bboxContainsRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c),o=qt.from(e,t,r,i);return a.contains(o)},m.bboxContainedByRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c);return qt.from(e,t,r,i).contains(a)},"polyline"==e.geometry_type&&Oh(m,{length:function(){return fr.getShapePerimeter(c,n)}}),"polygon"==e.geometry_type&&Oh(m,{area:function(){return g?m.planarArea:fr.getSphericalShapeArea(c,n)},perimeter:function(){return fr.getShapePerimeter(c,n)},compactness:function(){return fr.calcPolsbyPopperCompactness(m.area,m.perimeter)},planarArea:function(){return fr.getPlanarShapeArea(c,n)},innerPct:function(){return i||(i=function(e,t){var n,r,i,a=e.isPlanar()?fr.distance2D:fr.greatCircleDistance,o=new Bh(e,t);return function(e){return n=0,r=0,e&&e.forEach(s),r>0?r/(r+n):0};function s(e){e.forEach(u)}function u(t){i=0,e.forEachArcSegment(t,c),o.isInnerArc(t)?r+=i:n+=i}function c(e,t,n,r){i+=a(n[e],r[e],n[t],r[t])}}(n,e.shapes)),i(c)},originalArea:function(){var e,t=n.getRetainedInterval();return n.setRetainedInterval(0),e=m.area,n.setRetainedInterval(t),e},centroidX:function(){var e=v();return e?e.x:null},centroidY:function(){var e=v();return e?e.y:null},innerX:function(){var e=b();return e?e.x:null},innerY:function(){var e=b();return e?e.y:null}})):h&&(Object.defineProperty(m,"coordinates",{set:function(n){!n||t.isArray(n)?e.shapes[f]=n||null:bt("Can't assign non-array to $.coordinates")},get:function(){return e.shapes[f]||null}}),Object.defineProperty(m,"x",{get:function(){return y(),u?u[0]:null},set:function(e){y(),u&&(u[0]=Number(e))}}),Object.defineProperty(m,"y",{get:function(){return y(),u?u[1]:null},set:function(e){y(),u&&(u[1]=Number(e))}})),function(t){return f=t,a=null,p&&(o=null,s=null,c=e.shapes[t]),h&&(u=null),m}}function Qh(e,t,n){var r=n||{},i=t||np(),a=ep(e,r),o=tp(e),s=!r.no_assign&&o.length>0;return r.no_assign&&rp(o,i),i._=i,function(t){var n,r=i.$||null;s&&rp(o,t);try{n=a.call(r,t,i)}catch(t){bt(t.name,"in expression ["+e+"]:",t.message)}return n}}function ep(e,t){var n;e=function(e){return e.replace(/\\\n/g," ")}(e),n="with($$env){with($$record){ "+(n=t.no_return?e:"var $$retn = "+e+"; return $$retn;")+"}}";try{return new Function("$$record,$$env",n)}catch(t){bt(t.name,"in expression ["+e+"]")}}function tp(e,n){var r=e.match(/[a-z_$][.a-z0-9_$]*(?= *=[^>=])/gi)||[],i=t.uniq(r.filter(function(e){var t=e.indexOf(".");return n?t>-1:-1==t}));return i}function np(e){return(e=e||{}).globalThis=void 0,function(){for(var t in this)e[t]=void 0}(),e.console=console,e}function rp(e,t){for(var n=0;n<e.length;n++)e[n]in t==!1&&(t[e[n]]=null)}var ip=Object.freeze({__proto__:null,compileExpressionToFunction:ep,getAssignedVars:tp,getBaseContext:np,getExpressionFunction:Qh,nullifyUnsetProperties:rp});function ap(e,t,n,r){var i=r||{};tp(e).length>0&&!t.data&&Wi(t);var a=t.data?t.data.getRecords():[],o=Kh(t,n,i),s=Hh({},t,n),u=up(t,i.context||{},i),c=Qh(e,u,i);return function(e,t){var n=t||a[e]||(a[e]={});return u.$=e>=0?o(e):s,u.d=n,c(n)}}function op(e,t,n){var r=sp(e,t,n);return function(e,t){var n=r(e,t);return Ch(n,'"where" expression must return true or false'),n}}function sp(e,t,n){var r=up({}),i=s(t,n),a=s(t,n),o=Qh(e,r,{});function s(e,t){var n=e.data?e.data.getRecords():[],r=Kh(e,t);function i(){}return function(e){var t;return-1==e?null:(i.prototype=n[e]||{},(t=new i).$=r(e),t)}}return function(e,t,n){return r.A=i(e),r.B=a(t),o(n||{})}}function up(e,n,r){var a=i("defs"),o=np(),s={},u=e.data?e.data.getFields():[];return r=r||{},function(e){Object.assign(e,{round:Gl,int_median:Ph,sprintf:t.format,blend:Eh,format_dms:kh,parse_dms:Mh})}(o),u.length>0&&rp(u,o),n=t.defaults(n||{},a),o.global=a,Object.keys(n).forEach(function(e){var t=Object.getOwnPropertyDescriptor(n,e);t.get?Object.defineProperty(s,e,{get:t.get}):Object.defineProperty(s,e,{value:n[e]})}),Object.keys(o).reduce(function(e,t){return t in e?r.no_warn||("function"==typeof e[t]&&u.indexOf(t)>-1?xt("Warning: "+t+"() function is hiding a data field with the same name"):xt('Warning: "'+t+'" has multiple definitions')):Object.defineProperty(e,t,{value:o[t]}),e},s)}var cp=Object.freeze({__proto__:null,compileFeatureExpression:ap,compileFeaturePairExpression:sp,compileFeaturePairFilterExpression:op});function fp(e){return lp(e).modes[0]}function lp(e,t){var n=function(e){var t,n,r=[],i={},a=[];for(t=0;t<e.length;t++)(n=e[t])in i==0?(i[n]=r.length,r.push(n),a.push(1)):a[i[n]]++;return{values:r,counts:a}}(e),r=function(e){var t,n,r=e.counts,i=e.values,a=r.length>0?function(e){var t,n=-1/0;for(t=0;t<e.length;t++)e[t]>n&&(n=e[t]);return n}(r):0,o=0,s=[];for(t=0;t<r.length;t++)(n=r[t])===a?s.push(i[t]):n>o&&(o=n);return{modes:s,margin:s.length>1?0:a-o,count:a}}(n);return t&&(r.counts=n.counts,r.values=n.values),r}var hp=Object.freeze({__proto__:null,getMode:fp,getModeData:lp}),pp={};function dp(e,n,r){var i=t.extend({},e),a={expression:r.where,invert:!!r.invert,verbose:!1,no_replace:r.no_replace};return pp.filterFeatures(i,n,a)}function gp(e,t,n){var r,a,o,s=n.expression;return n.where&&(e=dp(e,t,n),s+=" where "+n.where),a=i("defs"),r=yp(e,t,n.expression)(null,a),n.to_layer||xt(s+": "+r),o={expression:n.expression,value:r},n.where&&(o.where=n.where),e.name&&(o.layer_name=e.name),o}function mp(e,t,n){return yp(e,t,n)()}function yp(e,n,r){var i,a,o,s=0,u=0,c=-1,f=[],l={count:v,sum:y,sums:b,average:y,mean:y,median:y,quantile:y,iqr:y,quartile1:y,quartile2:y,quartile3:y,min:y,max:y,mode:b,collect:b,collectIds:function(){b(c)},first:function(e){0===s&&(f[u]=e);return u++,e},every:function(e){e=!!e,f[u]=(0===s||f[u])&&e,u++},some:function(e){e=!!e,f[u]=f[u]||e,u++},last:v},h={count:g(function(){return s},0),sum:g(t.sum,0),sums:g(function(e){var n=e&&e.length?e[0].length:0,r=t.initializeArray(Array(n),0);return e.forEach(function(e){if(e&&e.length)for(var t=0;t<n;t++)r[t]+=+e[t]||0}),r}),median:g(t.findMedian),quantile:(o=t.findQuantile,function(e,t){var n=u++;return s>0?o(f[n],t):null}),iqr:g(function(e){return t.findQuantile(e,.75)-t.findQuantile(e,.25)}),quartile1:g(function(e){return t.findQuantile(e,.25)}),quartile2:g(t.findMedian),quartile3:g(function(e){return t.findQuantile(e,.75)}),min:g(function(e){return t.getArrayBounds(e).min}),max:g(function(e){return t.getArrayBounds(e).max}),average:g(t.mean),mean:g(t.mean),mode:g(fp),collect:g(d),collectIds:g(d),first:g(d),every:g(d,!1),some:g(d,!1),last:g(d)},p=ki(e);return e.geometry_type&&(l.width=l.height=function(){},h.width=function(){return Ji(e,n).width()},h.height=function(){return Ji(e,n).height()}),i=ap(r,e,n,{context:l,no_assign:!0,no_warn:!0,no_return:!0}),a=ap(r,e,n,{context:h,no_warn:!0}),function(e,t){var n;return e?function(e){e.forEach(m)}(e):function(){for(var e=0;e<p;e++)m(e)}(),n=a(void 0,t),c=-1,s=0,u=0,f=[],n};function d(e){return e}function g(e,t){var n=arguments.length>1?t:null;return function(){var t=u++;return s>0?e(f[t]):n}}function m(e){(e<0||e>=p)&&vt("Invalid record index"),c=e,i(e),s++,u=0}function y(e){return isNaN(e)&&e&&bt("Expected a number, received:",e),b(e)}function v(e){return f[u++]=e,e}function b(e){var t;return 0===s&&(f[u]=[]),(t=f[u]).length!=s&&bt("Evaluation failed"),t.push(e),u++,e}}pp.calc=function(e,t,n){var r=e.map(e=>gp(e,t,n));return n.to_layer?{info:{},layers:[{name:n.name||"info",data:new di(r)}]}:null};var vp=Object.freeze({__proto__:null,applyCalcExpression:gp,compileCalcExpression:yp,evalCalcExpression:mp});function bp(e,t){var n=yp({data:e},null,t);return function(e,t){e||(e=[]),n(e,t)}}var _p=Object.freeze({__proto__:null,getJoinCalc:bp});function xp(e,t){if(!e||0===e.length)return function(){return 0};e.forEach(function(e){Pi(t,e)});var n={},r=0,i=t.getRecords(),a=wp(e);return function(e){var t=a(i[e]);return t in n==!1&&(n[t]=r++),n[t]}}function wp(e){return e.reduce(function(e,t){var n=function(e){return String(e[t])};return e?function(t){return e(t)+"~~"+n(t)}:n},null)}function Sp(e,t,n){var r=function(e,t){for(var n,r=[],i=0;i<t;i++)(n=e(i))in r?r[n].push(i):r[n]=[i];return r}(t,e.length);return Ep(e,r,n)}function Ap(e,t,n,r){for(var i=[],a=0;a<n;a++)i.push(t(a));return Ep(e,i,r)}function Ep(e,t,n){var r,i=n.sum_fields||[],a=n.copy_fields||[];function o(t,n){for(var r,i=0,a=0;a<n.length;a++)i+=(r=e[n[a]])&&r[t]||0;return i}return n.fields&&(a=a.concat(n.fields)),n.calc&&(r=bp(new di(e),n.calc)),t.map(function(t){var n,s,u={};for(s=e[(t=t||[])[0]],n=0;n<i.length;n++)u[i[n]]=o(i[n],t);for(n=0;n<a.length;n++)u[a[n]]=s?s[a[n]]:null;return r&&r(t,u),u})}var Mp=Object.freeze({__proto__:null,aggregateDataRecords:Sp,getCategoryClassifier:xp,getMultiFieldKeyFunction:wp,recombineDataRecords:Ap});function Ip(e,t,n,r){var i=function(e,t){var n=[];return wr(e,function(e){var r=t(e.shapeId);r in n==!1&&(n[r]=[]),n[r].push(e.arcId)}),n}(e.shapes,t),a=function(e){var t=new Uint8Array(e.size()),n=function(e){return t[Yt(e)]>0},r=function(e){t[Yt(e)]=0},i=new lo(e);return function(e){e.forEach(function(e){t[Yt(e)]=1});var a=function(e,t,n){var r=[];return e.forEach(function(e){0===t.getConnectedArcs(e,n).length&&r.push(~e),0===t.getConnectedArcs(~e,n).length&&r.push(e)}),r}(e,i,n),o=kp(a,i,n,r),s=kp(e,i,n,r),u=o.concat(s);return e.forEach(function(e){t[Yt(e)]=0}),u}}(n);return i.map(a)}function kp(e,t,n,r){var i=[];return e.forEach(function(e){for(var a,o=[],s=e;n(s)&&(o.push(s),a=n(s)?t.getConnectedArcs(s,n):[],r(s),a.length>0);)s=~a[0];o.length>0&&i.push(o)}),i}function Cp(e,n){var r=function(e,n){var r=[],i=[],a=[],o=e.map(function(e,t){return n(t)});return wr(e,s),i.forEach(g),a;function s(e){var t=e.arcId,n=t<0?~t:t,o=a.length,s=r[n];s||(s=[],r[n]=s),s.push(o),e.group=s,a.push(e),3==s.length&&i.push(s)}function u(e,t){for(var n,r,i=0;i<e.length-1;i++){n=a[e[i]];for(var o=i+1;o<e.length;o++)if(t(n,r=a[e[o]]))return[n.segId,r.segId]}return null}function c(t,n){return Pp(t,a,e).arcId===~Pp(n,a,e).arcId}function f(t,n){return Op(t,a,e).arcId===~Op(n,a,e).arcId}function l(e,t){return p(e,t)&&c(e,t)&&f(e,t)}function h(e,t){return p(e,t)&&(c(e,t)||f(e,t))}function p(e,t){return e.arcId===~t.arcId&&o[e.shapeId]===o[t.shapeId]}function d(e){e.forEach(function(t){a[t].group=e})}function g(e){var n=u(e,l)||u(e,h)||u(e,p);n&&(e=e.filter(function(e){return!t.contains(n,e)}),d(e),d(n),e.length>2&&g(e))}}(e,n);return function(e,n,r){var i=[];return e.forEach(a),i;function a(e){e.used||(c(e)||s(e))}function o(e,t){t in i==!1&&(i[t]=[]),i[t].push(e)}function s(e){var t=[e.arcId],n=u(e);for(e.used=!0;n&&n!=e;)t.push(n.arcId),n.used=!0,(n=u(n))&&n!=e&&n.used&&vt("buildRing() topology error");n||vt("buildRing() traversal error"),e.used=!0,o(t,r(e.shapeId))}function u(t,r){var i,a=Pp(t,e,n);return r=r||0,a!=t&&(i=c(a))&&(r>100&&vt("deep recursion -- unhandled topology problem"),a=1==n[i.shapeId][i.partId].length?u(a,r+1):u(i,r+1)),a}function c(n){var i,a=r(n.shapeId);return i=t.find(n.group,function(t){var i=n,o=e[t];return i!=o&&!o.used&&r(o.shapeId)===a&&i.arcId==~o.arcId}),null===i?null:e[i]}}(r,e,n)}function Pp(e,t,n){return Np(e,t,n,1)}function Op(e,t,n){return Np(e,t,n,-1)}function Np(e,t,n,r){var i,a=n[e.shapeId][e.partId].length,o=(e.i+r)%a;return o<0&&(o+=a),(i=t[e.segId-e.i+o])&&i.shapeId==e.shapeId||vt("index error"),i}var Tp=Object.freeze({__proto__:null,dissolvePolygonGeometry:Cp});function Lp(e,n,r,i){var a,o=null;if(e.data)for(var s=0,u=(o=Sp(e.data.getRecords(),r,i)).length;s<u;s++)n&&!n[s]&&(n[s]=null);return a={name:i.no_replace?null:e.name,shapes:n,data:o?new di(o):null,geometry_type:e.geometry_type},i.silent||function(e,n){var r=ki(e),i=ki(n),a=t.format("Dissolved %,d feature%s into %,d feature%s",r,t.pluralSuffix(r),i,t.pluralSuffix(i));xt(a)}(e,a),a}function zp(e,n){var r=new Int32Array(e.length);t.initializeArray(r,-1);var i=[],a=[];function o(e,t,o){var u=r[t];if(-1!=u&&n.flat){if(!(o&&o(e)>o(u)))return;s(t,u),r[t]=u,u=-1}-1==u?r[t]=e:-2==u?i[t].push(e):(i[t]=[u,e],r[t]=-2),a[e].push(t)}function s(e,t){for(var n=a[t],r=0;r<n.length;r++)if(n[r]===e){n[r]=-1;break}}this.getTileIdsByShapeId=function(e){var t=a[e];return t?t.filter(function(e){return e>=0}):[]},this.getShapeIdByTileId=function(e){var t=r[e];return t>=0?t:-1},this.getShapeIdsByTileId=function(e){var t=r[e];return t>=0?[t]:-1==t?[]:i[e]},this.indexTileIdsByShapeId=function(e,t,n){a[e]=[];for(var r=0;r<t.length;r++)o(e,t[r],n)},this.flatten=function(){i.forEach(function(e,t){!function(e){var t,n=i[e],a=n[0];r[e]=a;for(var o=0;o<n.length;o++)(t=n[o])!=a&&s(e,t)}(t)}),i=[]},this.getUnusedTileIds=function(){for(var e=[],t=0,n=r.length;t<n;t++)-1==r[t]&&e.push(t);return e},this.addTileToShape=function(e,t){e in a!=!1&&-1==r[t]||vt("Internal error"),r[t]=e,a[e].push(t)}}function Rp(e,t,n){for(var r=0,i=e.length;r<i;r++)e[r]=Dp(e[r],t,n)}function Dp(e,t,n){return Or(e,function(e){var r=function(e,t){for(var n=0,r=0,i=e.length;r<i;r++)t.arcIsDegenerate(e[r])&&(n++,e[r]=null);return n>0?e.filter(function(e){return null!==e}):e}(e,t);return"polygon"==n&&r&&(jp(r),0===fr.getPlanarPathArea(r,t)&&(r=null)),r})}function jp(e){var t=e.length;if(t>=2){if(e[0]==~e[t-1])e.pop(),e.shift();else for(var n=1;n<t;n++)if(e[n-1]==~e[n]){e.splice(n-1,2);break}e.length<t&&jp(e)}}function Fp(e){var t=new Ml(e.arcs.size()),n=function(e){return t.hasId(~e)};return function(e){t.setIds(e);var n=r(e);return t.clear(),n};function r(e){for(var t=null,n=0,r=e.length;n<r-1;n++)if(null!==(t=i(e,e[n])))return t;return jp(e),e.length>0?[e]:[]}function i(r,i){var s,u,c,f=e.getConnectedArcs(i,n);if(f.length<2)return null;s=[];for(var l=0;l<f.length;l++)(c=o(r,u=~f[l]))>-1&&(t.clearId(u),s.push(c));return s.length<2?null:Up(r,s).reduce(a,null)}function a(e,t){var n=r(t);return null===e?n:(e.push.apply(e,n),e)}function o(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}}function Up(e,n){var r=[];t.genericSort(n,!0),n[0]>0&&r.push(e.slice(0,n[0]));for(var i=0,a=n.length;i<a;i++)i<a-1?r.push(e.slice(n[i],n[i+1])):r.push(e.slice(n[i]));return r.length>n.length&&t.merge(r[0],r.pop()),r}pp.dissolve=function(e,n,r){var i,a;return(r=t.extend({},r)).where?function(e,n,r,i){i&&i.where||vt('Missing required "where" parameter');var a=e(dp(n,r,i),r,t.defaults({where:null},i)),o=dp(n,r,t.defaults({invert:!0},i));return pp.mergeLayers([o,a],{verbose:!1,force:!0})[0]}(pp.dissolve,e,n,r):(r.field&&(r.fields=[r.field]),a=xp(r.fields,e.data),r.multipart||r.group_points?i=function(e,t){e.shapes&&e.geometry_type||bt("Layer is missing geometry");kr(e.shapes);var n=[];return e.shapes.forEach(function(e,r){var i=t(r);e&&(n[i]?n[i].push.apply(n[i],e):n[i]=e)}),n}(e,a):"polygon"==e.geometry_type?i=Cp(e.shapes,a):"polyline"==e.geometry_type?i=Ip(e,a,n):"point"==e.geometry_type&&(i=function(e,t,n){var r=!n.planar&&ia(Ji(e)),i=n.weight?ap(n.weight,e,null):null,a=[];return 0!==qi(e.shapes)&&bt("Dissolving multi-part points is not supported"),e.shapes.forEach(function(e,n){var o,s=t(n),u=i?i(n):1,c=e&&e[0];c&&(r&&(o=[],fr.lngLatToXYZ(c[0],c[1],o),c=o),a[s]=function(e,t,n){var r,i,a=t[0],o=t[1];return a==a&&o==o&&n>0&&(e?(r=e.sum+n,i=e.sum/r,e.centroid[0]=i*e.centroid[0]+n*a/r,e.centroid[1]=i*e.centroid[1]+n*o/r,3==t.length&&(e.centroid[2]=i*e.centroid[2]+n*t[2]/r),e.sum=r):e={sum:n,centroid:t.concat()}),e}(a[s],c,u))}),a.map(function(e){var t,n;return e?(r?(t=e.centroid,n=[],fr.xyzToLngLat(t[0],t[1],t[2],n)):n=e.centroid,e?[n]:null):null})}(e,a,r)),Lp(e,i,a,r))};var Bp=Object.freeze({__proto__:null,cleanShapes:Rp,getSelfIntersectionSplitter:Fp,removeSpikesInPath:jp,splitPathByIds:Up});function Gp(e){var t,n=new lo(e.arcs),r=function(e){for(var t,n=new Int32Array(e.arcs.size()),r=0,i=0,a=e.arcs.size();i<a;i++)t=e.findDuplicateArc(i),n[i]=t,i!=t&&r++;return r>0?n:null}(n);return r&&qp(e,r),t=function(e){var t=Vi(e.layers,e.arcs),n=e.arcs.size(),r=e.arcs.deleteArcs(t),i=e.arcs.size(),a=n-i;a>0&&qp(e,r);return a}(e),t>0&&(n=new lo(e.arcs)),n}function qp(e,t){var n=function(e){for(var n,r,i,a=0;a<e.length;a++)r=Yt(n=e[a]),i=t[r],e[a]=n==r?i:~i;return e};e.layers.forEach(function(e){wi(e)&&Pr(e.shapes,n)})}function Vp(e,t){var n,r=t||{},i=e.arcs,a=i&&i.getBounds();if(!a||!a.hasBounds())return new lo([]);Ct("addIntersectionCuts() snap dist:",n=r.snap_interval?oh(r.snap_interval,Ia(e)):!r.no_snap&&a.hasBounds()?Bn(a.toArray()):0),i.flatten();var o=function(e,t){var n,r,i,a=e.arcs,o=t>0?{tolerance:t}:{tolerance:0},s=!1,u=4,c=0;do{c++,i=0,n=qn(a,t),r=a.dedupCoords(),(n>0||i>0||1==c)&&(i=$p(e,o)),s|=n+r+i>0,Ct("[snapAndCut] pass:",c,"snaps:",n,"dupes:",r,"cuts:",i)}while(c<u&&i>0);return s}(e,n);return(o||r.rebuild_topology)&&Ka(e),e.layers.forEach(function(e){wi(e)&&Rp(e.shapes,i,e.geometry_type)}),Gp(e)}function $p(e,t){var n=e.arcs.getPointCount(),r=Wp(e.arcs,t),i=e.arcs.getPointCount();return Jp(e,r),i-n}function Jp(e,t){var n=function(e,t){return function(e){for(var t=[],r=0;r<e.length;r++)n(e[r],t);return t};function n(n,r){var i,a=n<0,o=a?~n:n,s=e[o],u=(o>=e.length-1?t:e[o+1])-1;do{a?(i=~u,u--):(i=s,s++),r.push(i)}while(u-s>=0)}}(t,e.arcs.size());e.layers.forEach(function(e){wi(e)&&Pr(e.shapes,n)})}function Wp(e,t){return Yp(Zp(e,t),e)}function Zp(e,t){var n=Il(e,t),r=e.getVertexData();return function(e){for(var t,n,r,i=[],a=0,o=e.length;a<o;a++)n=Hp((t=e[a]).x,t.y,t.a[0],t.a[1]),r=Hp(t.x,t.y,t.b[0],t.b[1]),n&&i.push(n),r&&i.push(r);return i}(n,r.xx,r.yy)}function Yp(e,t){var n,r,i,a,o=t.getVertexData(),s=o.xx,u=o.yy,c=o.nn,f=0,l=0,h=[],p=t.size(),d=new Uint32Array(p),g=Kp(Xp(e,s,u),t),m=t.getPointCount()+2*g.length,y=new Float64Array(m),v=new Float64Array(m);g.reverse(),a=g.pop();for(var b=0,_=0;b<p;b++){for(i=c[b],d[b]=_,n=0,r=0;n<i;){for(y[l]=s[f],v[l]=u[f],l++,r++;a&&a.i==f;)y[l]=a.x,v[l]=a.y,l++,r++,h[_++]=r,r=0,y[l]=a.x,v[l]=a.y,l++,r++,a=g.pop();n++,f++}h[_++]=r}return l!=m&&vt("[insertCutPoints()] Counting error"),t.updateVertexData(h,y,v,null),d}function Hp(e,t,n,r,i,a){return(r<n||r>n+1)&&vt("Out-of-sequence arc ids:",n,r),{x:e,y:t,i:n}}function Xp(e,t,n){return e.sort(function(e,r){return e.i!=r.i?e.i-r.i:fr.distanceSq(t[e.i],n[e.i],e.x,e.y)-fr.distanceSq(t[r.i],n[r.i],r.x,r.y)}),e}function Kp(e,t){var n=[],r=0;return t.forEach2(function(t,i,a,o,s){for(var u,c,f=i+a-1,l=o[i],h=s[i],p=o[f],d=s[f];r<e.length&&e[r].i<=f;)u=e[r],r++,c=n[n.length-1],u.x==l&&u.y==h&&u.i==i||u.x==p&&u.y==d&&u.i>=f-1||c&&c.x==u.x&&c.y==u.y&&c.i==u.i||n.push(u)}),n}var Qp=Object.freeze({__proto__:null,addIntersectionCuts:Vp,cutPathsAtIntersections:$p,divideArcs:Wp,filterSortedCutPoints:Kp,findClippingPoints:Zp,getCutPoint:Hp,insertCutPoints:Yp,remapDividedArcs:Jp,sortCutPoints:Xp}),ed={stack:[],start:function(){ed.stack.push(Date.now())},stop:function(){return Date.now()-ed.stack.pop()+"ms"}};function td(e){ed.start(),e.detachAcyclicArcs();var n=function(e){for(var t=e.arcs,n=[],r=[],i=[],a=[],o=new Uint8Array(t.size()),s=xl(e,l),u=0,c=o.length;u<c;u++)f(u),f(~u);return{cw:n,ccw:r,empty:i,lostArcs:a};function f(e){var o,u;if(h(e)){if(!(o=s(e)))return a.push(e),void Ct("Dead-end arc:",e);(u=fr.getPlanarPathArea(o,t))>0?n.push(o):u<0?r.push(o):i.push(o)}}function l(e){return h(e,!0)}function h(e,t){var n=Yt(e),r=n==e?1:2,i=0===(o[n]&r);return t&&i&&(o[n]|=r),i}}(e),r=n.cw.map(function(e){return[e]});Ct("Find mosaic rings",ed.stop()),ed.start();var i=[],a=new Vf(r,e.arcs);return n.ccw.forEach(function(e){var t=a.findSmallestEnclosingPolygon(e);t>-1?r[t].push(e):(mr(e),i.push([e]))}),Ct(t.format("Detect holes (holes: %d, enclosures: %d)",n.ccw.length-i.length,i.length),ed.stop()),{mosaic:r,enclosures:i,lostArcs:n.lostArcs}}var nd=Object.freeze({__proto__:null,buildPolygonMosaic:td,mosaic:function(e,t){var n,r,i,a,o,s,u,c,f=[];return e.arcs||bt("Dataset is missing path data"),r=td(n=Vp(e,t)),f.push({name:"mosaic",shapes:r.mosaic,geometry_type:"polygon"}),t.debug&&(f.push({geometry_type:"polygon",name:"mosaic-enclosure",shapes:r.enclosures}),r.lostArcs.length>0&&(f=f.concat((i=r.lostArcs,a=n.arcs,o={geometry_type:"polyline",name:"lost-arcs",shapes:[]},s={geometry_type:"point",name:"lost-arc-endpoints",shapes:[]},u=[],c=[],i.forEach(function(e){var t=a.getVertex(e,0),n=a.getVertex(e,-1);u.push({ARCID:e}),o.shapes.push([[e]]),c.push({ARCID:e},{ARCID:e}),s.shapes.push([[t.x,t.y]],[[n.x,n.y]])}),o.data=new di(u),s.data=new di(c),[o,s])))),f}});function rd(e){var n=new Int32Array(e),r=new Int32Array(e);t.initializeArray(n,-1),t.initializeArray(r,-1),this.setId=function(e,t){e<0?r[~e]=t:n[e]=t},this.hasId=function(e){return this.getId(e)>-1},this.getId=function(t){var i=t<0?~t:t;return i>=e?-1:t<0?r[i]:n[i]}}function id(e){var t=[],n=new rd(e),r=n.setId;return n.setId=function(e,i){n.hasId(e)||t.push(e),r(e,i)},n.clear=function(){t.forEach(function(e){r(e,-1)}),t=[]},this.clearId=function(e){n.hasId(e)||vt("Tried to clear an unset id"),r(e,-1)},n}function ad(e,t){Pr(e.shapes,function(e){if(fr.getPathArea(e,t)<=0)return null})}function od(e,t){var n=Fp(e);return function(r,i,a){var o=t?fr.getSphericalPathArea:fr.getPlanarPathArea;Cr(r,function(t){var r=n(t);0===r.length&&Ct("[getRingDivider()] Defective path:",t),r.forEach(function(t,n){var r=o(t,e.arcs);r>0?i.push(t):r<0&&a.push(t)})})}}var sd=Object.freeze({__proto__:null,deleteHoles:ad,getHoleDivider:od});function ud(e,t,n,r){var i,a,o,s=n.arcs,u=new Ml(e.length),c=od(n),f=new Ml(s.size()),l=new Ml(s.size());function h(e){i=i?i.concat(e):e}function p(t){a=s.getSimpleShapeBbox(t),f.setIds(t),function(t){var n,r=t.concat();for(;r.length>0;)(n=m(r.pop()))>=0&&d(r,e[n])}(t),f.clear(),u.clear()}function d(e,t){for(var n,r,i=0,a=t.length;i<a;i++)for(var o=0,s=(r=t[i]).length;o<s;o++)g(n=r[o])&&e.push(~n)}function g(e){var t=~e;return!(f.hasId(e)||f.hasId(t)||l.hasId(e)||l.hasId(t))}function m(e){var n=t.getShapeIdByArcId(e);return-1==n||u.hasId(n)?-1:!1===s.arcIsContained(Yt(e),a)?(Ct("Out-of-bounds ring arc",e),-1):(u.setId(n),o.push(n),n)}this.getTilesInShape=function(e,t){var n,a=[],s=[];return o=[],i=[],r.no_holes?c(e,a,s):(c(e,a,s),s.forEach(h),l.setIds(i)),a.forEach(p),n=o,o=null,l.clear(),i=null,n}}var cd=Object.freeze({__proto__:null,PolygonTiler:ud});function fd(e,t,n){var r=n||{},i=e.shapes,a=td(t).mosaic,o=new ld(a,t.arcs),s=new Ml(a.length),u=new zp(a,r),c=new ud(a,o,t,r),f=null;function l(e,t,n){var r=[],i=n?-1:1;return function(n){var a;return n in r?a=r[n]:(a=i*Math.abs(fr.getShapeArea(e[n],t)),r[n]=a),a}}function h(e,t){return a[e]}function p(e){for(var n,r,i,s,c=a[e][0],f=t.arcs,l=-1,h=0,p=0;p<c.length;p++)n=c[p],(i=o.getShapeIdByArcId(~n))<0||(r=u.getShapeIdByTileId(i))<0||(s=fr.getPathPerimeter([n],f))>h&&(l=r,h=s);l>-1&&u.addTileToShape(l,e)}!r.simple&&r.flat&&(f=function(e,t,n){var r;n&&"max-area"!=n?"min-area"==n?r=l(e,t,!0):"max-id"==n?r=function(e){return e}:"min-id"==n?r=function(e){return-e}:bt("Unknown overlap rule:",n):r=l(e,t,!1);return r}(e.shapes,t.arcs,r.overlap_rule)),this.mosaic=a,this.nodes=t,this.getSourceIdsByTileId=u.getShapeIdsByTileId,this.getTileIdsByShapeId=u.getTileIdsByShapeId,i.forEach(function(e,t){var n=c.getTilesInShape(e,t);u.indexTileIdsByShapeId(t,n,f)}),r.flat&&u.flatten(),this.removeGaps=function(e){r.flat||vt("MosaicIndex#removeGaps() should only be called with a flat mosaic");var t=u.getUnusedTileIds(),n=t.filter(function(t){var n=a[t];return e(n[0])});return n.forEach(p),{removed:n.length,remaining:t.length-n.length}},this.getUnusedTiles=function(){return u.getUnusedTileIds().map(h)},this.getTilesByShapeIds=function(e){return function(e){var t,n,r,i,a=[];for(r=0;r<e.length;r++)for(n=u.getTileIdsByShapeId(e[r]),i=0;i<n.length;i++)t=n[i],s.hasId(t)||(s.setId(t),a.push(t));return s.clear(),a}(e).map(h)}}function ld(e,t){var n,r=new rd(t.size());function i(e){for(var t,i=0,a=e.length;i<a;i++)t=e[i],r.setId(t,n)}e.forEach(function(e,t){n=t,e.forEach(i)}),this.getShapeIdByArcId=function(e){return r.getId(e)}}var hd=Object.freeze({__proto__:null,MosaicIndex:fd,ShapeArcIndex:ld});function pd(e,n,r){(r=t.extend({},r)).field&&(r.fields=[r.field]);var i=xp(r.fields,e.data),a=function(e,t){return e.shapes.reduce(function(e,n,r){var i=t(r);return i in e==!1&&(e[i]=[]),e[i].push(r),e},[])}(e,i);return Lp(e,gd(a,e,n,r),i,r)}function dd(e,n){var r=n.map(function(e,t){return{tile_id:t}});return t.defaults({shapes:n,data:new di(r)},e)}function gd(e,n,r,i){var a,o,s=pr(n.shapes,r.arcs),u=new fd(n,new lo(r.arcs,s),{flat:!i.allow_overlaps,simple:1==e.length,overlap_rule:i.overlap_rule}),c=!i.allow_overlaps&&(i.sliver_control||i.gap_fill_area);c&&(o=lh(n,r,t.extend({sliver_control:1},i)),a=u.removeGaps(o.filter));var f,l,h,p,d=wl(u.nodes),g=e.map(function(e){var t=u.getTilesByShapeIds(e);return i.tiles?t.reduce(function(e,t){return e.concat(t)},[]):function(e,t){for(var n,r,i=[],a=[],o=0,s=e.length;o<s;o++)r=e[o],i.push(r[0]),r.length>1&&(a=a.concat(r.slice(1)));n=t(i.concat(a),"dissolve"),n.length;return n.length>0?n:null}(t,d)});if(g=function(e,t){var n=function(e,n){mr(n);var r=t([n],"flatten");return r.length>1?(r.forEach(mr),e=e.concat(r)):e.push(mr(n)),e};return e.map(function(e){return e?e.reduce(n,[]):null})}(g,d),c&&!i.quiet){var m=(f=a.removed,l=a.remaining,h=o.label,p=f+l,f>0==0?"":t.format("Removed %,d of %,d sliver%s using %s",f,p,t.pluralSuffix(p),h));m&&xt(m)}return g}var md=Object.freeze({__proto__:null,composeMosaicLayer:dd,dissolvePolygonGroups2:gd,dissolvePolygonLayer2:pd});function yd(e,t,n){var r=t.arcs,i=new lo(r,pr(e.shapes,r)),a=new id(r.size());e.shapes=e.shapes.map(function(e,t){return e?(e=function(e,t){var n=[];return Cr(e,r),n;function r(e){for(var r,i=e.length,a=[],o=0;o<i;o++)r=e[o],a.push(r),o<i-1&&t.getConnectedArcs(r).length>1&&(n.push(a),a=[]);a.length>0&&n.push(a)}}(e,i),a.clear(),e=function(e,t){var n=e.reduce(function(e,n){return function(e,t,n){for(var r,i=[],a=0;a<t.length;a++)r=t[a],n.hasId(r)?i.length>0&&(e.push(i),i=[]):i.push(r),n.setId(r,a),n.setId(~r,a);i.length>0&&e.push(i)}(e,n,t),e},[]);return n.length>0?n:null}(e,a),a.clear(),e=function(e,t,n){return!e||e.length<2?e:(e.forEach(function(e,t){var i=~e[0],a=e[e.length-1];(n.hasId(i)||n.hasId(a))&&vt("Indexing error"),n.setId(i,t),n.setId(a,t),r(i,t),r(a,t)}),e.filter(function(e){return!!e}));function r(r,i){var a,o=0,s=-1,u=n.getId(r);if(t.forEachConnectedArc(r,function(e){n.hasId(e)&&(s=n.getId(e),a=e),o++}),1==o&&s>-1&&s<i){!function(e,t,n,r,i){var a,o,s=e[t],u=e[r];~n==s[0]?a=!0:n==s[s.length-1]?a=!1:vt("Index error");~i==u[0]?o=!0:i==u[u.length-1]?o=!1:vt("Index error 2");o||(u=mr(u.concat()));a?function(e,t){t=mr(t.concat());var n=[0,0].concat(t);e.splice.apply(e,n)}(s,u):function(e,t){e.push.apply(e,t)}(s,u)}(e,s,a,u,r),n.setId(r,s);var c=function(e,t){var n=~e[0],r=e[e.length-1];if(t==n)return r;if(t==r)return n;vt("Indexing error")}(e[u],r);n.setId(c,s),u!=s&&(e[u]=null)}}}(e,i,a),e):null})}function vd(e,n,r){var i,a=r||{},o=!a.only_arcs,s=t.some(e,wi);a.debug?Vp(n,a):(e.forEach(function(e){xi(e)&&("polygon"==e.geometry_type&&a.rewind&&$f(e,n.arcs),o&&(i||(i=Vp(n,a)),"polygon"==e.geometry_type?function(e,t,n){n=Object.assign({gap_fill_area:"auto"},n);var r=e.shapes.map(function(e,t){return[t]});e.shapes=gd(r,e,t,n)}(e,n,a):"polyline"==e.geometry_type?yd(e,n):"point"==e.geometry_type&&function(e){var t,n;function r(e){var r=e.join("~");r in t||(t[r]=!0,n.push(e))}e.shapes=e.shapes.map(function(e,i){return e&&e.length>0!=!1?1==e.length?e:(t={},n=[],e.forEach(r),0===n.length?null:n):null})}(e)),a.allow_empty||pp.filterFeatures(e,n.arcs,{remove_empty:!0,verbose:a.verbose}))}),!a.no_arc_dissolve&&s&&n.arcs&&ho(n))}function bd(e){return e.reduce(function(e,n){return null===e?e=n.name||null:e&&n.name&&(e=t.mergeNames(e,n.name)),e},null)||""}pp.cleanLayers=vd,pp.mergeAndFlattenLayers=function(e,t,n){if(!n.flatten)return pp.mergeLayers(e,n);e.forEach(function(e){Ri(e,"the flatten option requires polygon layers")});var r=pp.mergeLayers(e,n);return ko(t,e,r),vd(r,t,{overlap_rule:"max-id"}),ko(t,r,e),r},pp.mergeLayers=function(e,n){var r=e.filter(ki),i={};return n=n||{},r.length?1==r.length?(xt("Use the target= option to specify multiple layers for merging"),r.concat()):(i.data=function(e,n){var r=t.uniq(e.reduce(function(e,t){return e.concat(t.data?t.data.getFields():[])},[]));if(0===r.length)return null;var i=e.reduce(function(e,t){var n=t.data?t.data.getRecords():new di(ki(t)).getRecords();return e.concat(n)},[]),a=function(e,n){var r=t.uniq(n.reduce(function(n,r){return n.concat(t.difference(e,r.data?r.data.getFields():[]))},[]));return r}(r,e);(function(e,t){var n;e.length>0&&(n="["+e.join(", ")+"]",n=(1==e.length?"Field "+n+" is missing":"Fields "+n+" are missing")+" from one or more layers",t.force?!1!==t.verbose&&xt("Warning: "+n):bt(n))})(a,n),function(e,t){e.forEach(function(e){var n=function(e,t){return t.reduce(function(t,n){var r=n.data?ei(e,n.data.getRecords()):null;return r&&-1==t.indexOf(r)&&t.push(r),t},[])}(e,t);n.length>1&&bt('Inconsistent data types in "'+e+'" field:',n.join(", "))})}(r,e),a.length>0&&Kr(i);return new di(i)}(r,n),i.name=bd(r),i.geometry_type=function(e){var n=t.uniq(t.pluck(e,"geometry_type")).filter(function(e){return!!e});n.length>1&&bt("Incompatible geometry types:",n.join(", "));return n[0]||null}(r),i.geometry_type&&(i.shapes=function(e){return e.reduce(function(e,t){for(var n=t.shapes||[],r=ki(t),i=-1;++i<r;)e.push(n[i]||null);return e},[])}(r)),i.shapes&&i.data&&i.shapes.length!=i.data.size()&&vt("Mismatch between geometry and attribute data"),[i]):null};var _d={};function xd(e,n){(n=t.extend({},n)).rfc7946=!n.gj2008;var r=n.extension||"json";return n.rfc7946&&Sd(e),n.file&&(r=Ro(n.file)),(n.combine_layers?[e.layers]:e.layers.map(function(e){return[e]})).map(function(i){var a=bd(i)||"output";return{content:Ed(t.defaults({layers:i},e),n,"buffer"),filename:a+"."+r}})}function wd(e,t,n,r,i){var a,o=Pd(e.data,n),s=e.shapes,u=Nd(e.data,n);return a=n.ndjson?Xf:n.prettify?Kf(["bbox","coordinates"]):JSON.stringify,o&&s&&o.length!==s.length&&vt("Mismatch between number of properties and number of shapes"),(s||o||[]).reduce(function(c,f,l){var h=s?s[l]:null,p=_d.exporters[e.geometry_type],d=h?p(h,t.arcs,n):null,g=null;if(r)g=function(e,t,n){var r=_d.toFeature(e,t);Array.isArray(n.hoist)&&t&&(r.properties=Object.assign({},t),n.hoist.forEach(e=>{t.hasOwnProperty(e)&&(r[e]=t[e],delete r.properties[e])}));return r}(d,o?o[l]:null,n),u&&(g.id=u[l]),n.no_null_props&&!g.properties&&(g.properties={});else{if(!d)return c;g=d}return i&&(g=a(g),"buffer"==i&&(g=Vr(g,"utf8"))),c.push(g),c},[])}function Sd(e){var t=Ia(e);if(!(t&&Na(t)||So(e))){var n="RFC 7946 warning: non-WGS84 GeoJSON output.";t&&(n+=' Tip: use "-proj wgs84" to convert.'),xt(n)}}function Ad(e,t){var n,r,i,a,o=Ia(e),s=t&&o&&Na(o),u=new qt,c=new qt;return e.layers.forEach(function(t){wi(t)?wr(t.shapes,null,function(t){var n=e.arcs.getSimpleShapeBounds(t.arcs);(n.centerX()<0?u:c).mergeBounds(n)}):Si(t)&&Wt(t.shapes,function(e){(e[0]<0?u:c).mergePoint(e[0],e[1])})}),(n=(new qt).mergeBounds(c).mergeBounds(u)).hasBounds()&&(a=n.toArray()),s&&c.hasBounds()&&u.hasBounds()&&(r=c.xmin-u.xmax,i=360+u.xmin-c.xmax,r>0&&r>i&&(a[0]=c.xmin,a[2]=u.xmax)),a||null}function Ed(e,t,n){var r,i,a={},o=e.layers,s=kd(o,t);return a.type=s?"FeatureCollection":"GeometryCollection",t.gj2008&&Id(e,a),t.bbox&&(i=Ad(e,t.rfc7946))&&(a.bbox=i),r=o.reduce(function(r,i,a){var o=wd(i,e,t,s,n);return r.length>0?r.concat(o):o},[]),"Feature"==t.geojson_type&&1==r.length?r[0]:t.ndjson?_d.formatCollectionAsNDJSON(r):n?_d.formatCollection(a,r):(a[Md(a.type)]=r,a)}function Md(e){return"FeatureCollection"==e?"features":"GeometryCollection"==e?"geometries":void vt("Invalid collection type:",e)}function Id(e,t){var n=e.info||{};!n.crs&&"input_geojson_crs"in n&&(t.crs=n.input_geojson_crs)}function kd(e,n){var r=n.geojson_type||"";return"Feature"==r||"FeatureCollection"==r||"GeometryCollection"!=r&&(r&&bt("Unsupported GeoJSON type:",n.geojson_type),t.some(e,function(e){var t=e.data?e.data.getFields():[],r=Cd(t,n),i=!!Od(t,n);return r||i}))}function Cd(e,t){return!(t.drop_table||t.cut_table||0===e.length||1==e.length&&e[0]==_d.ID_FIELD)}function Pd(e,n){var r,i=e?e.getFields():[],a=Od(i,n);return Cd(i,n)?(r=e.getRecords(),a==_d.ID_FIELD?r.map(function(e){return delete(e=t.extend({},e))[a],e}):r):null}function Od(e,n){var r=[],i=n.id_field;return t.isString(i)?r.push(i):t.isArray(i)&&(r=i),r.push(_d.ID_FIELD),t.find(r,function(n){return t.contains(e,n)})}function Nd(e,t){var n=Od(e?e.getFields():[],t);return n?e.getRecords().map(function(e){return n in e?e[n]:null}):null}_d.ID_FIELD="FID",_d.typeLookup={LineString:"polyline",MultiLineString:"polyline",Polygon:"polygon",MultiPolygon:"polygon",Point:"point",MultiPoint:"point"},_d.translateGeoJSONType=function(e){return _d.typeLookup[e]||null},_d.pathIsRing=function(e){var t=e[0],n=e[e.length-1];return e.length>=4&&t[0]==n[0]&&t[1]==n[1]},_d.toFeature=function(e,t){var n=e?e.type:null;return"Feature"==n?e:n in _d.typeLookup?{type:"Feature",geometry:e,properties:t||null}:{type:"Feature",geometry:null,properties:t||null}},_d.formatCollectionAsNDJSON=function(e){var n=t.createBuffer("\n","utf8"),r=e.reduce(function(e,t,r){return r>0&&e.push(n),e.push(t),e},[]);return u.concat(r)},_d.formatCollection=function(e,n){var r=JSON.stringify(e).replace(/\}$/,', "'+Md(e.type)+'": [\n');return t.isString(n[0])?r+n.join(",\n")+"\n]}":_d.joinOutputBuffers(r,"\n]}",n)},_d.joinOutputBuffers=function(e,n,r){var i=t.createBuffer(",\n","utf8"),a=r.reduce(function(e,t,n){return n>0&&e.push(i),e.push(t),e},[t.createBuffer(e,"utf8")]);return a.push(t.createBuffer(n,"utf8")),u.concat(a)},_d.exportPointGeom=function(e,t){var n=null;return 1==e.length?n={type:"Point",coordinates:e[0]}:e.length>1&&(n={type:"MultiPoint",coordinates:e}),n},_d.exportLineGeom=function(e,t){var n=Yf(e,t,"polyline");if(0===n.pointCount)return null;var r=n.pathData.map(function(e){return e.points});return 1==r.length?{type:"LineString",coordinates:r[0]}:{type:"MultiLineString",coordinates:r}},_d.exportPolygonGeom=function(e,t,n){var r=Yf(e,t,"polygon");if(0===r.pointCount)return null;var i=Wf(r.pathData,t,n.invert_y),a=n.rfc7946&&!n.invert_y,o=i.map(function(e){return e.map(function(e){return a&&e.points.reverse(),e.points})});return 1==o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o}},_d.exporters={polygon:_d.exportPolygonGeom,polyline:_d.exportLineGeom,point:_d.exportPointGeom};var Td=Object.freeze({__proto__:null,default:_d,exportDatasetAsGeoJSON:Ed,exportGeoJSON:xd,exportIds:Nd,exportLayerAsGeoJSON:wd,exportProperties:Pd,getDatasetBbox:Ad,getIdField:Od,preserveOriginalCRS:Id,useFeatureCollection:kd,warnIfNotWgs84:Sd});function Ld(e,t){var n,r=Ud(e);return(n=r?Rd(r,e.arcs):Dd(e,t)).invert_y=!!t.invert_y,n.crs=Ia(e),n}function zd(e,t){var n=new qt(t.bbox),r=t.bbox2?new qt(t.bbox2):new qt(0,0,t.width,t.height);n.fillOut(r.width()/r.height());var i=n.getTransform(r,t.invert_y);No(e,function(e,t){return i.transform(e,t)})}function Rd(e,t){var n=Ji(e,t),r=e.data.getReadOnlyRecordAt(0).width||800;return{type:"frame",width:r,height:Math.round(r*n.height()/n.width()),bbox:n.toArray()}}function Dd(e,t){var n,r;return t.svg_bbox?(n=new qt(t.svg_bbox),t=Object.assign({margin:0},t)):n=wo(e),r=qd(n,t),{bbox:n.toArray(),bbox2:r.toArray(),width:Math.round(r.width()),height:Math.round(r.height())||1,type:"frame"}}function jd(e,t){var n,r,i=e.width()/e.height();return n=(r=t.pixels?Math.sqrt(+t.pixels*i):+t.width)/i,[Math.round(r),Math.round(n)]}function Fd(e,t){return"frame"==rm(e)&&Ai(e,t)}function Ud(e){return t.find(e.layers,function(t){return Fd(t,e.arcs)})}function Bd(e){return t.find(e.getLayers(),function(e){return Fd(e.layer,e.dataset.arcs)})}function Gd(e){var t,n,r=new qt(e.bbox);return e.crs?(t=Pa(r.centerX(),r.centerY(),e.crs),n=e.crs.to_meter):(t=1,n=1),r.width()/t*n/e.width}function qd(e,t){var n,r,i,a,o,s=0,u=0,c=0,f=0,l=e.width(),h=e.height(),p=Vd(t.margin),d=p[0]+p[2],g=p[1]+p[3];return t.fit_bbox?(c=t.fit_bbox[0],f=t.fit_bbox[1],n=t.fit_bbox[2]-c,r=t.fit_bbox[3]-f,d=g=0):t.svg_scale>0?(n=l/t.svg_scale+d,r=0):+t.pixels?(n=(i=jd(e,t))[0],r=i[1]):(r=t.height||0,n=t.width||(r>0?0:800)),r>0&&(o=(h||l||1)/(r-g)),n>0&&(a=(l||h||1)/(n-d)),n?r||(o=a,r=h>0?g+h/o:n,t.max_height>0&&r>t.max_height&&(o=a*r/t.max_height,r=t.max_height)):(a=o,n=l>0?d+l/a:r),a>o?u=(o=a)*(r-g)-h:o>a&&(s=(a=o)*(n-d)-l),e.padBounds(p[0]*a+.5*s,p[1]*o+.5*u,p[2]*a+.5*s,p[3]*o+.5*u),n>0&&r>0||vt("Missing valid height and width parameters"),a===o&&a>0||vt("Missing valid margin parameters"),new qt(c,f,n+c,r+f)}function Vd(e){var n=(t.isNumber(e)?String(e):e||"").trim().split(/[, ] */);return 1==n.length&&n.push(n[0]),2==n.length&&n.push(n[0],n[1]),3==n.length&&n.push(n[2]),n.map(function(e){var t=parseFloat(e);return isNaN(t)?0:t})}var $d=Object.freeze({__proto__:null,calcFrameData:Dd,calcOutputBounds:qd,findFrame:Bd,findFrameDataset:function(e){var t=Bd(e);return t&&t.dataset||null},findFrameLayer:function(e){var t=Bd(e);return t&&t.layer||null},findFrameLayerInDataset:Ud,fitDatasetToFrame:zd,getFrameData:Ld,getFrameLayerBounds:function(e){return new qt(im(e).bbox)},getFrameLayerData:Rd,getFrameSize:jd,getMapFrameMetersPerPixel:Gd,isFrameLayer:Fd,parseMarginOption:Vd});function Jd(e){if(!e)return null;var t=function(e){var t=/[, ]+(?![^(]*\))/;return String(e).trim().split(t)}(e),n=t[0]||"",r=null;return n.startsWith("dot")?(t[0]="dots",r=Hd(t)):n.startsWith("square")?(t[0]="squares",r=Hd(t)):n.startsWith("hatch")?(t[0]="hatches",r=Zd(t)):n.startsWith("dash")?r=Wd(t):isNaN(parseFloat(n))||(t.unshift("hatches"),r=Zd(t)),r||xt("Invalid pattern, ignoring:",e),r}function Wd(e){e.shift();for(var n,r=[],i=e.pop(),a=Xd(e.pop());e.length>0;){if(Yd(n=e.pop())){e.push(n);break}r.push(n)}var o=Xd(e.pop()),s=[Xd(e.pop()),Xd(e.pop())].reverse(),u=45;return e.length>0&&(u=Xd(e.pop())),e.length>0||o>0==!1?null:{type:"dashes",tileSize:[r.length*(o+a),t.sum(s)],colors:r,width:o,dashes:s,spacing:a,background:i,rotation:u}}function Zd(e){e.shift();for(var n=e.length%2==1?Xd(e.shift()):45,r=[],i=[],a=0;a<e.length;a+=2)i.push(Xd(e[a])),r.push(e[a+1]);return Math.min.apply(null,i)>0==!1?null:{tileSize:[t.sum(i),10],type:"hatches",colors:r,widths:i,rotation:n}}function Yd(e){return Xd(e)>0}function Hd(e){var t=[],n=e.shift(),r=0;Yd(e[1])&&(r=Xd(e.shift()));for(var i=Xd(e.shift()),a=e.pop(),o=Xd(e.pop());e.length>0;)t.push(e.shift());if(i>0==!1||o>=0==!1)return null;if(0===t.length)return null;var s=t.length*(i+o);return{type:n,tileSize:[s,s],colors:t,size:i,spacing:o,background:a,rotation:r}}function Xd(e){return parseFloat(e)||0}function Kd(e,n){var r=e["fill-pattern"],i=("hash_"+r).replace(/[()# ,_]+/g,"_"),a=t.find(n,function(e){return e.id==i});if(delete e["fill-pattern"],!a){if(a=function(e,t){var n,r=Jd(e);if(!r)return null;"hatches"==r.type?n=function(e){for(var t=e.tileSize[1],n="",r=0,i=0;r<e.widths.length;r++)n+=`<rect x="${i}" y="0" width="${e.widths[r]}" height="${t}" fill="${e.colors[r]}"></rect>`,i+=e.widths[r];return n}(r):"dots"==r.type||"squares"==r.type?n=function(e){for(var t=e.size,n=e.colors.length,r=t+e.spacing,i=n*n,a="squares"==e.type?tg:eg,o="",s=0,u=0,c=0;s<i;s++)o+=a(u,c,t,e.colors[(s+Math.floor(s/n))%n]),0===(u=(s+1)%n*r)&&(c+=r);return o}(r):"dashes"==r.type&&(n=function(e){for(var t="",n=0,r=0;n<e.colors.length;n++)t+=`<rect x="${r}" y="0" width="${e.width}" height="${e.dashes[0]}" fill="${e.colors[n]}"></rect>`,r+=e.width+e.spacing;return t}(r));return{svg:Qd(r,t,n),id:t,href:`url(#${t})`}}(r,i),!a)return;n.push(a)}e.fill=a.href}function Qd(e,t,n){var r=e.tileSize[0],i=e.tileSize[1],a=`<pattern id="${t}" patternUnits="userSpaceOnUse" width="${r}" height="${i}" patternTransform="rotate(${e.rotation})">`;return e.background&&(a+=`<rect x="0" y="0" width="${r}" height="${i}" fill="${e.background}"></rect>`),a+n+"</pattern>"}function eg(e,t,n,r){const i=n/2;return`<circle cx="${e+i}" cy="${t+i}" r="${i}" fill="${r}"></circle>`}function tg(e,t,n,r){return`<rect x="${e}" y="${t}" width="${n}" height="${n}" fill="${r}"></rect>`}var ng=Object.freeze({__proto__:null,convertFillPattern:Kd,parseDashes:Wd,parseDots:Hd,parseHatches:Zd,parsePattern:Jd}),rg={css:"inlinecss",class:"classname",dx:"measure",dy:"measure",fill:"color","fill-pattern":"pattern","fill-effect":null,"font-family":null,"font-size":null,"font-style":null,"font-stretch":null,"font-weight":null,"label-text":null,"letter-spacing":"measure","line-height":"measure",opacity:"number",r:"number",stroke:"color","stroke-dasharray":"dasharray","stroke-width":"number","stroke-opacity":"number","stroke-miterlimit":"number","fill-opacity":"number","vector-effect":null,"text-anchor":null},ig=t.extend({type:null,length:"number",rotation:"number",radius:"number",radii:null,flipped:"boolean",rotated:"boolean",direction:"number",sides:"number",points:"number",anchor:null,"head-angle":"number","head-width":"number","head-length":"number","stem-width":"number","stem-curve":"number","stem-taper":"number","stem-length":"number","min-stem-ratio":"number","arrow-scaling":"number",effect:null},rg),ag="css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity,vector-effect".split(","),og={polygon:t.arrayToIndex(ag.concat("fill","fill-pattern","fill-effect")),polyline:t.arrayToIndex(ag.concat("stroke-linecap","stroke-linejoin","stroke-miterlimit")),point:t.arrayToIndex(ag.concat("fill","r")),label:t.arrayToIndex(ag.concat("fill,font-family,font-size,text-anchor,font-weight,font-style,font-stretch,letter-spacing,dominant-baseline".split(",")))};function sg(e,t,n,r){for(var i=fg(Object.keys(n||{}),t),a=0,o=i.length;a<o;a++)r&&!r(i[a])||ug(e,i[a],n[i[a]]);"polygon"!=t&&"circle"!=t||!n.stroke||n.fill||ug(e,"fill","none")}function ug(e,t,n){e.properties||(e.properties={}),e.properties[t]=n,"stroke-dasharray"==t&&n&&(e.properties["stroke-linecap"]="butt")}function cg(e){return e in rg}function fg(e,t){var n=og[t]||{};return e.filter(function(e){return e in n})}function lg(e,t){var n={},r=[];return!e.data||e.data.getFields(),Object.keys(t).forEach(function(i){var a=i.replace(/_/g,"-");if(a in ig){var o=t[i];n[a]=pg(o,a,e),r.push(a)}}),function(e){for(var t,i={},a=0;a<r.length;a++)i[t=r[a]]=n[t](e);return i}}function hg(e,t){return(t=t||[]).indexOf(e.trim())>-1||/[(){}./*?:&|=[+-]/.test(e)}function pg(e,t,n){var r,i=String(e).trim(),a=ig[t],o=n.data?n.data.getFields():[],s=null;return a&&-1===o.indexOf(i)&&(s=function(e,t){var n=null;"number"==t?n=gg(e)?Number(e):null:"color"==t?n=bg(e)?e:null:"classname"==t?n=dg(e)?e:null:"measure"==t?n=yg(e)?vg(e):null:"dasharray"==t?n=/^[0-9]+( [0-9]+)*$/.test(e)?e:null:"pattern"==t?n=function(e){return!!Jd(e)}(e)?e:null:"boolean"==t?n=mg(e):"inlinecss"==t&&(n=e);return n}(i,a)),null===s&&hg(i,o)&&(r=function(e,t){var n;try{(n=ap(e,t,null,{no_warn:!0}))(0)}catch(e){n=null}return n}(i,n)),r||null!==s||a||(s=i),r||(null!==s?function(e){return s}:void bt("Unexpected value for",t+":",i))}function dg(e){return/^( ?[_a-z][-_a-z0-9]*\b)+$/i.test(e)}function gg(e){return t.isFiniteNumber(e)||t.isString(e)&&/^-?[.0-9]+$/.test(e)}function mg(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&null}function yg(e){return t.isFiniteNumber(e)||t.isString(e)&&/^-?[.0-9]+[a-z]*$/.test(e)}function vg(e){return t.isString(e)&&/[a-z]/.test(e)?e:Number(e)}function bg(e){return/^[a-z]+$/i.test(e)||/^#[0-9a-f]+$/i.test(e)||/^rgba?\([0-9,. ]+\)$/.test(e)}var _g=Object.freeze({__proto__:null,applyStyleAttributes:sg,findStylePropertiesBySymbolGeom:fg,getSymbolDataAccessor:lg,getSymbolPropertyAccessor:pg,isSupportedSvgStyleProperty:cg,isSvgClassName:dg,isSvgColor:bg,isSvgMeasure:yg,isSvgNumber:gg,mightBeExpression:hg,parseBoolean:mg,parseSvgMeasure:vg}),xg={Point:Sg,Polygon:Pg,LineString:Mg,MultiPoint:function(e,t){for(var n,r=[],i=0;i<e.length;i++)(n=Sg(e[i],t))&&("g"==n.tag&&n.children?r=r.concat(n.children):r.push(n));return r.length>0?{tag:"g",children:r}:null},MultiLineString:Ig,MultiPolygon:kg};function wg(e,t){return t=t||{},e.map(function(e){var n="Feature"==e.type?e.geometry:e,r=n&&n.type,i=_d.translateGeoJSONType(r),a=e.properties||{},o=null;return r&&n.coordinates&&(o=xg[r](n.coordinates,a)),o?("polyline"==i||"polygon"==i?sg(o,i,a):"point"==i&&Eg(a)&&sg(o,i,a,Ag),"id"in e&&(o.properties||(o.properties={}),o.properties.id=(t.id_prefix||"")+e.id),o):{tag:"g"}})}function Sg(e,t){if(Eg(t=t||{}))return{tag:"circle",properties:{cx:e[0],cy:e[1],r:t.r}};var n=Fg(t);return n&&(n.properties.transform=Dg(e)),n}function Ag(e){return"r"!=e}function Eg(e){return e&&e.r>0&&!e["svg-symbol"]&&!e["label-text"]}function Mg(e){return{tag:"path",properties:{d:Ng(e)}}}function Ig(e){return{tag:"path",properties:{d:e.map(Ng).join(" ")}}}function kg(e){return Pg(Cg(e))}function Cg(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Pg(e){if(0===e.length)return null;var t={tag:"path",properties:{d:Og(e)}};return e.length>1&&(t.properties["fill-rule"]="evenodd"),t}function Og(e){for(var t=[],n=0;n<e.length;n++)t.push(Ng(e[n])+" Z");return t.length>0?t.join(" "):""}function Ng(e){if(0===e.length)return"";for(var t="M",n=0,r=e.length;n<r;n++)t+=" "+e[n][0]+" "+e[n][1];return t}var Tg=Object.freeze({__proto__:null,flattenMultiPolygonCoords:Cg,importGeoJSONFeatures:wg,importLineString:Mg,importMultiLineString:Ig,importMultiPolygon:kg,importPoint:Sg,importPolygon:Pg});function Lg(e){var t=zg(e);return sg(t,"label",e),t}function zg(e){var t,n,r,i=(t=e["label-text"])||0===t||!1===t?String(t):"",a=/\n|\\n|<br>/i,o=e.dx||0,s={y:e.dy||0,x:o};return a.test(i)&&(n=i.split(a),i=n.shift()),r={tag:"text",value:i,properties:s},n&&(r.children=[],n.forEach(function(t){var n={tag:"tspan",value:t,properties:{x:o,dy:e["line-height"]||"1.1em"}};r.children.push(n)})),r}var Rg=Object.freeze({__proto__:null,renderLabel:zg,renderStyledLabel:Lg});function Dg(e,t){var n="translate("+ql(e[0])+" "+ql(e[1])+")";return t&&1!=t&&(n+=" scale("+t+")"),n}var jg={line:function(e,t,n){var r,i;return r=[[t,n],[t+(e.dx||0),n+(e.dy||0)]],sg(i=Mg(r),"polyline",e),i},polygon:function(e){var t=Pg(e.coordinates||[]);return sg(t,"polygon",e),t},polyline:function(e){var t=Ig(e.coordinates||[]);return sg(t,"polyline",e),t},circle:Bg,square:function(e,t,n){var r=e.r||0,i={tag:"rect",properties:{x:t-r,y:n-r,width:2*r,height:2*r}};return sg(i,"point",e),i},image:function(e,t,n){var r=e.width||20,i=e.height||20,a={tag:"image",properties:{width:r,height:i,x:(t||0)-r/2,y:(n||0)-i/2,href:e.href||""}};e.fill&&(a.properties.fill=e.fill);return a},group:function(e,t,n){var r={tag:"g",children:[]},i=r.children;return(e.parts||[]).forEach(function(e){var r=Ug(e,t,n);i.push(r),"line"==e.type&&(t+=e.dx||0,n+=e.dy||0),"offset"==e.type&&(i=r.children,t=n=0)}),1!=r.children.length||r.properties?r:r.children[0]},label:function(e,t,n){var r=Lg(e);(t||n)&&(r.properties.transform=Dg([t,n]));return r},offset:function(e,t,n){var r=(t||0)+(e.dx||0),i=(n||0)+(e.dy||0);return{tag:"g",properties:{transform:Dg([r,i])},children:[]}}};function Fg(e){var t=[];Mm(e)&&t.push(function(e){if(e["svg-symbol"])return Ug(e["svg-symbol"]);if(e.r>0)return Bg(e);return{tag:"g",properties:{},children:[]}}(e)),Im(e)&&t.push(Lg(e));var n=t.length>1?{tag:"g",children:t}:t[0];return n?(n.properties=n.properties||{},n):null}function Ug(e,n,r){if(t.isString(e)&&(e=JSON.parse(e)),e.tag)return e;var i=jg[e.type];if(!i)return xt(e.type?"Unknown symbol type: "+e.type:"Symbol is missing a type property"),{tag:"g",properties:{},children:[]};var a=i(e,n||0,r||0);return e.opacity&&(a.properties.opacity=e.opacity),a}function Bg(e,t,n){var r={tag:"circle",properties:{cx:t||0,cy:n||0}};return sg(r,"point",e),r}var Gg=Object.freeze({__proto__:null,getTransform:Dg,renderPoint:Fg,symbolRenderers:jg});function qg(e){var n=t.defaults({type:"scalebar"},e);return{name:e.name||"scalebar",data:new di([n])}}function Vg(e,t){if(!t.crs)return xt("Unable to render scalebar: unknown CRS."),[];if(t.width>0==!1)return[];var n,r,i=function(e){var t="b"==e.style||"B"==e.style?"b":"a";return Object.assign({},Jg,$g[t],e,{style:t})}(e),a=Gd(t),o=t.width,s=e.label?e.label.split(","):null,u=s&&s[0]||null,c=Xg(u||function(e,t,n){var r=70*t/1e3;return"1/8 1/5 1/4 1/2 1 2 3 4 5 8 10 15 20 25 30 40 50 75 100 150 200 250 300 350 400 500 750 1,000 1,500 2,000 2,500 3,000 4,000 5,000".split(" ").reduce(function(e,t){if(e)return e;var i=Yg(t,n);return Hg(i)>r?i:void 0},null)||""}(0,a,"mile")),f="b"==i.style&&s&&s[1]||null;if(c.km>0==!1)return xt("Unusable scalebar label:",u),[];var l=Math.round(c.km/a*1e3);l>0==!1&&bt("Null scalebar length"),f&&(n=Xg(f),(r=Math.round(n.km/a*1e3))>l&&bt("First part of a dual-unit scalebar must be longer than the second part."));var h=function(e){var t=e.position||"top-left";return{ypos:t.includes("top")?"top":"bottom",xpos:t.includes("left")?"left":"right"}}(i),p=Zg(i),d="right"==h.xpos?o-l-i.margin:i.margin,g="bottom"==h.ypos?t.height-i.margin:i.margin,m=Math.round(i.label_offset+i.tic_length+.8*i.font_size+i.bar_width/2),y=Math.round(i.bar_width/2),v="top"==p.ypos||f?m:y,b="bottom"==p.ypos||f?m:y;"top"==h.ypos?g+=v:g-=b;var _=function(e,t,n,r,i){var a=Wg(t,e,i),o=Wg("0",e,Object.assign({flipx:!0},i)),s=function(e,t,n){var r;r="b"==n.style?function(e,t,n){var r=[],i=Zg(n),a=n.tic_length+n.bar_width/2;"top"==i.ypos&&(a=-a);r.push([[0,a],[0,0],[e,0],[e,a]]),t>0&&(r.push([[0,0],[0,-a]]),r.push([[t,0],[t,-a]]));return r}(e,t,n):[[[0,0],[e,0]]];var i=Ig(r);return Object.assign(i.properties,{stroke:"black",fill:"none","stroke-width":n.bar_width,"stroke-linecap":"butt","stroke-linejoin":"miter"}),i}(e,n,i),u="b"==i.style?[o,a,s]:[a,s];r&&(u.push(Wg(r,n,Object.assign({flipy:!0},i))),u.push(Wg("0",n,Object.assign({flipx:!0,flipy:!0},i))));return{tag:"g",children:u}}(l,u,r,f,i);return _.properties={transform:"translate("+d+" "+g+")"},[_]}pp.scalebar=function(e,t){var n=qg(t);t.label&&!Kg(t.label)&&bt(`Expected units of km or miles in scalebar label (received ${t.label})`),function(e,t){var n={info:{},layers:[e]};t.getDatasets().push(n)}(n,e)};var $g={a:{bar_width:3,tic_length:0},b:{bar_width:1,tic_length:5}},Jg={position:"top-left",label_position:"top",label_offset:4,font_size:12,margin:12};function Wg(e,t,n){var r=Zg(n),i=t*r.kx+r.dx,a=n.bar_width+n.tic_length+n.label_offset,o=-n.label_offset-n.tic_length,s="top"==r.ypos?o:a,u={"label-text":e,"font-size":n.font_size,"text-anchor":r.anchor,"dominant-baseline":"top"==r.ypos?"auto":"hanging"};return jg.label(u,i,s)}function Zg(e){var t,n=e.label_position,r=n.includes("bottom")?"bottom":"top",i=0;return t="a"==e.style?(n.includes("center")?"center":n.includes("right")&&"right")||"left":"right",e.flipx&&(t=("left"==t?"right":"right"==t&&"left")||t),e.flipy&&(r=("top"==r?"bottom":"bottom"==r&&"top")||r),"b"==e.style&&(i="left"==t&&-e.font_size/4||"right"==t&&e.font_size/4||0),{xpos:t,ypos:r,dx:i,kx:("right"==t?1:"center"==t&&.5)||0,anchor:("center"==t?"middle":"left"==t&&"start")||"end"}}function Yg(e,t){var n=Qg(e);return e+" "+(("km"==t?"KM":n>1&&"MILES")||"MILE")}function Hg(e){var t=Kg(e),n=Qg(e);return t&&n?"mile"==t?1.60934*n:n:NaN}function Xg(e){var t=e?Qg(e):null,n=e?Kg(e):"mile",r=NaN;return n&&t&&(r="mile"==n?1.60934*t:t),{number:t,units:n,km:r}}function Kg(e){var t=/(miles?|mi[.]?|英里)$/.test(e.toLowerCase()),n=/(k\.m\.|km|kilometers?|kilom.tres?|公里)$/.test(e.toLowerCase());return(t?"mile":n&&"km")||""}function Qg(e){var t,n,r=/^([0-9]+) ?\/ ?([0-9]+)/;return e=e.replace(/[\s]/g,"").replace(/,/g,""),(n=r.test(e)?+(t=r.exec(e))[1]/+t[2]:parseFloat(e))>0&&n<1/0?n:NaN}var em=Object.freeze({__proto__:null,formatDistanceLabel:Yg,getScalebarLayer:qg,parseScalebarLabelToKm:Hg,renderScalebar:Vg}),tm={scalebar:Vg};function nm(e){var t=rm(e);return!!t&&t in tm}function rm(e){var t=e.data&&e.data.getReadOnlyRecordAt(0);return t&&t.type||null}function im(e){return e.data&&e.data.getReadOnlyRecordAt(0)}function am(e,t){var n=im(e),r=tm[n.type];return r||bt("Missing renderer for",n.type,"element"),t.crs||bt(`Unable to render ${n.type} (unknown map projection)`),Oa(t.crs)||bt(`Unable to render ${n.type} (map is unprojected)`),r(n,t)||[]}var om=Object.freeze({__proto__:null,getFurnitureLayerData:im,getFurnitureLayerType:rm,isFurnitureLayer:function(e){return nm(e)},layerHasFurniture:nm,renderFurnitureLayer:am});function sm(e){var t,n;return e&&e.tag?(t="<"+e.tag,e.properties&&(t+=lm(e.properties)),e.children||e.value?(t+=">"+(n="text"==e.tag||"tspan"==e.tag?"":"\n"),e.value&&(t+=fm(e.value)),e.children&&(t+=e.children.map(sm).join(n)),t+=n+"</"+e.tag+">"):t+="/>",t):""}var um=/[&<>"']/g,cm={"&":"&","<":"<",">":">",'"':""","'":"'"};function fm(e){return String(e).replace(um,function(t,n){var r=cm[t];return"&"==t&&e.substr(n,r.length)==r?"&":r})}function lm(e){return Object.keys(e).reduce(function(n,r){var i=e[r];return i||0===i?("href"==r&&(r="xlink:href"),"css"==r&&(r="style"),n+" "+r+'="'+fm(t.isString(i)?i:JSON.stringify(i))+'"'):n},"")}var hm=Object.freeze({__proto__:null,stringEscape:fm,stringify:sm,stringifyProperties:lm});function pm(){return{cx:.5,cy:.5,r:.57,fx:.35,fy:.35,stops:[{offset:.3,opacity:0},{offset:.6,opacity:.1},{offset:.78,opacity:.25},{offset:.87,opacity:.45},{offset:.95,opacity:1}]}}function dm(e,n){if("sphere"==e["fill-effect"]){var r="mapshaper_sphere_effect",i=`url(#${r})`,a={cx:.5,cy:.5,r:.57,fx:.35,fy:.35,stops:[{offset:.3,opacity:0},{offset:.6,opacity:.1},{offset:.78,opacity:.25},{offset:.87,opacity:.45},{offset:.95,opacity:1}]},o=a.stops.map(function(e){return`<stop offset="${e.offset}" stop-opacity="${e.opacity}"/>`}),s=`<radialGradient id="${r}" cx="${a.cx}" cy="${a.cy}" r="${a.r}" fx="${a.fx}" fy="${a.fy}">${o.join("")}</radialGradient>`;t.find(n,function(e){return e.id==r})||n.push({svg:s,id:r,href:i}),e.fill=i,"opacity"in e==!1&&"fill-opacity"in e==!1&&(e["fill-opacity"]=.35)}}var gm=Object.freeze({__proto__:null,convertFillEffect:dm,getSphereEffectParams:pm}),mm={};function ym(e,n){!function e(r){"path"==r.tag&&r.properties["fill-pattern"]&&Kd(r.properties,n);"path"==r.tag&&r.properties["fill-effect"]&&dm(r.properties,n);"image"==r.tag?/\.svg/.test(r.properties.href||"")&&function(e,n){var r=e.properties.href,i=t.find(n,function(e){return e.href==r});i||((i={href:r,id:vm(r)}).svg=function(e,t){var n="";try{n=function(e,t){return e=e.replace(/[^]*<svg/,"<svg"),e.replace(/^<svg[^>]*>/,function(e){return e=(e=e.replace(/ id="[^"]*"/,"")).replace(/<svg/,'<svg id="'+t+'"')})}(function(e){var t;0===e.indexOf("http")?t=function(e){if(e in mm)return mm[e];var t=s("sync-request")("GET",e,{timeout:2e3}).getBody().toString();return mm[e]=t,t}(e):s("fs").existsSync(e)?t=s("fs").readFileSync(e,"utf8"):bt("Invalid SVG location:",e);return t}(e),t)+"\n",n="\x3c!-- "+e+"--\x3e\n"+n}catch(e){}return n}(r,i.id),n.push(i));i.svg&&(e.tag="use",e.properties.href="#"+i.id)}(r,n):r.children&&r.children.forEach(e)}(e)}function vm(e){return function(e){for(var t,n,r,i,a,o,s,u=0,c=0,f=[],l=[t=1732584193,n=4023233417,~t,~n,3285377520],h=[],p=unescape(encodeURI(e)),d=p.length;c<=d;)h[c>>2]|=(p.charCodeAt(c)||128)<<8*(3-c++%4);for(h[s=d+8>>2|15]=d<<3;u<=s;u+=16){for(t=l,c=0;c<80;t=[0|[(o=((p=t[0])<<5|p>>>27)+t[4]+(f[c]=c<16?~~h[u+c]:o<<1|o>>>31)+1518500249)+((n=t[1])&(r=t[2])|~n&(i=t[3])),a=o+(n^r^i)+341275144,o+(n&r|n&i|r&i)+882459459,a+1535694389][0|c++/20],p,n<<30|n>>>2,r,i])o=f[c-3]^f[c-8]^f[c-14]^f[c-16];for(c=5;c;)l[--c]=l[c]+t[c]|0}for(e="";c<40;)e+=(l[c>>3]>>4*(7-c++%8)&15).toString(16);return e}(e).substr(0,12)}function bm(e,n){var r,i,a,o='xmlns="http://www.w3.org/2000/svg"',s=[],u="";n.crisp_paths&&(u="\n<style>\n path {shape-rendering: crispEdges;}\n</style>"),n.final?e.arcs&&e.arcs.flatten():e=bo(e),n=Object.assign({invert_y:!0,margin:"1"},n),r=Ld(e,n),zd(e,r),Hl(e,n.precision||.01),n.svg_data&&wm(e.layers,n.svg_data),a=e.layers,n.scalebar&&a.push(qg({})),i=a.map(function(t){var i;return ym(i=nm(t)?_m(t,r,n):xm(t,e,n),s),sm(i)}).join("\n"),s.length>0&&(i="<defs>\n"+t.pluck(s,"svg").join("")+"</defs>\n"+i),i.includes("xlink:")&&(o+=' xmlns:xlink="http://www.w3.org/1999/xlink"');var c=`stroke-linecap="${n.default_linecap||"round"}" stroke-linejoin="round"`;i.includes('stroke-linejoin="miter"')&&(c+=' stroke-miterlimit="2"');var f=`<?xml version="1.0"?>\n<svg ${o} version="1.2" baseProfile="tiny" width="%d" height="%d" viewBox="%s %s %s %s" ${c}>${u}\n${i}\n</svg>`;return[{content:i=t.format(f,r.width,r.height,0,0,r.width,r.height),filename:n.file||Bo(e)+".svg"}]}function _m(e,t,n){var r=Em(e,n);return r.children=am(e,t),r}function xm(e,n,r){var i=Em(e,r);return Ai(e,n.arcs)&&function(e){var t=bi(e).getRecords()[0];t.fill||t.stroke||(t.fill="none")}(e=Bi(e)),i.children=function(e,n,r){var i=t.defaults({layers:[e]},n),a=Ed(i,r),o=wg(a.features||a.geometries||(a.type?[a]:[]),r);r.svg_data&&e.data&&function(e,n,r){var i=n.getFields(),a=r.indexOf("*")>-1?i.concat():r,o=t.difference(a,i);o.length>0&&(a=t.difference(a,o));var s=Sm(n.getRecords(),a);e.length!=s.length&&vt("Mismatch between number of SVG symbols and data attributes");e.forEach(function(e,n){t.extend(e.properties||{},s[n])})}(o,e.data,r.svg_data);return o}(e,n,r),i}function wm(e,n){var r=n.reduce(function(n,r){return function(e,n){return t.some(e,function(e){return e.data&&e.data.fieldExists(n)||!1})}(e,r)||n.push(r),n},[]);r.length&&-1==r.indexOf("*")&&bt("Missing data field(s):",r.join(", "))}function Sm(e,n){var r=/^[a-z_][a-z0-9_-]*$/i,i=/^xml/,a=n.filter(function(e){return r.test(e)&&!i.test(e)}),o=t.difference(n,a);return o.length>0&&(xt("Unable to add data-* attributes for field(s):",o.join(", ")),xt("data-* names should match pattern [a-z_][a-z0-9_-]*")),e.map(function(e){for(var t={},n=0;n<a.length;n++)t["data-"+a[n].toLowerCase()]=Am(e[a[n]]);return t})}function Am(e){return String(e)}function Em(e,n){var r={tag:"g",properties:{id:(n.id_prefix||"")+(e.name||t.getUniqueName("layer"))},children:[]};return("polyline"==e.geometry_type||km(e))&&(r.properties.fill="none"),"polyline"==e.geometry_type&&(r.properties.stroke="black",r.properties["stroke-width"]=1),(Cm(e)||km(e)||nm(e))&&(r.properties["font-family"]="sans-serif",r.properties["font-size"]="12",r.properties["text-anchor"]="middle"),r}function Mm(e){return!(!e||!e["svg-symbol"]&&!e.r)}function Im(e){var t=e&&e["label-text"];return t||0===t}function km(e){return"point"==e.geometry_type&&e.data&&e.data.fieldExists("svg-symbol")}function Cm(e){return"point"==e.geometry_type&&e.data&&e.data.fieldExists("label-text")}var Pm=Object.freeze({__proto__:null,exportDataAttributesForSVG:Sm,exportFurnitureLayerForSVG:_m,exportLayerForSVG:xm,exportSVG:bm,featureHasLabel:Im,featureHasSvgSymbol:Mm,getEmptyLayerForSVG:Em,layerHasLabels:Cm,layerHasSvgSymbols:km,validateSvgDataFields:wm});function Om(e,n){t.isNumber(e)?e=new ArrayBuffer(e):e instanceof ArrayBuffer||("function"==typeof u&&e instanceof u||e instanceof Uint8Array?e=e.buffer&&e.buffer.byteLength==e.length?e.buffer:Om.copyToArrayBuffer(e):vt("BinArray constructor takes an integer, ArrayBuffer or Buffer argument")),this._buffer=e,this._bytes=new Uint8Array(e),this._view=new DataView(e),this._idx=0,this._le=!1!==n}Om.bufferToUintArray=function(e,t){return 4==t?new Uint32Array(e):2==t?new Uint16Array(e):1==t?new Uint8Array(e):void vt("BinArray.bufferToUintArray() invalid word length:",t)},Om.uintSize=function(e){return 1&e||2&e||4},Om.bufferCopy=function(e,t,n,r,i){r=r||0,i=i||n.byteLength-r,e.byteLength-t<i&&vt("Buffer overflow; tried to write:",i);for(var a=Math.min(Om.uintSize(i),Om.uintSize(r),Om.uintSize(e.byteLength),Om.uintSize(t),Om.uintSize(n.byteLength)),o=Om.bufferToUintArray(n,a),s=Om.bufferToUintArray(e,a),u=i/a,c=r/a,f=t/a;u--;)s[f++]=o[c++];return i},Om.copyToArrayBuffer=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e[i];return n},Om.bufferSize=function(e){return e instanceof ArrayBuffer?e.byteLength:0|e.length},Om.prototype={size:function(){return this._buffer.byteLength},littleEndian:function(){return this._le=!0,this},bigEndian:function(){return this._le=!1,this},buffer:function(){return this._buffer},bytesLeft:function(){return this._buffer.byteLength-this._idx},skipBytes:function(e){return this._idx+=e+0,this},readUint8:function(){return this._bytes[this._idx++]},writeUint8:function(e){return this._bytes[this._idx++]=e,this},readInt8:function(){return this._view.getInt8(this._idx++)},writeInt8:function(e){return this._view.setInt8(this._idx++,e),this},readUint16:function(){var e=this._view.getUint16(this._idx,this._le);return this._idx+=2,e},writeUint16:function(e){return this._view.setUint16(this._idx,e,this._le),this._idx+=2,this},readUint32:function(){var e=this._view.getUint32(this._idx,this._le);return this._idx+=4,e},writeUint32:function(e){return this._view.setUint32(this._idx,e,this._le),this._idx+=4,this},readInt32:function(){var e=this._view.getInt32(this._idx,this._le);return this._idx+=4,e},writeInt32:function(e){return this._view.setInt32(this._idx,e,this._le),this._idx+=4,this},readFloat64:function(){var e=this._view.getFloat64(this._idx,this._le);return this._idx+=8,e},writeFloat64:function(e){return this._view.setFloat64(this._idx,e,this._le),this._idx+=8,this},readFloat64Array:function(e){var t,n=8*e,r=this._idx,i=this._buffer;if(r%8==0)t=new Float64Array(i,r,e);else if(i.slice)t=new Float64Array(i.slice(r,r+n));else{var a=new ArrayBuffer(n);Om.bufferCopy(a,0,i,r,n),t=new Float64Array(a)}return this._idx+=n,t},readUint32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.readUint32());return t},peek:function(e){return this._view.getUint8(e>=0?e:this._idx)},position:function(e){return null!=e?(this._idx=e,this):this._idx},readCString:function(e,t){for(var n="",r=e>=0?e:this.bytesLeft();r>0;){var i=this.readUint8();if(r--,0==i)break;if(i>127&&t){n=null;break}n+=String.fromCharCode(i)}return e>0&&r>0&&this.skipBytes(r),n},writeString:function(e,t){var n,r=0,i=e.length;t&&(i=Math.min(i,t));for(var a=0;a<i;a++)(n=e.charCodeAt(a))>127&&(n="?".charCodeAt(0)),this.writeUint8(n),r++;return r},writeCString:function(e,t){var n=t?t-1:null,r=this.writeString(e,n);if(this.writeUint8(0),r++,t)for(;r<t;)this.writeUint8(0),r++;return this},writeBuffer:function(e,t,n){return this._idx+=Om.bufferCopy(this._buffer,this._idx,e,n,t),this}};var Nm=Object.freeze({__proto__:null,BinArray:Om,buffersAreIdentical:function(e,t){var n=Om.bufferSize(e);if(n!=Om.bufferSize(t))return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}}),Tm={},Lm=254;Tm.MAX_STRING_LEN=Lm,Tm.convertValueToString=Rm,Tm.convertFieldNames=jm,Tm.discoverFieldType=Bm,Tm.getDecimalFormatter=Gm,Tm.getNumericFieldInfo=qm,Tm.truncateEncodedString=$m,Tm.getFieldInfo=Um,Tm.exportRecords=function(e,n,r){var i=e.length,a=fi(e,r),o=n||"utf8",s=Fr(a.join(""))?"ascii":o,u=function(e,n){return e.map(function(e){for(var r=Vr(e,n),i=r.length,a=t.createBuffer(11),o=0;o<11;o++)a[o]=o<10&&i>=o-1?r[o]:0;return a})}(jm(a,s),s),c=a.map(function(t,n){var r=Um(e,t,o);return r.warning&&xt("["+t+"] "+r.warning),r}),f=(y=c.length,33+32*y),l=(m=t.pluck(c,"size"),t.sum(m)+1),h=f+i*l+1,p=new ArrayBuffer(h),d=new Om(p).littleEndian(),g=new Date;var m;var y;d.writeUint8(3),d.writeUint8(g.getFullYear()-1900),d.writeUint8(g.getMonth()+1),d.writeUint8(g.getDate()),d.writeUint32(i),d.writeUint16(f),d.writeUint16(l),d.skipBytes(17),d.writeUint8(0),d.skipBytes(2),c.reduce(function(e,t,n){return d.writeBuffer(u[n],11,0),d.writeUint8(t.type.charCodeAt(0)),d.writeUint32(e),d.writeUint8(t.size),d.writeUint8(t.decimals),d.skipBytes(14),e+t.size},1),d.writeUint8(13),d.position()!=f&&vt("Dbf#exportRecords() header size mismatch; expected:",f,"written:",d.position());e.forEach(function(e,t){var n=d.position();d.writeUint8(32);for(var r=0,i=c.length;r<i;r++)c[r].write(t,d);d.position()-n!=l&&vt("#exportRecords() Error exporting record:",e)}),d.writeUint8(26),d.position()!=h&&vt("Dbf#exportRecords() file size mismatch; expected:",h,"written:",d.position());return p};var zm=new function(){var e,t;function n(){e=new Uint8Array(5e3),t=0}return n(),{reserve:function(r){return t+r>5e3&&n(),t+=r,e.subarray(t-r,t)},putBack:function(e){t-=e}}};function Rm(e){return null==e?"":String(e)}function Dm(e,t,n,r){var i="ascii"==r?Vm:function(e){return function(t){var n=Vm(t,!0);return null===n&&(n=Vr(String(t),e)),n}}(r),a=1,o=0,s=t.map(function(e){var t=Rm(e[n]),s=i(t);return s.length>Lm&&(s="ascii"==r?s.subarray(0,Lm):$m(s,r,Lm),o++),a=Math.max(a,s.length),s});e.size=a,e.write=function(e,t){var n,r=s[e],i=Math.min(a,r.length),o=t._bytes,u=t.position();for(n=0;n<i;n++)o[n+u]=r[n];t.position(u+a)},o>0&&(e.warning="Truncated "+o+" string"+(1==o?"":"s")+" to fit the 254-byte limit")}function jm(e,t){var n=ri(e.map(Fm),10,t);return n.forEach(function(t,n){e[n]!=t&&xt('Changed field name from "'+e[n]+'" to "'+t+'"')}),n}function Fm(e){return e.replace(/[-\s]+/g,"_")}function Um(e,n,r){var i=Bm(e,n),a={type:i,decimals:0};return"N"==i?function(e,n,r){var i,a;i=qm(n,r),e.decimals=i.decimals,(a=Math.max(i.max.toFixed(e.decimals).length,i.min.toFixed(e.decimals).length))>18&&(a=18,e.decimals-=a-18,e.decimals<0&&vt("Dbf#getFieldInfo() Out-of-range error.")),e.size=a;var o=Gm(a,e.decimals);e.write=function(e,i){var s=n[e],u=o(s[r]);u.length<a&&(u=t.lpad(u,a," ")),i.writeString(u,a)}}(a,e,n):"C"==i?Dm(a,e,n,r):"L"==i?function(e,t,n){e.size=1,e.write=function(e,r){var i,a=t[e][n];i=!0===a?"T":!1===a?"F":"?",r.writeString(i)}}(a,e,n):"D"==i?function(e,n,r){e.size=8,e.write=function(e,i){var a,o=n[e][r];a=o instanceof Date==0?"00000000":t.lpad(o.getUTCFullYear(),4,"0")+t.lpad(o.getUTCMonth()+1,2,"0")+t.lpad(o.getUTCDate(),2,"0"),i.writeString(a)}}(a,e,n):(a.size=0,a.type="N",i&&(a.warning="Unable to export "+i+"-type data, writing null values"),a.write=function(){}),a}function Bm(e,n){for(var r,i=0,a=e.length;i<a;i++){if(r=e[i][n],t.isString(r))return"C";if(t.isNumber(r))return"N";if(t.isBoolean(r))return"L";if(r instanceof Date)return"D";if(r)return typeof r}return null}function Gm(e,n){return function(r){var i=t.isFiniteNumber(r)?r.toFixed(n):String(" ");return t.lpad(i,e," ")}}function qm(e,n){for(var r,i=0,a=0,o=1,s=1,u=0,c=1e-15,f=0,l=e.length;f<l;f++)if(r=e[f][n],t.isFiniteNumber(r)){if(r<i||r>a)for(r<i&&(i=r),r>a&&(a=r);Math.abs(r)>=s;)s*=10,c*=10;for(;Math.abs(Math.round(r*o)-r*o)>c&&15!=u;)u++,c*=10,o*=10}return{decimals:u,min:i,max:a}}function Vm(e,t){var n,r,i=String(e),a=i.length,o=zm.reserve(a);for(n=0;n<a;n++){if((r=i.charCodeAt(n))>127){if(t){o=null,n=0;break}r="?".charCodeAt(0)}o[n]=r}return zm.putBack(a-n),o?o.subarray(0,n):null}function $m(e,t,n){for(var r,i,a=e.slice(0,n),o=n;o>0&&o>=n-3;){if("�"!=(i=$r(r=o==n?a:e.slice(0,o),t)).charAt(i.length-1)){a=r;break}o--}return a}function Jm(e,n,r){var i,a=e.data;return(!a||r.cut_table||r.drop_table)&&(a=new di(e.shapes?e.shapes.length:0)),a.isEmpty()&&a.addIdField(),i=a.exportAsDbf?a.exportAsDbf(r):Tm.exportRecords(a.getRecords(),r.encoding,r.field_order),t.isInteger(r.ldid)&&(new Uint8Array(i)[29]=r.ldid),[{content:i,filename:e.name+".dbf"}]}function Wm(e,t,n){var r,i,a=[],o=e.length,s=t.length;for(a.push(e),r=0;r<s;r++)i=Zm(t[r][e],n),o=Math.max(o,i.length),a.push(i);for(r=0;r<a.length;r++)a[r]=a[r].padEnd(o," ");return a}function Zm(e,n){return null==e?"":t.isString(e)?e:t.isNumber(e)?n.decimal_comma?t.formatIntlNumber(e):t.formatNumber(e):t.isObject(e)?JSON.stringify(e):e+""}function Ym(e){var n=function(e){var n=t.splitLines(e);n.length>2&&n.pop();for(var r,i,a,o,s=function(e){for(var t=0,n=0;n<e.length;n++)t=Math.max(t,e[n].length);return t}(n),u=n[0],c=[],f=0,l=!1,h=!1,p=0;p<=s;p++){if(i=Km(u,p),r=!Qm(n,p),(a=i&&!h)&&l)return null;(p==s||p>0&&a)&&(o=p==s?void 0:p-1,c.push({name:Hm(u,f,o),end:o,start:f}),f=p),l=r,h=i}return c.length>0?c:null}(e.substring(0,2e3));if(!n)return[];var r=t.splitLines(e);""===r[r.length-1]&&r.pop();for(var i=[],a=1;a<r.length;a++)i.push(Xm(r[a],n));return i}function Hm(e,t,n){return e.substring(t,n).trim()}function Xm(e,t){for(var n,r={},i=0;i<t.length;i++)r[(n=t[i]).name]=Hm(e,n.start,n.end);return r}function Km(e,t){return t<e.length&&" "!==e[t]}function Qm(e,t){for(var n=0;n<e.length;n++)if(Km(e[n],t))return!1;return!0}function ey(e,t){var n=function(e,t){var n=",",r=t.file?Ro(t.file):"";t.delimiter?n=t.delimiter:"tsv"==r?n="\t":"csv"==r?n=",":e.input_delimiter&&(n=e.input_delimiter);return n}(e.info,t),r=function(e,t){var n="txt";t.file?n=Ro(t.file):"\t"==e?n="tsv":","==e&&(n="csv");return n}(n,t);return e.layers.reduce(function(e,i){return i.data&&e.push({content:ty(i,n,t),filename:(i.name||"output")+"."+r}),e},[])}function ty(e,t,n){var r=n||{},i=r.encoding||"utf8",a=e.data.getRecords(),o=fi(a,r.field_order);if(" "==t)return function(e,t,n){for(var r,i=[],a=0;a<e.length;a++)if(r=Wm(e[a],t,n),0===a)i=r;else for(var o=0;o<i.length;o++)i[o]+=" "+r[o];return i.join("\n")}(o,a,r);var s=function(e,t,n){var r=ry(t,n);return function(n){return e.map(function(e){return r(n[e])}).join(t)}}(o,t,r);return Ur(i)&&!r.to_buffer&&(a.length<1e4||r.to_string)?function(e,t,n){var r=ny(e,n);return t.length?r+"\n"+t.map(n).join("\n"):r}(o,a,s):function(e,t,n,r){var i=ny(e,n),a=[Vr(i,r)],o=[],s=t.length,c=0;for(;c<s;)o.push(n(t[c])),++c%1e3!=0&&c!=s||(i="\n"+o.join("\n"),o=[],a.push(Vr(i,r)));return u.concat(a)}(o,a,s,i)}function ny(e,t){var n=e.reduce(function(e,t){return e[t]=t,e},{});return t(n)}function ry(e,n){var r=new RegExp('["\n\r'+e+"]"),i=n&&n.decimal_comma||!1;function a(e){return r.test(e)&&(e='"'+e.replace(/"/g,'""')+'"'),e}return function(e){return null==e?"":t.isString(e)?a(e):t.isNumber(e)?i?t.formatIntlNumber(e):t.formatNumber(e):t.isObject(e)?a(JSON.stringify(e)):e+""}}var iy=Object.freeze({__proto__:null,exportDelim:ey,exportLayerAsDSV:ty,getDelimValueFormatter:ry}),ay={NULL:0,POINT:1,POLYLINE:3,POLYGON:5,MULTIPOINT:8,POINTZ:11,POLYLINEZ:13,POLYGONZ:15,MULTIPOINTZ:18,POINTM:21,POLYLINEM:23,POLYGONM:25,MULIPOINTM:28,MULTIPATCH:31};function oy(e,n){return e.layers.reduce(function(r,i){var a=function(e,t){var n=t.info||{},r=n.prj;if(!r)try{r=ma(Ia(t))}catch(e){}r||xt("Unable to generate .prj file for",e.name+".shp");return r?{content:r,filename:e.name+".prj"}:null}(i,e);return r=r.concat(function(e,n){var r,i=e.shapes||t.initializeArray(new Array(ki(e)),null),a=new qt,o=function(e){var t,n=e.geometry_type;t="point"==n?Nr(e.shapes||[])<=1?ay.POINT:ay.MULTIPOINT:"polygon"==n?ay.POLYGON:"polyline"==n?ay.POLYLINE:ay.NULL;return t}(e),s=100,u=100+8*i.length,c=new Om(u).bigEndian().position(100),f=i.map(function(t,r){var i=function(e,t,n){var r=ay.isMultiPartType(n),i=!r&&!ay.isMultiPointType(n),a=e.pointCount>0==!1,o=a?null:e.bounds,s=null;if(a)s=new Om(12,!1).writeInt32(t).writeInt32(2).littleEndian().writeInt32(0);else if(i)s=new Om(28,!1).writeInt32(t).writeInt32(10).littleEndian().writeInt32(n).writeFloat64(e.pathData[0].points[0][0]).writeFloat64(e.pathData[0].points[0][1]);else{var u=52,c=r?u+4*e.pathCount:48,f=c+16*e.pointCount,l=0;s=new Om(f,!1).writeInt32(t).writeInt32((f-8)/2).littleEndian().writeInt32(n).writeFloat64(o.xmin).writeFloat64(o.ymin).writeFloat64(o.xmax).writeFloat64(o.ymax),r&&s.writeInt32(e.pathCount),s.writeInt32(e.pointCount),e.pathData.forEach(function(e,t){r&&s.position(u+4*t).writeInt32(l),s.position(c+16*l);for(var n=0,i=e.points.length;n<i;n++)s.writeFloat64(e.points[n][0]),s.writeFloat64(e.points[n][1]);l+=n}),e.pointCount!=l&&vt("Shp record point count mismatch; pointCount:",l,"data.pointCount:",e.pointCount)}return{bounds:o,buffer:s.buffer()}}(Yf(t,n.arcs,e.geometry_type),r+1,o),u=i.buffer.byteLength;return c.writeInt32(s/2),c.writeInt32(u/2-4),s+=u,i.bounds&&a.mergeBounds(i.bounds),i.buffer});r=new Om(s,!1).writeInt32(9994).skipBytes(20).writeInt32(s/2).littleEndian().writeInt32(1e3).writeInt32(o),a.hasBounds()?r.writeFloat64(a.xmin||0).writeFloat64(a.ymin||0).writeFloat64(a.xmax||0).writeFloat64(a.ymax||0):r.skipBytes(32);return r.skipBytes(32),f.forEach(function(e){r.writeBuffer(e)}),c.position(0).writeBuffer(r.buffer(),100).position(24).writeInt32(u/2),[{content:r.buffer(),filename:e.name+".shp"},{content:c.buffer(),filename:e.name+".shx"}]}(i,e)),r=r.concat(Jm(i,0,n)),a&&r.push(a),r},[])}ay.isPolygonType=function(e){return 5==e||15==e||25==e},ay.isPolylineType=function(e){return 3==e||13==e||23==e},ay.isMultiPartType=function(e){return ay.isPolygonType(e)||ay.isPolylineType(e)},ay.isMultiPointType=function(e){return 8==e||18==e||28==e},ay.isZType=function(e){return[11,13,15,18].includes(e)},ay.isMType=function(e){return ay.isZType(e)||[21,23,25,28].includes(e)},ay.hasBounds=function(e){return ay.isMultiPartType(e)||ay.isMultiPointType(e)};var sy=Object.freeze({__proto__:null,exportShapefile:oy}),uy={};function cy(e){var t=1e4/e;return function(e){return e===1/0?0:Math.ceil(e*t)}}function fy(e,t,n){return Wf(Er(e,t,"polygon"),t,n).map(function(e){return e.map(function(e){return e.ids})})}function ly(e){return Object.assign({},e)}uy.forEachShapePart=function(e,t){var n={GeometryCollection:function(e){e.geometries.forEach(r)},LineString:function(e){var n=t(e.arcs);n&&(e.arcs=n)},MultiLineString:function(e){i(e.arcs)},Polygon:function(e){i(e.arcs)},MultiPolygon:function(e){e.arcs.forEach(i)}};function r(e){e.type in n&&n[e.type](e)}function i(e){for(var n,r=0;r<e.length;r++)(n=t(e[r]))&&(e[r]=n)}r(e)},uy.forEachArc=function(e,n){uy.forEachShapePart(e,function(e){for(var r,i=0;i<e.length;i++)r=n(e[i]),t.isInteger(r)&&(e[i]=r)})},pp.explodeFeatures=function(e,n,r){var i=e.data?e.data.getRecords():null,a=i?[]:null,o=[],s=t.extend({},e);return e.shapes.forEach(function(s,u){var c;if(s?(c="polygon"==e.geometry_type&&s.length>1?r&&r.naive?function(e,t){var n=Er(e,t,"polygon");return n.map(function(e){return e.area<0&&mr(e.ids),[e.ids]})}(s,n):fy(s,n):function(e){return e.map(function(e){return[e.concat()]})}(s),t.merge(o,c)):o.push(null),null!==a)for(var f=0,l=c?c.length:1;f<l;f++)a.push(ly(i[u]))}),s.shapes=o,null!==a&&(s.data=new di(a)),function(e,n){var r=ki(e),i=ki(n),a=t.format("Exploded %,d feature%s into %,d feature%s",r,t.pluralSuffix(r),i,t.pluralSuffix(i));xt(a)}(e,s),s};var hy=Object.freeze({__proto__:null,explodePolygon:fy});function py(e,n){var r="."+(n.extension||"json"),i=!n.final||Eo(e)&&e.arcs.getRetainedInterval()>0,a=JSON.stringify;return i&&(e=_o(e)),n.prettify&&(a=Kf("coordinates,arcs,bbox,translate,scale".split(","))),n.width>0||n.height>0?zd(e,Ld(e,n=t.defaults({invert_y:!0},n))):n.fit_bbox&&zd(e,Ld(e,{fit_bbox:n.fit_bbox})),n.precision&&n.no_quantization?Hl(e,n.precision,!!n.fix_geometry):n.precision&&xt(`Ignoring precision=${n.precision} -- this option only works with no-quantization.`),n.singles?mo(e).map(function(e){return{content:a(uy.exportTopology(e,n)),filename:(e.layers[0].name||"output")+r}}):[{filename:n.file||Bo(e)+r,content:a(uy.exportTopology(e,n))}]}function dy(e,t){var n=hr(e);return[n[0]*t,n[1]*t]}function gy(e,t,n){var r;return r=n.topojson_precision>0?dy(t,n.topojson_precision):n.quantization>0?[e.width()/(n.quantization-1),e.height()/(n.quantization-1)]:n.precision>0?[n.precision,n.precision]:dy(t,.02),new qt(0,0,Math.ceil(e.width()/r[0])||0,Math.ceil(e.height()/r[1])||0)}uy.getPresimplifyFunction=cy,uy.exportTopology=function(e,t){var n={type:"Topology",arcs:[]},r=Eo(e),i=wo(e);return t.bbox&&i.hasBounds()&&(n.bbox=i.toArray()),r&&t.presimplify&&!e.arcs.getVertexData().zz&&pp.simplify(e,t),t.no_quantization||!t.quantization&&!r||(n.transform=function(e,t,n){var r,i=gy(t,e.arcs,n),a=t.getTransform(i),o=a.invert();function s(e,t){var n=a.transform(e,t);return[Math.round(n[0]),Math.round(n[1])]}function u(e,t){return a.transform(e,t)}e.arcs&&n.fix_geometry?(e.arcs.transformPoints(u),r=Dl(e.arcs),e.arcs.transformPoints(function(e,t){return[Math.round(e),Math.round(t)]}),r(e.arcs)):e.arcs&&e.arcs.transformPoints(s);n.no_point_quantization||e.layers.filter(Si).forEach(function(e){Ii(e,s)});return{scale:[o.mx,o.my],translate:[o.bx,o.by]}}(e,i,t)),r&&(ho(e),n.arcs=function(e,t,n){var r=null,i=[];n.presimplify&&(r=cy(t.width()));return e.forEach2(function(e,t,n,a,o,s){for(var u,c=[],f=t+n;t<f;t++)u=[a[t],o[t]],r&&u.push(r(s[t])),c.push(u);i.push(c.length>1?c:null)}),i}(e.arcs,i,t),n.transform&&n.arcs.forEach(function(e){for(var t,n,r,i,a,o=0,s=e.length;o<s;o++)r=(a=e[o])[0],i=a[1],o>0&&(a[0]=r-t,a[1]=i-n),t=r,n=i})),n.objects=e.layers.reduce(function(n,r,i){return n[r.name||"layer"+(i+1)]=uy.exportLayer(r,e.arcs,t),n},{}),t.metadata&&(n.metadata=function(e){var t=Ia(e),n=null;return t&&(n=ga(t)),{proj4:n}}(e)),n},uy.exportProperties=function(e,t,n){var r=Pd(t,n),i=Nd(t,n);e.forEach(function(e,t){r&&(e.properties=r[t]),i&&(e.id=i[t])})},uy.exportLayer=function(e,t,n){for(var r,i=ki(e),a=[],o=uy.exporters[e.geometry_type]||null,s=0;s<i;s++)r=o&&e.shapes[s],a[s]=r?o(r,t,n):{type:null};return e.data&&uy.exportProperties(a,e.data,n),{type:"GeometryCollection",geometries:a}},uy.exportPolygonGeom=function(e,t,n){var r={};return(e=Ar(e,t))&&0!==e.length?e.length>1?(r.arcs=fy(e,t,n.invert_y),1==r.arcs.length?(r.arcs=r.arcs[0],r.type="Polygon"):r.type="MultiPolygon"):(r.arcs=e,r.type="Polygon"):r.type=null,r},uy.exportLineGeom=function(e,t){var n={};return(e=Ar(e,t))&&0!==e.length?1==e.length?(n.type="LineString",n.arcs=e[0]):(n.type="MultiLineString",n.arcs=e):n.type=null,n},uy.exporters={polygon:uy.exportPolygonGeom,polyline:uy.exportLineGeom,point:_d.exportPointGeom};var my=Object.freeze({__proto__:null,calcExportBounds:gy,exportTopoJSON:py});function yy(e){return Kr(e),{layers:[{data:new di(e)}],info:{}}}function vy(e,t){return e.layers.reduce(function(e,n){return n.data&&e.push({content:by(n,t),filename:(n.name||"output")+".json"}),e},[])}function by(e,t){t=t||{};var n=e.data.getRecords();return t.ndjson?n.map(Xf).join("\n"):t.prettify?Kf([])(n):JSON.stringify(n)}var _y=Object.freeze({__proto__:null,exportJSON:vy,exportJSONTable:by,importJSONTable:yy});function xy(e,t){var n=t.file||null,r=e.info&&e.info.input_formats&&e.info.input_formats[0],i=null;return t.format?t.format:(n?i=wy(n,r):r&&(i=r),"json"==i&&Ao(e)&&(i="geojson"),i||null)}function wy(e,t){var n=Ro(e).toLowerCase(),r=null;return"gz"==n?wy(jo(e,""),t):(n==ef?r=ef:"shp"==n?r="shapefile":"dbf"==n?r="dbf":"svg"==n?r="svg":"kml"==n||"kmz"==n?r="kml":/json$/.test(n)?(r="geojson","topojson"==n||"topojson"==t&&"geojson"!=n?r="topojson":"json"==n&&"json"==t&&(r="json")):mf(e)?r="dsv":t&&(r=t),r)}var Sy=Object.freeze({__proto__:null,getOutputFormat:xy,inferOutputFormat:wy});async function Ay(e,n,r){if(r.fit_extent){var i=e.findSingleLayer(r.fit_extent),a=Ji(i.layer,i.dataset.arcs);r=Object.assign({svg_bbox:a.toArray()},r)}var o=n.map(function(e){return t.defaults({layers:e.layers},e.dataset)});return async function(e,n){var r,i=xy(e[0],n);if(i==ef)return tf(e,n=t.defaults({compact:!0},n));"kml"==i||"svg"==i||"topojson"==i||"geojson"==i&&n.combine_layers?e.length>1&&(e=[no(e)],"topojson"==i&&Ka(e[0]),n=t.defaults({final:!0},n)):function(e){var t=e.reduce(function(e,t){return e.concat(t.layers)},[]);Iy(t)}(e=e.map(xo));r=e.reduce(function(e,r){return qc()?t.sortOn(r.layers,"menu_order",!0):t.sortOn(r.layers,"target_id",!0),e.concat(Ey(r,n))},[]),n.bbox_index&&r.push(function(e){var t=[];return e.forEach(function(e){e.layers.forEach(function(n){var r=Ji(n,e.arcs);t.push({bbox:r.toArray(),name:n.name})})}),{content:JSON.stringify(t),filename:"bbox-index.json"}}(e));ky(r),n.gzip&&r.forEach(function(e){e.filename+=".gz",e.content=Jc(e.content)});return r}(o,r)}function Ey(e,n){var r,i,a=n.format=xy(e,n),o=My[a],s=[];return a?o||vt("Unknown output format:",a):vt("Missing output format"),e=t.defaults({layers:e.layers.map(function(e){return t.extend({},e)})},e),n.file&&"topojson"!=a&&"svg"!=a&&"kml"!=a&&e.layers.forEach(function(e){e.name=zo(n.file)}),Iy(e.layers),n.precision&&"svg"!=a&&"topojson"!=a&&Hl(e=_o(e),n.precision,!!n.fix_geometry),n.cut_table&&(s=(r=e.layers,i=[],r.forEach(function(e){e.data&&i.push({content:JSON.stringify(e.data),filename:(e.name?e.name+"-":"")+"table.json"})}),i).concat(s)),n.extension&&(n.extension=n.extension.replace(/^\.+/,"")),function(e){e.forEach(function(e){e.geometry_type?(t.contains(["polygon","polyline","point"],e.geometry_type)||vt("A layer has an invalid geometry type:",e.geometry_type),e.shapes||vt("A layer is missing shape data")):e.shapes&&t.some(e.shapes,function(e){return!!e})&&vt("A layer contains shape records and a null geometry type")})}(e.layers),function(e){var t={};e.forEach(function(e,n){var r=e.filename;r||vt("Missing a filename for file"+n),r in t&&vt("Duplicate filename",r),t[r]=!0})}(s=o(e,n).concat(s)),s}var My={geojson:xd,topojson:py,shapefile:oy,dsv:ey,dbf:function(e,t){return e.layers.reduce(function(n,r){return r.data&&(n=n.concat(Jm(r,e,t))),n},[])},json:vy,svg:bm,kml:function(e,t){return[{content:(0,s("@placemarkio/tokml").toKML)(Ed(e,Object.assign({combine_layers:!0,geojson_type:"FeatureCollection"},t))),filename:t.file||Bo(e)+".kml"}]}};function Iy(e){var n=e.map(function(e){return e.name||"layer"}),r=t.uniqifyNames(n);e.forEach(function(e,t){e.name=r[t]})}function ky(e){var n=e.map(function(e){return e.filename}),r=t.uniqifyNames(n,Cy);e.forEach(function(e,t){e.filename=r[t]})}function Cy(e,n){var r,i,a=e.split(".");return a.length<2?t.formatVersionedName(e,n):(r=a.pop(),i=a.join("."),t.formatVersionedName(i,n)+"."+r)}var Py=Object.freeze({__proto__:null,assignUniqueFileNames:ky,assignUniqueLayerNames:Iy,exportFileContent:Ey,exportTargetLayers:Ay,formatVersionedFileName:Cy});function Oy(e,t){return qr(e.readSync(0,Math.min(t||1e3,e.size())))}function Ny(e){var t=0;this.position=function(){return t},this.remaining=function(){return Math.max(e.size()-t,0)},this.advance=function(e){t+=e},this.readSync=function(){return e.readSync(t)},this.expandBuffer=function(){e.expandBuffer()}}function Ty(e){var n,r,i=e.byteLength||e.length;function a(){return r||(r=t.toBuffer(e)),r}this.readToBinArray=function(t,r){return i<t+r&&vt("Out-of-range error"),n||(n=new Om(e)),n.position(t),n},this.toString=function(e){return qr(a(),e)},this.readSync=function(e,t){return a().slice(e,t?e+t:i)},this.findString=Ly.prototype.findString,this.expandBuffer=function(){return this},this.size=function(){return i},this.close=function(){}}function Ly(e,n){var r,a,o,u,c=s("fs"),f=c.statSync(e).size,l=n&&n.cacheSize||16777216,h=n&&n.bufferSize||262144;function p(n,i){var s,u,h=f-n;return(h<i||h<0)&&vt("Tried to read past end-of-file"),!(o&&n>=a&&a+o.length>=n+i)&&(h<(u=Math.max(l,i))&&(u=h),o&&u==o.length||(o=t.createBuffer(u)),r||(r=c.openSync(e,"r")),s=c.readSync(r,o,0,u,n),a=n,s!=u&&vt("Error reading file"),!0)}(i("input_files")||[]).push(e),this.expandBuffer=function(){return 2*(h*=2)>l&&(l=2*h),this},this.readToBinArray=function(e,t){return p(e,t)&&(u=new Om(o)),u.position(e-a),u},this.readSync=function(e,n){return n>0==!1&&(n=h),e+n>f&&(n=f-e),0===n?t.createBuffer(0):(p(e,n),o.slice(e-a,e-a+n))},this.size=function(){return f},this.toString=function(t){return Lf.readFile(e,t||"utf8")},this.close=function(){r&&(c.closeSync(r),r=null,o=null)}}Ly.prototype.findString=function(e,t){var n,r=Math.min(this.size(),t||this.size()),i=this.readSync(0,r),a=e.length,o=i.length-a,s=e.charCodeAt(0);for(n=0;n<o;n++)if(i[n]==s&&i.toString("utf8",n,n+a)==e)return{offset:n+a,text:i.toString("utf8",0,n)};return null};var zy=Object.freeze({__proto__:null,BufferReader:Ty,FileReader:Ly,Reader2:Ny,readFirstChars:Oy});function Ry(e,t,n){var r=n||{};if(" "==t)return function(e,t){return Ym(e.toString(t.encoding||"ascii"))}(e,r);var i,a,o=new Ny(e),s=Uy(Gy(o,function(e){var t=e.csv_skip_lines||0;e.csv_field_names||t++;return t}(r),r.encoding),t,r),u=Fy(s.import_fields),c=r.batch_size||1e3,f=[];if(0===s.import_fields.length)return[];for(;i=Gy(o,c,r.encoding);)if(a=qy(i,t,u,s.column_filter||!1,s.row_filter||!1),f.push.apply(f,a),r.csv_lines&&f.length>=r.csv_lines)return f.slice(0,r.csv_lines);return f}function Dy(e,t,n){if(" "==t)return Ym(e);var r=Uy(e,t,n);if(0===r.import_fields.length||!r.remainder)return[];var i=Fy(r.import_fields),a=qy(r.remainder,t,i,r.column_filter,r.row_filter);return n.csv_lines>0&&(a=a.slice(0,n.csv_lines)),a}function jy(e,t){var n=/\r\n|[\r\n]|.$/g,r=1;if(1===t)return 0;if(t>1==!1)return-1;for(;n.exec(e);)if(++r<t==!1)return n.lastIndex;return-1}function Fy(e){return new Function("arr","return {"+e.map(function(e,t){return JSON.stringify(e)+": arr["+t+'] || ""'}).join(",")+"}")}function Uy(e,n,r){var i,a,o,s={headers:[],import_fields:[]},u={};if(e=e||"",r.csv_skip_lines>0){if(-1===(i=jy(e,r.csv_skip_lines+1)))return s;e=e.substr(i)}if(r.csv_field_names)u.headers=r.csv_field_names;else{if(-1===(i=jy(e,2)))return s;u.headers=qy(e.slice(0,i),n)[0],e=e.substr(i)}return r.csv_dedup_fields&&(u.headers=t.uniqifyNames(u.headers)),r.csv_filter&&(u.row_filter=(a=r.csv_filter,o=Qh(a),function(e){var t=o(e);return Ch(t),t})),r.csv_fields?(u.column_filter=By(u.headers,r.csv_fields),u.import_fields=u.headers.filter(function(e,t){return u.column_filter(t)})):u.import_fields=u.headers,u.remainder=e,u}function By(e,n){var r=t.arrayToIndex(n),i=e.map(function(e){return e in r}),a=t.difference(n,e);if(a.length>0){var o=[""].concat(e).join("\n "),s=[""].concat(a).join("\n ");bt("csv-fields option has",1==a.length?"a name":a.length+" names","not found in the file\nFields:",o,"\nMissing:",s)}return function(e){return i[e]}}function Gy(e,t,n){var r,i=e.readSync(),a=function(e,t){var n,r,i=13,a=10,o=34,s=!1,u=0,c=e.length;for(u++,n=0;n<c&&u<=t;n++)(r=e[n])==o?s=!s:r!=i&&r!=a||s||(r==i&&n+1<c&&e[n+1]==a&&n++,u++);return{bytesRead:n,buffer:e.slice(0,n)}}(i,t);return a.bytesRead==i.length&&a.bytesRead<e.remaining()?(e.expandBuffer(),Gy(e,t,n)):(r=a.bytesRead>0?$r(a.buffer,n):"",0===e.position()&&(r=Wr(r)),e.advance(a.bytesRead),r)}function qy(e,t,n,r,i){var a,o,s,u,c,f=t.charCodeAt(0),l=!1,h=!1,p=-1,d=[];function g(){var e=n?n(c):c;i&&!i(e)||d.push(e),p=-1}function m(e){a=e,0===++p&&(c=[]),r&&!r(p)||(h=!0)}function y(t,n){var r;h&&(h=!1,r=t===n?"":34==e.charCodeAt(t)?e.slice(t+1,n-1).replace(/""/g,'"'):e.slice(t,n),c.push(r))}for(n||(n=function(e){return e}),m(0),o=0,u=e.length;o<u;o++)34==(s=e.charCodeAt(o))?l=!l:l||(s==f?(y(a,o),m(o+1)):13!=s&&10!=s||(y(a,o),g(),13==s&&10==e.charCodeAt(o+1)&&o++,o+1<u&&m(o+1)));return p>-1&&(h&&y(a,o),g()),d}var Vy=Object.freeze({__proto__:null,getDelimFieldFilter:By,getRowConverter:Fy,indexOfLine:jy,parseDelimHeaderSection:Uy,parseDelimText:qy,readDelimRecords:Ry,readDelimRecordsFromString:Dy,readLinesAsString:Gy});function $y(e){var t=e.length;return t>=2&&254==e[0]&&255==e[1]?"utf16be":t>=2&&255==e[0]&&254==e[1]?"utf16le":t>=3&&239==e[0]&&187==e[1]&&191==e[2]?"utf8":""}function Jy(e){var n=[{encoding:"latin1",confidence:0},{encoding:"win1252",confidence:Zy(e)},{encoding:"utf8",confidence:Yy(e)},{encoding:"gb18030",confidence:Hy(e)}];return t.sortOn(n,"confidence","descending"),n[0]}function Wy(e,t){return t.map(function(t){return $r(t,e).trim()})}function Zy(e){var t=Wy("win1252",e).join(""),n=Qy(t,"abcdefghijklmnopqrstuvwxyz0123456789.()'\"?+-\n,:;/|_$% "),r=Qy(t,"ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ°–±’‘ ")+n;return Xy(r>.98&&n>=.8,r>.97&&n>=.6)}function Yy(e){var t=Ky(Wy("utf8",e).join(""));return Xy(0==t,t<.03)}function Hy(e){var t=Wy("gb18030",e).join(""),n=t.replace(/[^\u4e00-\u9fa5]/g,""),r=n.length/t.length,i=function(e){return e.replace(/[^a-zA-Z0-9.()'"?+\n,:;/|_$% -]/g,"")}(t),a=i.length/t.length,o=Qy(n,"的一了是不我他在人有这来个说上你们到地大着子那就也时道中出得为里下她要么去可以过和看之然后会自没小好生天而起对能还事想都心只家面样把国多又于头年手发如什开前当所无知老但见长已军从方声儿回意作话两点现很成身情十用些走经同进动己三行种向日明女正问此学太打间分因给本眼定二气力被门真法外听实其高先几笑再主将山战才口文最部第它西与全白者便相住公使东等边信像斯机光次感神却死理名重四做别叫王并水月果何位怎马常觉海张少处亲安特美呢色原直望命由候吧让应尔难关许车平师民夫书新接吗路利世比放活快总立队更花爱清五内金带工风克任至指往入空德吃表连解教思飞物电受今完林干代告兵加认通找远非性脸体轻记目令变似反南场跟必石拉士报李火且满该孩字红象即结言员房件万条提写或坐北早失离步陈乎请转近切黑深城办倒各父传音站官半男击合阿英决怕杀未形及算青黄落刚百论谁突交团度义罗始强紧敌八母钱极片化流管惊每题晚虽政兴答司妈夜越啊奇达谈武友数领朝保服曾拿则哪格尽根急语容喜求衣留双影刻制随冷九苦量备布照周故准客船江系姐争功怪星断句龙竟视界讲取古六静底精七河久绝阳识哈台确息期整伤忙娘终剑送计愿欢微您沉装敢云脚消若复收千木乐毛华集树弟皇响希诉号巴穿线汉攻呀警派刘酒雷停史阵错建足显丽另包势破亮首志观病热跑业治田冲运约暗待共院仍区害元哥围屋胡产室调类细议爷注易务众帝市摇乱密姑斗除式示睛楼造朋社持慢般皮京况块忽脑校甚查土怀福单联赶背统喝疑支血饭灵够章群威举兰游器察嘴痛铁掉宝历改推枪念参术帮党据品须居称旁退梦科岁低严引吉睡爸呼追局露维苏证村挥独节谢香亚波角案读图左掌假跳究楚余鬼钟座礼展玉肯既止守广考恩异料段尼画续米草胜存唐医程弹烟商顾招宗堂野初府激雨尚渐诗顿伯孙际沙雪板闻导致护春态基设耳简婚幸味右买演权卡继依恶庄炮亦虎州刀球需兄闪笔否烈玩啦逃排仅弄具散默景顶郑洋丝卫速侠差贵君习妇助恐救湖莫窗险顺封佛委旧印伙妹副宫洞永罪松责组防艺营班试鲁宋靠索灯介翻喊纪秘妻纸银略充戏担某杨射魔遇鱼陆级坏忘乡鲜哭费抓叶醒族纳床咱桌境列午振抱专毫店街怒托剧置秋藏赵划普岛较承脱革忍伸份免齐抗猛园临犯食架选歌按败良隐养属洛朱狂修坚压寻旅谋温探资端投泪阴换药麻施丈冰雄著绿职负短模荣遗农叹川毒吴蒋卖范禁杂富秀县祖梅谷凡刺登蓝奶缓姓牛价规篇劳质婆仙馆摆舞层狗占墙善熟验肉臣状呆圣懂袋唱值迷替归巨讨毕批镇吸森拍灭握伊杰勒卷偷奔省谓危付伦休厅预迎罢恨博亡欲悲宣标闹岸"),s=Ky(t);return Xy(r>.5&&r+a>.9&&0===s&&o>.25,r>.3&&r+a>.8&&o>.15)}function Xy(e,t){return(e?2:t&&1)||0}function Ky(e){return(e.match(/\ufffd/g)||[]).length/e.length}function Qy(e,t){var n={},r=0;e=e.toLowerCase();for(var i=0,a=t.length;i<a;i++)n[t[i]]=1;for(i=0,a=e.length;i<a;i++)r+=n[e[i]]||0;return r/e.length||0}var ev=Object.freeze({__proto__:null,decodeSamples:Wy,detectEncoding:Jy,detectEncodingFromBOM:$y});function tv(e,n){var r,i,a,o,s,c=!e.content&&""!==e.content,f=e.content;return n=n||{},c?r=new Ly(e.filename):f instanceof ArrayBuffer||f instanceof u||f instanceof Uint8Array?(r=new Ty(f),f=null):t.isString(f)||vt("Unexpected object type"),r&&("utf16be"==(s=$y(r.readSync(0,Math.min(r.size(),3))))||"utf16le"==s?(f=Wr(r.toString(s)),r=null):n.encoding&&!Br(n.encoding)&&(f=r.toString(n.encoding),r=null)),0===(i=r?Ry(r,a=iv(Oy(r,2e3)),n):Dy(f,a=iv(f),n)).length&&xt("Unable to read any data records"),ov(i,n),ti(o=new di(i),ni),{layers:[{data:o}],info:{input_delimiter:a}}}var nv=["|","\t",",",";"," "];function rv(e){return t.contains(nv,e)}function iv(e){return t.find(nv,function(n){var r=function(e){var n="^[^\\n\\r]+"+t.regexEscape(e);return new RegExp(n)}(n);return r.test(e)})||","}function av(e){var t={};return(e=e||{}).string_fields&&e.string_fields.forEach(function(e){t[e]="string"}),e.field_types&&e.field_types.forEach(function(e){var n,r,i;-1!=e.indexOf(":")?(r=(n=e.split(":"))[0],i=function(e){var t=e.toLowerCase(),n=null;"n"==t[0]?n="number":"s"==t[0]&&(n="string");return n}(n[1])):"+"===e[0]&&(r=e.substr(1),i="number"),i?t[r]=i:xt("Invalid type hint (expected :str or :num) ["+e+"]")}),t}function ov(e,n){var r=n||{},i=av(r),a=i["*"],o=Object.keys(e[0]||[]),s=[],u=r.decimal_comma?t.parseIntlNumber:t.parseNumber,c={};o.forEach(function(t){var n=i[t],r=null;"number"==n||"number"==a?r=function(e,t,n){for(var r=[],i=0,a=t.length;i<a;i++)r.push(n(t[i][e]));return r}(t,e,u):"string"==n||"string"==a?r=null:(r=function(e,t,n){for(var r,i,a,o=[],s=0,u=0,c=t.length;u<c;u++){if(null===(a=n(r=t[u][e]))){if((i=r?r.trim():"").length>0&&"NA"!=i&&"NaN"!=i)return null}else s++;o.push(a)}return s>0?o:null}(t,e,u),r&&s.push(t)),r&&(c[t]=r)}),Object.keys(c).length>0&&function(e,t,n){var r="return {"+e.map(function(e){var t=JSON.stringify(e);return t+": "+(n[e]?"replacements["+t+"][i]":"rec["+t+"]")}).join(", ")+"}",i=new Function("rec","replacements","i",r);t.forEach(function(e,r){t[r]=i(e,n,r)})}(o,e,c),s.length>0&&xt(t.format("Auto-detected number field%s: %s",1==s.length?"":"s",s.join(", ")))}var sv=Object.freeze({__proto__:null,adjustRecordTypes:ov,getFieldTypeHints:av,guessDelimiter:iv,importDelim:function(e,t){return tv({content:e},t)},importDelim2:tv,isSupportedDelimiter:rv});function uv(e){var t=e.options;e._,t.files&&(t.files=Lf.expandInputFiles(t.files),"-"!=t.files[0]&&"/dev/stdin"!=t.files[0]||(delete t.files,t.stdin=!0)),"precision"in t&&t.precision>0==!1&&vt("precision= option should be a positive number"),t.encoding&&(t.encoding=jr(t.encoding))}function cv(e){var t=e.options;t.interval||t.percentage||t.resolution||vt("Command requires an interval, percentage or resolution parameter")}function fv(e){e.options.crs||e.options.match||e.options.init||bt("Missing projection data")}function lv(e){var t=e.options;if(1==e._.length){var n=e._[0].split(",");t.cols=parseInt(n[0],10),t.rows=parseInt(n[1],10)||t.cols}}function hv(e){e.options.expression||vt("Command requires a JavaScript expression")}function pv(e){var t=e.options,n=t._||"",r=Lo(n);"-"==n||"/dev/stdout"==n?t.stdout=!0:n&&!r.extension?(Lf.isDirectory(n)||vt("Unknown output option:",n),t.directory=n):n&&(r.directory&&(t.directory=r.directory),/gz/i.test(r.extension)?(Lo(r.basename).extension?t.file=r.basename:t.file=r.filename,t.gzip=!0):/zip/i.test(r.extension)?(t.file=null,t.zipfile=r.filename,t.zip=!0):t.file=r.filename,Ef(t.file)&&vt("Output file looks like an unsupported file type:",t.file)),t.format&&(t.format=t.format.toLowerCase(),"csv"==t.format?(t.format="dsv",t.delimiter=t.delimiter||","):"tsv"==t.format&&(t.format="dsv",t.delimiter=t.delimiter||"\t"),wf(t.format)||vt("Unsupported output format:",t.format)),t.delimiter&&(t.delimiter=t.delimiter.replace(/^["']?\\t["']?$/,"\t"),rv(t.delimiter)||vt("Unsupported delimiter:",t.delimiter)),t.encoding&&(t.encoding=jr(t.encoding)),t.field_order&&"ascending"!=t.field_order&&vt("Unsupported field order:",t.field_order),"quantization"in t&&t.quantization>0==!1&&vt("quantization= option should be a nonnegative integer"),"topojson_precision"in t&&t.topojson_precision>0==!1&&vt("topojson-precision= option should be a positive number")}var dv=/^([a-z0-9_+-]+)=(?!=)(.*)$/i;function gv(e){var n=new RegExp("(([^'\"\\s])+|'((\\\\'|[^'])*?)'|\"((\\\\\"|[^\"])*?)\")*","g");return(e.match(n)||[]).filter(function(e){return!!e&&"\\"!=e}).map(t.trimQuotes)}function mv(e){return e.split(",").map(parseFloat)}function yv(e){var t=_v(e,",");return 1==t.length&&(t=_v(t[0],",")),t}function vv(e){var t=_v(e.replace(/[ ,] *(?=[^(]*\))/g,"~~~"),", ");return 1==t.length&&(t=_v(t[0],", ")),t=t.map(function(e){return e.replace(/~~~/g,",")})}function bv(e){return e=(e=e.map(function(e){return/= $/.test(e)||(e=t.rtrim(e)),e=t.ltrim(e)})).filter(function(e){return""!==e})}function _v(e,n){for(var r,i=new RegExp("^("+("([^"+n+"'\"][^"+n+"]*)")+"|'((\\\\'|[^'])*?)'|\"((\\\\\"|[^\"])*?)\")(["+n+"]+|$)"),a=[];null!==(r=i.exec(e));)a.push(r[1]),e=e.substr(r[0].length);return a.filter(function(e){return!!e&&"\\"!=e}).map(t.trimQuotes)}function xv(e){return dv.test(e)}function wv(e){var n=dv.exec(e);return[n[1],t.trimQuotes(n[2])]}var Sv=Object.freeze({__proto__:null,cleanArgv:bv,formatOptionValue:function(e){return(e=String(e)).indexOf(" ")>-1&&(e=JSON.stringify(e)),e},isAssignment:xv,parseColorList:vv,parseNumberList:mv,parseStringList:yv,splitAssignment:wv,splitShellTokens:gv});function Av(){var e,n=/^--?([a-z][\w-]*)$/i,r=/^--?[a-z][\w-]*[=]/i,i="",a=[],o=[],s=null;if(this instanceof Av==!1)return new Av;function u(){return o.map(function(e){return e.done()})}function c(e){return!!f(e,u())}function f(e,n){return t.find(n,function(t){return t.name===e||t.alias===e||t.old_alias===e})}function l(e,n){return t.find(n.options,function(t){return t.name===e||t.alias===e||t.old_alias===e})}this.usage=function(e){return i=e,this},this.note=function(t){return e=t,this},this.default=function(e){s=e},this.example=function(e){a.push(e)},this.command=function(e){var t=new Ev(e);return t.option("verbose",{type:"flag"}),t.option("debug",{type:"flag"}),o.push(t),t},this.section=function(e){return this.command("").title(e)},this.isCommandName=c,this.parseArgv=function(e){var i,a,o,h=u(),p=[],d=bv(e);for(1==d.length&&c(d[0])?d.unshift("-help"):d.length>0&&!y(d[0])&&s&&d.unshift("-"+s);d.length>0;)(a=_(d))||bt("Invalid command:",d[0]),i=(o=f(a,h)||null)?g(d,o):m(d,a),p.push(i);return p;function g(e,n){for(var r={name:n.name,options:{},_:[]};e.length>0&&!y(e[0]);)v(r,e,n);try{r._.length>0&&function(e,n){var r,i=function(e){return t.find(e.options,function(e){return!!e.DEFAULT})}(n),a=e._;n&&(i||vt("Received one or more unexpected parameters:",a.join(" ")));var o=!0===i.DEFAULT?{}:i.DEFAULT;o.type=o.type||i.type||"string",o.name=i.name,a.length>1&&!o.multi_arg&&vt(o.multi_error_msg||"Command expects a single value.","Received:",a.join(" "));a=a.map(e=>b(e,o)),r=o.multi_arg?t.isString(o.join)?a.join(o.join):a:a[0];e.options[i.name]=r}(r,n),n.validate&&n.validate(r),delete r.options._}catch(e){bt("["+a+"] "+e.message)}return r}function m(e,t){for(var n={name:t,options:{},_:[]};e.length>0&&!y(e[0]);)n._.push(e.shift());return n}function y(e){return r.test(e)&&bt("Invalid command syntax:",e),n.test(e)}function v(e,t,n){var r,i,a,o=t.shift();xv(o)?(i=l((a=wv(o))[0],n))&&("flag"==i.type||i.assign_to?bt("-"+n.name+" "+a[0]+" option doesn't take a value"):t.unshift(a[1])):i=l(o,n),i?(i.alias_to&&(i=l(i.alias_to,n)),r=(r=i.name).replace(/-/g,"_"),i.assign_to?e.options[i.assign_to]=i.name:"flag"==i.type?e.options[r]=!0:e.options[r]=function(e,t){(0===e.length||y(e[0]))&&bt("Missing value for "+t.name+" option");return b(e.shift(),t)}(t,i)):e._.push(o)}function b(e,t){var n,r,i=t.type;return(n="number"==i?Number(e):"integer"==i?Math.round(Number(e)):"colors"==i?vv(e):"strings"==i?yv(e):"bbox"==i||"numbers"==i?mv(e):e)!=n&&(r="Invalid numeric value"),r&&bt(r+" for "+t.name+" option"),n}function _(e){var t=n.exec(e[0]);return t?(e.shift(),t[1]):null}},this.getHelpMessage=function(n){var r,o,s;return n?((o=f(n,u()))||bt(n,"is not a known command"),s=function(e){var t=[],n=[];e.options.forEach(function(e){n=n.concat(function(e){var t,n=[],r=e.describe;r&&(e.label?n.push([e.label,r]):e.DEFAULT?(t=e.name+"=",n.push(["<"+e.name+">","shortcut for "+t]),n.push([t,r])):(t=e.name,e.alias&&(t+=", "+e.alias),"flag"==e.type||e.assign_to||(t+="="),n.push([t,r])));return n}(e))}),t.push("COMMAND",c(e)),n.length>0&&(t.push("","OPTIONS"),t=t.concat(n));e.examples&&(t.push("","EXAMPLE"+(e.examples.length>1?"S":"")),e.examples.forEach(function(e,n){n>0&&t.push(""),e.split("\n").forEach(function(e,n){t.push(" "+e)})}));return t}(o)):(r=u().filter(function(e){return e.name&&e.describe||e.title}),s=function(t){var n=[];i&&n.push(i);t.forEach(function(e){e.title?n.push("",e.title):n.push(c(e))}),a.length>0&&(n.push("","Examples"),a.forEach(function(e){n.push("",e)}));e&&n.push("",e);return n}(r)),function(e){var n=function(e){var t=0;return e.forEach(function(e){Array.isArray(e)&&(t=Math.max(t,e[0].length))}),t}(e),r=qc()?"":" ",i=e.map(function(e){return Array.isArray(e)&&(e=r+t.rpad(e[0],n," ")+" "+e[1]),e}).join("\n");return i}(s);function c(e){var t=e.name?"-"+e.name:"";return e.alias&&(t+=", -"+e.alias),[t,e.describe||"(undocumented command)"]}}}function Ev(e){var n={name:e,options:[]};this.validate=function(e){return n.validate=e,this},this.describe=function(e){return n.describe=e,this},this.example=function(e){return n.examples||(n.examples=[]),n.examples.push(e),this},this.alias=function(e){return n.alias=e,this},this.oldAlias=function(e){return n.old_alias=e,this},this.title=function(e){return n.title=e,this},this.option=function(e,r){return r=t.extend({},r),t.isString(e)&&e||vt("Missing option name"),t.isObject(r)||vt("Invalid option definition:",r),r.name=e,n.options.push(r),this},this.options=function(e){return Object.keys(e).forEach(function(t){this.option(t,e[t])},this),this},this.done=function(){return n}}function Mv(){var e={describe:"layer(s) to target (comma-sep. list)"},t={describe:"rename the edited layer(s)"},n={alias:"+",type:"flag",label:"+, no-replace",describe:"retain both input and output layer(s)"},r={describe:"name the output layer"},i={alias:"+",type:"flag",label:"+",describe:"save output to a new layer"},a={type:"flag"},o={describe:"text encoding (applies to .dbf and delimited text files)"},s={describe:"snapping distance in source units (default is tiny)",type:"distance"},u={describe:"boost gap-fill-area of slivers (0-1, default is 1)",type:"number"},c={describe:"use a JS expression to aggregate data values"},f={describe:"fields to sum when dissolving (comma-sep. list)",type:"strings"},l={describe:"fields to copy when dissolving (comma-sep. list)",type:"strings"},h={DEFAULT:!0,type:"strings",describe:"(optional) field(s) to dissolve on (comma-sep. list)"},p={describe:"type hints for csv source files, e.g. FIPS:str,ZIPCODE:str",type:"strings"},d={describe:"csv field(s) to import as strings, e.g. FIPS,ZIPCODE",type:"strings"},g={type:"bbox",describe:"comma-sep. bounding box: xmin,ymin,xmax,ymax"},m={type:"flag",describe:"retain only features that would have been deleted"},y={describe:"use a JS expression to select a subset of features"},v={describe:"filter polygon boundaries using a JS expression (with A and B)"},b={describe:"aspect ratio as a number or range (e.g. 2 0.8,1.6 ,2)"},_={describe:"offset distance or pct of h/w (single value or l,b,r,t list)",type:"distance"},x=new Av;x.usage("Usage: mapshaper -<command> [options] ..."),x.note("Enter mapshaper -help <command> to view options for a single command"),x.section("I/O commands"),x.default("i"),x.command("i").describe("input one or more files").validate(uv).option("files",{DEFAULT:{multi_arg:!0,type:"string"},type:"strings",describe:"one or more files to import, or - to use stdin"}).option("combine-files",{describe:"import files to separate layers with shared topology",type:"flag"}).option("merge-files",{type:"flag"}).option("no-topology",{describe:"treat each shape as topologically independent",type:"flag"}).option("precision",{describe:"coordinate precision in source units, e.g. 0.001",type:"number"}).option("snap",{type:"flag",describe:"snap nearly identical points to fix minor topology errors"}).option("auto-snap",{alias_to:"snap"}).option("snap-interval",s).option("encoding",o).option("id-field",{describe:"import Topo/GeoJSON id property to this field"}).option("string-fields",d).option("field-types",p).option("name",{describe:"rename the imported layer(s)"}).option("geometry-type",{}).option("json-path",{}).option("csv-skip-lines",{type:"integer",describe:"[CSV] number of lines to skip at the beginning of the file"}).option("csv-lines",{type:"integer",describe:"[CSV] number of data records to read"}).option("csv-field-names",{type:"strings",describe:"[CSV] comma-sep. list of field names to assign each column"}).option("csv-dedup-fields",{type:"flag",describe:"[CSV] rename fields with duplicate names"}).option("csv-filter",{describe:"[CSV] JS expression for filtering records"}).option("csv-fields",{type:"strings",describe:"[CSV] comma-sep. list of fields to import"}).option("decimal-comma",{type:"flag",describe:"[CSV] import numbers formatted like 1.000,01 or 1 000,01"}).option("json-path",{old_alias:"json-subtree",describe:"[JSON] path to JSON input data; separator is /"}).option("single-part",{type:"flag"}),x.command("o").describe("output edited content").validate(pv).option("_",{label:"<file|directory>",describe:"(optional) name of output file or directory, - for stdout",DEFAULT:{multi_error_msg:"Command takes one file or directory argument."}}).option("format",{describe:"options: shapefile,geojson,topojson,json,dbf,csv,tsv,svg"}).option("target",e).option("force",{describe:"allow overwriting input files",type:"flag"}).option("gzip",{describe:"apply gzip compression to output files",type:"flag"}).option("zip",{describe:"save all output files in a single .zip file",type:"flag"}).option("dry-run",{type:"flag"}).option("ldid",{type:"number"}).option("precision",{describe:"coordinate precision in source units, e.g. 0.001",type:"number"}).option("fix-geometry",{describe:"remove intersections introduced by rounding or quantization",type:"flag"}).option("bbox-index",{describe:"export a .json file with bbox of each layer",type:"flag"}).option("cut-table",{describe:"detach data attributes from shapes and save as a JSON file",type:"flag"}).option("drop-table",{describe:"remove data attributes from output",type:"flag"}).option("encoding",{describe:"[Shapefile/CSV] text encoding (default is utf8)"}).option("field-order",{describe:"[Shapefile/CSV] field-order=ascending sorts columns A-Z"}).option("id-field",{describe:"[Topo/GeoJSON/SVG] field to use for id property",type:"strings"}).option("bbox",{type:"flag",describe:"[Topo/GeoJSON] add bbox property"}).option("extension",{describe:'[Topo/GeoJSON] set file extension (default is ".json")'}).option("prettify",{type:"flag",describe:"[Topo/GeoJSON/JSON] format output for readability"}).option("singles",{describe:"[TopoJSON] save each target layer as a separate file",type:"flag"}).option("quantization",{describe:"[TopoJSON] specify quantization (auto-set by default)",type:"integer"}).option("no-quantization",{describe:"[TopoJSON] export coordinates without quantization",type:"flag"}).option("metadata",{type:"flag"}).option("no-point-quantization",{type:"flag"}).option("presimplify",{describe:"[TopoJSON] add per-vertex data for dynamic simplification",type:"flag"}).option("topojson-precision",{type:"number"}).option("gj2008",{describe:"[GeoJSON] use original GeoJSON spec (not RFC 7946)",type:"flag"}).option("rfc7946",{type:"flag"}).option("combine-layers",{describe:"[GeoJSON] output layers as a single file",type:"flag"}).option("geojson-type",{describe:"[GeoJSON] FeatureCollection, GeometryCollection or Feature"}).option("no-null-props",{describe:'[GeoJSON] use "properties":{} when a Feature has no data',type:"flag"}).option("hoist",{describe:"[GeoJSON] move properties to the root level of each Feature",type:"strings"}).option("ndjson",{describe:"[GeoJSON/JSON] output newline-delimited features or records",type:"flag"}).option("width",{describe:"[SVG/TopoJSON] pixel width of output (SVG default is 800)",type:"number"}).option("height",{describe:"[SVG/TopoJSON] pixel height of output (optional)",type:"number"}).option("max-height",{describe:"[SVG/TopoJSON] max pixel height of output (optional)",type:"number"}).option("margin",{describe:"[SVG/TopoJSON] space betw. data and viewport (default is 1)"}).option("pixels",{describe:"[SVG/TopoJSON] output area in pix. (alternative to width=)",type:"number"}).option("fit-bbox",{type:"bbox",describe:"[TopoJSON] scale and shift coordinates to fit a bbox"}).option("svg-scale",{describe:"[SVG] source units per pixel (alternative to width= option)",type:"number"}).option("svg-bbox",{describe:"[SVG] bounding box of SVG map in projected map units",type:"bbox"}).option("fit-extent",{describe:"[SVG] layer to use for the map extent"}).option("point-symbol",{describe:"[SVG] circle or square (default is circle)"}).option("svg-data",{type:"strings",describe:"[SVG] fields to export as data-* attributes"}).option("id-prefix",{describe:"[SVG] prefix for namespacing layer and feature ids"}).option("scalebar",{type:"flag"}).option("delimiter",{describe:"[CSV] field delimiter"}).option("decimal-comma",{type:"flag",describe:"[CSV] export numbers with decimal commas not points"}).option("show-all",{type:"flag",describe:"[Snapshot] show all layers in Web UI"}).option("final",{type:"flag"}).option("metadata",{type:"flag"}),x.section("Editing commands"),x.command("affine").describe("transform coordinates by shifting, scaling and rotating").option("shift",{type:"strings",describe:"x,y offsets in source units (e.g. 5000,-5000)"}).option("scale",{type:"number",describe:"scale (default is 1)"}).option("rotate",{type:"number",describe:"angle of rotation in degrees (default is 0)"}).option("anchor",{type:"numbers",describe:"center of rotation/scaling (default is center of selected shapes)"}).option("fit-bbox",{type:"bbox",describe:"scale and shift coordinates to fit a bbox"}).option("where",y).option("target",e),x.command("buffer").option("radius",{describe:"radius of buffer, as an expression or a constant",DEFAULT:!0}).option("tolerance",{}).option("vertices",{type:"integer"}).option("arc-quality",{type:"integer"}).option("slice-length",{type:"integer"}).option("backtrack",{type:"integer"}).option("cap-style",{describe:"flat or round (default is round)"}).option("type",{}).option("planar",{type:"flag"}).option("v2",{type:"flag"}).option("v3",{type:"flag"}).option("debug-offset",{type:"flag"}).option("debug-winding",{type:"flag"}).option("debug-points",{type:"flag"}).option("debug-mosaic",{type:"flag"}).option("left",{type:"flag"}).option("right",{type:"flag"}).option("no-cleanup",{type:"flag"}).option("units",{describe:"distance units (meters|miles|km|feet) (default is meters)"}).option("name",t).option("target",e).option("no-replace",n),x.command("classify").describe("assign colors or values using one of several methods").option("field",{describe:"name of field to classify",DEFAULT:!0}).option("save-as",{describe:"name of output field (default is fill|stroke|class)"}).option("colors",{describe:"list of CSS colors or color scheme name (see -colors)",type:"colors"}).option("values",{describe:"values to assign to classes (alternative to colors=)",type:"strings"}).option("color-scheme",{}).option("non-adjacent",{describe:"assign non-adjacent colors to a polygon layer",assign_to:"method"}).option("stops",{describe:"a pair of values (0-100) for limiting a color ramp",type:"numbers"}).option("null-value",{describe:"value (or color) to use for invalid or missing data"}).option("method",{describe:"quantile, nice, equal-interval, categorical, etc."}).option("quantile",{assign_to:"method"}).option("equal-interval",{assign_to:"method"}).option("hybrid",{assign_to:"method"}).option("nice",{assign_to:"method"}).option("breaks",{describe:"user-defined sequential class breaks",type:"numbers"}).option("outer-breaks",{describe:"min,max breakpoints, to limit the effect of outliers",old_alias:"range",type:"numbers"}).option("classes",{describe:"number of classes (can be inferred from other options)",type:"integer"}).option("invert",{describe:"reverse the order of colors/values",type:"flag"}).option("continuous",{describe:"output interpolated values, for unclassed colors",type:"flag"}).option("index-field",{describe:"apply pre-calculated classes (0 ... n-1, -1)"}).option("precision",{describe:"round data values before classification (e.g. 0.1)",type:"number"}).option("categories",{describe:"list of data values for categorical color scheme",type:"strings"}).option("other",{describe:"default value for categorical scheme"}).option("key",{type:"flag"}).option("key-style",{describe:"one of: simple, gradient, dataviz"}).option("key-name",{describe:"name of output SVG file"}).option("key-width",{describe:"width of key in pixels",type:"number"}).option("key-font-size",{describe:"label size in pixels",type:"number"}).option("key-tile-height",{describe:"height of color tiles in pixels",type:"number"}).option("key-tic-length",{describe:"length of tic mark in pixels"}).option("key-label-suffix",{describe:"string to append to each label"}).option("key-last-suffix",{describe:"string to append to last label"}).option("target",e),x.command("clean").describe("fixes geometry issues, such as polygon overlaps and gaps").option("gap-fill-area",{old_alias:"min-gap-area",describe:"threshold for filling gaps, e.g. 1.5km2 (default is small)",type:"area"}).option("sliver-control",u).option("snap-interval",s).option("no-snap",a).option("allow-overlaps",{describe:"allow polygons to overlap (disables gap fill)",type:"flag"}).option("overlap-rule",{describe:"how to resolve overlaps: min-id|max-id|min-area|[max-area]"}).option("allow-empty",{describe:"keep null geometries (removed by default)",type:"flag"}).option("rewind",{describe:"fix errors in the CW/CCW winding order of polygon rings",type:"flag"}).option("arcs",{alias_to:"only-arcs"}).option("only-arcs",{describe:"delete unused arcs but don't remove gaps and overlaps",type:"flag"}).option("no-arc-dissolve",{type:"flag"}).option("target",e),x.command("clip").describe("use a polygon layer to clip another layer").example("$ mapshaper states.shp -clip land_area.shp -o clipped.shp").option("source",{DEFAULT:!0,describe:"file or layer containing clip polygons"}).option("remove-slivers",{describe:"remove sliver polygons created by clipping",type:"flag"}).option("bbox",g).option("bbox2",{type:"bbox",describe:"experimental fast bbox clipping"}).option("name",t).option("no-snap",a).option("no-cleanup",{type:"flag"}).option("target",e).option("no-replace",n),x.command("colorizer").describe("define a function to convert data values to color classes").option("colors",{describe:"comma-separated list of CSS colors",type:"colors"}).option("breaks",{describe:"ascending-order list of breaks for sequential color scheme",type:"numbers"}).option("categories",{describe:"comma-sep. list of keys for categorical color scheme",type:"strings"}).option("random",{describe:"randomly assign colors",type:"flag"}).option("other",{describe:"default color for categorical scheme (default is nodata color)"}).option("nodata",{describe:"color to use for invalid or missing data (default is white)"}).option("name",{describe:"function name to use in -each and -svg-style commands"}).option("precision",{describe:"rounding precision to apply before classification (e.g. 0.1)",type:"number"}).example("Define a sequential color scheme and use it to create a new field\n$ mapshaper data.json -colorizer name=getColor nodata=#eee breaks=20,40 \\\n colors=#e0f3db,#a8ddb5,#43a2ca -each 'fill = getColor(RATING)' -o output.json"),x.command("dashlines").describe("split lines into sections, with or without a gap").oldAlias("split-lines").option("dash-length",{type:"distance",describe:"length of split-apart lines (e.g. 200km)"}).option("gap-length",{type:"distance",describe:"length of gaps between dashes (default is 0)"}).option("scaled",{type:"flag",describe:"scale dashes and gaps to prevent partial dashes"}).option("planar",{type:"flag",describe:"use planar geometry"}).option("where",y).option("target",e),x.command("define").option("expression",{DEFAULT:!0,describe:"one or more assignment expressions (comma-sep.)"}),x.command("dissolve").describe("merge features within a layer").example("Dissolve all polygons in a feature layer into a single polygon\n$ mapshaper states.shp -dissolve -o country.shp").example("Generate state-level polygons by dissolving a layer of counties\n(STATE_FIPS, POPULATION and STATE_NAME are attribute field names)\n$ mapshaper counties.shp -dissolve STATE_FIPS copy-fields=STATE_NAME sum-fields=POPULATION -o states.shp").option("field",{}).option("fields",h).option("calc",c).option("sum-fields",f).option("copy-fields",l).option("multipart",{type:"flag",describe:"make multipart features instead of dissolving"}).option("where",y).option("group-points",{type:"flag",describe:"[points] group points instead of converting to centroids"}).option("weight",{describe:"[points] field or expression to use for weighting centroid"}).option("planar",{type:"flag",describe:"[points] use 2D math to find centroids of latlong points"}).option("name",t).option("target",e).option("no-replace",n),x.command("dissolve2").describe("merge adjacent polygons (repairs overlaps and gaps)").option("field",{}).option("fields",h).option("calc",c).option("sum-fields",f).option("copy-fields",l).option("gap-fill-area",{describe:"threshold for filling gaps, e.g. 1.5km2",type:"area"}).option("sliver-control",u).option("allow-overlaps",{describe:"allow dissolved polygons to overlap (disables gap fill)",type:"flag"}).option("name",t).option("no-snap",a).option("target",e).option("no-replace",n),x.command("divide").describe("divide lines by polygons, copy polygon data to lines").option("fields",{describe:"fields to copy (comma-sep.) (default is all but key field)",type:"strings"}).option("calc",{describe:"use a JS expression to assign values (for many-to-one joins)"}).option("force",{describe:"replace values from same-named fields",type:"flag"}).option("source",{DEFAULT:!0,describe:"file or layer containing polygons"}).option("target",e),x.command("dots").describe("fill polygons with dots of one or more colors").option("fields",{DEFAULT:!0,describe:"one or more fields containing numbers of dots",type:"strings"}).option("colors",{describe:"one or more colors",type:"strings"}).option("values",{describe:"values to assign to dot classes (alternative to colors=)",type:"strings"}).option("save-as",{describe:"name of color/value output field (default is fill)"}).option("progressive",{type:"flag"}).option("r",{describe:"radius of each dot in pixels",type:"number"}).option("evenness",{describe:"(0-1) dot spacing, from random to even (default is 1)",type:"number"}).option("per-dot",{describe:"number for scaling data values (e.g. 10 per dot)",type:"number"}).option("copy-fields",{describe:"list of fields to copy from polygons to dots",type:"strings"}).option("multipart",{describe:"combine groups of same-color dots into multi-part features",type:"flag"}).option("target",e).option("name",t).option("no-replace",n),x.command("drop").describe("delete layer(s) or elements within the target layer(s)").option("geometry",{describe:"delete all geometry from the target layer(s)",type:"flag"}).option("holes",{describe:"delete holes from polygons",type:"flag"}).option("fields",{type:"strings",describe:"delete a list of attribute data fields, e.g. 'id,name' '*'"}).option("target",e),x.command("each").describe("create/update/delete data fields using a JS expression").example("Add two calculated data fields to a layer of U.S. counties\n$ mapshaper counties.shp -each 'STATE_FIPS=CNTY_FIPS.substr(0, 2), AREA=$.area'").option("expression",{DEFAULT:!0,describe:"JS expression to apply to each target feature"}).option("ids",{type:"numbers"}).option("where",y).option("target",e),x.command("erase").describe("use a polygon layer to erase another layer").example("$ mapshaper land_areas.shp -erase water_bodies.shp -o erased.shp").option("source",{DEFAULT:!0,describe:"file or layer containing erase polygons"}).option("remove-slivers",{describe:"remove sliver polygons created by erasing",type:"flag"}).option("bbox",g).option("name",t).option("no-snap",a).option("no-cleanup",{type:"flag"}).option("target",e).option("no-replace",n),x.command("explode").describe("divide multi-part features into single-part features").option("naive",{type:"flag"}).option("target",e),x.command("filter").describe("delete features using a JS expression").option("expression",{DEFAULT:!0,describe:"delete features that evaluate to false"}).option("bbox",{describe:"delete features outside bbox (xmin,ymin,xmax,ymax)",type:"bbox"}).option("invert",m).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("keep-shapes",{type:"flag"}).option("ids",{type:"numbers"}).option("cleanup",{type:"flag"}).option("name",t).option("target",e).option("no-replace",n),x.command("filter-fields").describe("retain a subset of data fields").option("fields",{DEFAULT:!0,type:"strings",describe:"fields to retain (comma-sep.), e.g. 'fips,name'"}).option("invert",{type:"flag",describe:"retain only fields that would have been deleted"}).option("target",e),x.command("filter-geom").describe("").option("bbox",{type:"bbox",describe:"remove non-intersecting geometry (xmin,ymin,xmax,ymax)"}).option("target",e),x.command("filter-islands2").option("min-area",{type:"area",describe:"remove small-area islands (e.g. 10km2)"}).option("min-vertices",{type:"integer",describe:"remove low-vertex-count islands"}).option("keep-shapes",{type:"flag",describe:"only filter smaller parts of multipart polygons"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("target",e),x.command("filter-islands").describe("remove small detached polygon rings (islands)").option("min-area",{type:"area",describe:"remove small-area islands (e.g. 10km2)"}).option("min-vertices",{type:"integer",describe:"remove low-vertex-count islands"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("target",e),x.command("filter-slivers").describe("remove small polygon rings").option("min-area",{type:"area",describe:"area threshold (e.g. 2sqkm)"}).option("sliver-control",{describe:"boost area threshold of slivers (0-1, default is 1)",type:"number"}).option("weighted",{type:"flag"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("keep-shapes",{type:"flag",describe:"protect sliver polygons from complete removal"}).option("target",e),x.command("graticule").describe("create a graticule layer").option("interval",{describe:"size of grid cells in degrees (default is 10)",type:"number"}).option("polygon",{describe:"create a polygon to match the outline of the graticule",type:"flag"}).option("name",t),x.command("grid2").option("type",{describe:"square, hex or hex2 (default is square)"}).option("interval",{describe:"side length (e.g. 500m, 12km)",type:"distance"}).option("name",t).option("target",e).option("no-replace",n),x.command("grid").describe("create a grid of square or hexagonal polygons").option("type",{describe:"square, hex or hex2 (default is square)"}).option("interval",{describe:"side length (e.g. 500m, 12km)",type:"distance"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("name",t).option("target",e).option("no-replace",n),x.command("include").describe("import JS data and functions for use in JS expressions").option("file",{DEFAULT:!0,describe:"file containing a JS object with key:value pairs to import"}),x.command("inlay").describe("inscribe a polygon layer inside another polygon layer").option("source",{DEFAULT:!0,describe:"file or layer containing polygons to inlay"}).option("target",e),x.command("innerlines").describe("convert polygons to polylines along shared edges").option("where",v).option("name",t).option("target",e).option("no-replace",n),x.command("join").describe("join data records from a file or layer to a layer").example("Join a csv table to a Shapefile (don't auto-convert FIPS column to numbers)\n$ mapshaper states.shp -join data.csv keys=STATE_FIPS,FIPS string-fields=FIPS -o joined.shp").validate(function(e){e.options.source||vt("Command requires the name of a layer or file to join")}).option("source",{DEFAULT:!0,describe:"file or layer containing data records"}).option("keys",{describe:"join by matching target,source key fields, e.g. keys=FID,id",type:"strings"}).option("calc",{describe:"use a JS expression to assign values (for many-to-one joins)"}).option("where",{describe:"use a JS expression to filter source records"}).option("fields",{describe:"fields to copy (comma-sep.) (default is all but key field)",type:"strings"}).option("prefix",{describe:"prefix for renaming fields joined from the source table"}).option("interpolate",{describe:"(polygon-polygon join) list of area-interpolated fields",type:"strings"}).option("point-method",{describe:"(polygon-polygon join) join polygons via inner points",type:"flag"}).option("largest-overlap",{describe:"(polygon-polygon join) use max overlap to join one polygon",type:"flag"}).option("min-overlap-pct",{describe:"(polygon-polygon join) min overlap as pct of target polygon",type:"percent"}).option("min-overlap-area",{describe:"(polygon-polygon join) minimum area of overlap",type:"area"}).option("max-distance",{describe:"(point-point join) join source points within this radius",type:"distance"}).option("planar",{type:"flag"}).option("duplication",{describe:"duplicate target features on many-to-one joins",type:"flag"}).option("string-fields",d).option("field-types",p).option("sum-fields",{describe:"fields to sum in a many-to-one join (or use calc= for this)",type:"strings"}).option("force",{describe:"replace values from same-named fields",type:"flag"}).option("unjoined",{describe:'copy unjoined records from source table to "unjoined" layer',type:"flag"}).option("unmatched",{describe:'copy unmatched records in target table to "unmatched" layer',type:"flag"}).option("encoding",o).option("target",e),x.command("lines").describe("convert a polygon or point layer to a polyline layer").option("fields",{DEFAULT:!0,describe:"field(s) to create a hierarchy of boundary lines",type:"strings"}).option("where",v).option("each",{describe:"apply a JS expression to each polygon boundary (with A and B)"}).option("segments",{describe:"convert paths to segments, for debugging",type:"flag"}).option("callouts",{type:"flag"}).option("arcs",{describe:"convert paths to arcs, for debugging",type:"flag"}).option("groupby",{describe:"field for grouping point input into multiple lines"}).option("name",t).option("target",e).option("no-replace",n),x.command("merge-layers").describe("merge multiple layers into as few layers as possible").option("force",{type:"flag",describe:"merge layers with inconsistent data fields"}).option("flatten",{describe:"remove polygon overlaps; higher-id polygons take priority",type:"flag"}).option("name",t).option("target",e),x.command("mosaic").describe("convert a polygon layer with overlaps into a flat mosaic").option("calc",c).option("name",t).option("target",e).option("snap-interval",s).option("no-snap",a).option("no-replace",n),x.command("point-grid").describe("create a rectangular grid of points").validate(lv).option("_",{label:"<cols,rows>",describe:"size of the grid, e.g. -point-grid 100,100",DEFAULT:!0}).option("interval",{describe:"distance between adjacent points, in source units",type:"distance"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("bbox",{type:"bbox",describe:"xmin,ymin,xmax,ymax (default is bbox of data)"}).option("name",t).option("target",e).option("no-replace",n),x.command("points").describe("create a point layer from a different layer type").option("x",{describe:"field containing x coordinate"}).option("y",{describe:"field containing y coordinate"}).option("inner",{describe:"create an interior point for each polygon's largest ring",type:"flag"}).option("centroid",{describe:"create a centroid point for each polygon's largest ring",type:"flag"}).option("vertices",{describe:"capture unique vertices of polygons and polylines",type:"flag"}).option("vertices2",{describe:"like vertices, but without removal of duplicate coordinates",type:"flag"}).option("endpoints",{describe:"capture unique endpoints of polygons and polylines",type:"flag"}).option("midpoints",{describe:"find the (planar) midpoint of each polyline",type:"flag"}).option("intersections",{type:"flag"}).option("interpolated",{describe:"interpolate points along polylines; requires interval=",type:"flag"}).option("interval",{describe:"distance between interpolated points (meters or projected units)",type:"distance"}).option("name",t).option("target",e).option("no-replace",n),x.command("polygons").describe("convert polylines to polygons").option("gap-tolerance",{describe:"specify gap tolerance in source units",type:"distance"}).option("from-rings",{describe:"do simple conversion from a layer of closed paths",type:"flag"}).option("target",e),x.command("proj").describe("project your data (using Proj.4)").option("crs",{DEFAULT:{multi_arg:!0,join:" "},describe:"set destination CRS using a Proj.4 definition or alias"}).option("projection",{alias_to:"crs"}).option("match",{describe:"set destination CRS using a .prj file or layer id"}).option("source",{alias_to:"match"}).option("from",{alias_to:"init",describe:"(deprecated) alias for init="}).option("init",{describe:"set source CRS (if unset) using a string, .prj or layer id"}).option("densify",{type:"flag",describe:"add points along straight segments to approximate curves"}).option("clip-angle",{describe:"use a custom clipping radius (for azimuthal projections)",type:"number"}).option("clip-bbox",{describe:"clip to a lat-long bounding box before projecting",type:"bbox"}).option("target",e).validate(fv),x.command("rectangle").describe("create a rectangle from a bbox or target layer").option("bbox",{describe:"rectangle coordinates (xmin,ymin,xmax,ymax)",type:"bbox"}).option("offset",_).option("width",{describe:"set width of map in pixels, use rectangle as frame"}).option("aspect-ratio",b).option("source",{describe:"name of layer to enclose"}).option("name",t).option("target",e).option("no-replace",n),x.command("rectangles").describe("create a rectangle for each feature in a layer").option("offset",_).option("bbox",{describe:"Use an expression to generate a rectangle for each feature"}).option("aspect-ratio",b).option("name",t).option("target",e).option("no-replace",n),x.command("rename-fields").describe("rename data fields").option("fields",{DEFAULT:!0,type:"strings",describe:"list of replacements (comma-sep.), e.g. 'fips=STATE_FIPS,st=state'"}).option("target",e),x.command("rename-layers").describe("assign new names to layers").option("names",{DEFAULT:!0,type:"strings",describe:"list of replacements (comma-sep.)"}).option("target",e),x.command("simplify").validate(cv).example("Retain 10% of removable vertices\n$ mapshaper input.shp -simplify 10%").describe("simplify the geometry of polygon and polyline features").option("percentage",{DEFAULT:!0,alias:"p",type:"percent",describe:"percentage of removable points to retain, e.g. 10%"}).option("dp",{alias:"rdp",describe:"use Ramer-Douglas-Peucker simplification",assign_to:"method"}).option("visvalingam",{describe:'use Visvalingam simplification with "effective area" metric',assign_to:"method"}).option("weighted",{describe:"use weighted Visvalingam simplification (default)",assign_to:"method"}).option("method",{}).option("weighting",{type:"number",describe:"weighted Visvalingam coefficient (default is 0.7)"}).option("resolution",{describe:"output resolution as a grid (e.g. 1000x500)"}).option("interval",{describe:"output resolution as a distance (e.g. 100)",type:"distance"}).option("variable",{describe:"JS expr. assigning to one of: interval= percentage= resolution=",type:"flag"}).option("planar",{describe:"simplify decimal degree coords in 2D space (default is 3D)",type:"flag"}).option("cartesian",{alias_to:"planar"}).option("keep-shapes",{describe:"prevent small polygon features from disappearing",type:"flag"}).option("lock-box",{type:"flag"}).option("no-repair",{describe:"don't remove intersections introduced by simplification",type:"flag"}).option("stats",{describe:"display simplification statistics",type:"flag"}).option("target",e),x.command("slice").option("source",{DEFAULT:!0,describe:"file or layer containing clip polygons"}).option("id-field",{describe:"slice id field (from source layer)"}).option("name",t).option("no-snap",a).option("target",e).option("no-replace",n),x.command("snap").describe("snap together nearby vertices").option("interval",{describe:"snap together vertices within a tolerance (default is small)",DEFAULT:!0,type:"distance"}).option("endpoints",{describe:"only snap together the endpoints of lines",type:"flag"}).option("precision",{describe:"round all coordinates to a given decimal precision (e.g. 0.000001)",type:"number"}).option("fix-geometry",{describe:"remove intersections introduced by rounding and snapping",type:"flag"}).option("target",e),x.command("sort").describe("sort features using a JS expression").option("expression",{DEFAULT:!0,describe:"JS expression to generate a sort key for each feature"}).option("ascending",{describe:"sort in ascending order (default)",type:"flag"}).option("descending",{describe:"sort in descending order",type:"flag"}).option("target",e),x.command("split").describe("split a layer into single-feature or multi-feature layers").option("field",{alias_to:"expression"}).option("expression",{DEFAULT:!0,describe:"expression or field for grouping features and naming split layers"}).option("ids",{type:"numbers"}).option("apart",{describe:"save output layers to independent datasets",type:"flag"}).option("target",e).option("no-replace",n),x.command("split-on-grid").describe("split features into separate layers using a grid").validate(lv).option("_",{DEFAULT:!0,label:"<cols,rows>",describe:"size of the grid, e.g. -split-on-grid 12,10"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("id-field",{describe:"assign each feature a cell id instead of splitting layer"}).option("target",e),x.command("style").oldAlias("svg-style").describe("set SVG style properties using JS or literal values").option("clear",{describe:"remove all style properties from a layer",type:"flag"}).option("where",y).option("class",{describe:"name of CSS class or classes (space-separated)"}).option("css",{describe:"inline css style"}).option("fill",{describe:"fill color; examples: #eee pink rgba(0, 0, 0, 0.2)"}).option("fill-pattern",{describe:'pattern fill, ex: "hatches 2px grey 2px blue"'}).option("fill-effect",{describe:'use "sphere" on a circle for a 3d globe effect'}).option("fill-opacity",{describe:"fill opacity"}).option("fill-hatch",{alias_to:"fill-pattern"}).option("stroke",{describe:"stroke color"}).option("stroke-width",{describe:"stroke width"}).option("stroke-dasharray",{describe:'stroke dashes. Examples: "4" "2 4"'}).option("stroke-opacity",{describe:"stroke opacity"}).option("opacity",{describe:"opacity; example: 0.5"}).option("r",{describe:"symbol radius (set this to export points as circles)"}).option("label-text",{describe:"label text (set this to export points as labels)"}).option("text-anchor",{describe:"label alignment; one of: start, end, middle (default)"}).option("dx",{describe:"x offset of labels (default is 0)"}).option("dy",{describe:"y offset of labels (default is 0/baseline-aligned)"}).option("font-size",{describe:"size of label text (default is 12)"}).option("font-family",{describe:"CSS font family of labels (default is sans-serif)"}).option("font-weight",{describe:"CSS font weight property of labels (e.g. bold, 700)"}).option("font-style",{describe:"CSS font style property of labels (e.g. italic)"}).option("font-stretch",{describe:"CSS font stretch property of labels (e.g. condensed)"}).option("letter-spacing",{describe:"CSS letter-spacing property of labels"}).option("line-height",{describe:"line spacing of multi-line labels (default is 1.1em)"}).option("target",e),x.command("symbols").describe("symbolize points as arrows, circles, stars, polygons, etc.").option("type",{describe:"types: arrow, circle, square, star, polygon, ring"}).option("stroke",{}).option("stroke-width",{}).option("fill",{describe:"symbol fill color (filled symbols only)"}).option("stroke",{describe:"symbol line color (linear symbols only)"}).option("stroke-width",{describe:"symbol line width (linear symbols only)"}).option("opacity",{describe:"symbol opacity"}).option("geographic",{old_alias:"polygons",describe:"make geographic shapes instead of SVG objects",type:"flag"}).option("pixel-scale",{describe:"set symbol scale in meters per pixel (geographic option)",type:"number"}).option("rotated",{type:"flag",describe:"symbol is rotated to an alternate orientation"}).option("rotation",{describe:"rotation of symbol in degrees"}).option("scale",{describe:"scale symbols by a multiplier",type:"number"}).option("radius",{describe:"distance from center to farthest point on the symbol",type:"distance"}).option("sides",{describe:"(polygon) number of sides of a (regular) polygon symbol",type:"number"}).option("points",{describe:"(star) number of points"}).option("point-ratio",{old_alias:"star-ratio",describe:"(star) ratio of minor to major radius of star",type:"number"}).option("radii",{describe:"(ring) comma-sep. list of concentric radii, ascending order"}).option("arrow-style",{describe:"(arrow) options: stick, standard (default is standard)"}).option("length",{old_alias:"arrow-length",describe:"(arrow) length of arrow in pixels"}).option("direction",{old_alias:"arrow-direction",describe:"(arrow) angle off of vertical (-90 = left-pointing)"}).option("head-angle",{old_alias:"arrow-head-angle",describe:"(arrow) angle of tip of arrow (default is 40 degrees)"}).option("head-width",{old_alias:"arrow-head-width",describe:"(arrow) width of arrow head from side to side"}).option("head-length",{old_alias:"arrow-head-width",describe:"(arrow) length of head (alternative to head-angle)"}).option("head-shape",{}).option("stem-width",{old_alias:"arrow-stem-width",describe:"(arrow) width of stem at its widest point"}).option("stem-length",{old_alias:"arrow-stem-length",describe:"(arrow) alternative to length"}).option("stem-taper",{old_alias:"arrow-stem-taper",describe:"(arrow) factor for tapering the width of the stem (0-1)"}).option("stem-curve",{old_alias:"arrow-stem-curve",describe:"(arrow) curvature in degrees (default is 0)"}).option("min-stem-ratio",{old_alias:"arrow-min-stem",describe:"(arrow) minimum ratio of stem to total length",type:"number"}).option("anchor",{describe:"(arrow) takes one of: start, middle, end (default is start)"}).option("effect",{}).option("name",t).option("target",e).option("no-replace",n),x.command("target").describe("set active layer (or layers)").option("target",{DEFAULT:!0,describe:"name or index of layer to target"}).option("type",{describe:"type of layer to target (polygon|polyline|point)"}).option("name",{describe:"rename the target layer"}),x.command("union").describe("create a flat mosaic from two or more polygon layers").option("fields",{type:"strings",describe:"fields to retain (comma-sep.) (default is all fields)"}).option("name",t).option("target",{describe:"specify layers to target (comma-sep. list)"}).option("no-replace",n),x.command("uniq").describe("delete features with the same id as a previous feature").option("expression",{DEFAULT:!0,describe:"JS expression to obtain the id of a feature"}).option("max-count",{type:"number",describe:"max features with the same id (default is 1)"}).option("index",{type:"flag"}).option("invert",m).option("verbose",{describe:"print each removed feature",type:"flag"}).option("target",e),x.section("Experimental commands (may give unexpected results)"),x.command("add-shape").describe("").option("geojson",{}).option("coordinates",{}).option("properties",{}).option("name",t).option("target",e).option("no-replace",n),x.command("alpha-shapes").option("interval",{describe:"alpha parameter",type:"number"}).option("keep-points",{type:"flag"}).option("name",t).option("target",e).option("no-replace",n),x.command("check-geometry").option("strict",{describe:"stops the program if any errors are found",type:"flag"}),x.command("cluster").describe("group polygons into compact clusters").option("id-field",{describe:'field name of cluster id (default is "cluster")'}).option("pct",{alias:"p",type:"percent",describe:"percentage of shapes to retain, e.g. 50%"}).option("max-width",{describe:"max width of cluster bounding box",type:"number"}).option("max-height",{describe:"max height of cluster bounding box",type:"number"}).option("max-area",{describe:"max area of a cluster",type:"number"}).option("group-by",{describe:"field name; only same-value shapes will be grouped"}).option("target",e),x.command("data-fill").describe("fill in missing values in a polygon layer").option("field",{describe:"name of field to fill in"}).option("postprocess",{alias_to:"contiguous"}).option("contiguous",{describe:"remove non-contiguous data islands",type:"flag"}).option("weight-field",{describe:"use field values to calculate data island weights"}),x.command("filter-points").option("group-interval",{type:"number"}),x.command("frame").describe("create a rectangular map frame layer at a given display width").option("width",{describe:"width of frame (e.g. 5in, 10cm, 600px; default is 800px)"}).option("height",{describe:"(optional) height of frame; similar to width= option"}).option("aspect-ratio",{describe:"(optional) aspect ratio of frame, if height= or width= is omitted",type:"number"}).option("bbox",{describe:"frame coordinates (xmin,ymin,xmax,ymax)",type:"bbox"}).option("offset",{describe:"padding in display units or pct of width, e.g. 5cm 20px 5%",type:"strings"}).option("offsets",{describe:"separate offsets for each side, in l,b,r,t order",type:"strings"}).option("name",t).option("target",e),x.command("fuzzy-join").describe("join points to polygons, with data fill and fuzzy match").option("source",{DEFAULT:!0,describe:"file or layer containing data records"}).option("field",{describe:"field to join"}).option("dedup-points",{describe:"uniqify points with the same location and field value",type:"flag"}).option("no-dropouts",{describe:"try to retain all values from the point layer",type:"flag"}).option("postprocess",{alias_to:"contiguous"}).option("contiguous",{describe:"remove non-contiguous data islands",type:"flag"}).option("target",e),x.command("point-to-grid").option("interval",{type:"number"}).option("radius",{type:"number"}).option("circles",{type:"flag"}).option("cell-margin",{type:"number"}).option("aligned",{type:"flag"}).option("calc",c).option("target",e).option("name",t).option("no-replace",n),x.command("require").describe("require a Node module or ES module to use in JS expressions").option("module",{DEFAULT:!0,describe:"name of installed module or path to module file"}).option("alias",{describe:"Set the module name to an alias"}),x.command("rotate").option("rotation",{DEFAULT:!0,type:"numbers"}).option("invert",{type:"flag"}),x.command("run").describe("create commands on-the-fly and run them").option("expression",{DEFAULT:!0,describe:"JS expression or template to generate command(s)"}).option("commands",{alias_to:"expression"}).option("target",e),x.command("scalebar").describe("add a simple scale bar to SVG output").option("label",{DEFAULT:!0,describe:'distance label, e.g. "35 miles"'}).option("style",{describe:"two options: a or b"}).option("font-size",{type:"number"}).option("tic-length",{describe:"length of tic marks (style b)",type:"number"}).option("bar-width",{describe:"line width of bar",type:"number"}).option("label-offset",{type:"number"}).option("position",{describe:"e.g. bottom-right (default is top-left)"}).option("label-position",{describe:"top, bottom, top-center (style a), etc"}).option("dual-units",{type:"flag"}).option("margin",{describe:"offset in pixels from edge of map",type:"number"}),x.command("shape").describe("create a polyline or polygon from coordinates").option("coordinates",{describe:"list of vertices as x,y,x,y...",type:"numbers"}).option("offsets",{describe:"list of vertices as offsets from coordinates list",type:"numbers"}).option("closed",{describe:"close an open path to create a polygon",type:"flag"}).option("type",{DEFAULT:!0}).option("center",{type:"numbers"}).option("radius",{type:"number"}).option("radius-angle",{type:"number"}).option("bbox",{type:"numbers"}).option("geometry",{}).option("rotation",{type:"numbers"}).option("name",t),x.command("subdivide").describe("recursively split a layer using a JS expression").validate(hv).option("expression",{DEFAULT:!0,describe:"boolean JS expression"}).option("target",e),x.section("Control flow commands");var w={expression:{DEFAULT:!0,describe:"JS expression"},layer:{describe:"name or id of layer to test (default is current target)"},target:e};return x.command("if").describe("run the following commands if a condition is met").options(w),x.command("elif").describe("test an alternate condition; used after -if").options(w),x.command("else").describe("run commands if all preceding -if/-elif conditions are false"),x.command("endif").describe("mark the end of an -if sequence"),x.command("ignore").option("empty",{describe:"ignore empty files",type:"flag"}).option("target",e),x.command("stop").describe("stop processing (skip remaining commands)"),x.section("Informational commands"),x.command("calc").describe("calculate statistics about the features in a layer").example("Calculate the total area of a polygon layer\n$ mapshaper polygons.shp -calc 'sum($.area)'").example("Count census blocks in NY with zero population\n$ mapshaper ny-census-blocks.shp -calc 'count()' where='POPULATION == 0'").validate(hv).option("expression",{DEFAULT:!0,describe:"functions: sum() average() median() max() min() count()"}).option("where",y).option("target",e).option("to-layer",i).option("name",r),x.command("colors").describe("print list of color scheme names"),x.command("comment").describe("add a comment to the sequence of commands").option("message",{DEFAULT:{multi_arg:!0,join:" "}}),x.command("encodings").describe("print list of supported text encodings (for .dbf import)"),x.command("help").alias("h").describe("print help; takes optional command name").option("command",{DEFAULT:!0,describe:"view detailed information about a command"}),x.command("info").describe("print information about data layers").option("save-to",{describe:"name of file to save info in JSON format"}).option("target",e).option("to-layer",i).option("name",r),x.command("inspect").describe("print information about a feature").option("expression",{DEFAULT:!0,describe:"boolean JS expression for selecting a feature"}).option("target",e).validate(hv),x.command("print").describe("print a message to stdout").option("message",{DEFAULT:{multi_arg:!0,join:" "}}),x.command("projections").describe("print list of supported projections"),x.command("quiet").describe("inhibit console messages"),x.command("verbose").describe("print verbose processing messages"),x.command("version").alias("v").describe("print mapshaper version"),x.command("debug"),x}var Iv=[1,"437",2,"850",3,"1252",8,"865",9,"437",10,"850",11,"437",13,"437",14,"850",15,"437",16,"850",17,"437",18,"850",19,"932",20,"850",21,"437",22,"850",23,"865",24,"437",25,"437",26,"850",27,"437",28,"863",29,"850",31,"852",34,"852",35,"852",36,"860",37,"850",38,"866",55,"850",64,"852",77,"936",78,"949",79,"950",80,"874",87,"1252",88,"1252",89,"1252",100,"852",101,"866",102,"865",103,"861",106,"737",107,"857",108,"863",120,"950",121,"949",122,"936",123,"932",124,"874",134,"737",135,"852",136,"857",200,"1250",201,"1251",202,"1254",203,"1253",204,"1257"],kv={932:"Japanese",936:"Simplified Chinese",950:"Traditional Chinese",1252:"Western European",949:"Korean",874:"Thai",1250:"Eastern European",1251:"Russian",1254:"Turkish",1253:"Greek",1257:"Baltic"},Cv='To set the text encoding, re-import using the "encoding=" option.\nTo list the supported encodings, run the "encodings" command.';function Pv(e,t,n){for(var r,i=e.position(),a=0,o=0;o<t&&0!==(r=e.readUint8());o++)(a>0||32!=r)&&(n[a++]=r);for(;a>0&&32==n[a-1];)a--;return e.position(i+t),a}function Ov(e){var n=e||"ascii",r=Gr(n),i=t.createBuffer(256);return"utf8"==r||"ascii"==r?function(e,t){var n=Pv(e,t,i);return i.toString(r,0,n)}:function(e,t){var r,a,o=Pv(e,t,i),s="";for(r=0;r<o;r++){if((a=i[r])>127)return qr(i,n,0,o);s+=String.fromCharCode(a)}return s}}function Nv(e,t){for(var n=0;n<t;n++)if(e[n]>=128)return!0;return!1}function Tv(e,t){return e.readInt32()}function Lv(e,t){var n=e.readCString(t),r=null;return/[ty]/i.test(n)?r=!0:/[fn]/i.test(n)&&(r=!1),r}function zv(e,t){var n=e.readCString(t),r=n.substr(0,4),i=n.substr(4,2),a=n.substr(6,2);return new Date(Date.UTC(+r,+i-1,+a))}function Rv(e,n){var r,i,a=t.isString(e)?new Ly(e,{cacheSize:33554432,bufferSize:4194304}):new Ty(e),o=function(e){var t=e.readToBinArray(0,Math.min(8193,e.size()));t.position(0).littleEndian();var n,r={version:t.readInt8(),updateYear:t.readUint8(),updateMonth:t.readUint8(),updateDay:t.readUint8(),recordCount:t.readUint32(),dataOffset:t.readUint16(),recordSize:t.readUint16(),incompleteTransaction:t.skipBytes(2).readUint8(),encrypted:t.readUint8(),mdx:t.skipBytes(12).readUint8(),ldid:t.readUint8()},i=1;t.skipBytes(2),r.fields=[];for(;13!=t.peek()&&10!=t.peek()&&t.position()<r.dataOffset-1;)(n=u(t)).columnOffset=i,r.fields.push(n),i+=n.size;i!=r.recordSize&&vt("Record length mismatch; header:",r.recordSize,"detected:",i);13!=t.peek()&&xt("Found a non-standard DBF header terminator ("+t.peek()+"). DBF file may be corrupted.");return r}(a);function s(){if(!r){var e="ascii";l(),g().length>0&&(e=h()),r=o.fields.map(function(n){var r=t.extend({},n);return r.name=$r(n.namebuf,e),r}),ri(t.pluck(r,"name")).forEach(function(e,t){r[t].name=e})}}function u(e){var n=t.createBuffer(11),r=Pv(e,11,n);return{namebuf:t.createBuffer(n.slice(0,r)),type:String.fromCharCode(e.readUint8()),address:e.readUint32(),size:e.readUint8(),decimals:e.readUint8(),id:e.skipBytes(2).readUint8(),position:e.skipBytes(2).readUint8(),indexFlag:e.skipBytes(7).readUint8()}}function c(){return s(),t.pluck(r,"name")}function f(e){return o.dataOffset+o.recordSize*e}function l(){i||(i=n||function(){var e,n=o.ldid,r=function(e){var t=Iv.indexOf(e);return-1==t?null:Iv[t+1]}(n),i=function(){var e,n,r,i,s,u,c=[],l=o.fields.filter(function(e){return"C"==e.type}),h=l.length,p=Math.min(o.recordCount,1e4),d=50,m=t.createBuffer(256),y={};c=g();for(var v=0;v<p;v++){u=(s=a.readToBinArray(f(v),o.recordSize)).position();for(var b=0;b<h&&!(c.length>=d);b++)e=l[b],s.position(u+e.columnOffset),(n=Pv(s,e.size,m))>0&&Nv(m,n)&&(i=(r=t.createBuffer(m.slice(0,n))).toString("hex"))in y==!1&&(y[i]=!0,c.push(r))}return c}(),s=0===i.length;r&&87!=n?e=r:s&&(e="ascii");if(!e){var u,c=Jy(i);e=c.encoding,c.confidence<2&&(u="Warning: Unable to auto-detect the DBF file text encoding"+(1==c.confidence?" with high confidence":"")+".",u+=" Defaulting to "+e+(e in kv?" ("+kv[e]+").":"."),u+="\n\nSample of how non-ascii text was imported:\n",qc()?u+="<pre>"+Rt(Wy(e,i),50)+"</pre>":u+=Rt(Wy(e,i)),xt(u+="\n\n"+Cv+"\n"))}return e}())}function h(){return l(),i}function p(){s();var e,t=r.map(d),n=(e=c().map(function(e,t){return JSON.stringify(e)+": arguments["+t+"]"}),new Function("return {"+e.join(",")+"};")),i=[];return function(e){var s,u,c=a.readToBinArray(f(e),o.recordSize),l=c.position();(c.bytesLeft()<o.recordSize||c.bytesLeft()==o.recordSize&&26==c.peek(c.size()-1))&&bt("Invalid DBF file: encountered end-of-file while reading data");for(var h=0,p=r.length;h<p;h++)s=l+(u=r[h]).columnOffset,c.position(s),i[h]=t[h](c,u.size);return n.apply(null,i)}}function d(e){var t=e.type,n=null;return"I"==t?n=Tv:"F"==t||"N"==t?n=function(){var e=Ov("ascii");return function(t,n){var r,i=e(t,n);return i.indexOf(",")>=0&&(i=i.replace(",",".")),r=parseFloat(i),isNaN(r)?null:r}}():"L"==t?n=Lv:"D"==t?n=zv:"C"==t?n=Ov(h()):(xt('Field "'+e.name+'" has an unsupported type ('+e.type+") -- converting to null values"),n=function(){return null}),n}function g(){var e=[];return o.fields.forEach(function(t){Nv(t.namebuf,t.namebuf.length)&&e.push(t.namebuf)}),e}this.size=function(){return o.recordCount},this.readRow=function(e){return p()(e)},this.getFields=c,this.getBuffer=function(){return a.readSync(0,a.size())},this.deleteField=function(e){s(),r=r.filter(function(t){return t.name!=e})},this.readRows=function(){for(var e=p(),t=[],n=0,r=this.size();n<r;n++)t.push(e(n));return t}}function Dv(e,t){return new jv(e,(t||{}).encoding)}function jv(e,t){var n,r=new Rv(e,t),i=!1;function a(){return n||(n=new di(r.readRows()),r=null,e=null),n}this.exportAsDbf=function(e){if(!(!r||i||e.field_order||e.encoding))try{return r.getBuffer()}catch(e){}return Tm.exportRecords(a().getRecords(),e.encoding,e.field_order)},this.getReadOnlyRecordAt=function(e){return r?r.readRow(e):n.getReadOnlyRecordAt(e)},this.deleteField=function(e){n?n.deleteField(e):(i=!0,r.deleteField(e))},this.getRecords=function(){return a().getRecords()},this.getFields=function(){return r?r.getFields():n.getFields()},this.isEmpty=function(){return r?0===this.size():n.isEmpty()},this.size=function(){return r?r.size():n.size()}}Object.assign(jv.prototype,di.prototype);var Fv=Object.freeze({__proto__:null,ShapefileTable:jv,importDbfTable:Dv});function Uv(e){return[ay.POLYGON,ay.POLYGONM,ay.POLYGONZ].includes(e)?"polygon":[ay.POLYLINE,ay.POLYLINEM,ay.POLYLINEZ].includes(e)?"polyline":[ay.POINT,ay.POINTM,ay.POINTZ,ay.MULTIPOINT,ay.MULTIPOINTM,ay.MULTIPOINTZ].includes(e)?"point":null}function Bv(e){return[0,1,3,5,8,11,13,15,18,21,23,25,28].includes(e)}var Gv=Object.freeze({__proto__:null,isSupportedShapefileType:Bv,translateShapefileType:Uv});function qv(e){var t,n,r=ay.hasBounds(e),i=ay.isMultiPartType(e),a=ay.isZType(e),o=ay.isMType(e),s=!r,u=s?0:16;t=function(t,n){var r=t.position();if(this.id=t.bigEndian().readUint32(),this.type=t.littleEndian().skipBytes(4).readUint32(),0===this.type||0===e)return{id:this.id,isNull:!0,pointCount:0,partCount:0,byteLength:12};(n>0!=!0||this.type!=e&&0!==this.type)&&vt("Unable to read a shape -- .shp file may be corrupted"),this.byteLength=n,s?(this.pointCount=1,this.partCount=1):(t.skipBytes(32),this.partCount=i?t.readUint32():1,this.pointCount=t.readUint32()),this._data=function(){return t.position(r)}};var c={_xypos:function(){var e=12;return s||(e+=4),r&&(e+=32),i&&(e+=4*this.partCount+4),e},readCoords:function(){if(0===this.pointCount)return null;var e=this.readPartSizes(),t=this._data().skipBytes(this._xypos());return e.map(function(e){return t.readFloat64Array(2*e)})},readXY:function(){return 0===this.pointCount?new Float64Array(0):this._data().skipBytes(this._xypos()).readFloat64Array(2*this.pointCount)},readPoints:function(){for(var e,t=this.readXY(),n=a?this.readZ():null,r=o&&this.hasM()?this.readM():null,i=[],s=0,u=t.length/2;s<u;s++)e=[t[2*s],t[2*s+1]],n&&e.push(n[s]),r&&e.push(r[s]),i.push(e);return i},readPartSizes:function(){var e,t,n,r=[];if(0===this.pointCount);else if(1==this.partCount)r.push(this.pointCount);else{t=0,n=this._data().skipBytes(56);for(var i=0,a=this.partCount;i<a;i++)(e=(i<a-1?n.readUint32():this.pointCount)-t)>0&&(r.push(e),t+=e)}return r}},f={read:function(){var e=2;return a&&e++,this.hasM()&&e++,this._data().skipBytes(12).readFloat64Array(e)},stream:function(e){var t=this._data().skipBytes(12);e.addPoint(t.readFloat64(),t.readFloat64()),e.endPath()}},l={readBounds:function(){return this._data().skipBytes(12).readFloat64Array(4)},stream:function(e){for(var t,n=this.readPartSizes(),r=this.readXY(),i=0,a=0;i<n.length;){for(t=n[i];t-- >0;)e.addPoint(r[a++],r[a++]);e.endPath(),i++}r.length!=a&&vt("Counting error")},stream2:function(e){for(var t,n=this.readPartSizes(),r=this._data().skipBytes(this._xypos()),i=0;i<n.length;){for(t=n[i];t-- >0;)e.addPoint(r.readFloat64(),r.readFloat64());e.endPath(),i++}},read:function(){for(var e=[],t=this.readPartSizes(),n=this.readPoints(),r=0,i=t.length-1;r<i;r++)e.push(n.splice(0,t[r]));return e.push(n),e}},h={_mpos:function(){var e=this._xypos()+16*this.pointCount;return a&&(e+=8*this.pointCount+u),e},readMBounds:function(){return this.hasM()?this._data().skipBytes(this._mpos()).readFloat64Array(2):null},readM:function(){return this.hasM()?this._data().skipBytes(this._mpos()+u).readFloat64Array(this.pointCount):null},hasM:function(){var e=this._mpos(),t=e+8*this.pointCount+u;return this.byteLength!=e&&(this.byteLength==t||void vt("#hasM() Counting error"))}},p={_zpos:function(){return this._xypos()+16*this.pointCount},readZBounds:function(){return this._data().skipBytes(this._zpos()).readFloat64Array(2)},readZ:function(){return this._data().skipBytes(this._zpos()+u).readFloat64Array(this.pointCount)}};return n=0===e?{}:s?Object.assign(c,f):Object.assign(c,l),a&&Object.assign(n,p),o&&Object.assign(n,h),t.prototype=n,n.constructor=t,t}function Vv(e,n){if(this instanceof Vv==!1)return new Vv(e,n);var r,i,a=t.isString(e)?new Ly(e):new Ty(e),o=function(e){var t={signature:e.bigEndian().readUint32(),byteLength:2*e.skipBytes(20).readUint32(),version:e.littleEndian().readUint32(),type:e.readUint32(),bounds:e.readFloat64Array(4),zbounds:e.readFloat64Array(2),mbounds:e.readFloat64Array(2)};9994!=t.signature&&vt("Not a valid .shp file");Bv(t.type)||vt("Unsupported .shp type:",t.type);t.byteLength!=a.size()&&vt("File size of .shp doesn't match size in header");return t}(a.readToBinArray(0,100)),s=o.type,u=100,c=0,f=0,l=new qv(s);function h(e,t){var n=e.size();if(t+12>n)return null;var r=e.readToBinArray(t,12);r.bigEndian().readUint32();var i=2*r.readUint32()+8,a=r.littleEndian().readUint32();return t+i<=n&&i>=12&&(0===a||a==s)?(r=e.readToBinArray(t,i),new l(r,i)):null}n&&(i=t.isString(n)?new Ly(n):new Ty(n),r=i.readToBinArray(0,i.size()).bigEndian()),this.header=function(){return o},this.forEachShape=function(e){for(var t=this.nextShape();t;)e(t),t=this.nextShape()},this.nextShape=function(){var e;return a||vt("Tried to read from a used ShpReader"),e=function(e){return r?function(e,t,n){if(t.size()<=100+8*n)return null;t.position(100+8*n);var r=n+1,i=2*t.readUint32();t.readUint32();var a=h(e,i);a||bt("Index of Shapefile record",r,"in the .shx file is invalid.");a.id!=r&&(f++,Mt(`Warning: A feature has a different record number in .shx (${r}) and .shp (${a.id}).`));return a}(a,r,e):function(e,t,n){var r,i,a,o=n+1,c=t,f=e.size(),l=null;for(;c+12<=f;)if(i=(r=e.readToBinArray(c,12)).bigEndian().readUint32(),!((a=r.littleEndian().skipBytes(4).readUint32())==s||0===a)||i!=o&&0===a)c+=4;else{if(!(l=h(e,c)))break;if(u=c+l.byteLength,i==o)break;i<o?(xt("Found a Shapefile record with the same id as a previous record ("+l.id+") -- skipping."),c+=l.byteLength):bt("Shapefile contains an out-of-sequence record. Possible data corruption -- bailing.")}l&&c>t&&Mt("Skipped over "+(c-t)+" non-data bytes in the .shp file.");return l}(a,u,e)}(c),e?(c++,e):(a.close(),a=i=r=null,f>0&&xt(`Warning: ${f}/${c} features have non-standard record numbers in the .shp file.`),null)}}function $v(e,t){var n,r=e.arcs;(t.snap||t.auto_snap||t.snap_interval)&&(t.snap_interval&&(n=oh(t.snap_interval,Ia(e))),r&&Gn(r,n)),e.layers.forEach(function(e){wi(e)&&Rp(e.shapes,r,e.geometry_type)})}function Jv(e){return e[0]>-1e38&&e[1]>-1e38}function Wv(e){var n=1e4,r=new Float64Array(n),i=new Float64Array(n),a=0;this.endPath=function(){e(r,i,a),a=0},this.addPoint=function(e,o){a>=n&&(n=Math.ceil(1.3*n),r=t.extendBuffer(r,n),i=t.extendBuffer(i,n)),r[a]=e,i[a]=o,a++}}function Zv(e){var n=e.reserved_points>0?e.reserved_points:2e4,r=new Float64Array(n),i=new Float64Array(n),a=[],o=[],s=[],u=[],c=e.type||null,f=null,l=-1,h=-1,p=0,d=0,g=0;function m(e){var t=h<u.length?u[h]:null;t?t!=e&&bt("Unable to import mixed-geometry features"):(u[h]=e,c?e!=c&&(c="mixed"):c=e)}function y(e){if(e>r.length){var n=Math.max(e,Math.ceil(1.5*r.length));r=t.extendBuffer(r,n,p),i=t.extendBuffer(i,n,p)}}function v(e){(a[h]||(a[h]=[])).push(e)}e.precision&&(f=Vl(e.precision)),t.extend(this,new Wv(function(e,t,n){var a,o,u,h,m=0;y(p+n);for(var b=0;b<n;b++)a=e[b],o=t[b],f&&(a=f(a),o=f(o)),b>0&&a==u&&o==h?d++:(r[p]=a,i[p]=o,p++,m++),h=o,u=a;"polygon"==c&&m>0&&(e[0]==e[n-1]&&t[0]==t[n-1]||(y(p+1),r[p]=e[0],i[p]=t[0],g++,p++,m++));!function(e){l++,s[l]=e,v([l])}(m)})),this.startShape=function(e){a[++h]=null,e&&(o[h]=e)},this.importLine=function(e){e.length<2?Mt("Skipping a defective line"):(m("polyline"),this.importPath(e))},this.importPoints=function(e){m("point"),e=e.filter(Jv),f&&e.forEach(function(e){e[0]=f(e[0]),e[1]=f(e[1])}),e.forEach(v)},this.importRing=function(e,t){var n=fr.getPlanarPathArea2(e);!n||e.length<4?Mt("Skipping a defective ring"):(m("polygon"),(!0===t&&n>0||!1===t&&n<0)&&e.reverse(),this.importPath(e))},this.importPath=function(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],this.addPoint(t[0],t[1]);this.endPath()},this.done=function(){var e,n,f={name:""};return d>0&&Mt(t.format("Removed %,d duplicate point%s",d,t.pluralSuffix(d))),g>0&&xt(t.format("Closed %,d open polygon ring%s",g,t.pluralSuffix(g))),p>0&&(p<r.length&&(r=r.subarray(0,p),i=i.subarray(0,p)),e=new Wa(s,r,i)),"mixed"==c?n=ji(a,o,u):(f={geometry_type:c},c&&(f.shapes=a),o.length>0&&(f.data=new di(o)),n=[f]),n.forEach(function(e){e.data&&Kr(e.data.getRecords())}),{arcs:e||null,info:{},layers:n}}}Vv.prototype.type=function(){return this.header().type};var Yv=Object.freeze({__proto__:null,PathImporter:Zv,cleanPathsAfterImport:$v,pointHasValidCoords:Jv});function Hv(e,n,r){var i=new Vv(e,n),a=i.type(),o=Uv(a),s=new Zv(t.defaults({type:o,reserved_points:Math.round(i.header().byteLength/16)},r));return Bv(a)||bt("Unsupported Shapefile type:",a),ay.isZType(a)?Mt("Warning: Shapefile Z data will be lost."):ay.isMType(a)&&Mt("Warning: Shapefile M data will be lost."),i.forEachShape(function(e){s.startShape(),e.isNull||("point"==o?s.importPoints(e.readPoints()):e.stream(s))}),s.done()}var Xv=Object.freeze({__proto__:null,importShp:Hv});function Kv(e,n){var r,i,a=n||{},o=Object.keys(_d.pathImporters),s=t.isString(e)?JSON.parse(e):e,u=new Qv(a);return((r="Feature"==s.type?{type:"FeatureCollection",features:[s]}:o.includes(s.type)?{type:"GeometryCollection",geometries:[s]}:s).features||r.geometries||[]).forEach(u.parseObject),tb(i=u.done(),s),i}function Qv(e){var t=e.id_field||_d.ID_FIELD,n=new Zv(e);this.parseObject=function(r){var i,a;r&&r.type?"Feature"==r.type?(i=r.geometry,a=r.properties||{},"id"in r&&(a[t]=r.id)):i=r:i=null,i&&"GeometryCollection"==i.type?_d.importComplexFeature(n,i,a,e):e.single_part&&function(e){return e&&e.type&&0===e.type.indexOf("Multi")}(i)?_d.importMultiAsSingles(n,i,a,e):_d.importSimpleFeature(n,i,a,e)},this.done=function(){return n.done()}}function eb(e,t){return t=t||{},e.forEach(function(e){if(e){var n=_d.translateGeoJSONType(e.type);n?(n in t==!1&&(t[n]=[]),t[n].push(e)):"GeometryCollection"==e.type&&eb(e.geometries||[],t)}}),Object.values(t)}function tb(e,t){"crs"in t&&(e.info.input_geojson_crs=t.crs)}_d.importComplexFeature=function(e,t,n,r){var i=eb(t.geometries||[]);0!==i.length?i.forEach(function(t,i){e.startShape(Hr(n)),t.forEach(function(t){_d.importSimpleGeometry(e,t,r)})}):e.startShape(n)},_d.importSimpleFeature=function(e,t,n,r){e.startShape(n),_d.importSimpleGeometry(e,t,r)},_d.importMultiAsSingles=function(e,t,n,r){t.coordinates.forEach(function(i,a){var o={type:t.type.substr(5),coordinates:i},s=0===a?n:Hr(n);_d.importSimpleFeature(e,o,s,r)})},_d.importSimpleGeometry=function(e,t,n){var r=t?t.type:null;if(null===r);else if(r in _d.pathImporters){if(n.geometry_type&&n.geometry_type!=_d.translateGeoJSONType(r))return;_d.pathImporters[r](t.coordinates,e)}else Mt("Unsupported geometry type:",t.type)},_d.pathImporters={LineString:function(e,t){t.importLine(e)},MultiLineString:function(e,t){for(var n=0;n<e.length;n++)_d.pathImporters.LineString(e[n],t)},Polygon:function(e,t){for(var n=0;n<e.length;n++)t.importRing(e[n],n>0)},MultiPolygon:function(e,t){for(var n=0;n<e.length;n++)_d.pathImporters.Polygon(e[n],t)},Point:function(e,t){t.importPoints([e])},MultiPoint:function(e,t){t.importPoints(e)}};var nb=Object.freeze({__proto__:null,GeoJSONParser:Qv,importCRS:tb,importGeoJSON:Kv});function rb(e,n){var r,i,a;return t.isString(e)&&(e=JSON.parse(e)),e.arcs&&e.arcs.length>0&&(e.transform&&function(e,t){var n=t.scale[0],r=t.scale[1],i=t.translate[0],a=t.translate[1];e.forEach(function(e){for(var t,o,s,u=0,c=0,f=0,l=e.length;f<l;f++)o=(t=e[f])[0]+u,s=t[1]+c,t[0]=o*n+i,t[1]=s*r+a,u=o,c=s})}(e.arcs,e.transform),n&&n.precision&&function(e,t){var n,r=Vl(t);e.forEach(function(e){for(var t=0,i=e.length;t<i;t++)(n=e[t])[0]=r(n[0]),n[1]=r(n[1])})}(e.arcs,n.precision),i=new Wa(e.arcs)),a=Object.keys(e.objects).reduce(function(t,r){for(var a,o=uy.importObject(e.objects[r],i,n),s=0,u=o.length;s<u;s++)(a=o[s]).name=r,t.push(a);return t},[]),a.forEach(function(t){var n,r;wi(t)&&Rp(t.shapes,i,t.geometry_type),"point"==t.geometry_type&&e.transform&&(n=t.shapes,r=e.transform,Wt(n,function(e){e[0]=e[0]*r.scale[0]+r.translate[0],e[1]=e[1]*r.scale[1]+r.translate[1]})),t.data&&Kr(t.data.getRecords())}),tb(r={layers:a,arcs:i,info:{}},e),e.metadata&&function(e,t){t.proj4&&Ea(e,wa(t.proj4))}(r,e.metadata),r}uy.importObject=function(e,t,n){var r=new uy.GeometryImporter(t,n);return("GeometryCollection"==e.type?e.geometries:[e]).forEach(r.addGeometryObject,r),r.done()},uy.GeometryImporter=function(e,t){var n,r=t&&t.id_field||_d.ID_FIELD,i=[],a=[],o=[],s=0,u=null;this.addGeometryObject=function(e){var t=e.properties||null;n=a.length,a[n]=null,"id"in e&&((t=t||{})[r]=e.id),i[n]=t,t||s++,e.type&&this.addShape(e)},this.addShape=function(t){var r,i=a[n],o=_d.translateGeoJSONType(t.type);"GeometryCollection"==t.type?t.geometries.forEach(this.addShape,this):o?(this.setGeometryType(o),(r=uy.shapeImporters[t.type](t,e))&&r.length&&(Array.isArray(r[0])?a[n]=i?i.concat(r):r:bt("Invalid TopoJSON",t.type,"geometry"))):t.type&&bt("Invalid TopoJSON geometry type:",t.type)},this.setGeometryType=function(e){var t=n<o.length?o[n]:null;t?t!=e&&bt("Unable to import mixed-type TopoJSON geometries"):(o[n]=e,this.updateCollectionType(e))},this.updateCollectionType=function(e){u?e&&u!=e&&(u="mixed"):u=e},this.done=function(){return"mixed"==u?ji(a,i,o):[{geometry_type:u,shapes:u?a:null,data:s<a.length?new di(i):null}]}},uy.importPolygonArcs=function(e,t){var n,r=e[0],i=null;if(t||bt("Invalid TopoJSON file: missing arc data."),!(n=r?fr.getPlanarPathArea(r,t):null))return null;n<0&&mr(r),i=[r];for(var a=1;a<e.length;a++)r=e[a],(n=fr.getPlanarPathArea(r,t))&&(n>0&&mr(r),i.push(r));return i},uy.shapeImporters={Point:function(e){return[e.coordinates]},MultiPoint:function(e){return e.coordinates},LineString:function(e){return[e.arcs]},MultiLineString:function(e){return e.arcs},Polygon:function(e,t){return uy.importPolygonArcs(e.arcs,t)},MultiPolygon:function(e,t){return e.arcs.reduce(function(e,n){var r=uy.importPolygonArcs(n,t);return r&&(e=e?e.concat(r):r),e},null)}};var ib,ab=Object.freeze({__proto__:null,importTopoJSON:rb}),ob=123,sb=93,ub=34,cb=44,fb=4096,lb=1e7;function hb(e,t){var n=Lb(e,0),r=function(e){var t=e.getChar(),n=0;for(;t!=ib&&n<fb;){if(n++,t==ob)return e.back(),!0;t=e.getChar()}return!1}(n);r||bt("File is not GeoJSON");var i=Eb(n,t);if("FeatureCollection"==i.type||"GeometryCollection"==i.type)return i;for(i.type||bt("Invalid GeoJSON"),t(i),yb(n);n.peek()==ob;)t(Eb(n,t)),yb(n);return null}function pb(e,t){t>=0&&(e+=" at position "+t),bt(e)}function db(e,t){if(e==ib)return pb("Unexpected end of JSON input");pb(e==ub?"Unexpected string in JSON":e<33||e>126?"Unexpected token in JSON":"Unexpected token "+String.fromCharCode(e)+" in JSON",t)}function gb(e,t){t==ib&&pb("Unterminated string in JSON",e),pb("Too-long string in JSON",e)}function mb(e){return 32==e||10==e||13==e||9==e}function yb(e){for(;mb(e.peek());)e.advance()}function vb(e,t){var n;for(xb(e,91),n=wb(e,sb);n!=sb;)e.refresh(),t(bb(e)),n=Ab(e,cb,sb)}function bb(e){var t,n,r,i,a=e.index();if(91==e.getChar()&&Ob(e.peek())&&(t=Tb(e),r=e.getChar(),yb(e),r==cb&&Ob(e.peek()))){if(n=Tb(e),(i=e.getChar())==sb)return[t,n];if(i==cb)return function(e,t){yb(e);do{e.refresh(),t.push(Sb(e))}while(Ab(e,cb,sb)==cb);return t}(e,[t,n])}return e.index(a),Sb(e)}function _b(e,t){for(var n=0;n<t.length;n++)xb(e,t.charCodeAt(n));return!0}function xb(e,t){var n=e.getChar();n!=t&&db(n,e.index()-1)}function wb(e,t){return yb(e),e.peek()===t?(e.advance(),yb(e),t):null}function Sb(e){var t,n=e.peek();return Ob(n)?t=Tb(e):91==n?t=function(e){var t,n=[];for(xb(e,91),t=wb(e,sb);t!=sb;)e.refresh(),n.push(bb(e)),t=Ab(e,cb,sb);return n}(e):n==ub?t=kb(e):n==ob?t=Eb(e):110==n?t=function(e){return _b(e,"null"),null}(e):116==n?t=function(e){return _b(e,"true"),!0}(e):102==n?t=function(e){return _b(e,"false"),!1}(e):db(n,e.index()),t}function Ab(e,t,n){yb(e);var r=e.getChar();return r!=t&&r!=n&&db(r,e.index()-1),yb(e),r}function Eb(e,t){var n,r,i={};for(xb(e,ob),r=wb(e,125);125!=r;)e.refresh(),n=Ib(e),yb(e),xb(e,58),yb(e),"features"!=n&&"geometries"!=n||91!=e.peek()||!t?"type"==n&&e.peek()==ub?i[n]=Ib(e):i[n]=Sb(e):(vb(e,t),i[n]=null),r=Ab(e,cb,125);return i}function Mb(){return(fb*=2)<=5e6}function Ib(e){var t=e.index(),n=e.cache,r=!1,i=0;xb(e,ub);for(var a=e.getChar();a!=ub||!0===r;)++i>2e3&&gb(t,a),r?r=!1:92==a&&(r=!0),n[a]||(n[a]=[]),n=n[a],a=e.getChar();return n[0]||(e.index(t),n[0]=kb(e)),n[0]}function kb(e){var t=e.index();xb(e,ub);for(var n=0,r="",i=e.getChar();i!=ub;){if(++n>256||92==i||i<32||i>126)return e.index(t),Cb(e);r+=String.fromCharCode(i),i=e.getChar()}return r}function Cb(e){e.refresh();var t=fb-2,n=e.index(),r=0,i=!1;xb(e,ub);for(var a,o=e.getChar();o!=ub||!0===i;){if(++r>t)return o!=ib&&Mb()||gb(n,o),e.index(n),Cb(e);i?i=!1:92==o&&(i=!0),o=e.getChar()}return a=JSON.parse(e.toString(n,r+2)),e.refresh(),a}function Pb(e){return e>=48&&e<=57}function Ob(e){return e>=48&&e<=57||45==e}function Nb(e){return e>=48&&e<=57||45==e||46==e||43==e||69==e||101==e}function Tb(e){var t,n,r=e.index(),i=0,a=1,o=1,s=!1,u=!1,c=e.getChar();for(45===c&&(o=-1,c=e.getChar()),t=c;Pb(c);)i=10*i+(n=c-48),c=e.getChar();if(i>0&&48===t&&(u=!0),46==c){for(;Pb(c=e.getChar());)a*=10,i=10*i+(n=c-48);1!=a&&46!=t||(u=!0)}return 0===i&&48!=t&&(u=!0),u&&pb("Invalid number in JSON",r),a>1e22&&(s=!0),i>=9007199254740992&&(!(i>=0x40000000000000)&&1&~n||(s=!0)),s||69==c||101==c?(e.index(r),function(e){for(var t=e.index(),n=0;Nb(e.getChar());)n++;e.back();var r=e.toString(t,n),i=Number(r);return isNaN(i)&&pb("Invalid number in JSON",t),i}(e)):(e.back(),o*i/a)}function Lb(e,t){var n=e.size(),r=t,i=e.readSync(r,lb),a=0,o={peek:function(){return i[a]},getChar:function(){return i[a++]},advance:function(){a++},back:function(){a--},toString:function(e,t){var n=e-r;return i.toString("utf8",n,n+t)},index:function(e){if(e>=0==!1)return a+r;a=e-r},refresh:s,cache:[]};return s(),o;function s(){i.length-a>=fb||r+i.length>=n||(r+=a,a=0,i=e.readSync(r,lb))}}function zb(e,t){var n=null;return e.length>1e3&&(e=e.substr(0,1e3)),e=e.replace(/\s/g,""),t&&t.json_path||/^\[[{\]]/.test(e)?n="json":/"arcs":\[|"objects":\{|"transform":\{/.test(e)?n="topojson":/^\{"/.test(e)&&(n="geojson"),n}function Rb(e){var n=null;return e&&("Topology"==e.type?n="topojson":e.type?n="geojson":t.isArray(e)&&(n="json")),n}function Db(e,t){var n=new Qv(t);return hb(e,n.parseObject),n.done()}function jb(e,n){var r,i,a=e.content,o=e.filename,s={filename:o};if(a?(a instanceof ArrayBuffer||a instanceof u||a instanceof Uint8Array)&&((a.byteLength||a.length)<1e7?a=qr(t.createBuffer(a)):(r=new Ty(a),a=null)):r=new Ly(o),r&&(e=function(e,t){var n;return n="geojson"==zb(Oy(e,1e3),t)?{dataset:Db(e,t),format:"geojson"}:{content:e.toString("utf8")},e.close(),n}(r,n),e.dataset?(s.dataset=e.dataset,s.format=e.format):a=e.content),a){if(t.isString(a))try{a=JSON.parse(a)}catch(e){bt("JSON parsing error:",e.message)}n.json_path?(i=Rb(a=function(e,t){var n,r,i,a=/(.*)\[([0-9]+)\]$/,o=t.indexOf("/")>0?"/":".",s=t.split(o);for(;s.length>0;)if(n=s.shift(),!(e=(i=a.exec(n))?(r=e[i[1]])&&r[+i[2]]||null:e[n]))return null;return e}(a,n.json_path)))||bt("Unexpected object type at JSON path:",n.json_path):i=Rb(a),"topojson"==i?s.dataset=rb(a,n):"geojson"==i?s.dataset=Kv(a,n):"json"==i?s.dataset=yy(a):bt("Unknown JSON format"),s.format=i}return s}var Fb=Object.freeze({__proto__:null,identifyJSONObject:Rb,identifyJSONString:zb,importGeoJSONFile:Db,importJSON:jb});function Ub(e,n){var r,i,a;return n=n||{},e.json?(i=(a=jb(e.json,n)).format,$v(r=a.dataset,n)):e.text?(i="dsv",r=tv(a=e.text,n)):e.shp?(i="shapefile",a=e.shp,r=function(e,n){var r,i=e.shp.content||e.shp.filename,a=e.shx?e.shx.content||e.shx.filename:null,o=Hv(i,a,n),s=o.layers[0];e.dbf&&(r=Bb(e,n),t.extend(o.info,r.info),s.data=r.layers[0].data,s.shapes&&s.data.size()!=s.shapes.length&&xt("Mismatched .dbf and .shp record count -- possible data loss."));e.prj&&(o.info.prj=e.prj.content);e.cpg&&(o.info.cpg=e.cpg.content,"string"!=typeof o.info.cpg&&vt("Invalid encoding argument, expected a string"));return o}(e,n),$v(r,n)):e.dbf?(i="dbf",a=e.dbf,r=Bb(e,n)):e.prj?(i="prj",r={layers:[],info:{prj:(a=e.prj).content}}):e.kml&&(i="kml",r=function(e,t){var n=s("@tmcw/togeojson"),r="undefined"==typeof DOMParser?s("@xmldom/xmldom").DOMParser:DOMParser;return Kv(n.kml((new r).parseFromString(e,"text/xml")),t||{})}((a=e.kml).content,n)),r||bt("Missing an expected input type"),r.arcs&&!n.no_topology&&"topojson"!=i&&Ka(r),"topojson"!=i&&r.layers.forEach(function(e){e.name||(e.name=function(e){var t="layer1",n=Lo(e);n.basename&&n.extension&&(t=n.basename);return t}(a.filename||""))}),a.filename&&(r.info.input_files=[a.filename]),r.info.input_formats=[i],r}function Bb(e,n){return n=t.extend({},n),e.cpg&&!n.encoding&&(n.encoding=e.cpg.content),{info:{},layers:[{data:Dv(e.dbf.content||e.dbf.filename,n)}]}}var Gb=Object.freeze({__proto__:null,importContent:Ub,importFileContent:function(e,t,n){var r={};return r[pf(t,e)]={filename:t,content:e},Ub(r,n)}});async function qb(e){return Vb(Us(e,{}))}async function Vb(e){(function(e){if(!Array.isArray(e.datasets))return!1;return!0})(e)||bt("Invalid mapshaper session data object");var t=await Promise.all(e.datasets.map($b));return t=t.filter(Boolean),Object.assign(e,{datasets:t})}async function $b(e){var t=null,n=(e.layers||[]).map(Zb);try{e.arcs&&(t=await async function(e){if($c(e.xx)){var t=[];t.push(Zc(e.nn)),t.push(Zc(e.xx)),t.push(Zc(e.yy)),e.zz&&t.push(Zc(e.zz));var n=await Promise.all(t);e.nn=n.shift(),e.xx=n.shift(),e.yy=n.shift(),e.zz&&(e.zz=n.shift())}var r=Jb(e.nn,Uint32Array),i=Jb(e.xx,Float64Array),a=Jb(e.yy,Float64Array),o=new Wa(r,i,a);e.zz&&(o.setThresholds(Jb(e.zz,Float64Array)),o.setRetainedInterval(e.zlimit));return o}(e.arcs))}catch(e){return wt(`Some coordinates are corrupted, skipping ${1==n.length?"a layer":n.length+" layers"}.`),null}return{info:await Wb(e.info||{}),layers:n,arcs:t}}function Jb(e,t){return new t(Om.copyToArrayBuffer(e))}async function Wb(e){return e.crs_string?(await la({crs:e.crs_string}),e.crs=Sa(e.crs_string)):e.prj&&(e.crs=Ra(e.prj)),e}function Zb(e){var t=e.data;return t&&(t=Kc(t)),Object.assign(e,{data:e.data?new di(t):null})}var Yb=Object.freeze({__proto__:null,restoreSessionData:Vb,unpackSessionData:qb});function Hb(e,t){var n;e in t?n=t[e]:(n=e,Lf.checkFileExists(e));var r=If(n);return Object.assign(t,r),function(e){return Object.keys(e).filter(function(t){var n=ff(t);return("dbf"!=n||!(jo(t,"shp")in e))&&(n&&!lf(n))})}(r)}function Xb(e,t){return Kb(e,t)}pp.importFiles=async function(e,n){var r,i=n.files||[];return n.stdin?(r=Xb("/dev/stdin",n),e.addDataset(r),r):(i.length>0==!1&&bt("Missing input file(s)"),Mt("Importing: "+i.join(" ")),(n=Object.assign({},n)).input=Object.assign({},n.input),function(e,n){var r=e.map(e=>df(e)?"layer.json":null).filter(Boolean);if(0===r.length)return;r.length>1&&(r=t.uniqifyNames(r,Cy));e.forEach((t,i)=>{if(df(t)){var a=r.shift();n[a]=t,e[i]=a}})}(i,n.input),i=function(e,t){var n=[];return e.forEach(function(e){var r;r=bf(e)?Hb(e,t):_f(e)?function(e,t){var n=Hb(e,t),r=jo(Lo(e).filename,"kml");"doc.kml"==n[0]&&(n[0]=r,t[r]=t["doc.kml"]);return n}(e,t):[e],n=n.concat(r)}),n}(i,n.input),0===i.length&&bt("Missing importable files"),i.some(vf)?(i.length>1&&bt("Expected a single package file"),r=await async function(e,t,n){var r=Lf.readFile(e,null,n.input),i=await qb(r);return i.datasets.forEach(t.addDataset,t),i.target}(i[0],e,n),r):(r=1==i.length?Xb(i[0],n):Qb(i,n),n.merge_files&&i.length>1&&(r.layers=pp.mergeLayers(r.layers)),e.addDataset(r),r))};var Kb=function(e,n){var r,i=ff(e),a={},o=n&&n.encoding||null,s=n&&n.input||null,u=s&&e in s;if(Lf.checkFileExists(e,s),"shp"!=i&&"json"!=i&&"text"!=i&&"dbf"!=i||u)if(i&&Sf(e))r=Lf.readFile(e,null,s),t.isString(r)&&bt("Expected binary content, received a string");else if(i)r=Lf.readFile(e,o||"utf-8",s);else if("gz"==Ro(e)){var c=e;(i=ff(e=c.replace(/\.gz$/,"")))||bt("Unrecognized file type:",e),r=Yc(Lf.readFile(c,null,s),e)}else"text"==(i=hf(r=Lf.readFile(e,o||"utf-8",s)))&&r.indexOf("�")>-1&&(i=null);else r=null;return i||bt(function(e){var t=Ro(e),n="Unable to import "+e;"zip"==t.toLowerCase()?n+=" (ZIP files must be unpacked before running mapshaper)":n+=" (unknown file type)";return n}(e)),a[i]={filename:e,content:r},r=null,"shp"!=i&&"dbf"!=i||function(e,t,n){var r=jo(e,"dbf"),i=jo(e,"shx"),a=jo(e,"cpg"),o=jo(e,"prj");Lf.isFile(o,n)&&(t.prj={filename:o,content:Lf.readFile(o,"utf-8",n)});Lf.isFile(i,n)&&(t.shx={filename:i,content:Lf.readFile(i,null,n)});!t.dbf&&Lf.isFile(r,n)&&(t.dbf={filename:r,content:n&&r in n?Lf.readFile(r,null,n):null});t.dbf&&Lf.isFile(a,n)&&(t.cpg={filename:a,content:Lf.readFile(a,"utf-8",n).trim()})}(e,a,s),"shp"!=i||a.dbf||xt(t.format("[%s] .dbf file is missing - shapes imported without attribute data.",e)),Ub(a,n)};function Qb(e,n){var r=!1,i=io(e.map(function(e){var i=Xb(e,t.defaults({no_topology:!0,snap:!1,snap_interval:null,files:[e]},n));return i.arcs&&i.arcs.size()>0&&"topojson"!=i.info.input_formats[0]&&(r=!0),i}));return r&&!n.no_topology&&($v(i,n),Ka(i)),i}var e_=Object.freeze({__proto__:null,importFile:Xb,importFilesTogether:Qb,replaceImportFile:function(e){Kb=e}});function t_(e,t){return function(e){return/[$][{]/.test(e)}(e)?((t.length>1||1!=t[0].layers.length)&&bt("Interpolated names are not compatible with multiple targets."),n_(e,t[0].layers[0])):e}function n_(e,t){var n={target:t.name||""},r="with($$ctx) { return `"+e+"`; }";try{e=new Function("$$ctx",r)(n)}catch(t){bt("Unable to interpolate ["+e+"]")}return e}function r_(e,n,r){var i,a=n.findSingleLayer(e);return a||((i=Xb(e,t.defaults({no_topology:!0},r)))?i.layers.length>1&&bt("Multiple-layer sources are not supported"):bt(t.format("Unable to find source [%s]",e)),a={dataset:i,layer:i.layers[0],disposable:!0}),a}var i_=Object.freeze({__proto__:null,convertInterpolatedName:n_,convertSourceName:t_,findCommandSource:r_});function a_(){var e=[],t=[];function n(e,t){return{layer:e,dataset:t}}function r(e,t){var n=-1;return t.forEach(function(t,r){t.layer==e&&(n=r)}),n}this.forEachLayer=function(t){var n=0;e.forEach(function(e){e.layers.forEach(function(r){t(r,e,n++)})})},this.deleteLayer=function(e,n){this.getActiveLayer().layer==e&&(t=[]),n.layers.splice(n.layers.indexOf(e),1),0===n.layers.length&&this.removeDataset(n),t=t.filter(function(t){var n=t.layers.indexOf(e);return-1==n||(t.layers.splice(n,1),t.layers.length>0)})},this.findLayer=function(e){var t="function"==typeof e?e:null,r=null;return this.forEachLayer(function(i,a){(t?t(i,a):i==e)&&(r=n(i,a))}),r},this.findCommandTargets=function(e,t){return e?qh(this.getLayers(),e,t):this.getDefaultTargets()||[]},this.findSingleLayer=function(e){var t=$h(this.getLayers(),e);return t.length>1&&bt("Ambiguous pattern (multiple layers were matched):",e),t[0]||null},this.clear=function(){e=[],t=[]},this.removeDataset=function(n){t=t.filter(function(e){return e.dataset!=n}),e=e.filter(function(e){return e!=n})},this.getDatasets=function(){return e},this.getLayers=function(){var e=[];return this.forEachLayer(function(t,r){e.push(n(t,r))}),e},this.addDataset=function(e){return this.setDefaultTarget(e.layers,e),this},this.addDatasets=function(e){e.forEach(function(e){this.addDataset(e)},this)},this.findNextLayer=function(e){var t=this.getLayers(),n=r(e,t);return n>-1?t[(n+1)%t.length]:null},this.findPrevLayer=function(e){var t=this.getLayers(),n=r(e,t);return n>-1?t[(n-1+t.length)%t.length]:null},this.isEmpty=function(){return 0===e.length},this.getDefaultTargets=function(){return 0!==t.length||this.isEmpty()||(t=[{dataset:e[0],layers:e[0].layers.slice(0,1)}]),t},this.setDefaultTarget=function(e,t){this.setDefaultTargets([{layers:e.concat(),dataset:t}])},this.setDefaultTargets=function(n){n.forEach(function(t){-1==e.indexOf(t.dataset)&&e.push(t.dataset)}),t=n},this.getActiveLayer=function(){var e=(this.getDefaultTargets()||[])[0],t=e?.layers[e.layers.length-1];return e?{layer:t,dataset:e.dataset}:null}}function o_(e){var t=[];return e.forEachLayer(function(e,n,r){t.push(" ["+(r+1)+"] "+(e.name||"[unnamed]"))}),t.length>0?t.join("\n"):"[none]"}var s_=Object.freeze({__proto__:null,Catalog:a_,getFormattedLayerList:o_});function u_(e){var t,n={catalog:e||new a_,defs:{},settings:{},input_files:[],initSettings:function(e){n.settings=e,c_(n,{})},startCommand:function(e){t=e,c_(n,e)},endCommand:function(){t=null,a()},resumeCommand:function(){c_(n,t)}};return n}function c_(e,t){a(),r("current_command",t.name),r("DEBUG",e.settings.DEBUG||t.debug),r("VERBOSE",e.settings.VERBOSE||t.verbose),r("QUIET",e.settings.QUIET||t.quiet),r("defs",e.defs),r("input_files",e.input_files)}function f_(e,n){var r=t.toArray(arguments).slice(2),i=n.reduce(function(n,i){var a=e.apply(null,[i].concat(r));return t.isArray(a)?n=n.concat(a):a&&n.push(a),n},[]);return i.length>0?i:null}function l_(e){return"string"==typeof e?JSON.parse(e):e}function h_(e){return e?l_(e):null}function p_(e){return e.length>=2&&e.every(t.isNumber)}function d_(e){return e.every(g_)}function g_(e){return e&&2==e.length&&p_(e)}function m_(e,t,n,r){var i=e*Math.PI/180,a=t*Math.cos(i),o=-t*Math.sin(i);return function(e,t){return[a*(e-r[0])-o*(t-r[1])+n[0]+r[0],o*(e-r[0])+a*(t-r[1])+n[1]+r[1]]}}pp.addShape=function(e,t,n){e.length>1&&bt("Command expects a single target layer");var r=e[0],i=!n.no_replace&&r&&r.geometry_type||null,a=Kv(function(e,t){if(e.geojson)return l_(e.geojson);var n=e.coordinates&&function(e){"string"==typeof e&&((e=e.trim()).startsWith("[")||e.endsWith("]")||(e="["+e+"]"));var t=l_(e);if(g_(t))return{type:"Point",coordinates:t};p_(t)&&(t=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);d_(t)||bt("Unable to parse x,y,x,y... coordinates");return t}(t));if(function(e){return d_(e)&&e.length>3&&(t=e[0],n=e[e.length-1],t[0]==n[0]&&t[1]==n[1]);var t,n}(t))return{type:"Polygon",coordinates:[t]};if(d_(t))return{type:"LineString",coordinates:t};bt("Unable to import coordinates")}(e.coordinates)||null;n||bt("Missing required shape coordinates");"point"==t&&"Point"!=n.type&&bt("Expected point coordinates, received",n.type);"polygon"==t&&"Polygon"!=n.type&&bt("Expected polygon coordinates, received",n.type);"polyline"==t&&("Polygon"==n.type?(n.coordinates=n.coordinates[0],n.type="LineString"):bt("Expected polyline coordinates, received",n.type));return{type:"Feature",properties:h_(e.properties),geometry:n}}(n,i)),o=to(t,[a])[0];if(n.no_replace||!r)return Ui(o,r&&r.name,null,n),[o];return pp.mergeLayers([r,o],{force:!0})},pp.affine=function(e,n,r){var i,a,o,s=r.rotate||0,u=r.scale||1,c=r.shift?sh(r.shift,Ia(n)):[0,0],f=n.arcs,l=[],h=[],p=[];n.layers.filter(xi).forEach(function(t){var i,a=[],o=[];-1==e.indexOf(t)?o=t.shapes:r.where?(i=ap(r.where,t,n.arcs),t.shapes.forEach(function(e,t){(i(t)?a:o).push(e)})):a=t.shapes,"point"==t.geometry_type?p=p.concat(a):(l=l.concat(a),h=h.concat(o))});var d=function(e,t){var n,r;n=t.anchor?t.anchor:[(r=wo(e)).centerX(),r.centerY()];return n}({arcs:n.arcs,layers:[{geometry_type:"point",shapes:p},{geometry_type:"polyline",shapes:l}]},r);o=m_(s,u,c,d),r.fit_bbox&&(o=function(e,t,n,r){var i={arcs:r,layers:[]};t&&t.length&&i.layers.push({geometry_type:"point",shapes:t});n&&n.length&&i.layers.push({geometry_type:"polyline",shapes:n});var a=Dd(i,{fit_bbox:e}),o=new qt(a.bbox),s=new qt(a.bbox2),u=o.getTransform(s,!1);return function(e,t){return u.transform(e,t)}}(r.fit_bbox,p,l,f)),l.length>0&&(i=new Uint8Array(f.size()),a=new Uint8Array(f.size()),dr(l,i),h.length>0&&(dr(h,a),function(e,t){for(var n=0,r=e.length;n<r;n++)0===t[n]&&(e[n]=0)}(a,i),n.arcs=function(e,n,r){for(var i,a=0,o=0,s=n.getVertexData(),u=[],c=[],f=[],l=[],h=0,p=r.length;h<p;h++)r[h]>0&&(l[h]=n.size()+a,i=s.nn[h],t.copyElements(s.xx,s.ii[h],u,o,i),t.copyElements(s.yy,s.ii[h],c,o,i),f.push(i),o+=i,a++);return br(e,function(e){var t=Yt(e);if(r[t]>0)return e<0?~l[t]:l[t]}),oo([n,new Wa(f,u,c)])}(h,f,a)),n.arcs.transformPoints(function(e,t,n){if(n<i.length&&i[n]>0)return o(e,t)})),Wt(p,function(e){var t=o(e[0],e[1]);e[0]=t[0],e[1]=t[1]})};const y_=11102230246251565e-32,v_=134217729,b_=(3+8*y_)*y_;function __(e,t,n,r,i){let a,o,s,u,c=t[0],f=r[0],l=0,h=0;f>c==f>-c?(a=c,c=t[++l]):(a=f,f=r[++h]);let p=0;if(l<e&&h<n)for(f>c==f>-c?(o=c+a,s=a-(o-c),c=t[++l]):(o=f+a,s=a-(o-f),f=r[++h]),a=o,0!==s&&(i[p++]=s);l<e&&h<n;)f>c==f>-c?(o=a+c,u=o-a,s=a-(o-u)+(c-u),c=t[++l]):(o=a+f,u=o-a,s=a-(o-u)+(f-u),f=r[++h]),a=o,0!==s&&(i[p++]=s);for(;l<e;)o=a+c,u=o-a,s=a-(o-u)+(c-u),c=t[++l],a=o,0!==s&&(i[p++]=s);for(;h<n;)o=a+f,u=o-a,s=a-(o-u)+(f-u),f=r[++h],a=o,0!==s&&(i[p++]=s);return 0===a&&0!==p||(i[p++]=a),p}function x_(e){return new Float64Array(e)}const w_=x_(4),S_=x_(8),A_=x_(12),E_=x_(16),M_=x_(4);function I_(e,t,n,r,i,a){const o=(t-a)*(n-i),s=(e-i)*(r-a),u=o-s,c=Math.abs(o+s);return Math.abs(u)>=33306690738754716e-32*c?u:-function(e,t,n,r,i,a,o){let s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A;const E=e-i,M=n-i,I=t-a,k=r-a;_=E*k,h=v_*E,p=h-(h-E),d=E-p,h=v_*k,g=h-(h-k),m=k-g,x=d*m-(_-p*g-d*g-p*m),w=I*M,h=v_*I,p=h-(h-I),d=I-p,h=v_*M,g=h-(h-M),m=M-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,w_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,w_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,w_[2]=v-(A-l)+(y-l),w_[3]=A;let C=function(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}(4,w_),P=22204460492503146e-32*o;if(C>=P||-C>=P)return C;if(l=e-E,s=e-(E+l)+(l-i),l=n-M,c=n-(M+l)+(l-i),l=t-I,u=t-(I+l)+(l-a),l=r-k,f=r-(k+l)+(l-a),0===s&&0===u&&0===c&&0===f)return C;if(P=11093356479670487e-47*o+b_*Math.abs(C),C+=E*f+k*s-(I*c+M*u),C>=P||-C>=P)return C;_=s*k,h=v_*s,p=h-(h-s),d=s-p,h=v_*k,g=h-(h-k),m=k-g,x=d*m-(_-p*g-d*g-p*m),w=u*M,h=v_*u,p=h-(h-u),d=u-p,h=v_*M,g=h-(h-M),m=M-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const O=__(4,w_,4,M_,S_);_=E*f,h=v_*E,p=h-(h-E),d=E-p,h=v_*f,g=h-(h-f),m=f-g,x=d*m-(_-p*g-d*g-p*m),w=I*c,h=v_*I,p=h-(h-I),d=I-p,h=v_*c,g=h-(h-c),m=c-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const N=__(O,S_,4,M_,A_);_=s*f,h=v_*s,p=h-(h-s),d=s-p,h=v_*f,g=h-(h-f),m=f-g,x=d*m-(_-p*g-d*g-p*m),w=u*c,h=v_*u,p=h-(h-u),d=u-p,h=v_*c,g=h-(h-c),m=c-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const T=__(N,A_,4,M_,E_);return E_[T-1]}(e,t,n,r,i,a,c)}const k_=Math.pow(2,-52),C_=new Uint32Array(512);class P_{static from(e,t=R_,n=D_){const r=e.length,i=new Float64Array(2*r);for(let a=0;a<r;a++){const r=e[a];i[2*a]=t(r),i[2*a+1]=n(r)}return new P_(i)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1;let o=1/0,s=1/0,u=-1/0,c=-1/0;for(let t=0;t<a;t++){const n=e[2*t],r=e[2*t+1];n<o&&(o=n),r<s&&(s=r),n>u&&(u=n),r>c&&(c=r),this._ids[t]=t}const f=(o+u)/2,l=(s+c)/2;let h,p,d,g=1/0;for(let t=0;t<a;t++){const n=O_(f,l,e[2*t],e[2*t+1]);n<g&&(h=t,g=n)}const m=e[2*h],y=e[2*h+1];g=1/0;for(let t=0;t<a;t++){if(t===h)continue;const n=O_(m,y,e[2*t],e[2*t+1]);n<g&&n>0&&(p=t,g=n)}let v=e[2*p],b=e[2*p+1],_=1/0;for(let t=0;t<a;t++){if(t===h||t===p)continue;const n=T_(m,y,v,b,e[2*t],e[2*t+1]);n<_&&(d=t,_=n)}let x=e[2*d],w=e[2*d+1];if(_===1/0){for(let t=0;t<a;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];L_(this._ids,this._dists,0,a-1);const t=new Uint32Array(a);let n=0;for(let e=0,r=-1/0;e<a;e++){const i=this._ids[e];this._dists[i]>r&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(I_(m,y,v,b,x,w)<0){const e=p,t=v,n=b;p=d,v=x,b=w,d=e,x=t,w=n}const S=function(e,t,n,r,i,a){const o=n-e,s=r-t,u=i-e,c=a-t,f=o*o+s*s,l=u*u+c*c,h=.5/(o*c-s*u),p=e+(c*f-s*l)*h;return{x:p,y:t+(o*l-u*f)*h}}(m,y,v,b,x,w);this._cx=S.x,this._cy=S.y;for(let t=0;t<a;t++)this._dists[t]=O_(e[2*t],e[2*t+1],S.x,S.y);L_(this._ids,this._dists,0,a-1),this._hullStart=h;let A=3;n[h]=t[d]=p,n[p]=t[h]=d,n[d]=t[p]=h,r[h]=0,r[p]=1,r[d]=2,i.fill(-1),i[this._hashKey(m,y)]=h,i[this._hashKey(v,b)]=p,i[this._hashKey(x,w)]=d,this.trianglesLen=0,this._addTriangle(h,p,d,-1,-1,-1);for(let a,o,s=0;s<this._ids.length;s++){const u=this._ids[s],c=e[2*u],f=e[2*u+1];if(s>0&&Math.abs(c-a)<=k_&&Math.abs(f-o)<=k_)continue;if(a=c,o=f,u===h||u===p||u===d)continue;let l=0;for(let e=0,t=this._hashKey(c,f);e<this._hashSize&&(l=i[(t+e)%this._hashSize],-1===l||l===n[l]);e++);l=t[l];let g,m=l;for(;g=n[m],I_(c,f,e[2*m],e[2*m+1],e[2*g],e[2*g+1])>=0;)if(m=g,m===l){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,u,n[m],-1,-1,r[m]);r[u]=this._legalize(y+2),r[m]=y,A++;let v=n[m];for(;g=n[v],I_(c,f,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(v,u,g,r[u],-1,r[v]),r[u]=this._legalize(y+2),n[v]=v,A--,v=g;if(m===l)for(;g=t[m],I_(c,f,e[2*g],e[2*g+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(g,u,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,A--,m=g;this._hullStart=t[u]=m,n[m]=t[v]=u,n[u]=v,i[this._hashKey(c,f)]=u,i[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(A);for(let e=0,t=this._hullStart;e<A;e++)this.hull[e]=t,t=n[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[e],s=e-e%3;if(a=s+(e+2)%3,-1===o){if(0===i)break;e=C_[--i];continue}const u=o-o%3,c=s+(e+1)%3,f=u+(o+2)%3,l=t[a],h=t[e],p=t[c],d=t[f];if(N_(r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1],r[2*d],r[2*d+1])){t[e]=d,t[o]=l;const r=n[f];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===f){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(o,n[a]),this._link(a,f);const s=u+(o+1)%3;i<C_.length&&(C_[i++]=s)}else{if(0===i)break;e=C_[--i]}}return a}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,i,a){const o=this.trianglesLen;return this._triangles[o]=e,this._triangles[o+1]=t,this._triangles[o+2]=n,this._link(o,r),this._link(o+1,i),this._link(o+2,a),this.trianglesLen+=3,o}}function O_(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}function N_(e,t,n,r,i,a,o,s){const u=e-o,c=t-s,f=n-o,l=r-s,h=i-o,p=a-s,d=f*f+l*l,g=h*h+p*p;return u*(l*g-d*p)-c*(f*g-d*h)+(u*u+c*c)*(f*p-l*h)<0}function T_(e,t,n,r,i,a){const o=n-e,s=r-t,u=i-e,c=a-t,f=o*o+s*s,l=u*u+c*c,h=.5/(o*c-s*u),p=(c*f-s*l)*h,d=(o*l-u*f)*h;return p*p+d*d}function L_(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=e[i],a=t[r];let o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+1,a=r;z_(e,n+r>>1,i),t[e[n]]>t[e[r]]&&z_(e,n,r),t[e[i]]>t[e[r]]&&z_(e,i,r),t[e[n]]>t[e[i]]&&z_(e,n,i);const o=e[i],s=t[o];for(;;){do{i++}while(t[e[i]]<s);do{a--}while(t[e[a]]>s);if(a<i)break;z_(e,i,a)}e[n+1]=e[a],e[a]=o,r-i+1>=a-n?(L_(e,t,i,r),L_(e,t,n,a-1)):(L_(e,t,n,a-1),L_(e,t,i,r))}}function z_(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function R_(e){return e[0]}function D_(e){return e[1]}function j_(e,t){return Ta(e)?function(e){return function(t,n){return gn(t[0],t[1],n[0],n[1])<=e}}(t):function(e){return function(t,n){return cn(t[0],t[1],n[0],n[1])<=e}}(t)}function F_(e){var t=1e-4,n=e[0],r=e[1];return[[[n,r],[n,r+t],[n+t,r+t],[n+t,r],[n,r]]]}function U_(e){var t=Fp(e);return function(n){var r=[];return Cr(n,function(n){for(var i,a=t(n),o=0;o<a.length;o++)i=a[o],fr.getPlanarPathArea(i,e.arcs)<0&&(i=mr(i)),r.push(i)}),r.length>0?r:null}}function B_(e,t){var n=U_(t);e.shapes=e.shapes.map(function(e){return n(e)})}function G_(e,t){var n=Fp(t);e.shapes=e.shapes.map(function(e,r){return function(e){var r=[];return Cr(e,function(e){var i=n(e);if(0===i.length)vt("[cleanPolygon()] Defective path:",e);else if(1==i.length)r.push(i[0]);else{var a,o=fr.getPlanarPathArea(e,t.arcs)>0?1:-1;i.reduce(function(e,n,r){var i=fr.getPlanarPathArea(n,t.arcs)*o;return i>e&&(a=n,e=i),e},0),a&&r.push(a)}}),r.length>0?r:null}(e)})}pp.alphaShapes=function(e,t,n){Ti(e),n.interval>0==!1&&bt("Expected a non-negative interval parameter");var r=function(e,t,n){var r=function(e,t,n){for(var r,i,a,o,s,u,c=Jt(e),f=P_.from(c),l=n.keep_points?new Uint8Array(c.length):null,h=f.triangles,p={type:"MultiPolygon",coordinates:[]},d=0,g=h.length;d<g;d+=3)o=h[d],s=h[d+1],u=h[d+2],r=c[o],i=c[s],a=c[u],t(r,i)&&t(i,a)&&t(r,a)&&(p.coordinates.push([[a,i,r,a]]),l&&(l[o]=1,l[s]=1,l[u]=1));l&&function(e,t,n){for(var r=0,i=n.length;r<i;r++)0===n[r]&&e.coordinates.push(F_(t[r]))}(p,c,l);return Kv(p)}(e,t,n);Ka(r),n.debug||vd(r.layers,r,{quiet:!0});return r}(e,j_(t,n.interval),n),i=io([t,r]),a=i.layers.pop();return t.arcs=i.arcs,Ui(a,e,null,n),a};var q_=Object.freeze({__proto__:null,getPolygonRewinder:U_,repairPolygonGeometry:function(e,t,n){var r=Vp(t);return e.forEach(function(e){G_(e,r)}),e},repairSelfIntersections:G_,rewindPolygonParts:B_});function V_(e,t){return rh(e).value&&ah(e,t)||null}function $_(e,t,n){n.radius||bt("Missing expected radius parameter");var r=n.units||"",i=Ia(t),a=V_(n.radius+r,i);if(a)return function(){return a};var o=ap(n.radius,e,null);return function(e){var t=o(e);return t&&V_(t+r,i)||0}}function J_(e,t,n,r){return i=e[0],a=e[1],o=t[0],s=t[1],u=n[0],c=n[1],f=r[0],l=r[1],i<u&&i<f&&o<u&&o<f||i>u&&i>f&&o>u&&o>f||a<c&&a<l&&s<c&&s<l||a>c&&a>l&&s>c&&s>l?null:Qn(i,a,o,s,u,c,f,l);var i,a,o,s,u,c,f,l}function W_(e,t){var n,r,i,a={},o=[],s=t.backtrack>=0?t.backtrack:100,u=0;function c(){n=[],r=[],i=[],u=0}return c(),a.size=function(){return r.length+n.length},a.getDebugPoints=function(){var e=o;return o=[],e},a.addPathVertex=function(e){r.push(e)},a.addBufferVertices=function(e){for(var t=0;t<e.length;t++)a.addBufferVertex(e[t])},a.addBufferVertex=function(t,r){var a=i.length,o=a-1;if(r)return i.push(!0),void n.push(t);if(-1==o)return n.push(t),void i.push(!1);var c=n[o],f=i[o];if(!function(e,t){return e[0]===t[0]&&e[1]===t[1]}(c,t)){for(var l,h,p,d,g,m=f,y=0,v=a-3;y<s&&v>=u;y++,v--)if(h=n[v],p=n[v+1],(l=e(h,p,c,t))&&(d=i[v],g=i[v+1],!d||!g)){for(;n.length>v+1;)n.pop(),i.pop();n.push(l),i.push(!1),m=!1;break}n.push(t),i.push(m)}},a.done=function(){t.debug_points&&(o=o.concat(n.map((e,t)=>({type:"Feature",geometry:{type:"Point",coordinates:e},properties:{id:t,inside:i[t],fill:i[t]?"magenta":"dodgerblue"}}))));var e=r.reverse().concat(n);return e.length<3&&vt("Defective buffer ring:",e),e.push(e[0]),c(),e},a}var Z_=nn;function Y_(e){Na(e)||vt("Expected an unprojected CRS");var t=e.es/(1+Math.sqrt(e.one_es));return new(s("geographiclib-geodesic").Geodesic.Geodesic)(e.a,t)}function H_(e,t,n,r,i){var a=1-i;return[e*a+n*i,t*a+r*i]}function X_(e){if(!(e&&Na(e)))return H_;var t=Y_(e);return function(e,n,r,i,a){var o=t.Inverse(n,e,i,r),s=o.s12*a,u=t.Direct(n,e,o.azi1,s);return[u.lon2,u.lat2]}}function K_(e,t,n,r){var i=n/180*Math.PI;return[e+Math.sin(i)*r,t+Math.cos(i)*r]}function Q_(e,t,n,r){var i=Math.PI/180,a=Math.cos(t*i),o=2*a*a-1,s=2*a*o-a,u=2*a*s-o,c=1e3*(111.41513*a-.09455*s+12e-5*(2*a*u-s)),f=1e3*(111.13209-.56605*o+.0012*u),l=n*i,h=t+Math.cos(l)*r/f;return[e+Math.sin(l)*r/c,h]}function ex(e,t,n,r){var i=Math.PI/180,a=1/298.257223563,o=a*(2-a),s=Z_*i,u=Math.cos(t*i),c=1/(1-o*(1-u*u)),f=Math.sqrt(c),l=s*f*u,h=s*f*c*(1-o),p=function(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}(n-e)*l,d=(r-t)*h;return Math.atan2(p,d)/i}function tx(e){if(!Na(e))return K_;var t=Y_(e);return function(e,n,r,i){var a=t.Direct(n,e,r,i);return[a.lon2,a.lat2]}}function nx(e){return Na(e)?Q_:K_}function rx(e){return Na(Ia(e))?ex:ix}function ix(e,t,n,r){return 180*fr.bearing2D(e,t,n,r)/Math.PI}var ax=Object.freeze({__proto__:null,bearingDegrees:function(e,t,n,r){return 180*fr.bearing(e,t,n,r)/Math.PI},bearingDegrees2D:ix,getBearingFunction:rx,getFastGeodeticSegmentFunction:nx,getGeodeticSegmentFunction:tx,getInterpolationFunction:X_,getPlanarSegmentEndpoint:K_,interpolatePoint2D:H_});function ox(e,t){var n=nx(Ia(e)),r=J_,i=rx(e),a=t.arc_quality>=2?t.arc_quality:12,o=360/a/4,s=t.cap_style||"round",u=new Ba(e.arcs),c=new W_(r,t);return function(e,n){var r=[];if((e||[]).forEach(function(e,i){var a=function(e,n){var r,i=[];t.right&&!t.left||(i=i.concat(f(e,n)));t.left&&!t.right||(r=mr(e.concat()),i=i.concat(f(r,n)));return i}(e,n);r=r.concat(a)}),0===r.length)return null;var i={type:"Feature",properties:null,geometry:{type:"MultiPolygon",coordinates:r.map(e=>[e])}};return t.debug_points?[i].concat(c.getDebugPoints()):i};function f(e,t){var a,f,p,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P=[],O=0;for(u.init(e),u.hasNext()&&(a=y=u.x,f=v=u.y,c.addPathVertex([a,f]),O++);u.hasNext();)u.x!==y||u.y!==v?(p=y,m=v,y=u.x,v=u.y,c.addPathVertex([y,v]),S=i(p,m,y,v),A=i(y,v,p,m)-180,b=n(p,m,S-90,t),_=n(y,v,A-90,t),1==O?k=S:M=g(E,S),1==O?c.addBufferVertex(b,!1):M>1.5*o?(C=l(p,m,E-90,M,t),c.addBufferVertices(C),b=C.pop()):M>0&&(I=h(x,w,b,_))||M<0&&(I=r(x,w,b,_))?(c.addBufferVertex(I,!1),b=I):0==M?c.addBufferVertex(b,!1):(c.addBufferVertex(w),c.addBufferVertex(b,M<0)),E=A,x=b,w=_,O++):Ct("skipping a duplicate point");return w&&c.addBufferVertex(w),y==a&&v==f?(M=g(A,k))>0&&c.addBufferVertices(function(e,t,r,i,a){var o=d(e,t,r,i,a);return o.push(n(e,t,r+i,a)),o}(y,v,S-90,M,t)):"round"==s&&c.addBufferVertices(function(e,t,r,i){var a=d(e,t,r,180,i);return a.push(n(e,t,r+180,i)),a}(y,v,A-90,t)),P.push(c.done()),P}function l(e,t,i,a,s){for(var u,c,f,l,h,p,d,g=Math.max(1,Math.round(a/o)),m=a/g,y=[],v=0;v<=g;){if(p=n(e,t,d=i+m*v,s),f=n(p[0],p[1],d-90,2*s),l=n(p[0],p[1],d+90,2*s),v>0){if(!(h=r(u,c,f,l)))throw Error(`no intersection on ${v} of ${g}`);y.push(h)}u=f,c=l,v++}return y}function h(e,t,n,i){var a=8192,o=[p(t[0],t[0]-e[0],a),p(t[1],t[1]-e[1],a)],s=[p(n[0],n[0]-i[0],a),p(n[1],n[1]-i[1],a)];return r(e,o,s,i)}function p(e,t,n){return e+t*n}function d(e,t,r,i,o){for(var s=[],u=90/a,c=u;c<i;)s.push(n(e,t,r+c,o)),c+=u;return s}function g(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}}function sx(e,t){var n,r,i,a=nx(Ia(e)),o=rx(e),s=t.slice_length||1/0,u=t.backtrack>=0?t.backtrack:100,c=t.arc_quality>=2?t.arc_quality:12,f=t.cap_style||"round",l=new Ba(e.arcs);return function(e,n){var r=[];return(e||[]).forEach(function(e,i){var a=function(e,n){var r,i=[];t.right&&!t.left||(i=i.concat(h(e,n)));t.left&&!t.right||(r=mr(e.concat()),i=i.concat(h(r,n)));return i}(e,n);r=r.concat(a)}),0===r.length?null:{type:"MultiPolygon",coordinates:r.map(e=>[e])}};function h(e,t){var u,c,h,y,v,b,_,x,w,S,A,E,M,I;n=[],r=[],i=[];var k=0;for(l.init(e),l.hasNext()&&(u=v=l.x,c=b=l.y,k++);l.hasNext();)l.x!==v||l.y!==b?(h=v,y=b,v=l.x,b=l.y,E=A,S=o(h,y,v,b),A=o(v,b,h,y)-180,w=x,_=a(h,y,S-90,t),x=a(v,b,A-90,t),1==k?I=S:M=g(E,S),0==r.length&&r.push([h,y]),r.push([v,b]),k>1&&M>0?(w&&m(w),d(h,y,E-90,M,t).forEach(m),m(_),m(x)):(m(_),m(x)),r.length-1>=s&&p(),k++):Ct("skipping a duplicate point");return r.length>1&&p(),v==u&&b==c?(M=g(A,I))>0&&function(e,t,n,r,i,o){var s=e.pop(),u=d(t,n,r,i,o);e.push.apply(e,u),e.push(a(t,n,r+i,o)),e.push(s)}(i[i.length-1],v,b,S-90,M,t):function(e,t,n,r,i){if("flat"==f||e.length<4)return;var o=e.pop(),s=function(e,t,n,r){var i=d(e,t,n,180,r);return i.push(a(e,t,n+180,r)),i}(t,n,r-90,i);e.push.apply(e,s),e.push(o)}(i[i.length-1],v,b,A,t),i}function p(){if(r.length<2)Ct("defective path, skipping");else{var e=r.reverse().concat(n);e.push(e[0]),n=[],r=[],i.push(e)}}function d(e,t,n,r,i){for(var o=[],s=90/c,u=s;u<r;)o.push(a(e,t,n+u,i)),u+=s;return o}function g(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}function m(e){var t,r,i,a,o=n;i=o[o.length-1];for(var s=0,c=o.length-3;s<u&&c>=0;s++,c--)if(t=o[c],r=o[c+1],a=cx(t[0],t[1],r[0],r[1],i[0],i[1],e[0],e[1])){for(;o.length>c+1;)o.pop();ux(o,a),i=a}ux(o,e)}}function ux(e,t){var n,r,i,a,o,s=e[e.length-1];s&&(n=s[0],r=s[1],i=t[0],a=t[1],o=1e-10,fr.distance2D(n,r,i,a)<o)||e.push(t)}function cx(e,t,n,r,i,a,o,s){return e<i&&e<o&&n<i&&n<o||e>i&&e>o&&n>i&&n>o||t<a&&t<s&&r<a&&r<s||t>a&&t>s&&r>a&&r>s?null:fr.segmentIntersection(e,t,n,r,i,a,o,s)}function fx(e,t){var n=nx(Ia(e)),r=rx(e),i=function(e,t,n,r){var i=r.backtrack>=0?r.backtrack:50,a=new Ba(e),o=r.cap_style||"round";function s(e,n,r,a,o,s){for(var u=10,c=a+o,f=a+u;f<c;)d(e,t(n,r,f,s),i),f+=u}function u(e,t,n,r,i){return fr.distance2D(e,t,n,r)<i}function c(e,t,n){var r=e[e.length-1];return u(r[0],r[1],t,n,1e-6)}function f(e,t){var n=e[e.length-1];u(n[0],n[1],t[0],t[1],1e-10)||e.push(t)}function l(e,t,n,r){return"flat"==o?[[e,t]]:h(e,t,n,r)}function h(e,n,r,i){for(var a=[],o=10,s=r-90,u=o;u<180;)a.push(t(e,n,s+u,i)),u+=o;return a}function p(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}function d(e,t,n){for(var r,i,a,o,s=0,u=e.length-3;s<n&&u>=0;s++,u--)if(a=e[e.length-1],r=e[u],i=e[u+1],o=lx(r[0],r[1],i[0],i[1],a[0],a[1],t[0],t[1])){for(;e.length>u+1;)e.pop();f(e,o)}f(e,t)}return function(e,r){var o,u,f,h,g,m,y,v,b,_,x,w,S=[],A=0;for(a.init(e);a.hasNext();)a.x===g&&a.y===m||(f=g,h=m,g=a.x,m=a.y,A>=1&&(_=b,b=n(f,h,g,m),y=t(f,h,b-90,r),v=t(g,m,b-90,r)),1==A&&(x=b,o=f,u=h,S.push(y,v)),A>1&&(w=p(_,b),c(S,y[0],y[1])?d(S,v,i):w>0?(s(S,f,h,_-90,w,r),d(S,y,i),d(S,v,i)):(d(S,y,i),d(S,v,i))),A++);return g==o&&m==u?(w=p(b,x))>0&&s(S,g,m,b-90,w,r):S.push.apply(S,l(g,m,b,r)),S}}(e.arcs,n,r,t),a=t.geometry_type,o="polyline"==t.output_geometry?"polyline":"polygon";function s(e,t){var n,r=i(e,t);return"polyline"==a&&(n=mr(e.concat()),r=r.concat(i(n,t))),r.push(r[0]),"polyline"==o?r:[r]}return function(e,t){for(var n={type:"polyline"==o?"MultiLineString":"MultiPolygon",coordinates:[]},r=0;r<e.length;r++)n.coordinates.push(s(e[r],t));return 0==n.coordinates.length?null:n}}function lx(e,t,n,r,i,a,o,s){return e<i&&e<o&&n<i&&n<o||e>i&&e>o&&n>i&&n>o||t<a&&t<s&&r<a&&r<s||t>a&&t>s&&r>a&&r>s?null:fr.segmentIntersection(e,t,n,r,i,a,o,s)}function hx(e,t,n){Pt("buffer");var r=Kv(px(e,t,n),{});return n.debug_points||function(e,t){var n,r=t||{},i=e.layers[0];if(!r.debug_offset){var a=new fd(i,Vp(e,{rebuild_topology:!0}),{flat:!1,no_holes:!1});if(i.shapes=i.shapes.map(function(e,t){var n=a.getTilesByShapeIds([t]);return n.length?n.reduce(function(e,t){return e.concat(t)},[]):null}),!r.debug_winding){if(r.debug_mosaic)return n=dd(i,a.mosaic),i.shapes=n.shapes,void(i.data=n.data);var o=wl(a.nodes),s=i.shapes.map(function(e,t){for(var n=a.getTilesByShapeIds([t]),r=[],i=0;i<n.length;i++)r.push(n[i][0]);return o(r,"dissolve")});i.shapes=s,r.no_dissolve||ho(e)}}}(r,n),Ot("buffer"),r}function px(e,t,n){var r=$_(e,t,n),i=Object.assign({geometry_type:e.geometry_type},n),a=n.v2&&sx(t,i)||n.v3&&ox(t,i)||fx(t,i),o=e.shapes.reduce(function(e,t,n){var i=r(n);if(!i||!t)return e;var o=a(t,i);return e.concat(o)},[]),s=o?.[0].type;return"Feature"==s?{type:"FeatureCollection",features:o}:{type:"GeometryCollection",geometries:o}}function dx(e,t,n){var r=Kv(px(e,t,n),{});return function(e){var t,n={},r=e.layers[0];if(!n.debug_offset){var i=Vp(e,{rebuild_topology:!0});if(n.debug_winding)B_(r,i);else{B_(r,i);var a=new fd(r,i,{flat:!1,no_holes:!1});if(n.debug_mosaic)return t=dd(r,a.mosaic),r.shapes=t.shapes,void(r.data=t.data);var o=wl(a.nodes),s=r.shapes.map(function(e,t){for(var n=a.getTilesByShapeIds([t]),r=[],i=0;i<n.length;i++)r.push(n[i][0]);return o(r,"dissolve")});r.shapes=s,n.no_dissolve||ho(e)}}}(r),r}var gx=1e-10,mx=90-gx,yx=-180+gx,vx=-90+gx,bx=180-gx;function _x(e){return e[e.length-1]}function xx(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}function wx(e){return xx(e[0],_x(e))}function Sx(e){e[0]<=yx&&(e[0]=-180),e[0]>=bx&&(e[0]=180),e[1]<=vx&&(e[1]=-90),e[1]>=mx&&(e[1]=90)}function Ax(e){return e[1]>=mx||e[1]<=vx}function Ex(e,t){return Ax(e)||Ax(t)||e[0]<=yx&&t[0]<=yx||e[0]>=bx&&t[0]>=bx}function Mx(e){return e[1]<=vx||e[1]>=mx||e[0]<=yx||e[0]>=bx}function Ix(e){if(!function(e){for(var t=0,n=e.length;t<n;t++)if(Mx(e[t]))return!0;return!1}(e))return e;var t,n,r,i=[],a=!1;e.pop(),t=e[e.length-1],n=e[0];for(var o=1,s=e.length;o<=s;o++)(r=o==s?i[0]:e[o])&&((a||Ex(t,n))&&Ex(n,r)?a=!0:(!0===a&&(a=!1),i.push(n),t=n),n=r);return i.length>0&&i.push(i[0].concat()),i}function kx(e){return Tx(e)}function Cx(e){return-180==e[0]||180==e[0]}function Px(e){for(var n,r=[],i=[],a=0;a<e.length;a++)wx(n=e[a])||vt("Received an open path"),0===Nx(n)?r.push(n):i=i.concat(Tx(n));return i.length>0&&(r=r.concat(function(e){var n=function(e){var n=e.map(function(e){return e[0][1]});return t.genericSort(n,!0)}(e),r=[],i=[];return e.forEach(function(e,t){if(!i[t]){(function(e){var t=_x(e)[0],n=e[0][0];return!(180!=t&&-180!=t||180!=n&&-180!=n)})(e)||vt("Geometry error");var n=a(e,[]);n&&(wx(n)||vt("Generated an open ring"),r.push(n))}}),r;function a(t,r){var o=_x(t),s=e.indexOf(t);if(i[s])return Ct("Tried to use a previously used path"),null;i[s]=!0,r=r.concat(t);var u=function(e,t,n){var r,i=t[0],a=t[1],o=n.indexOf(a),s=-180==i?180:-180,u=180==i,c=u?o-1:o+1;if(180!=i&&-180!=i)return Ct("Unexpected error"),null;if(-1==o)return Ct("Point missing from intersection table:",t),null;r=c<0||c>=n.length?[s,a]:[i,n[c]];return r}(0,o,n);if(!u)return null;if(o[0]!=u[0]){var c=180==o[0]?-90:90;r.push([o[0],c],[0,c],[u[0],c])}var f=function(e,t){for(var n=0;n<e.length;n++)if(xx(e[n][0],t))return e[n];return null}(e,u);return f?xx(r[0],f[0])?(r.push(r[0]),r):a(f,r):null}}(i))),r}function Ox(e,t){t.length>1&&e.push(t)}function Nx(e){for(var t,n,r=0,i=0,a=e.length;i<a;i++)n=e[i],i>0&&Math.abs(t[0]-n[0])>180&&r++,t=n;return r}function Tx(e){for(var t,n,r,i=[],a=[],o=e[0],s=xx(o,_x(e)),u=0,c=e.length;u<c;u++)t=e[u],u>0&&Lx(n,t)&&(zx(a,n,r=Rx(n,t)),Ox(i,a),zx(a=[],t,r)),a.push(t),n=t;return Ox(i,a),s&&i.length>1&&!Cx(o)&&((a=i.pop()).pop(),i[0]=a.concat(i[0])),i}function Lx(e,t){return Math.abs(e[0]-t[0])>180}function zx(e,t,n){var r=t[0]<0?-180:180;Cx(t)||e.push([r,n])}function Rx(e,t){var n,r;return t[0]-e[0]>0?(n=e[0]+180,r=180-t[0]):(n=180-e[0],r=t[0]+180),0===n?e[1]:0===r?t[1]:(r*e[1]+n*t[1])/(n+r)}function Dx(e){return zn(new ja(e))}function jx(e,t,n){var r=function(e,t,n){var r=n.vertices||72,i=$_(e,t,n),a=Ia(t),o=Na(a),s=tx(a),u=e.shapes.map(function(e,t){var n=i(t);return n&&e?Ux(e,n,r,s,o):null});return{type:"GeometryCollection",geometries:u}}(e,t,n);return Kv(r,{})}function Fx(e,t,n,r){var i=tx(Sa("wgs84"));return r.inset&&(t-=r.inset),"polyline"==r.geometry_type?function(e,t,n,r){var i,a=[];if(!e||!e.length)return null;for(var o=0;o<e.length;o++)for(i=kx(i=Bx(e[o],t,n,r));i.length>0;)a.push(i.pop());return 1==a.length?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a}}([e],t,360,i):Ux([e],t,360,i,!0)}function Ux(e,t,n,r,i){var a,o,s=[];if(!e||!e.length)return null;for(var u=0;u<e.length;u++)if(a=Bx(e[u],t,n,r),i)if(Nx(a)>0)for(o=Px([a]);o.length>0;)s.push([o.pop()]);else Dx(a)<0?s.push([[[180,90],[180,-90],[0,-90],[-180,-90],[-180,90],[0,90],[180,90]],a]):s.push([a]);else s.push([a]);return{type:"MultiPolygon",coordinates:s}}function Bx(e,t,n,r){for(var i,a=[],o=360/n,s=0;s<n;s++)i=(s+.5)*o%360,a.push(r(e[0],e[1],i,t));return a.push(a[0].concat()),a}pp.buffer=function(e,t,n){var r;"point"==e.geometry_type?r=jx(e,t,n):"polyline"==e.geometry_type?r=hx(e,t,n):"polygon"==e.geometry_type?r=dx(e,t,n):bt("Unsupported geometry type");return Oo(e,t,r,n)},pp.checkGeometry=function(e,t,n){if(t.arcs){var r=Il(t.arcs);r.length>0&&function(e,t){var n=t.strict?bt:xt;n(e)}(`Found ${r.length} intersection${r.length>1?"s":""}.`,n)}};var Gx=[10,12,15,18,20,22,25,30,35,40,45,50,60,70,80,90,100],qx=[10,2,5,2,10,2,5,10,5,10,5,50,10,10,10,10,10];function Vx(e){var t=Gx.indexOf(e);return qx[t]||vt("Unknown error")}function $x(e,t){return(t>=50?1:t>=10&&.9)||t>=5&&.8||.7}function Jx(e,n){var r=NS(e,n),i=function(e,t,n){var r=[],i=Math.max(Math.abs(e),Math.abs(t)),a=n>=2?(t-e)/(n-1):i,o=function(e){var t=1;e>1e-4!=!1&&e<1e9!=!1||bt("Data range error");for(;e>100;)e/=10,t/=10;for(;e<10;)e*=10,t*=10;return t}(a),s=Hx(o*a);return s.forEach(function(t){var i=Vx(t),a=Zx(t,o),s=Zx(i,o),u=function(e,t){var n=Vl(t)(e),r=n+(e>n?t:-t),i=n<r?[n,r]:[r,n];return i}(e,s);u.forEach(function(e){r.push({interval:a,precision:s,roundness:$x(0,i),breaks:Yx(e,a,n)})})}),r}(r[0],r[r.length-1],n);return i.forEach(function(n){var r,i,a,o;TS(n.breaks,e),n.distribution=TS(n.breaks,e),n.quality=n.roundness*(r=n.distribution,i=t.sum(r)/r.length,a=r[0],o=r[r.length-1],(Wx(i,a)+Wx(i,o))/2)}),t.sortOn(i,"quality",!1),i[0].breaks}function Wx(e,t){return t>e?e/t:e/(2*e-t)}function Zx(e,t){return t<1?e*Math.round(1/t):e/t}function Yx(e,t,n){for(var r=[e],i=1;i<n;i++)r.push(e+t*i);return r}function Hx(e){for(var t,n,r=Gx,i=1;i<r.length;i++)if(t=r[i-1],n=r[i],e>=t&&e<=n)return[t,n];vt("Range error")}function Xx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Kx(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Qx(){}var ew=.7,tw=1/ew,nw="\\s*([+-]?\\d+)\\s*",rw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",iw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aw=/^#([0-9a-f]{3,8})$/,ow=new RegExp(`^rgb\\(${nw},${nw},${nw}\\)$`),sw=new RegExp(`^rgb\\(${iw},${iw},${iw}\\)$`),uw=new RegExp(`^rgba\\(${nw},${nw},${nw},${rw}\\)$`),cw=new RegExp(`^rgba\\(${iw},${iw},${iw},${rw}\\)$`),fw=new RegExp(`^hsl\\(${rw},${iw},${iw}\\)$`),lw=new RegExp(`^hsla\\(${rw},${iw},${iw},${rw}\\)$`),hw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pw(){return this.rgb().formatHex()}function dw(){return this.rgb().formatRgb()}function gw(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=aw.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?mw(t):3===n?new _w(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?yw(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?yw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ow.exec(e))?new _w(t[1],t[2],t[3],1):(t=sw.exec(e))?new _w(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=uw.exec(e))?yw(t[1],t[2],t[3],t[4]):(t=cw.exec(e))?yw(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=fw.exec(e))?Mw(t[1],t[2]/100,t[3]/100,1):(t=lw.exec(e))?Mw(t[1],t[2]/100,t[3]/100,t[4]):hw.hasOwnProperty(e)?mw(hw[e]):"transparent"===e?new _w(NaN,NaN,NaN,0):null}function mw(e){return new _w(e>>16&255,e>>8&255,255&e,1)}function yw(e,t,n,r){return r<=0&&(e=t=n=NaN),new _w(e,t,n,r)}function vw(e){return e instanceof Qx||(e=gw(e)),e?new _w((e=e.rgb()).r,e.g,e.b,e.opacity):new _w}function bw(e,t,n,r){return 1===arguments.length?vw(e):new _w(e,t,n,null==r?1:r)}function _w(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function xw(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}`}function ww(){const e=Sw(this.opacity);return`${1===e?"rgb(":"rgba("}${Aw(this.r)}, ${Aw(this.g)}, ${Aw(this.b)}${1===e?")":`, ${e})`}`}function Sw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Aw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ew(e){return((e=Aw(e))<16?"0":"")+e.toString(16)}function Mw(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new kw(e,t,n,r)}function Iw(e){if(e instanceof kw)return new kw(e.h,e.s,e.l,e.opacity);if(e instanceof Qx||(e=gw(e)),!e)return new kw;if(e instanceof kw)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new kw(o,s,u,e.opacity)}function kw(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Cw(e){return(e=(e||0)%360)<0?e+360:e}function Pw(e){return Math.max(0,Math.min(1,e||0))}function Ow(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Xx(Qx,gw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pw,formatHex:pw,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Iw(this).formatHsl()},formatRgb:dw,toString:dw}),Xx(_w,bw,Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new _w(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new _w(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _w(Aw(this.r),Aw(this.g),Aw(this.b),Sw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xw,formatHex:xw,formatHex8:function(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}${Ew(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ww,toString:ww})),Xx(kw,function(e,t,n,r){return 1===arguments.length?Iw(e):new kw(e,t,n,null==r?1:r)},Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new kw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new kw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new _w(Ow(e>=240?e-240:e+120,i,r),Ow(e,i,r),Ow(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new kw(Cw(this.h),Pw(this.s),Pw(this.l),Sw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Sw(this.opacity);return`${1===e?"hsl(":"hsla("}${Cw(this.h)}, ${100*Pw(this.s)}%, ${100*Pw(this.l)}%${1===e?")":`, ${e})`}`}}));const Nw=Math.PI/180,Tw=180/Math.PI;var Lw=-.14861,zw=1.78277,Rw=-.29227,Dw=-.90649,jw=1.97294,Fw=jw*Dw,Uw=jw*zw,Bw=zw*Rw-Dw*Lw;function Gw(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof qw)return new qw(e.h,e.s,e.l,e.opacity);e instanceof _w||(e=vw(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Bw*r+Fw*t-Uw*n)/(Bw+Fw-Uw),a=r-i,o=(jw*(n-i)-Rw*a)/Dw,s=Math.sqrt(o*o+a*a)/(jw*i*(1-i)),u=s?Math.atan2(o,a)*Tw-120:NaN;return new qw(u<0?u+360:u,s,i,e.opacity)}(e):new qw(e,t,n,null==r?1:r)}function qw(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xx(qw,Gw,Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new qw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new qw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Nw,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new _w(255*(t+n*(Lw*r+zw*i)),255*(t+n*(Rw*r+Dw*i)),255*(t+n*(jw*r)),this.opacity)}}));var Vw=e=>()=>e;function $w(e,t){return function(n){return e+n*t}}function Jw(e){return 1===(e=+e)?Ww:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Vw(isNaN(t)?n:t)}}function Ww(e,t){var n=t-e;return n?$w(e,n):Vw(isNaN(e)?t:e)}var Zw=function e(t){var n=Jw(t);function r(e,t){var r=n((e=bw(e)).r,(t=bw(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Ww(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);var Yw,Hw=(Yw=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return function(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}((n-r/t)*t,o,i,a,s)}},function(e){var t,n,r=e.length,i=new Array(r),a=new Array(r),o=new Array(r);for(t=0;t<r;++t)n=bw(e[t]),i[t]=n.r||0,a[t]=n.g||0,o[t]=n.b||0;return i=Yw(i),a=Yw(a),o=Yw(o),n.opacity=1,function(e){return n.r=i(e),n.g=a(e),n.b=o(e),n+""}});function Xw(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function Kw(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=aS(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}function Qw(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function eS(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function tS(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=aS(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}var nS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rS=new RegExp(nS.source,"g");function iS(e,t){var n,r,i,a=nS.lastIndex=rS.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(n=nS.exec(e))&&(r=rS.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,u.push({i:o,x:eS(n,r)})),a=rS.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var n,r=0;r<t;++r)s[(n=u[r]).i]=n.x(e);return s.join("")})}function aS(e,t){var n,r=typeof t;return null==t||"boolean"===r?Vw(t):("number"===r?eS:"string"===r?(n=gw(t))?(t=n,Zw):iS:t instanceof gw?Zw:t instanceof Date?Qw:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?Xw:Array.isArray(t)?Kw:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?tS:eS)(e,t)}function oS(e){return function t(n){function r(t,r){var i=e((t=Gw(t)).h,(r=Gw(r)).h),a=Ww(t.s,r.s),o=Ww(t.l,r.l),s=Ww(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,r.gamma=t,r}(1)}oS(function(e,t){var n=t-e;return n?$w(e,n>180||n<-180?n-360*Math.round(n/360):n):Vw(isNaN(e)?t:e)});var sS=oS(Ww);function uS(e,t){for(var n,r=cS(e,null),i=e.length,a=function(e){var t=e[0]/100,n=e[1]/100;return 2!=e.length&&bt("Only two stops are currently supported"),t>=0&&n<=1&&t<n||bt("Invalid gradient stops:",e),function(e){return e*(n-t)+t}}(t),o=[],s=0;s<i;s++)n=r(a(s/(i-1))*(i-1)),o.push(n);return o}function cS(e,t){for(var n=[],r=e.length-1,i=1;i<e.length;i++)n.push(aS(e[i-1],e[i]));return function(e){if(-1==e)return t;!1==(e>=0&&e<=r)&&vt("Range error");var i=e==r?r-1:Math.floor(e),a=e==r?1:e%1;return n[i](a)}}function fS(e,t,n){var r=e.length;return function(i){return i>=0&&i<r?e[i]:-2==i?void 0===n?t:n:t}}function lS(e,t,n){return n.continuous?cS(e,t):fS(e,t,n.other)}function hS(e,t){return{width:t.key_width||"dataviz"==e&&500||300,tileHeight:t.key_tile_height||10,labelSuffix:t.key_label_suffix||"",lastSuffix:t.key_last_suffix||"",chartHeight:90,chartColor:"#ddd",ticColor:"rgba(0,0,0,0.3)",ticLen:t.key_tic_length>=0?+t.key_tic_length:6,fontFamily:"sans-serif",fontSize:t.key_font_size||13,textColor:"#555"}}function pS(e,t,n,r,i){var a,o,s,u=hS("simple",i),c=function(e,t,n){for(var r=[],i=0;i<n.length;i++)r.push(IS(i*e,0,e,t,n[i]));return AS(r)}(u.width/e.length,u.tileHeight,e),f=[c];e.length==t.length+1?(a=wS(t,s=vS(t.length,u.width),0,u.width,u),o=bS(s,0,u.width,u),f.push(o,a)):e.length==t.length+2&&(u.ticLen=2,a=function(e,t){var n,r=[],i=yS(e,t);_S(t);for(var a=0;a<i.length;a++)n=(a+.5)*t.width/i.length,r.push(ES(i[a],n,t));return AS(r)}(xS(t,n,r),u),f.push(a)),SS(i.key_name||"simple-key",f,u.width)}function dS(e,t,n,r){var i=hS("dataviz",r),a=n[0],o=n[n.length-1],s=xS(t,a,o),u=function(e,t){for(var n,r,i=5,a=Math.floor(t.width/i),o=TS(OS(e,a-1),e),s=Math.max.apply(o,o),u=[],c=t.tileHeight,f=0;f<a;f++)(n=o[f])&&(r=n/s*t.chartHeight,u.push(IS(f*i,c,i,r,t.chartColor)));return AS(u)}(n,i),c=function(e,t,n,r,i){for(var a,o,s=xS(t,n,r),u=mS(i.width,n,r),c=[],f=0;f<s.length;f++)a=u(s[f]),o=u(s[f+1])-a,c.push(IS(a,0,o,i.tileHeight,e[f]));return AS(c)}(e,t,a,o,i),f=wS(s,s,a,o,i),l=bS(s,a,o,i);SS(r.key_name||"dataviz-key",[u,c,l,f],i.width)}function gS(e,t,n,r,i){var a=hS("gradient",i),o=function(e,t,n){for(var r=[],i=function(e,t){var n=e.length-1,r=t/n;return function(t){var i=Math.min(Math.floor(t/r),n-1),a=(t-i*r)/r;return e[i]*(1-a)+e[i+1]*a}}(t,n.width),a=2,o=0;o<n.width;o+=a)r.push(IS(o,0,a,n.tileHeight,e(i(o))));return AS(r)}(e,xS(t,n,r),a),s=vS(t.length,a.width),u=wS(t,s,0,a.width,a),c=[o,bS(s,0,a.width,a),u];SS(i.key_name||"gradient-key",c,a.width)}function mS(e,t,n){return function(r){return(r-t)/(n-t)*e}}function yS(e,t){var n=function(e){var t=e[0],n=e[e.length-1],r=(n-t)/e.length,i=0;r<1?i=2:r<10&&(i=1);return i}(e);return e.map(function(r,i){var a=i==e.length-1&&t.lastSuffix||t.labelSuffix||"";return Bl(r,n)+a})}function vS(e,t){for(var n=[],r=0;r<e;r++)n.push((r+1)/(e+1)*t);return n}function bS(e,t,n,r){for(var i=mS(r.width,t,n),a=[],o=0;o<e.length;o++)a.push(MS(i(e[o]),r));return AS(a)}function _S(e){return e.labelSuffix?3:0}function xS(e,t,n){return[t].concat(e,n)}function wS(e,t,n,r,i){for(var a=yS(e,i),o=mS(i.width,n,r),s=[],u=0;u<t.length;u++)s.push(ES(a[u],o(t[u]),i));return AS(s)}function SS(e,t,n){var r={width:n,crisp_paths:!0,default_linecap:"butt"},i=e+(e.endsWith(".svg")?"":".svg"),a=bm(1==t.length?t[0]:io(t),r);a[0].filename=i,zf(a,{})}function AS(e){return Kv({type:"FeatureCollection",features:e})}function ES(e,t,n){var r,i=-(n.ticLen+.7*n.fontSize+4);return t<=0?r="start":t>=n.width?r="end":(r="middle",t+=_S(n)),{type:"Feature",properties:{"label-text":e,"font-family":n.fontFamily,"font-size":n.fontSize,"text-anchor":r,fill:n.textColor},geometry:{type:"Point",coordinates:[t,i]}}}function MS(e,t){var n=t.tileHeight,r=t.tileHeight+t.ticLen;return{type:"Feature",properties:{stroke:t.ticColor},geometry:{type:"LineString",coordinates:[[e,n],[e,n-r]]}}}function IS(e,t,n,r,i){var a=function(e,t,n,r){return[[e,t],[e,t+r],[e+n,t+r],[e+n,t],[e,t]]}(e,t,n,r);return{type:"Feature",properties:{fill:i},geometry:{type:"Polygon",coordinates:[a]}}}function kS(e,n,r,i,a){var o,s,u,c,f=e.length,l=(a.continuous?f-1:f)-1,h=a.precision?Vl(a.precision):null;h&&(r=r.map(h));var p,d=(p=r.filter(t.isFiniteNumber),t.genericSort(p,!0),p);a.outer_breaks&&(d=function(e,t){var n=t[0],r=t[1];r>n==!1&&bt("Invalid data range:",t);var i=e.map(function(e){return e<n&&(e=n),e>r&&(e=r),e});i[0]<n&&i.unshift(n);i[i.length-1]<r&&i.push(r);return i}(d,a.outer_breaks));var g=r.length-d.length,m=d[0],y=d[d.length-1],v=a.outer_breaks?function(e){return e<a.outer_breaks[0]&&(e=a.outer_breaks[0]),e>a.outer_breaks[1]&&(e=a.outer_breaks[1]),e}:null;return a.outer_breaks&&(m=a.outer_breaks[0],y=a.outer_breaks[1]),0===l?o=[]:a.breaks?o=a.breaks:"equal-interval"==i?o=OS(d,l):"quantile"==i?o=NS(d,l):"hybrid"==i?o=function(e,t){var n=NS(e,t);if(t<3)return n;var r=n[0],i=n[n.length-1],a=e.filter(function(e){return e>=r&&e<i}),o=OS(a,t-2),s=[r].concat(o).concat(i);return s}(d,l):"nice"==i?xt("Nice breaks:",o=Jx(d,l)):bt("Unknown classification method:",i),function(e,t,n){var r=TS(t,e),i=function(e,t){for(var n,r,i,a,o=[],s=0,u=0;s<=e.length;s++)(n=CS(t,r=0===s?-1/0:e[s-1],i=s<e.length?e[s]:1/0,u))?(a=[t[n[0]],t[n[1]]],u=n[1]):a=0===s?[i,i]:s<e.length?[r,i]:[r,r],o.push(a);return o}(t,e).map(function(e,t){return[`${e[0]} - ${e[1]}`,`(${r[t]})`]});i.push(["null or non-numeric values",`(${n})`]),xt("Data ranges and (feature counts):\n"+zt(i,["left","right"]))}(d,o,g),u=a.continuous?function(e,n,r){return function(i){var a,o,s=e.length;if(!t.isValidNumber(i)||i<n||i>r)return-1;for(var u=0;u<=s;u++)if(o=u===s?r:e[u],u===s||i<o)return u+(i-(a=0===u?n:e[u-1]))/(o-a);vt("Range error")}}(o,m,y):PS(o,h),c=lS(e,n,a),s=function(e){return v&&(e=v(e)),c(u(e))},a.colors&&(a.key||a.key_style)&&("gradient"==a.key_style&&a.continuous?gS(s,o,m,y,a):"dataviz"==a.key_style?dS(e,o,d,a):(a.key||"simple"==a.key_style)&&pS(e,o,m,y,a)),s}function CS(e,t,n,r){for(var i,a=e.length,o=-1,s=-1;r<a&&!((i=e[r])>=n);)-1==o&&i>=t&&(o=r),s=r,r++;return o>-1&&s>-1?[o,s]:null}function PS(e,n){var r=!1;return function(e){return LS(e,t.genericSort(e.map(parseFloat)))}(e)||(!function(e){return LS(e,t.genericSort(e.map(parseFloat),!1))}(e)?bt("Invalid class breaks:",e.join(",")):(e=e.concat().reverse(),r=!0)),function(t){var i=-1;return Number(t)===t&&(n&&(t=t(n)),i=zS(t,e)),r&&i>-1&&(i=e.length-i),i}}function OS(e,t){var n,r=t+1,i=e[0],a=(e[e.length-1]-i)/r,o=[];for(n=1;n<r;n++)o.push(i+n*a);return o}function NS(e,t){var n,r,i=t+1,a=e.length/i,o=[];for(n=1;n<i;n++)r=Math.floor(n*a),o.push(e[r]);return o}function TS(e,n){var r=t.initializeArray(new Array(e.length+1),0);return n.forEach(function(t){var n=zS(t,e);-1==n?vt("Indexing error"):r[n]++}),r}function LS(e,t){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return e.length==t.length}function zS(e,n){var r=0;if(!t.isValidNumber(e))return-1;for(;r<n.length&&e>=n[r];)r++;return r}function RS(e,t,n){var r=n.categories.reduce((e,t,n)=>(e[t]=n,e),{}),i=fS(e,t,n.other);return function(e){var t;return t=e in r?r[e]:e||0===e?-2:-1,i(t)}}function DS(e,n,r){var i,a=r||{},o=!a.reusable,s=n.size(),u=new Int32Array(s),c=new Int32Array(s);return a.where&&(i=op(a.where,e,n)),t.initializeArray(u,-1),t.initializeArray(c,-1),wr(e.shapes,function(e){var t=Yt(e.arcId),n=e.shapeId,r=u[t];-1==r?u[t]=n:n<r?(c[t]=r,u[t]=n):c[t]=n}),function(e){return function(t){return function(e,t){var n,r=Yt(e),a=u[r],s=c[r];return-1==a||null===(n=t(a,s))||!1===n?null:(o&&(u[r]=-1,c[r]=-1),i&&!i(a,s)?null:n)}(t,e)}}}var jS=Object.freeze({__proto__:null,getArcClassifier:DS});function FS(e,t){var n,r,i,a=DS(e,t,{reusable:!0})(function(e,t){return-1==t?-1:e==n?t:e});function o(e){var t=a(e);-1!=t&&(i?i(t,e):-1==r.indexOf(t)&&r.push(t))}return function(t,a){if(n=t,!a)return r=[],br(e.shapes[t],o),r;i=a,br(e.shapes[t],o),i=null}}function US(e,t){var n=DS(e,t)(function(e,t){return t>-1&&e>-1?[e,t]:null}),r=[],i={};return br(e.shapes,function(e){var t,a=n(e);a&&(t=a.join("~"))in i==!1&&(r.push(a),i[t]=!0)}),r}var BS=Object.freeze({__proto__:null,findPairsOfNeighbors:US,getNeighborLookupFunction:FS});function GS(e,n,r){Ri(e);var i,a,o,s=FS(e,n.arcs),u=0,c=t.range(ki(e)).map(function(e){var t=s(e)||[];return{nabes:t,colorId:-1,nabeColors:[],uncolored:t.length,saturation:0,common:0}}),f=(i=r.length,a=t.range(i),o=new Uint32Array(i),function(e){return e>=0&&e<i?(o[e]++,t.sortArrayIndex(a,o,!0)):void 0!==e&&vt("Unexpected color index:",e),a}),l=f(),h=function(e){var n=e.concat();function r(t){for(var r;n.length>0;)t(r=n.pop()),qS(r,n,e)}return t.sortOn(n,"uncolored",!0),{forEach:r}}(c);return h.forEach(function(e){var t=function(e,t,n){for(var r,i=0;i<n.length;i++)if(JS(e,t,r=n[i]))return r;return-1}(e,c,l);-1==t&&(u++,t=l[0]),e.colorId=t,l=f(t)}),u>0&&xt(`Unable to find non-adjacent colors for ${u} ${1==u?"polygon":"polygons"}`),function(e){return r[c[e].colorId]}}function qS(e,t,n){for(var r,i=e.nabes,a=0;a<i.length;a++)(r=n[i[a]]).colorId>-1||VS(r,e.colorId,t)}function VS(e,t,n){var r,i=function(e,t){var n,r=0,i=t.length;for(;i-r>50;)t[n=Math.floor((r+i)/2)].saturation>=e.saturation?i=n:r=n;return t.indexOf(e,r)}(e,n),a=n.length;for(-1==i&&vt("Indexing error"),e.uncolored--,e.nabeColors.includes(t)?e.common++:(e.saturation++,e.nabeColors.push(t));++i<a&&$S(e,r=n[i]);)n[i-1]=r,n[i]=e}function $S(e,t){return e.saturation>t.saturation||!(e.saturation<t.saturation)&&(e.common>t.common||!(e.common<t.common)&&e.uncolored<t.uncolored)}function JS(e,t,n){for(var r=e.nabes,i=0;i<r.length;i++)if(t[r[i]].colorId===n)return!1;return!0}function WS(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(6*r,6*++r);return n}var ZS=WS("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),YS=WS("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),HS=WS("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),XS=WS("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),KS=WS("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),QS=WS("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),eA=WS("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),tA=WS("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),nA=WS("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),rA=WS("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),iA=e=>Hw(e[e.length-1]),aA=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(WS),oA=iA(aA),sA=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(WS),uA=iA(sA),cA=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(WS),fA=iA(cA),lA=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(WS),hA=iA(lA),pA=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(WS),dA=iA(pA),gA=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(WS),mA=iA(gA),yA=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(WS),vA=iA(yA),bA=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(WS),_A=iA(bA),xA=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(WS),wA=iA(xA),SA=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(WS),AA=iA(SA),EA=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(WS),MA=iA(EA),IA=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(WS),kA=iA(IA),CA=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(WS),PA=iA(CA),OA=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(WS),NA=iA(OA),TA=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(WS),LA=iA(TA),zA=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(WS),RA=iA(zA),DA=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(WS),jA=iA(DA),FA=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(WS),UA=iA(FA),BA=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(WS),GA=iA(BA),qA=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(WS),VA=iA(qA),$A=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(WS),JA=iA($A),WA=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(WS),ZA=iA(WA),YA=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(WS),HA=iA(YA),XA=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(WS),KA=iA(XA),QA=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(WS),eE=iA(QA),tE=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(WS),nE=iA(tE),rE=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(WS),iE=iA(rE);var aE=sS(Gw(300,.5,0),Gw(-240,.5,1)),oE=sS(Gw(-100,.75,.35),Gw(80,1.5,.8)),sE=sS(Gw(260,.75,.35),Gw(80,1.5,.8)),uE=Gw();var cE=bw(),fE=Math.PI/3,lE=2*Math.PI/3;function hE(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var pE,dE=hE(WS("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),gE=hE(WS("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),mE=hE(WS("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),yE=hE(WS("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),vE=Object.freeze({__proto__:null,interpolateBlues:ZA,interpolateBrBG:oA,interpolateBuGn:AA,interpolateBuPu:MA,interpolateCividis:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"},interpolateCool:sE,interpolateCubehelixDefault:aE,interpolateGnBu:kA,interpolateGreens:HA,interpolateGreys:KA,interpolateInferno:mE,interpolateMagma:gE,interpolateOrRd:PA,interpolateOranges:iE,interpolatePRGn:uA,interpolatePiYG:fA,interpolatePlasma:yE,interpolatePuBu:LA,interpolatePuBuGn:NA,interpolatePuOr:hA,interpolatePuRd:RA,interpolatePurples:eE,interpolateRainbow:function(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return uE.h=360*e-100,uE.s=1.5-1.5*t,uE.l=.8-.9*t,uE+""},interpolateRdBu:dA,interpolateRdGy:mA,interpolateRdPu:jA,interpolateRdYlBu:vA,interpolateRdYlGn:_A,interpolateReds:nE,interpolateSinebow:function(e){var t;return e=(.5-e)*Math.PI,cE.r=255*(t=Math.sin(e))*t,cE.g=255*(t=Math.sin(e+fE))*t,cE.b=255*(t=Math.sin(e+lE))*t,cE+""},interpolateSpectral:wA,interpolateTurbo:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"},interpolateViridis:dE,interpolateWarm:oE,interpolateYlGn:GA,interpolateYlGnBu:UA,interpolateYlOrBr:VA,interpolateYlOrRd:JA,schemeAccent:YS,schemeBlues:WA,schemeBrBG:aA,schemeBuGn:SA,schemeBuPu:EA,schemeCategory10:ZS,schemeDark2:HS,schemeGnBu:IA,schemeGreens:YA,schemeGreys:XA,schemeOrRd:CA,schemeOranges:rE,schemePRGn:sA,schemePaired:XS,schemePastel1:KS,schemePastel2:QS,schemePiYG:cA,schemePuBu:TA,schemePuBuGn:OA,schemePuOr:lA,schemePuRd:zA,schemePurples:QA,schemeRdBu:pA,schemeRdGy:gA,schemeRdPu:DA,schemeRdYlBu:yA,schemeRdYlGn:bA,schemeReds:tE,schemeSet1:eA,schemeSet2:tA,schemeSet3:nA,schemeSpectral:xA,schemeTableau10:rA,schemeYlGn:BA,schemeYlGnBu:FA,schemeYlOrBr:qA,schemeYlOrRd:$A}),bE={categorical:[],sequential:[],rainbow:[],diverging:[],all:[]};function _E(){pE||(pE={},wE("categorical","Category10,Accent,Dark2,Paired,Pastel1,Pastel2,Set1,Set2,Set3,Tableau10"),wE("sequential","Blues,Greens,Greys,Purples,Reds,Oranges,BuGn,BuPu,GnBu,OrRd,PuBuGn,PuBu,PuRd,RdPu,YlGnBu,YlGn,YlOrBr,YlOrRd"),wE("rainbow","Cividis,CubehelixDefault,Rainbow,Warm,Cool,Sinebow,Turbo,Viridis,Magma,Inferno,Plasma"),wE("diverging","BrBG,PRGn,PRGn,PiYG,PuOr,RdBu,RdGy,RdYlBu,RdYlGn,Spectral"),function(){function e(e){e.forEach(function(e){vE["scheme"+e]||xt("Warning: missing data for",e)})}function t(e){e.forEach(function(e){vE["interpolate"+e]||xt("Missing interpolator for",e)})}e(bE.categorical),e(bE.sequential),e(bE.diverging),t(bE.sequential),t(bE.rainbow),t(bE.diverging)}(),SE("Category20","1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),SE("Category20b","393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),SE("Category20c","3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),SE("Tableau20","4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),bE.all=[].concat(bE.sequential,bE.rainbow,bE.diverging,bE.categorical))}function xE(e){if(!e)return null;for(var t=e.toLowerCase(),n=0;n<bE.all.length;n++)if(bE.all[n].toLowerCase()==t)return bE.all[n];return null}function wE(e,t){var n=t.split(",");bE[e]=bE[e].concat(n),"categorical"==e&&n.forEach(e=>{pE[e]=vE["scheme"+e]})}function SE(e,t){bE.categorical.push(e),pE[e]=function(e){for(var t=[],n=0,r=e.length;n<r;n+=6)t.push("#"+e.substr(n,6));return t}(t)}function AE(e){return _E(),bE.all.includes(xE(e))}function EE(e){return _E(),bE.categorical.includes(xE(e))}function ME(e,n,r){_E(),e=xE(e);var i,a=vE["scheme"+e],o=vE["interpolate"+e];return a||o||bt("Unknown color scheme name:",e),bE.categorical.includes(e)&&bt(e," is a categorical color scheme (expected a sequential color scheme)"),i=a&&a[n]?a[n]:function(e,n){n>0!=!1&&t.isInteger(n)||vt("Expected a positive integer");for(var r=[],i=0;i<n;i++)r.push(e(i/(n-1)));return r}(o,n),r&&(i=uS(i,r)),i}function IE(e){return"null_value"in e?function(e){t.isString(e)&&!isNaN(+e)&&(e=+e);"null"===e&&(e=null);return e}(e.null_value):e.colors?"#eee":e.values?null:-1}function kE(e,n,r){var i,a="categorical"==e||"non-adjacent"==e,o=r.colors&&1==r.colors.length?r.colors[0]:null;return"blacki"==e?[]:("random"==o?(i=a?function(e){_E();var n=Math.min(e,20),r=bE.categorical.filter(e=>pE[e].length>=n);return t.pickOne(r)||"Tableau20"}(n):function(e){_E();var n=bE[e];return n||vt("Unknown color scheme type:",e),t.pickOne(n)}("sequential"),xt("Randomly selected color scheme:",i)):AE(o)?i=o:o&&!bh(o)?bt("Unrecognized color scheme name:",o):r.colors&&r.colors.forEach(_h),i?a&&EE(i)?function(e,t){var n;return _E(),AE(e=xE(e))?n=EE(e)?pE[e]||vE["scheme"+e]:ME(e,t):bt("Unknown color scheme name:",e),t>n.length?(xt("Color scheme has",n.length,"colors. Using duplication to match",t,"categories."),n=function(e,t){for(;e.length>0&&e.length<t;)e=e.concat(e.slice(0,t-e.length));return e}(n,t)):n=n.slice(0,t),n}(i,n):ME(i,n,r.stops):r.colors||r.values?a?function(e,t){t!=e.length&&bt("Mismatch in number of categories and number of values");return CE(e)}(r.colors||r.values,n):function(e,t,n){var r=CE(e);if(t!=r.length||n.stops)return function(e,t,n){if(e.length==t&&!n)return e;for(var r,i,a,o,s=e.length-1,u=[e[0]],c=1;c<t-1;c++)a=(r=c/(t-1)*s)-(i=Math.floor(r)),o=aS(e[i],e[i+1])(a),u.push(o);return u.push(e[e.length-1]),n&&(u=uS(u,n)),u}(r,t,n.stops);return r}(r.colors||r.values,n,r):function(e){for(var t=[],n=0;n<e;n++)t.push(n);return t}(n))}function CE(e){var n=e;return e.every(t.parseNumber)&&(n=e.map(function(e){return+e})),n}var PE=["quantile","nice","equal-interval","hybrid","breaks"],OE=["non-adjacent","indexed","categorical","blacki"].concat(PE);function NE(e,t,n,r){var i=new Vf(t,n.arcs);return e.map(function(e){return function(e){var t=null;e&&(t=e.reduce(a,[]));return t&&t.length>0?t:null}(e)});function a(e,t){for(var n,a,o=null,s=0;s<t.length;s++)n=t[s],(a=i.arcIsEnclosed(n))&&"clip"==r||!a&&"erase"==r?(o||e.push(o=[]),o.push(n)):o=null;return e}}pp.classify=function(e,n,r){e.data||Wi(e);var i,a,o,s,u,c,f,l,h,p,d=r||{},g=e.data&&e.data.getRecords(),m=!!d.colors;d.color_scheme&&bt("color-scheme is not a valid option, use colors instead"),d.index_field?(i=d.index_field,a=ei(d.field,g)):d.field&&(i=d.field,a=ei(d.field,g)),i&&Pi(e.data,i),p=function(e,t){var n;if(e.method)n=e.method;else if(e.breaks)n="breaks";else if(e.index_field)n="indexed";else if(e.categories||"string"==t)n="categorical";else if("number"==t)n="quantile";else if("date"==t||"object"==t)bt("Data type does not support classification:",t);else{if(null===t)return null;bt(void 0===t?"Expected a data field to classify or the non-adjacent option":"Unable to determine which classification method to use.")}return OE.includes(n)||bt("Not a recognized classification method:",n),PE.includes(n)&&"number"!=t&&null!==t&&bt("The",n,"method requires a numerical data field"),n}(d,a),"non-adjacent"==p?("polygon"!=e.geometry_type&&bt("The non-adjacent option requires a polygon layer"),i&&bt("The non-adjacent option does not accept a data field argument")):i||bt("Missing a data field to classify"),"categorical"==p&&(d.categories&&!d.categories.includes("*")||!i||(d.categories=ai(g,i)),d.categories&&"number"==a&&(d.categories=d.categories.map(e=>+e))),d.classes?(t.isInteger(d.classes)&&d.classes>1!=!1||bt("Invalid number of classes:",d.classes,"(expected a value greater than 1)"),l=d.classes):l="blacki"==p?999:"indexed"==p&&i?function(e,n){var r=[],i=-1;return e.forEach(function(e){var a=(e||{})[n];!t.isInteger(a)||a<-2?r.push(a):i=Math.max(i,a)}),r.length>0&&bt(`Class index field contains invalid value(s): ${r.slice(0,5)}`),i+1}(g,i):d.breaks?d.breaks.length+1:"categorical"==p&&d.categories?d.categories.length:d.colors&&d.colors.length>1?d.colors.length:d.values&&d.values.length>1?d.values.length:"non-adjacent"==p?5:4,(h=d.continuous?l+1:l)>1==!1&&bt("Missing a valid number of values"),s=kE(p,h,d),d.invert&&(s=s.concat().reverse()),m&&xt("Colors:",function(e){if(e.some(e=>t.isString(e)&&0===e.indexOf("rgb(")))return function(e){return e.map(function(e){var t=gw(e);return t||bt("Unable to parse color:",e),t.formatHex()})}(e);return e}(s)),u=IE(d),null===a?f=function(){return u}:"blacki"==p?f=function(e,n){var r=e.data.getRecords(),i={},a=[],o=0;r.forEach(function(e,t){var r,s,u=e[n],c=-1;if(Array.isArray(u))for(var l=0;l<u.length;l++)-1==(r=(s=u[l])in i?i[s]:-1)?(-1==c&&(c=o++),Array.isArray(a[c])?a[c].includes(s)||a[c].push(s):a[c]=[s],i[s]=c):-1==c?c=r:c>r?(f(c,r),c=r):c<r&&f(r,c)});var s,u=(s=-1,a.map(function(e,t){return null!==e&&s++,s})),c=r.map(function(e){var t=e[n];return Array.isArray(t)&&0!==t.length?(t[0]in i==0&&vt("Internal error"),u[i[t[0]]]):-1});return a=null,i=null,function(e){return c[e]};function f(e,n){a[e].forEach(function(e){i[e]=n}),a[n]=t.uniq(a[n].concat(a[e])),a[e]=null}}(e,i):"non-adjacent"==p?f=GS(e,n,s):c="indexed"==p?function(e,n,r){var i=e.length,a=lS(e,n,r);return function(e){var n=t.isInteger(e)&&e>=0&&e<i?e:-1;return a(n)}}(s,u,d):"categorical"==p?RS(s,u,d):kS(s,u,ii(g,i),p,d),c&&(f=function(e){var t=g[e]||{};return c(t[i])}),o=m?"polyline"==e.geometry_type?"stroke":"fill":"class",d.save_as?o=d.save_as:xt(`Output was saved to "${o}" field (use save-as= to change)`),g.forEach(function(e,t){e[o]=f(t)})},pp.filterSlivers=function(e,n,r){return"polygon"!=e.geometry_type?0:function(e,n,r){var i=t.extend({sliver_control:1},r),a=lh(e,n,i),o=a.filter,s=0,u=function(e,t,n){if(o(e,t,n))return s++,null};Pr(e.shapes,u),xt(t.format("Removed %'d sliver%s using %s",s,t.pluralSuffix(s),a.label)),i.remove_empty&&pp.filterFeatures(e,n.arcs,{remove_empty:!0,verbose:!1});return s}(e,n,r)};var TE=Object.freeze({__proto__:null,clipPolylines:NE});function LE(e,t){t=t&&!e.arcs.isPlanar();var n=new Uint8Array(e.arcs.size()),r=od(e,t),i=wl(e,n);return function(t){if(!t)return null;var n=[],a=[];r(t,n,a),n=i(n,"flatten"),a.forEach(mr),(a=i(a,"flatten")).forEach(mr);var o=function(e,t){for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e}(n,a),s=i(o,"dissolve");return s.length>1&&(s=function(e,t){if(e.length<=1)return e;var n=Er(e,t,"polygon"),r=new Vf(e.map(function(e){return[e]}),t);return e.filter(function(e,t){var i,a=r.findSmallestEnclosingPolygon(e),o=!0;return a>-1&&(i=n[t].area>0,n[a].area>0==i&&(o=!1)),o})}(s,e.arcs)),s.length>0?s:null}}function zE(e,t,n,r,i){var a=n.arcs,o=i||{},s=new Uint8Array(a.size()),u=new Uint8Array(a.size()),c=0,f=0,l=[],h=xl(n,function(e){var t,n,i=e>=0,a=i?e:~e,o=u[a],c=s[a];i?(t=o,n=c):(t=o>>4,n=c>>4);n&=3;var h=!1;3==(t&=3)?1==n||2==n&&"erase"==r||(h=!0):0===t&&3==n&&(l.push(e),h=!0);h&&(3==n&&f++,o=i?gl(o,1,3):gl(o,16,48));return o|=i?4:64,u[a]=o,h},function(e){var t=e>=0,n=t?e:~e,r=t?1:16,i=u[n],a=s[n];a>0&&c++;return(i&r)>0||(a&r)>0}),p=LE(n);o.bbox2||(e=e.map(p)),bl(t,a,s,"clip"==r,"erase"==r,!0,17);var d=new Vf(t,a),g=e.map(function(e,t){return e?function(e,t,n){var r=[],i="clip"==t,o="erase"==t;bl(e,a,u,!0,!1,!1),Cr(e,function(e){for(var t,a=0,s=e.length;a<s;a++)if(c=0,f=0,t=h(e[a]))if(0===c||0===f){var u=n.pathIsEnclosed(t);(i&&u||o&&!u)&&r.push(t)}else r.push(t)}),_l(e,0,u,!0,!0,!0),l.length>0&&(_l(l,0,u,!0,!0,!0),l=[]);return 0===r.length?null:r}(e,r,d):null});vl(g,u);var m=function(e){return e.map(function(e){var t=[];return Cr(e,function(e){for(var n=!0,r=!1,i=0;i<e.length;i++){if(!y(e[i],u)){n=!1;break}!r&&v(e[i],s)&&(r=!0)}n&&r&&t.push(e)}),t.length>0?t:null})}(t);return _l(t,0,u,!0,!0),d=new Vf(m,a),e.forEach(function(e,t){var n=e?function(e,t,n){var r=n.findPathsInsideShape(e),i=[];if(!r)return null;"erase"==t&&r.forEach(mr);r.length<=1?i=r:(bl(r,a,u,!0,!1,!0),r.forEach(function(e){for(var t,n=0;n<e.length;n++)(t=h(e[n]))&&i.push(t)}));return i.length>0?i:null}(e,r,d):null;n&&(g[t]=(g[t]||[]).concat(n))}),g;function y(e,t){return!(136&t[Yt(e)])}function v(e,t){return(17&t[Yt(e)])>0}}function RE(e,t,n,r){var i=new Vf(t,n),a=e.reduce(function(e,t){for(var n,a=t?t.length:0,o=[],s=0;s<a;s++)n=i.findEnclosingShape(t[s])>-1,("clip"==r&&n||"erase"==r&&!n)&&o.push(t[s].concat());return e.push(o.length>0?o:null),e},[]);return a}var DE=Object.freeze({__proto__:null,clipPoints:RE});function jE(e,n,r,i){t.some(e,wi);var a,o,s,u=i.bbox||i.bbox2;return r&&r.geometry_type&&(r={dataset:n,layer:r,disposable:!0}),u?(o=function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=[[t,n],[t,i],[r,i],[r,n],[t,n]];i>n&&r>t||bt("Invalid bbox (should be [xmin, ymin, xmax, ymax]):",e);return{arcs:new Wa([a]),layers:[{shapes:[[[0]]],geometry_type:"polygon"}]}}(u),s=o.layers[0]):r?r.layer&&r.dataset?(s=r.layer,o=t.defaults({layers:[s]},r.dataset)):r.layers&&1==r.layers.length&&(s=r.layers[0],o=r):bt("Command requires a source file, layer id or bbox"),n.arcs!=o.arcs?(r&&!r.disposable&&(o.layers[0]=Gi(o.layers[0])),Ka(a=io([n,o]))):((a=t.extend({},n)).layers=n.layers.filter(function(e){return e!=s}),a.layers.push(s)),a}var FE=Object.freeze({__proto__:null,mergeLayersForOverlay:jE});function UE(e,t){var n=e.arcs,r=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=[],s=[],u=[],c=[];return e.forEachSegment(function(e,t,l,h){var p,d=l[e],g=h[e],m=l[t],y=h[t];BE(d,g,m,y,n,r,i,a)||GE(d,g,m,y,n,r,i,a)||((p=fr.segmentIntersection(n,a,i,a,d,g,m,y))&&f(o,p,e,t,l,h),(p=fr.segmentIntersection(n,r,i,r,d,g,m,y))&&f(u,p,e,t,l,h),(p=fr.segmentIntersection(n,r,n,a,d,g,m,y))&&f(c,p,e,t,l,h),(p=fr.segmentIntersection(i,r,i,a,d,g,m,y))&&f(s,p,e,t,l,h))}),{cutPoints:c.concat(u,s,o),bboxPoints:qE(t,c,o,s,u)};function f(e,t,n,r,i,a){t&&(e.push(l(t[0],t[1],n,r,i,a)),4==t.length&&e.push(l(t[2],t[3],n,r,i,a)))}function l(e,t,n,r,i,a){var o=zl(e,t,n,r,i,a);return Hp(e,t,o[0],o[1])}}(n,t),i=Yp(r.cutPoints,n);n.dedupCoords(),Jp(e,i);var a=function(e){for(var t,n,r=[],i=[],a={geometry_type:"polygon",shapes:[[i]]},o=0,s=e.length-1;o<s;o++)t=e[o],n=e[o+1],r.push([[t.x,t.y],[n.x,n.y]]),i.push(o);return{arcs:new Wa(r),layers:[a]}}(r.bboxPoints),o=io([e,a]),s=o.layers.pop();return e.arcs=o.arcs,e.layers=o.layers,s}function BE(e,t,n,r,i,a,o,s){return e<i&&n<i||e>o&&n>o||t<a&&r<a||t>s&&r>s}function GE(e,t,n,r,i,a,o,s){return e>i&&n>i&&e<o&&n<o&&t>a&&r>a&&t<s&&r<s}function qE(e,n,r,i,a){var o={x:e[0],y:e[1]},s={x:e[0],y:e[3]},u={x:e[2],y:e[3]},c={x:e[2],y:e[1]};return n=t.sortOn(n.concat([o,s]),"y",!0),r=t.sortOn(r.concat([s,u]),"x",!0),i=t.sortOn(i.concat([u,c]),"y",!1),a=t.sortOn(a.concat([c,o]),"x",!1),n.concat(r,i,a).reduce(function(e,t){var n=e.length>0?e[e.length-1]:null;return null!==n&&n.x==t.x&&n.y==t.y||e.push(t),e},[])}var VE=Object.freeze({__proto__:null,divideDatasetByBBox:UE,segmentInsideBBox:GE,segmentOutsideBBox:BE});function $E(e,t,n,r,i){var a=JE(e,t,n,r,i);e.forEach(function(e,t){var n=a[t];e.shapes=n.shapes,e.data=n.data}),ho(n)}function JE(e,n,r,i,a){var o,s,u,c=t.some(e,wi);return(a=a||{no_cleanup:!0}).bbox2&&c?WE(e,r,a):(s=(o=jE(e,r,n,a)).layers[o.layers.length-1],c?(u=Vp(o,a),r.arcs=o.arcs,s=pd(s=t.defaults({data:null},s),o,{quiet:!0,silent:!0})):u=new lo(o.arcs),ZE(e,s,u,i,a))}function WE(e,t,n){return ZE(e,UE(t,n.bbox2),new lo(t.arcs),"clip",n)}function ZE(e,t,n,r,i){return Ri(t,"Requires a polygon clipping layer"),e.reduce(function(e,a){return"slice"==r?e=e.concat(function(e,t,n,r){var i=pp.splitLayer(t,r.id_field,{no_replace:!0});return i.map(function(t,i){var a=YE(e,t,n,"clip",r);return a.name=function(e,t,n){var r=t?e.data.getRecords()[0][t]:n+1;return"slice-"+r}(t,r.id_field,i),a})}(a,t,n,i)):e.push(YE(a,t,n,r,i)),e},[])}function YE(e,t,n,r,i){var a,o,s,u=n.arcs,c=e.shapes?e.shapes.length:0,f=0;return 0===c?e:(e===t&&bt("Can't clip a layer with itself"),"point"==e.geometry_type?o=RE(e.shapes,t.shapes,u,r):"polygon"==e.geometry_type?o=zE(e.shapes,t.shapes,n,r,i):"polyline"==e.geometry_type?o=NE(e.shapes,t.shapes,n,r):bt("Invalid target layer:",e.name),s={name:e.name,geometry_type:e.geometry_type,shapes:o,data:e.data},i.remove_slivers&&"polygon"==s.geometry_type&&(f=function(e,t,n){var r=hh(n,dh(e,n),1),i=new Uint8Array(n.size()),a=0;return dr(t.shapes,i),Pr(e.shapes,function(e){for(var t=0,n=0,o=0,s=e&&e.length||0;o<s;o++)i[Yt(e[o])]>0?n++:t++;if(n>0&&t>0&&r(e))return a++,null}),a}(s,t,u)),pp.filterFeatures(s,u,{remove_empty:!0,verbose:!1}),s.data&&(s.data=s.data.clone()),(a=c-s.shapes.length)&&f&&xt(HE(a,f)),s)}function HE(e,n){var r=e?t.format("%,d null feature%s",e,t.pluralSuffix(e)):"",i=n?t.format("%,d sliver%s",n,t.pluralSuffix(n)):"";return r||i?t.format("Removed %s%s%s",r,r&&i?" and ":"",i):""}pp.clipLayers=function(e,t,n,r){return JE(e,t,n,"clip",r)},pp.eraseLayers=function(e,t,n,r){return JE(e,t,n,"erase",r)},pp.clipLayer=function(e,t,n,r){return pp.clipLayers([e],t,n,r)[0]},pp.eraseLayer=function(e,t,n,r){return pp.eraseLayers([e],t,n,r)[0]},pp.sliceLayers=function(e,t,n,r){return JE(e,t,n,"slice",r)},pp.sliceLayer=function(e,t,n,r){return pp.sliceLayers([e],t,n,r)};var XE=Object.freeze({__proto__:null,clipLayers:JE,clipLayersByBBox:WE,clipLayersByLayer:ZE,clipLayersInPlace:$E,getClipMessage:HE});function KE(e){var t,n=e.nodata||"white",r=e.precision?Vl(e.precision):null;return e.random||e.colors&&e.colors.length||bt("Missing colors= parameter"),e.random?t=function(e){e&&e.length||(e="#ccc,#888,#444".split(","));return function(t){var n=e.length,r=void 0===t?Math.floor(Math.random()*n):function(e){var t=String(e),n=5381,r=t.length;for(;r>0;)n=33*n^t.charCodeAt(--r);return Math.abs(n)}(t)%n;return e[r]}}(e.colors):e.breaks?(e.colors.length!=e.breaks.length+1&&bt("Number of colors should be one more than number of class breaks"),t=function(e,t,n,r){var i=PS(e,r),a=fS(t,n);return function(e){return a(i(e))}}(e.breaks,e.colors,n,r)):e.categories?(e.colors.length!=e.categories.length&&bt("Number of colors should be equal to the number of categories"),t=RS(e.colors,n,e)):bt("Missing categories= or breaks= parameter"),t}pp.cluster=function(e,n,r){Ri(e);var i=function(e,n,r){var i,a=function(e){var t=e.max_width||1/0,n=e.max_height||1/0,r=e.max_area||1/0;return function(e,i){var a=e.area+i.area,o=fr.distance2D(e.centroid.x,e.centroid.y,i.centroid.x,i.centroid.y),s=e.bounds.clone().mergeBounds(i.bounds);return(a>r||s.width()>t||s.height()>n)&&(o=-1),o}}(r),o=e.shapes.length,s=r.pct?t.parsePercent(r.pct):1,u=Math.round(o*s),c=r.group_by||null,f=e.shapes.map(function(t,r){var i=c&&e.data.getRecordAt(r)[c]||null;return{ids:[r],area:fr.getShapeArea(t,n),bounds:n.getMultiShapeBounds(t),centroid:fr.getShapeCentroid(t,n),group:i,friends:[]}}),l=[],h={};c&&!e.data&&bt("Missing attribute data table");US(e,n).forEach(function(e,t){var n,r,i=f[e[0]],a=f[e[1]];i.group===a.group&&((n={ids:e}).score=g(n),n.score<0||(r=l.length,i.friends.push(r),a.friends.push(r),l.push(n)))});for(;u-- >0&&(i=d());)p(i);return f.filter(Boolean).reduce(function(e,t,n){for(var r=t.ids,i=0;i<r.length;i++)e[r[i]]=n;return e},[]);function p(e){var t=y(e.ids),n=f.length;f[n]=t,b(t.friends,e.ids,n)}function d(){var e,t,n,r=-1,i=1/0;for(t=0,n=l.length;t<n;t++)null!==(e=l[t])&&e.score<i&&(i=e.score,r=t);return-1==r?null:(e=l[r],l[r]=null,e)}function g(e){return a(f[e.ids[0]],f[e.ids[1]])}function m(e,t){var n=e.area/(e.area+t.area),r=e.centroid,i=t.centroid;r.x=r.x*n+i.x*(1-n),r.y=r.y*n+i.y*(1-n)}function y(e){var t=f[e[0]],n=f[e[1]];return t.bounds.mergeBounds(n.bounds),t.area+=n.area,t.ids=t.ids.concat(n.ids),m(t,n),f[e[0]]=null,f[e[1]]=null,t.friends=v(t.friends.concat(n.friends)),t}function v(e){for(var t,n={},r=[],i=0;i<e.length;i++)(t=e[i])in n==!1&&null!==l[t]&&(r.push(t),n[t]=!0);return r}function b(e,t,n){for(var r,i,a=0,o=e.length;a<o;a++)i=e[a],x((r=l[i]).ids,t)&&(l[i]=_(r,t,n))}function _(e,t,n){var r,i=e.ids[0],a=e.ids[1];return t[0]!=i&&t[1]!=i||(i=n),t[0]!=a&&t[1]!=a||(a=n),i==a?null:(e.ids=[i,a],(r=w(e))in h?null:(h[r]=!0,e.score=g(e),e.score<0?null:e))}function x(e,t){return e[0]===t[0]||e[0]===t[1]||e[1]===t[0]||e[1]===t[1]}function w(e){var t=e.ids[0],n=e.ids[1];return n<t&&(t=n,n=e.ids[0]),t+","+n}}(e,n,r);return vi(e,r.id_field||"cluster",i),e},pp.colorizer=function(e){var t;e.name||bt("Missing required name= parameter"),t=e.name,/^(stroke|stroke-width|stroke-dasharray|stroke-opacity|fill|fill-opacity|opacity|r|class)$/.test(t)&&bt('"'+e.name+'" is a reserved name'),i("defs")[e.name]=KE(e)};var QE=Object.freeze({__proto__:null,getColorizerFunction:KE});function eM(e,t,n,r){var i=t.data.getRecords(),a=rM(e,t,n,r),o=function(e,t){var n=t.data.getRecords();return function(t){var r=n[t];return!!r&&nM(r[e])}}(e,t),s={},u=0;return t.shapes.forEach(function(e,t){if(o(t)){var n=a(t);n.group&&function(e,t){var n,r=t[e.group];if(!r)return void(t[e.group]={shapes:[e.shape],weights:e.weights,values:e.values});r.shapes.push(e.shape);for(var i=0,a=e.values.length;i<a;i++)n=r.values.indexOf(e.values[i]),r.weights[n]+=e.weights[i]}(n,s)}}),Object.keys(s).forEach(function(t){var n,r,a=s[t],o=tM(a);n=a.shapes,r=o,n.forEach(function(t){u++,i[t][e]=r})}),u>0&&(u+=eM(e,t,n,r)),u}function tM(e){var t=Math.max.apply(null,e.weights),n=e.weights.indexOf(t);return e.values[n]}function nM(e){return!e&&0!==e}function rM(e,t,n,r){var i,a=n.isPlanar(),o=t.data.getRecords();function s(t,r){var s,u,c=o[t][e];nM(c)||(s=fr.calcPathLen([r],n,!a),-1==(u=i.values.indexOf(c))?(i.values.push(c),i.weights.push(s)):i.weights[u]+=s)}return function(e){return i={shape:e,weights:[],values:[],group:""},r(e,s),i.group=i.values.concat().sort().join("~"),i}}pp.comment=function(e){},pp.dashlines=function(e,t,n){var r=Ia(t),a=i("defs");zi(e),a.splitFeature=function(e,t){var n=t.dash_length?ah(t.dash_length,e):0,r=t.gap_length?ah(t.gap_length,e):0;n>0==!1&&bt("Missing required dash-length parameter");r>=0==0&&bt("Invalid gap-length option");var i=function(e,t,n,r){var i,a,o,s,u=!!r.planar,c=X_(u?null:e),f=Na(e)?gn:cn;function l(e){i&&a.push(e),n>0&&(o=s*((i=!i)?t:n))}return function(e){var u,h,p,d=0,g=e[0],m=[g];s=r.scaled?function(e,t,n){var r=n/(e+t),i=Math.floor(r),a=Math.ceil(r),o=n/(i*(e+t)),s=n/(a*(e+t)),u=s;o<1/s&&i>0&&(u=o);return u}(t,n,function(e,t){for(var n=0,r=1,i=e.length;r<i;r++)n+=t(e[r-1][0],e[r-1][1],e[r][0],e[r][1]);return n}(e,f)):1,o=s*((i=!(n>0))?t:n),i||(o*=.5),a=[];for(var y=1,v=e.length;y<v;y++)if(p=g,g=e[y],!((u=f(p[0],p[1],g[0],g[1]))<=0)){for(;d+u>=o;)(h=(o-d)/u)>.999&&y==v-1&&(h=1),p=h<1?c(p[0],p[1],g[0],g[1],h):g,m.push(p),l(m),m=h<1?[p]:[],d=0,u*=1-h;m.push(g),d+=u}return d>0&&m.length>1&&l(m),a}}(e,n,r,t);return function(e){var t=e.geometry;return t?("LineString"==t.type&&(t.type="MultiLineString",t.coordinates=[t.coordinates]),"MultiLineString"!=t.type&&vt("Unexpected geometry:",t.type),t.coordinates=t.coordinates.reduce(function(e,t){try{var n=i(t);e=e.concat(n)}catch(e){throw console.error(e),e}return e},[]),e):e}}(r,n),pp.evaluateEachFeature(e,t,"this.geojson = splitFeature(this.geojson)",n),delete a.splitFeature},pp.dataFill=function(e,n,r){var i=r.field;i||bt("Missing required field= parameter"),Pi(e,i),"polygon"!=e.geometry_type&&bt("Target layer must be polygon type");var a,o,s,u=FS(e,n),c=(s=e.data.getRecords().map(function(e){return nM(e[i])}),function(e){return s[e]});a=eM(i,e,n,u),function(e,t,n,r,i){var a=rM(e,t,n,r),o=t.data.getRecords(),s=0;t.shapes.forEach(function(t,n){if(i(n)){var r=a(n);if(!(r.values.length<2)){var u=o[n][e],c=tM(r);u!=c&&(o[n][e]=c,s++)}}})}(i,e,n,u,c),r.contiguous&&(o=function(e,t,n,r,i){var a=t.data.getRecords(),o={},s=new Uint8Array(t.shapes.length),u=null,c=0,f=i.weight_field||null;f&&Pi(t,f);t.shapes.forEach(function(e,t){h(t)}),Object.keys(o).forEach(function(e){var t,n=o[e];n.length<2||(t=function(e){var t=-1/0,n=-1;return e.forEach(function(e,r){e.weight>t&&(n=r,t=e.weight)}),n}(n),-1!=t&&n.filter(function(e,n){return n!=t}).forEach(l))}),c>0&&eM(e,t,n,r);return c;function l(t){c++,t.shapes.forEach(function(t){a[t][e]=null})}function h(i){if(1!=s[i]){var c=a[i][e],l=!1;if(!nM(c)){if(u){if(c!=u.value)return}else l=!0,u={value:c,shapes:[],weight:0},c in o==!1&&(o[c]=[]),o[c].push(u);u.weight+=f?a[i][f]:fr.getShapeArea(t.shapes[i],n),u.shapes.push(i),s[i]=1,r(i).forEach(h),l&&(u=null)}}}}(i,e,n,u,r)),xt("Filled",a,"empty polygons"+t.pluralSuffix(a)),o>0&&xt("Removed",o,"non-contiguous polygon group"+t.pluralSuffix(o))};function iM(e,t){var n=ki(e),r={layer_name:e.name,geometry_type:e.geometry_type,feature_count:n,null_shape_count:0,null_data_count:e.data?cM(e.data.getRecords()):n};return e.shapes&&e.shapes.length>0&&(r.null_shape_count=function(e){for(var t=0,n=0;n<e.length;n++)e[n]&&0!==e[n].length||t++;return t}(e.shapes),r.bbox=Ji(e,t.arcs).toArray(),r.proj4=da(t)),r.source_file=Di(0,t)||null,r.attribute_data=aM(e),r}function aM(e,t){if(!e.data||0===e.data.size()||0===e.data.getFields().length)return null;var n=ui(e.data.getFields(),"ascending"),r=void 0===t?"first_value":"value";return n.map(function(n){return{field:n,[r]:e.data.getReadOnlyRecordAt(t||0)[n]}})}function oM(e){if(!e)return"Attribute data: [none]\n";var n="first_value"in e[0]?"first_value":"value",r=[],i=[];e.forEach(function(e){i.push(e.field),r.push(e[n])});var a=r.reduce(function(e,n){return t.isNumber(n)&&(e=Math.max(e,lM(n))),e},0),o=["Field"].concat(i),s=r.reduce(function(e,t){return e.push(hM(t,a)),e},["first_value"==n?"First value":"Value"]),u=fM(o),c=fM(s),f=(t.rpad("",u+2,"-")+"+"+t.rpad("",c+2,"-")).substr(0,50)+"\n",l="";return o.forEach(function(e,n){var r=sM(e);l+=" "+e+t.rpad("",u-r," ")+" | "+s[n]+"\n",0===n&&(l+=f)}),"\nAttribute data\n"+f+l+f}function sM(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=uM(e.charCodeAt(n));return t}function uM(e){return e>=4352&&(e<=4447||9001==e||9002==e||e>=11904&&e<=42191&&12351!=e||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141)?2:1}function cM(e){for(var t=0,n=0;n<e.length;n++)e[n]||t++;return t}function fM(e){return e.reduce(function(e,t){var n=sM(t);return n>e?n:e},0)}function lM(e){return t.isNumber(e)?(t.formatNumber(e)+".").indexOf("."):0}function hM(e,n){var r;return r=t.isNumber(e)?t.lpad("",n-lM(e)," ")+t.formatNumber(e):t.isString(e)?function(e){var t={"\n":"\\n","\r":"\\r","\t":"\\t"};return e=e.replace(/[\r\t\n]/g,function(e){return e in t?t[e]:""}),"'"+e+"'"}(e):t.isDate(e)?t.formatDateISO(e)+" (Date)":t.isObject(e)?JSON.stringify(e):String(e),"string"!=typeof r&&(r="["+typeof e+"]"),r}pp.info=function(e,n){var r=Gh(e).map(function(e){return iM(e.layer,e.dataset)});n.save_to&&zf([{filename:n.save_to+(n.save_to.endsWith(".json")?"":".json"),content:JSON.stringify(r,null,2)}],n);if(n.to_layer)return{info:{},layers:[{name:n.name||"info",data:new di(r)}]};xt(function(e){var n="";return e.forEach(function(e,r){var i="Layer: "+(e.layer_name||"[unnamed layer]"),a=oM(e.attribute_data),o=function(e){return Math.max.apply(null,e.split("\n").map(function(e){return sM(e)}))}(a),s=Math.min(Math.max(i.length,o),50);n+="\n",n+=t.lpad("",s,"=")+"\n",n+=i+"\n",n+=t.lpad("",s,"-")+"\n",n+=function(e){var n="";n+="Type: "+(e.geometry_type||"tabular data")+"\n",n+=t.format("Records: %,d\n",e.feature_count),e.null_shape_count>0&&(n+=t.format("Nulls: %'d",e.null_shape_count)+"\n");e.geometry_type&&e.feature_count>e.null_shape_count&&(n+="Bounds: "+e.bbox.join(",")+"\n",n+="CRS: "+e.proj4+"\n");return n+="Source: "+(e.source_file||"n/a")+"\n",n}(e),n+=a}),n}(r))},pp.printInfo=pp.info;var pM=Object.freeze({__proto__:null,formatAttributeTableInfo:oM,formatTableValue:hM,getAttributeTableInfo:aM,getLayerInfo:iM});function dM(e,t){if(e&&e.length>0){var n=Gh(e).reduce(function(e,t){var n=function(e){var t=iM(e.layer,e.dataset);function n(t){var n=Kv(t);n.layers[0].name=e.layer.name,Co(e.layer,e.dataset,n)}function r(){return{type:"FeatureCollection",features:wd(e.layer,e.dataset,{rfc7946:!0},!0)}}return t.layer=e.layer,t.dataset=e.dataset,Object.defineProperty(t,"geojson",{set:n,get:r}),t}(t);return e.push(n),t.layer.name&&(e[t.layer.name]=n),e},[]);Object.defineProperty(t,"targets",{value:n}),1==n.length&&Object.defineProperty(t,"target",{value:n[0]})}}function gM(e,t,n){return function(e,t,n){var r=n.layer||n.target||null,a=t.findCommandTargets(r),o=1==a.length&&1==a[0].layers.length;0===a.length&&r&&bt("Layer not found:",r);var s,u=i("defs")||{};s=o?Yh(a[0].layers[0],a[0].dataset.arcs):function(e){var t={},n=Wh(e);return Oh(t,{name:r,data:r,type:r,size:r,empty:r,bbox:r}),t.field_exists=r,t.field_type=r,t.field_includes=r,t;function r(){throw Error(`This expression requires a single target layer; Received ${n} layers.`)}}(a);dM(a,s),s.global=u;var c=ep(e,n);return s.layer_exists=function(e,n){try{if(t.findCommandTargets(e,n).length>0)return!0}catch(e){}return!1},s.file_exists=function(e){return Lf.isFile(e)},function(){try{return c.call(s,u,s)}catch(t){bt(t.name,"in expression ["+e+"]:",t.message)}}}(e,t,n)}function mM(e,n){var r=function(e,t){var n,r,i,a={isMax:function(e){return e===r.max},isMin:function(e){return e===r.min},isMode:function(e){return r.modes.indexOf(e)>-1}};return Object.defineProperty(a,"target",{get:function(){return i},enumerable:!0}),n=ap(e,{data:t},null,{context:a}),function(e,t,a){return r=a,i=t,n(e)}}(n,e),i=null;return function(e){return t.some(["isMax","isMin","isMode"],function(t){return e.indexOf(t)>-1})}(n)&&(i=function(e,t){var n,r,i,a,o;function s(){r=-1/0,i=1/0,n=null}return a={isMax:function(e){e>r&&(r=e)},isMin:function(e){e<i&&(i=e)},isMode:function(e){n||(n=[]),n.push(e)}},o=ap(e,{data:t},null,{context:a,no_return:!0}),function(e){var t;s();for(var a=0;a<e.length;a++)o(e[a]);return t=n?lp(n):null,{max:r,min:i,modes:t?t.modes:null,margin:t?t.margin:null}}}(n,e)),function(e,t){var n,a,o=i?i(e):null,s=[];for(a=0;a<e.length;a++)Ch(n=r(e[a],t,o),'"where" expression must return true or false'),!0===n&&s.push(e[a]);return s}}pp.define=function(e,t){t.expression||bt("Missing an assignment expression");var n=i("defs");ap(t.expression,{},null,{no_warn:!0,no_return:!0})(null,n)},pp.dissolve2=function(e,t,n){return e.forEach(Ri),Vp(t,n),e.map(function(e){return wi(e)?pd(e,t,n):e})};var yM=Object.freeze({__proto__:null,getJoinFilter:mM});function vM(e,t,n,r){return bM({data:e},t,n,r)}function bM(e,n,r,i){var a=e.data;n==a&&(n=n.clone());var o,s,u,c,f,l,h,p,d,g,m,y,v,b=!!i.duplication,_=n.getRecords(),x=a.getRecords(),w=i.prefix||"",S=[],A=EM(a.getFields(),n.getFields(),i),E=i.sum_fields||[],M=t.difference(A,E),I=new Uint32Array(_.length),k=0,C=0,P=[],O=0,N={};for(b&&(i.calc&&bt("duplication and calc options cannot be used together"),y=a.clone().getRecords(),v=e.shapes||[]),i.where&&(l=mM(n,i.where)),i.calc&&(h=bp(n,i.calc)),g=x.length,p=0;p<g;p++){for(u=x[p],(c=r(p))&&l&&(O+=c.length,O-=(c=l(c,u)).length),d=0,f=0,m=c?c.length:0;d<m;d++)o=_[s=c[d]],f>0&&b&&(u=Hr(y[p]),x.push(u),v.push(Ir(v[p]))),0===f||b?M.length>0&&wM(u,o,M,w):1==f&&(M.length>0&&!w&&AM(u,o,M,P),C++),E.length>0&&SM(u,o,E,w),I[s]++,f++;h&&h(c,u),f>0?k++:u&&(i.unmatched&&S.push(t.extend({},u)),xM(u,M,E,w))}return function(e,n,r,i,a,o,s){var u=n-e;if(e>0==!1)return void xt("No records could be joined");xt(t.format("Joined data from %'d source record%s to %'d target record%s",r,t.pluralSuffix(r),e,t.pluralSuffix(e))),u>0&&xt(t.format("%d target record%s received no data",u,t.pluralSuffix(u)));r<i&&xt(t.format("%d/%d source records could not be joined",i-r,i));a>0&&xt(t.format("%d/%d source records were skipped",a,i));o>0&&(xt(t.format("%d/%d target records were matched by multiple source records (many-to-one relationship)",o,n)),s.length>0&&xt(t.format("Inconsistent values were found in field%s [%s] during many-to-one join. Values in the first joining record were used.",t.pluralSuffix(s.length),s.join(","))))}(k,g,function(e){for(var t=0,n=0,r=e.length;n<r;n++)e[n]>0&&t++;return t}(I),_.length,O,C,P),i.unjoined&&(N.unjoined={name:"unjoined",data:new di(_.filter(function(e,t){return 0===I[t]}))}),i.unmatched&&(N.unmatched={name:"unmatched",data:new di(S)}),N}function _M(e){e.forEach(function(e){/:(str|num)/.test(e)&&bt("Unsupported use of type hints. Use string-fields= or field-types= options instead")})}function xM(e,t,n,r){wM(e,{},t,r),SM(e,{},n,r)}function wM(e,t,n,r){var i,a;r=r||"";for(var o=0,s=n.length;o<s;o++)a=r+(i=n[o]),Object.prototype.hasOwnProperty.call(t,i)?e[a]=t[i]:Object.prototype.hasOwnProperty.call(e,a)||(e[a]=null)}function SM(e,t,n,r){var i,a;r=r||"";for(var o=0;o<n.length;o++)e[a=r+(i=n[o])]=(e[a]||0)+(t[i]||0)}function AM(e,t,n,r){for(var i,a=0,o=n.length;a<o;a++)e[i=n[a]]!==t[i]&&-1===r.indexOf(i)&&r.push(i)}function EM(e,n,r){var i;if(r.fields?r.fields.indexOf("*")>-1?i=n:_M(i=r.fields):r.calc?i=[]:(i=n,r.keys&&(i=t.difference(i,[r.keys[1]]))),!r.force&&!r.prefix){var a=t.intersection(i,e);a.length>0&&(xt('Same-named fields not joined without the "force" flag:',a),i=t.difference(i,a))}return i}var MM=Object.freeze({__proto__:null,findCollisionFields:AM,getFieldsToJoin:EM,joinTableToLayer:bM,joinTables:vM,updateUnmatchedRecord:xM,validateFieldNames:_M});function IM(){return new kM("max")}function kM(e){var n,r,i,a=t.expandoBuffer(Int32Array),o=t.expandoBuffer(Int32Array),s="max"==e?function(e,t){var i=r[e],a=r[t];return n[i]<n[a]}:function(e,t){var i=r[e],a=r[t],o=n[i],s=n[a];return o>s||o===s&&i>a},u=0;function c(e){for(var t=h(e);t>e;)f(e,t),t=h(e=t)}function f(e,t){var n=r[e];l(e,r[t]),l(t,n)}function l(e,t){i[t]=e,r[e]=t}function h(e){var t=2*e+1,n=t+1,r=u;return t<r&&s(e,t)&&(e=t),n<r&&s(e,n)&&(e=n),e}this.init=function(e){var t;for(n=e,u=e.length,r=a(u),i=o(u),t=0;t<u;t++)l(t,t);for(t=u-2>>1;t>=0;t--)c(t)},this.size=function(){return u},this.updateValue=function(e,t){var r=i[e];n[e]=t,r>=0&&r<u||vt("Out-of-range heap index."),c(function(e){var t;for(;e>0&&!s(e,t=e-1>>1);)f(e,t),e=t;return e}(r))},this.popValue=function(){return n[this.pop()]},this.getValue=function(e){return n[e]},this.peek=function(){return r[0]},this.peekValue=function(){return n[r[0]]},this.pop=function(){var e;return u<=0&&vt("Tried to pop from an empty heap."),e=r[0],l(0,r[--u]),c(0),e}}function CM(e,t,n,r){return 0===n?[]:0===r.evenness?function(e,t,n){for(var r=t.getMultiShapeBounds(e),i=[],a=0;a<n;a++)i.push(PM(e,t,r));return i}(e,t,n):function(e,t,n,r){var i=r.evenness>=0?Math.min(r.evenness,1):1,a=fr.getPlanarShapeArea(e,t);if(a>0==!1)return[];var o=t.getMultiShapeBounds(e),s=Math.round(n*o.area()/a);r.progressive&&(s=Math.ceil(s/6));for(var u=new NM(o,s,i),c=[],f=0;f<n;f++)c.push(OM(e,t,u));return u.done(),c}(e,t,n,r)}function PM(e,t,n){for(var r,i,a=0;++a<100;)if(Cn(r=n.xmin+Math.random()*n.width(),i=n.ymin+Math.random()*n.height(),e,t))return[r,i];return null}function OM(e,t,n){for(var r,i=0;++i<100;)if((r=n.getPoint())&&Cn(r[0],r[1],e,t))return r;return null}function NM(e,n,r){var i,a,o,s=e.xmin,u=e.ymin,c=e.width(),f=e.height(),l=.9*n*(.5*(r-1)+1),h=Math.round(Math.sqrt(l*c/f))||1,p=Math.ceil(h*f/c),d=c,g=h*p,m=-1,y=function(e){for(var t=[],n=0;n<e;n++)t.push([]);return t}(g),v=d/h*.7*r;function b(){var e;for(i||(i=t.range(g),t.shuffle(i));++m<g;)if(T(e=O(i[m])))return e}function _(e){var t=function(e){var t=z(e),n=R(e)*h+t;return n}(e);return y[t].push(e),e}function x(e,t,n){var r=D(t,n);if(-1!=r){var i=a[r],s=o.getValue(r);P(e,i)<s*s&&w(r)}}function w(e){var t=S(e);o.updateValue(e,t)}function S(e){var t=F(e),n=A(j(e),t,0,0,1);return a[e]=n,n.pop()}function A(e,t,n,r,i){for(var a,o,s,u,c,f=Math.pow(3,i),l=0,h=0;h<3;h++)for(var p=0;p<3;p++)(c=I(l,s=E(e,t,n+h,r+p,f),e,t))>l&&(l=c,u=s,a=h,o=p);return 2==i?(u.push(l),u):A(e,t,3*(n+a),3*(r+o),i+1)}function E(e,t,n,r,i){return[((n+.5)/i+e)/h*c+s,((r+.5)/i+t)/p*f+u]}this.done=function(){},this.getPoint=function(){return 1===r?function(){var e=b();if(e)return _(e);a||function(){var e=[];a=[];for(var t=0;t<g;t++)e.push(S(t));(o=new IM).init(e)}();return function(){var e=o.peek(),t=a[e];return _(t),function(e,t){var n=F(t),r=j(t);w(t),x(e,r+1,n),x(e,r,n+1),x(e,r-1,n),x(e,r,n-1),x(e,r+1,n+1),x(e,r-1,n+1),x(e,r-1,n-1),x(e,r+1,n-1)}(t,e),v=o.peekValue(),t}()}():0===r?N():function(){var e=Math.ceil(Math.pow(g,.8)),t=10*g,n=0,r=b();if(r)return _(r);for(;n++<t;){if(T(r=N()))return _(r);n%e===0&&(v*=.9)}return null}()};var M=[[0,0],[0,-1],[-1,0],[1,0],[0,1],[-1,1],[1,-1],[-1,-1],[1,1]];function I(e,t,n,r){for(var i,a,o,s=1/0,u=0;u<9;u++){if((a=C(t,n+(i=M[u])[0],r+i[1]))<e*e)return 0;a<s&&(s=a)}return o=Math.sqrt(s),o=Math.min(o,k(t,n,r))}function k(e,t,n){if(t>0&&n>0&&t<h-1&&n<p-1)return 1/0;var r=e[0],i=e[1];return 3*Math.min(r-s,s+c-r,i-u,u+f-i)}function C(e,t,n){for(var r,i=1/0,a=D(t,n),o=a>-1?y[a]:[],s=0;s<o.length;s++)(r=P(e,o[s]))<i&&(i=r);return i}function P(e,t){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function O(e){var t=F(e),n=j(e);return[(Math.random()+n)/h*c+s,(Math.random()+t)/p*f+u]}function N(){return O(Math.floor(Math.random()*g))}function T(e){var t=z(e),n=R(e);return!(L(e,t,n)||function(e,t,n){return k(e,t,n)<v}(e,t,n)||L(e,t+1,n)||L(e,t,n+1)||L(e,t-1,n)||L(e,t,n-1)||L(e,t+1,n+1)||L(e,t-1,n+1)||L(e,t-1,n-1)||L(e,t+1,n-1))}function L(e,t,n){var r=D(t,n);return-1!=r&&function(e,t,n){for(var r=n*n,i=0;i<t.length;i++)if(P(e,t[i])<r)return!0;return!1}(e,y[r],v)}function z(e){var t=e[0]-s,n=Math.floor(t/c*h);return n<0&&(n=0),n>=h&&(n=h-1),n}function R(e){var t=e[1]-u,n=Math.floor(t/f*p);return n<0&&(n=0),n>=p&&(n=p-1),n}function D(e,t){return e<0||t<0||e>=h||t>=p?-1:t*h+e}function j(e){return e%h}function F(e){return Math.floor(e/h)}}function TM(e,t,n){var r={},i=n.save_as||"fill",a=n.colors||n.values;if(a?(r[i]=a[e],r.r=n.r||1.3):n.r&&(r.r=n.r),n.copy_fields)for(var o=0;o<n.copy_fields.length;o++)r[n.copy_fields[o]]=t[n.copy_fields[o]];return r}function LM(e){return e.includes("this.geojson")||e.includes("this.geometry")||e.includes("this.feature")}function zM(e,n){var r={},i=wd(Bi(e),n,{rfc7946:!0},!0),a=[];return r.get=function(e){return e>0&&(i[e-1]=null),i[e]},r.getGeometry=function(e){return e>0&&(i[e-1]=null),i[e]?i[e].geometry:null},r.setGeometry=function(e,n){t.isString(e)&&(e=JSON.parse(e));var a={type:"Feature",properties:i[n]?i[n].properties:null,geometry:e||null};r.set(a,n)},r.set=function(e,n){var r;t.isString(e)&&(e=JSON.parse(e)),e&&("GeometryCollection"==e.type?r=e.geometries.map(e=>_d.toFeature(e)):"FeatureCollection"==e.type?r=e.features:e=_d.toFeature(e),r?a=a.concat(r):a.push(e))},r.done=function(){if(0!==a.length)return Kv({type:"FeatureCollection",features:a})},r}function RM(e,t,n){var r=new qt(e),i="point"==t.geometry_type?function(e){return function(t){return e.containsPoint(t[0],t[1])?t:null}}(r):function(e,t){var n=e.toArray(),r=n[0],i=n[1],a=n[2],o=n[3];return function(n){if(!e.intersects(t.getSimpleShapeBounds(n)))return null;var s,u,c,f,l=!1,h=t.getShapeIter(n);for(h.hasNext()&&(s=h.x,u=h.y);h.hasNext();)if(c=s,f=u,!BE(s=h.x,u=h.y,c,f,r,i,a,o)){if(GE(s,u,c,f,r,i,a,o)){l=!0;break}if(fr.segmentIntersection(r,o,a,o,s,u,c,f)||fr.segmentIntersection(r,i,a,i,s,u,c,f)||fr.segmentIntersection(r,i,r,o,s,u,c,f)||fr.segmentIntersection(a,i,a,o,s,u,c,f)){l=!0;break}}return!l&&fr.testPointInRing(r,i,n,t)&&(l=!0),l?n:null}}(r,n);return i}function DM(e,t,n){var r=RM(e,t,n);return function(e){var n=t.shapes[e];if(!n)return!1;for(var i=0;i<n.length;i++)if(r(n[i]))return!0;return!1}}pp.divide=function(e,n,r,i){e.forEach(zi);var a=jE(e,n,r,i),o=Vp(a,i),s=a.layers.pop();Ri(s),n.arcs=a.arcs,e.forEach(function(e){!function(e,n,r,i){var a,o,s,u=new Vf(n.shapes,r.arcs),c=e.data?e.data.getRecords():[],f=[],l=[],h=[];function p(e,t,n){for(var r,i,u=0;u<e.length;u++)i=t[u],-1==(r=o.indexOf(i))?(o.push(i),a.push([e[u]]),s.push(n[u])):a[r].push(e[u])}function d(e){return e.sort().join(",")}function g(e){for(var t,n,r,i,a=[],o=[],s=[],c=null,f=0,l=e.length;f<l;f++)i=e[f],(n=d(t=u.findShapesEnclosingArc(Yt(i))))===c?r.push(i):(r=[i],a.push(r),o.push(n),s.push(t)),c=n;p(a,o,s)}e.shapes.forEach(function(e,n){var r=c[n]||{};if(!e)return f.push(null),void l.push(r);a=[],o=[],s=[],Cr(e,g),a.forEach(function(e,n){f.push(e),l.push(n>0?t.extend({},r):r),h.push(s[n])})}),e.shapes=f,e.data=new di(l),vM(e.data,n.data,function(e){return h[e]||[]},i)}(e,s,o,i)})},pp.dots=function(e,n,r){Ri(e),Array.isArray(r.fields)||bt("Missing required fields parameter"),_i(e)&&(r.fields.forEach(function(t,n){Pi(e,t)}),(r.copy_fields||[]).forEach(function(t){Pi(e,t)})),Array.isArray(r.colors)&&r.colors.forEach(_h);var i=e.data?e.data.getRecords():[],a=[],o=[];e.shapes.forEach(function(e,s){var u=i[s];if(u)for(var c=function(e,n,r,i){var a={shapes:[],attributes:[]};if(!e)return a;var o=i.fields.map(function(e){var t=r[e]||0;return i.per_dot>0&&(t=Math.round(t/i.per_dot)),t}),s=function(e){var t=[];return e.forEach(function(e,n){for(;e-- >0;)t.push(n)}),t}(o),u=function(e,n,r,i){for(var a=e.length>1?fy(e,n):[e],o=function(e,n,r){if(1===e.length)return[r];var i=e.map(function(e){return fr.getPlanarShapeArea(e,n)}),a=t.sum(i),o=r;return i.map(function(e,t){var n=e/a,r=Math.round(o*n);return o-=r,a-=e,r})}(a,n,r),s=[],u=0;u<a.length;u++)s=s.concat(CM(a[u],n,o[u],i));return s}(e,n,s.length,i);t.shuffle(s);for(var c,f,l,h,p=-1,d=!!i.multipart,g=0;g<u.length;g++)(l=u[g])&&(c=s[g],3===l.length&&i.debug&&(c=l.pop()),d&&c==p||(p=c,a.shapes.push(f=[]),h=TM(c,r,i),a.attributes.push(h)),f.push(l));return a}(e,n,u,r),f=0,l=c.shapes.length;f<l;f++)a.push(c.shapes[f]),o.push(c.attributes[f])});var s={geometry_type:"point",shapes:a,data:new di(o)};return Ui(s,e,null,r),[s]},pp.drop2=function(e,t,n){t.forEach(function(t){pp.drop(e,t.layers,t.dataset,n)})},pp.drop=function(e,t,n,r){var i=!1;t.forEach(function(t){var a=t.data&&r.fields,o=a&&Qr(a,t.data.getFields()),s=!a&&!r.geometry&&!r.holes||o&&r.geometry;r.geometry&&(i|=wi(t),delete t.shapes,delete t.geometry_type),r.holes&&"polygon"==t.geometry_type&&ad(t,n.arcs),s?e.deleteLayer(t,n):o?delete t.data:a&&r.fields.forEach(t.data.deleteField,t.data)}),i&&Io(n)},pp.filterGeom=function(e,t,n){xi(e)||bt("Layer is missing geometry"),n.bbox&&function(e,t,n){var r=RM(n.bbox,e,t);Pr(e.shapes,r)}(e,t,n),pp.filterFeatures(e,t,{remove_empty:!0,verbose:!1})};var jM=Object.freeze({__proto__:null,findShapesIntersectingBBox:function(e,t,n){for(var r=DM(e,t,n),i=[],a=0;a<t.shapes.length;a++)r(a)&&i.push(a);return i},getBBoxIntersectionTest:DM});function FM(e){var t=new Set(e);return function(e){return t.has(e)}}function UM(e,t){return e&&t?function(n){return e(n)&&t(n)}:e||t}pp.filterFeatures=function(e,n,r){var i,a=e.data?e.data.getRecords():null,o=e.shapes||null,s=ki(e),u=o?[]:null,c=a?[]:null,f=Fi(e,r),l=!!r.invert;return r.expression&&(i=ap(r.expression,e,n)),r.ids&&(i=UM(i,FM(r.ids))),r.remove_empty&&(i=UM(i,function(e,t){var n=e.shapes;if("polygon"==e.geometry_type)return function(e,t){return function(n){return!!e[n]&&fr.getPlanarShapeArea(e[n],t)>0}}(n,t);return function(e){return!!n[e]}}(e,n))),r.bbox&&(i=UM(i,DM(r.bbox,e,n))),i||bt("Missing a filter criterion"),t.repeat(s,function(e){var t=i(e);Ch(t),l&&(t=!t),!0===t&&(o&&u.push(o[e]||null),a&&c.push(a[e]||null))}),f.shapes=u,f.data=c?new di(c):null,r.no_replace&&(f=Bi(f)),!1===r.verbose||r.quiet||xt(t.format("Retained %,d of %,d features",ki(f),s)),f},pp.evaluateEachFeature=function(e,t,n,r){var i,a,o=ki(e),s=t.arcs,u=n||"",c={no_return:!0,geojson_editor:LM(u)?zM(e,t):null};o>0&&!e.data&&(e.data=new di(o)),r&&r.where&&(a=ap(r.where,e,s)),r&&r.ids&&(a=UM(a,FM(r.ids))),i=ap(u,e,s,c);for(var f=0;f<o;f++)a&&!a(f)||i(f);var l=c.geojson_editor?c.geojson_editor.done():null;l&&Co(e,t,l)};var BM={};function GM(e){"function"!=typeof e.command&&bt('Expected "command" parameter function'),e.target||bt('Missing required "target" parameter'),["layer","layers"].includes(e.target)||bt("Unrecognized command target type:",e.target)}function qM(e,t){var n,r=[],i=[],a=[],o=0;return e.forEach(function(e,u){!function(e,t){var u,c,f,l,h=!0,p=0;n=0;for(;e.hasNext();){if(!1===t(s,u=e.x,c=e.y,f,l,p++)){h=!1;break}f=u,l=c}h&&1==n&&(xt("An invalid arc was created"),h=!1);if(h)r.push(n);else{for(;n-- >0;)i.pop(),a.pop();r.push(0),o++}}(e,t)}),e.updateVertexData(r,i,a),o;function s(e){e&&(i.push(e[0]),a.push(e[1]),n++)}}function VM(e){var t=[],n=[];function r(e,t){for(var r=0;r<t.length;r++)e.push([n.length]),n.push(t[r])}function i(t){for(var n=[],r=e.arcs.getShapeIter(t);r.hasNext();)n.push([r.x,r.y]);return n}this.done=function(){e.layers=t,n.length&&(e.arcs=new Wa(n),Ka(e))},this.editLayer=function(n,a){var o=n.geometry_type;if(e.layers.indexOf(n)!=t.length&&vt("Layer was edited out-of-order"),o){var s=n.shapes.map(function(e,t){for(var n,s,u=[],c=0,f=e?e.length:0;c<f;c++)s="point"==o?e[c]:i(e[c]),n=a(s,c,e),Array.isArray(n)&&("point"==o?u.push(n):"polygon"!=o&&"polyline"!=o||r(u,n||[]));return u.length>0?u:null});t.push(Object.assign(n,{shapes:s}))}else t.push(n)}}function $M(e,t,n){if(function(e){for(var t,n,r,i=0,a=1,o=e.length;a<o;a++)n=e[a-1],r=e[a],(t=fr.distanceSq(n[0],n[1],r[0],r[1]))>i&&(i=t);return Math.sqrt(i)}(e)<t)return e;n||(n=JM(t));for(var r,i,a=[e[0]],o=1,s=e.length;o<s;o++)r=e[o-1],i=e[o],fr.distance2D(r[0],r[1],i[0],i[1])>t+1e-4&&WM(a,n(r,i)),a.push(i);return a}function JM(e){return function(t,n){for(var r=[],i=fr.distance2D(t[0],t[1],n[0],n[1]),a=Math.round(i/e)-1,o=(n[0]-t[0])/(a+1),s=(n[1]-t[1])/(a+1),u=1;u<=a;u++)r.push([t[0]+o*u,t[1]+s*u]);return r}}function WM(e,t){for(var n=0;n<t.length;n++)e.push(t[n])}function ZM(e,n){var r,i=function(e,n){var r=hr(e),i=e.getBounds(),a=function(e,n,r){for(var i=[.1,.2,.3,.4,.5,.6,.7,.8,.9],a=[],o=0;o<i.length;o++)for(var s=0;s<i.length;s++)a.push([i[o],i[s]]);var u=a.map(function(t){var i=e.xmin+e.width()*t[0],a=e.ymin+e.height()*t[1],o=r(i,a),s=r(i+n[0],a+n[1]);return o&&s?fr.distance2D(o[0],o[1],s[0],s[1]):1/0}).filter(function(e){return e<1/0});return u.length>0?t.findMedian(u):1/0}(i,r,n),o=function(e,t){var n=t(e.centerX(),e.centerY()),r=t(e.centerX(),e.ymin),i=t(e.xmax,e.centerY()),a=n&&r&&i?(fr.distance2D(n[0],n[1],r[0],r[1])+fr.distance2D(n[0],n[1],i[0],i[1]))/5e3:1/0;return a}(i,n),s=Math.min(a,o);s==1/0&&vt("Densification error");return s}(e,n),a=i*i*25;return qM(e,function(e,t,o,s,u,c){var f=r;if(!(r=n(t,o)))return!1;c>0&&fr.distanceSq(r[0],r[1],f[0],f[1])>a&&YM(s,u,f[0],f[1],t,o,r[0],r[1],n,i).forEach(e);e(r)})}function YM(e,t,n,r,i,a,o,s,u,c,f){var l=(e+i)/2,h=(t+a)/2,p=u(l,h);if(p)return f=f||[],fr.pointSegDistSq2(p[0],p[1],n,r,o,s)>c*c*.25&&fr.distance2D(e,t,i,a)>.01&&(YM(e,t,n,r,l,h,p[0],p[1],u,c,f),f.push(p),YM(l,h,p[0],p[1],i,a,o,s,u,c,f)),f}function HM(e){return!(!e||4!=e.length)&&(!e.some(isNaN)&&(e[0]<=e[2]!=0&&e[1]<=e[3]!=0))}function XM(e,t){if(t.width){e.data||Wi(e);var n=e.data.getRecords()[0]||{};n.width=eh(t.width),n.type="frame"}}function KM(e,t,n){var r=ia(e);return n.offset&&(e=function(e,t,n){var r=uh(e,n,t);return t.padBounds(r[0],r[1],r[2],r[3]),t}(n.offset,e,t)),e.area()>0==!1?null:(n.aspect_ratio&&(e=QM(n.aspect_ratio,e)),r&&(e=aa(e)),e)}function QM(e,t){var n,r,i=String(e).split(",").map(parseFloat),a=t.width()/t.height();return 1==i.length?i.push(i[0]):i[0]>i[1]&&i.reverse(),n=i[0],r=i[1],n||r?(n||(n=-1/0),r||(r=1/0),a<n?t.fillOut(n):a>r&&t.fillOut(r),t):t}function eI(e,t){var n=t||{},r=mi(e);return n.interval>0&&(r=$M(r,n.interval)),{type:"Polygon",coordinates:[r]}}pp.registerCommand=function(e,n){var r={name:e,options:n.options||[]};r.options.push({name:"target"}),t.defaults(r,n),GM(r),BM[e]=r},pp.runExternalCommand=function(e,t){var n=e.name,r=BM[n];r||bt("Unsupported command:",n);var i,a=r.target,o=function(e,t,n){var r=new Av,i=r.command(e);(t.options||[]).forEach(function(e){i.option(e.name,e)});var a=r.parseArgv(["-"+e].concat(n));return a[0]}(n,r,e._),s=t.findCommandTargets(o.target||"*"),u=s[0];u||bt("Missing a target"),"layer"==a&&(1!=u.layers.length||s.length>1)&&bt("This command only supports targeting a single layer"),s.length>1&&bt("Targetting layers from multiple datasets is not supported"),"layer"==a?i=r.command(u.layers[0],u.dataset,o.options):"layers"==a&&(i=r.command(u.layers,u.dataset,o.options)),i&&function(e,t,n,r){e.dataset&&e.layers&&e.layers.length>0!=!1||bt("Invalid command output");e.dataset==t.dataset&&bt("External commands are not currently allowed to modify input datasets");e.dataset.layers.length!=e.layers.length&&bt("Currently not supported: targetting a subset of output layers");r.no_replace||t.layers.forEach(function(e){n.deleteLayer(e,t.dataset)});n.addDataset(e.dataset)}(i,u,t,o)},pp.rectangles=function(e,n,r){var i,a=Ma(n),o=e.data?e.data.getRecords():null;r.bbox?i=function(e,t,n){for(var r,i=ap(e,t,n.arcs,{}),a=ki(t),o=[],s=0;s<a;s++)HM(r=i(s))||bt("Invalid bbox value (expected a GeoJSON-type bbox):",r),o.push(eI(r));return o}(r.bbox,e,n):(xi(e)||bt("Layer is missing geometric shapes"),i=function(e,t,n){var r=Ma(t);return e.shapes.map(function(i){var a="point"==e.geometry_type?$t(i):t.arcs.getMultiShapeBounds(i);return(a=KM(a,r.crs,n))?eI(a.toArray(),n):null})}(e,n,r));var s={type:"FeatureCollection",features:i.map(function(e,n){var i=o&&o[n]||null;return i&&r.no_replace&&(i=t.extend({},i)),{type:"Feature",properties:i,geometry:e}})},u=Kv(s,{});Ea(u,a);var c=to(n,[u]);return Ui(c[0],e,null,r),c},pp.rectangle2=function(e,t){if(1!=e.layers.length||!t.width||!Ai(e.layers[0],e.dataset.arcs)){var n=e.layers.map(function(n){var r=pp.rectangle({layer:n,dataset:e.dataset},t);return Ui(r.layers[0],n,null,t),t.no_replace||(r.layers[0].name=n.name||r.layers[0].name),r});return to(e.dataset,n)}XM(e.layers[0],t)},pp.rectangle=function(e,t){var n,r;t.bbox?(n=new qt(t.bbox),r=e&&Ma(e.dataset)||ia(n)&&wa("wgs84")||{}):e&&(n=Ji(e.layer,e.dataset.arcs),r=Ma(e.dataset)),(n=n&&KM(n,r.crs,t))&&n.hasBounds()||bt("Missing rectangle extent");var i=Kv({type:"Feature",properties:{},geometry:eI(n.toArray(),t)},{});return XM(i.layers[0],t),i.layers[0].name=t.name||"rectangle",Ea(i,r),i};var tI=Object.freeze({__proto__:null,applyAspectRatio:QM,bboxToPolygon:eI});function nI(e){return e||(e=["0"]),1==e.length?[e[0],e[0],e[0],e[0]]:(4!=e.length&&bt("List of offsets should have 4 values"),e)}pp.frame=function(e,n,r){var i,a,o,s;(r.width&&(i=eh(r.width))>0==!1&&bt("Invalid width parameter:",r.width),r.height&&(a=eh(r.height))>0==!1&&bt("Invalid height parameter:",r.height),i||a||(i=800,xt("Using default 800px frame width")),r.aspect_ratio&&(r.aspect_ratio>0==!1&&bt("Invalid aspect-ratio parameter:",r.aspect_ratio),a?i||(i=Bl(a*r.aspect_ratio,1)):a=Bl(i/r.aspect_ratio,1)),r.bbox)?s=r.bbox:(ka(t.pluck(n,"dataset"),"Targets include both projected and unprojected coordinates"),s=function(e){var t=Gh(e),n=t.reduce(function(e,t){return e.mergeBounds(Ji(t.layer,t.dataset.arcs))},new qt);return n.hasBounds()?n.toArray():null}(n),s||bt("Command target is missing geographical bounds"));!function(e,n){var r=function(e){return nI(e).map(e=>e.includes("%")?t.parsePercent(e):0)}(n),i=r[0],a=r[1],o=r[2],s=r[3],u=(e[2]-e[0])/(1-i-o),c=(e[3]-e[1])/(1-s-a);e[0]-=i*u,e[1]-=a*c,e[2]+=o*u,e[3]+=s*c}(s,r.offset||r.offsets),function(e,t,n,r){var i,a,o=function(e){return nI(e).map(e=>e.includes("%")?0:eh(e))}(r),s=o[0],u=o[1],c=o[2],f=o[3];t&&n&&function(e,t,n){var r=0,i=0,a=e[2]-e[0],o=e[3]-e[1];t/n>a/o?r=o*t/n-a:i=a*n/t-o;e[0]-=r/2,e[1]-=i/2,e[2]+=r/2,e[3]+=i/2}(e,t,n);a=e[2]-e[0],e[3],e[1],i=t?a/(t-s-c):a/(n-f-u);e[0]-=i*s,e[1]-=i*u,e[2]+=i*c,e[3]+=i*f}(s,i,a,r.offset||r.offsets),s[3]-s[1]>0!=!1&&s[2]-s[0]>0!=!1||bt("Frame has a collapsed bbox"),o=(s[2]-s[0])/(s[3]-s[1]),i?a||(a=Bl(i/o,1)):i=Bl(a*o,1);var u=Kv({type:"Feature",properties:{type:"frame",width:i,height:a},geometry:eI(s)});n.length>0&&Ea(u,Ma(n[0].dataset));u.layers[0].name=r.name||"frame",e.addDataset(u)};var rI=Object.freeze({__proto__:null,getAspectRatioArg:function(e,t){return t.split(",").map(function(t){var n=Number(t),r=Number(e);return t?r/n:""}).reverse().join(",")}});function iI(e,t){return function(n){return fr.countVerticesInPath(n,t)<=e}}function aI(e,t,n){for(var r=0,i=e.length;r<i;r++)if(n.arcIntersectsBBox(Yt(e[r]),t))return!0;return!1}function oI(e,t,n){for(var r,i,a=n.getSimpleShapeBbox(e),o=0,s=t.length;o<s;o++)if((r=t[o])&&r!=e&&aI(r,a,n)&&(i=n.getVertex(r[0],0),fr.testPointInRing(i.x,i.y,e,n)))return!0;return!1}function sI(e){return(e||[]).reduce(function(e,n){var r=n.split("="),i=t.trimQuotes(r[0]),a=r.length>1?t.trimQuotes(r[1]):i;return a&&i||bt("Invalid name assignment:",n),e[a]=i,e},{})}function uI(e){var t=Object.keys(e);return function(n){for(var r,i={},a=0,o=t.length;a<o;a++)r=t[a],i[e[r]]=n[r];return i}}function cI(e,t,n,r){var i=hI(e,t,n,r);return lI(e,n),bM(e,n.data,i,r)}function fI(e,t,n,r){var i=pI(e,t,n);return lI(e,t),bM(e,t.data,i,r)}function lI(e,t){e.data||(e.data=new di(e.shapes.length)),t.data||bt("Can't join a layer that is missing attribute data")}function hI(e,t,n,r){var i=pI(n,e,t),a=[],o=!!r.first_match;return n.shapes.forEach(function(e,t){for(var n,r=i(t),s=r?r.length:0,u=0;u<s&&((n=r[u])in a?a[n].push(t):a[n]=[t],!o);u++);}),function(e){return a[e]||null}}function pI(e,t,n,r){var i=new Vf(t.shapes,n),a=e.shapes;return function(e){var t=a[e],n=t?i.findEnclosingShapes(t[0]):[];return n.length>0?n:null}}pp.filterIslands=function(e,n,r){var i=t.extend({sliver_control:0},r),a=n.arcs,o=0;"polygon"==e.geometry_type&&(i.min_area||i.min_vertices?(o+=function(e,t,n){var r=0,i=new Uint8Array(t.size());dr(e.shapes,i);var a=function(e,a,o){if(1==e.length&&1===i[Yt(e[0])]&&(!n||n(e))&&!oI(e,o,t))return r++,null};return Pr(e.shapes,a),r}(e,a,i.min_area?lh(e,n,i).filter:iI(i.min_vertices,a)),i.remove_empty&&pp.filterFeatures(e,a,{remove_empty:!0,verbose:!1}),xt(t.format("Removed %'d island%s",o,t.pluralSuffix(o)))):xt("Missing a criterion for filtering islands; use min-area or min-vertices"))},pp.filterIslands2=function(e,n,r){var i=t.extend({sliver_control:0},r),a=n.arcs,o=0;"polygon"==e.geometry_type&&(i.min_area||i.min_vertices?(o+=function(e,t,n){var r=0,i=new Uint8Array(t.size());dr(e.shapes,i);var a=function(e,a,o){if(1==e.length&&1===i[Yt(e[0])]&&(!n||n(e))&&!oI(e,o,t))return r++,null};return Pr(e.shapes,a),r}(e,a,i.min_area?lh(e,n,i).filter:iI(i.min_vertices,a)),i.remove_empty&&pp.filterFeatures(e,a,{remove_empty:!0,verbose:!1}),xt(t.format("Removed %'d island%s",o,t.pluralSuffix(o)))):xt("Missing a criterion for filtering islands; use min-area or min-vertices"))},pp.filterFields=function(e,t,n){var r=e.data;if(Oi(r,t=t||[]),r){var i=sI(t);n.invert&&(i=function(e,t){return t.reduce(function(t,n){return n in e||(t[n]=n),t},{})}(i,r.getFields())),e.data.update(uI(i))}},pp.renameFields=function(e,n){var r=sI(n);Oi(e.data,Object.keys(r)),t.defaults(r,sI(e.data.getFields())),e.data.update(uI(r))},pp.filterPoints=function(e,n,r){Li(e),r.group_interval>0==!1&&bt("Expected a positive group_interval parameter");for(var i,a,o,s,u,c,f=j_(n,r.group_interval),l=Jt(e),h=P_.from(l).triangles,p=new Uint8Array(l.length),d=0,g=h.length;d<g;d+=3)s=h[d],u=h[d+1],c=h[d+2],i=l[s],a=l[u],o=l[c],f(i,a)&&f(a,o)&&f(i,o)&&(p[s]=1,p[u]=1,p[c]=1);!function(e,n){var r=e.data?e.data.getRecords():null,i=e.shapes||null,a=ki(e),o=i?[]:null,s=r?[]:null;t.repeat(a,function(e){var t=n(e);Ch(t),!0===t&&(i&&o.push(i[e]||null),r&&s.push(r[e]||null))}),e.shapes=o,e.data=s?new di(s):null}(e,function(e){return 1==p[e]})};var dI=Object.freeze({__proto__:null,getPolygonToPointsFunction:hI,joinPointsToPolygons:cI,joinPolygonsToPoints:fI,prepJoinLayers:lI});function gI(e,t){return t*Math.PI/180*function(e){return e.a*Math.sqrt(1-(e.es||0))}(e)}function mI(e){return e.params.proj.param}function yI(e){return!vI(e,"cassini,gnom,bertin1953,chamb,ob_tran,tpeqd,healpix,rhealpix,ocea,omerc,tmerc,etmerc,nicol")&&!function(e){return vI(e,"aeqd,gnom,laea,mil_os,lee_os,gs48,alsk,gs50,nsper,tpers,ortho,qsc,stere,ups,sterea")}(e)}function vI(e,t){return t.split(",").includes(mI(e))}function bI(e,t,n){var r=function(e,t){var n=_I(e,t);return function(e,t){return n([e,t])}}(t,n);e.layers.filter(Si).forEach(function(e){JI(e,r)}),e.arcs&&WI(e.arcs,r)}function _I(e,t){var n=(e[0]||0)*an,r=(e[1]||0)*an,i=(e[2]||0)*an;return function(e){return e[0]*=an,e[1]*=an,(t?wI:xI)(e,n,r,i),e[0]*=on,e[1]*=on,e}}function xI(e,t,n,r){return 0!=t&&SI(e,t),0===n&&0===r||AI(e,n,r,!1),e}function wI(e,t,n,r){return 0===n&&0===r||AI(e,n,r,!0),0!=t&&SI(e,-t),e}function SI(e,t){var n=e[0]+t;n>Math.PI?n-=2*Math.PI:n<-Math.PI&&(n+=2*Math.PI),e[0]=n}function AI(e,t,n,r){var i,a=Math.cos(t),o=Math.sin(t),s=Math.cos(n),u=Math.sin(n),c=Math.cos(e[1]),f=Math.cos(e[0])*c,l=Math.sin(e[0])*c,h=Math.sin(e[1]);r?(i=h*s-l*u,e[0]=Math.atan2(l*s+h*u,f*a+i*o),e[1]=Math.asin(i*a-f*o)):(i=h*a+f*o,e[0]=Math.atan2(l*s-i*u,f*a-h*o),e[1]=Math.asin(i*s+l*u))}function EI(e,t){Na(Ia(e))||bt("Command requires a lat-long dataset."),Array.isArray(t.rotation)&&t.rotation.length||bt("Invalid rotation parameter");var n=_I(t.rotation,t.invert),r=new VM(e);e.arcs&&e.arcs.flatten(),e.layers.forEach(function(e){var i=e.geometry_type;r.editLayer(e,function(e,t,n){var r;if("point"==e)return function(e){return e.forEach(t),e};if("polyline"==e)return function(e){return(e=$M(e,.5)).forEach(t),kx(e)};if("polygon"==e)return function(e,i,a){var o,s;if(!function(e){for(var t=0,n=e.length;t<n;t++)if(!Mx(e[t]))return!1;return!0}(e)?(e.forEach(Sx),(e=$M(e=Ix(e),.5,(s=JM(o=.5),function(e,t){var n;return n=Ax(e)||Ax(t)?[]:Ex(e,t)?function(e,t,n){var r,i,a=[],o=e[1]<t[1];e[0]!=t[0]&&vt("Expected an edge segment"),o?(r=e[1],i=t[1]):(r=t[1],i=e[1]);for(var s=Math.floor(r/n)*n+n;s<i;)a.push([e[0],s]),s+=n;return o||a.reverse(),a}(e,t,o):Lx(e,t)?[]:s(e,t),n}))).forEach(t)):e=$M(e,.5),0===i&&(r=[]),!(e.length<4))return xx(e[0],_x(e))||vt("Open polygon ring"),r.push(e),i==a.length-1?n.debug?r:Px(r):void 0;Ct("Short ring",e)};return null}(i,n,t))}),r.done(),t.debug||(Ka(e),$I(e))}function MI(e,t){for(var n=t.arcs,r=pr(e.shapes,n),i=[],a=[],o=0,s=n.size();o<s;o++)r(o)&&(i.push({arcid:o}),a.push([[o]]));return{geometry_type:"polyline",data:new di(i),shapes:a}}function II(e,t){for(var n,r=t.arcs,i={type:"FeatureCollection",features:[]},a=pr(e.shapes,r),o=0,s=r.size();o<s;o++)a(n=o)&&r.forEachArcSegment(n,u);function u(e,t,r,a){var o=r[e],s=a[e],u=r[t],c=a[t];i.features.push({type:"Feature",properties:{arc:n,i1:e,i2:t,x1:o,y1:s,x2:u,y2:c},geometry:{type:"LineString",coordinates:[[o,s],[u,c]]}})}var c=io([t,Kv(i,{})]);return t.arcs=c.arcs,c.layers.pop()}function kI(e){var t=[];return Wt(e,function(e){t.push(e.concat())}),{type:"LineString",coordinates:t}}function CI(e,n,r){var i,a=(r=r||{}).each?function(e,t,n){var r,i=DS(t,n)(o),a=sp(e,t,n);function o(e,t){a(e,t,r)}return function(e,t){return r=e,i(t[0][0]),e}}(r.each,e,n):null,o=DS(e,n,{where:r.where}),s=t.isArray(r.fields)?r.fields:[],u=0,c=[],f=[];return s.length>0&&!e.data&&bt("Missing a data table"),l(function(e,t){return NI(e,t(function(e,t){return-1==t?String(e):null}))}(e.shapes,o),"outer"),s.forEach(function(t){var n=e.data.getRecords();Pi(e,t),l(NI(e.shapes,o(function(e,r){var i=n[e],a=n[r];return i&&a&&i[t]!==a[t]?e+"-"+r:null})),t)}),l(OI(e.shapes,o),"inner"),Ui(i=PI(c,f),e,null,r),i;function l(e,n){var r=e.map(function(e,t){var r={RANK:u,TYPE:n};return a&&a(r,e),r});c=t.merge(e,c),f=t.merge(r,f),u++}}function PI(e,t){return{geometry_type:"polyline",shapes:e,data:t?new di(t):null}}function OI(e,t){return NI(e,t(function(e,t){return t>-1?e+"-"+t:null}))}function NI(e,t){var n,r=[],i={},a=null,o=null;return wr(e,function(e){var s,u,c=e.arcId,f=t(c);f&&(u=f in i?i[f]:null,s=f==o&&e.shapeId==a.shapeId&&e.partId==a.partId,u?s?u[u.length-1].push(c):u.push([c]):(u=[[c]],i[f]=u,r.push(u)),e.i==n.arcs.length-1&&u.length>1&&u[0][0]==n.arcs[0]&&(u[0]=u.pop().concat(u[0])));a=e,o=f},function(e){n=e}),r}pp.fuzzyJoin=function(e,n,r,i){var a=r?r.layer:null;a&&Si(a)||bt("Missing a point layer to join from"),Pi(a,i.field),Ri(e),i.dedup_points&&pp.uniq(a,null,{expression:'this.x + "~" + this.y + "~" + this.properties['+JSON.stringify(i.field)+"]",verbose:!1}),function(e,n,r,i){var a=i.field,o=hI(e,n,r,{first_match:!0}),s=function(e,t){var n=e.data.getRecords();return function(e){for(var r,i=[],a=0;a<e.length;a++)r=n[e[a]],i.push(r[t]);return i}}(r,a),u=[],c=[],f=[];if(e.shapes.forEach(function(e,t){var l=o(t)||[],h=lp(s(l),!0),p=h.margin>0?h.modes[0]:null;null===p&&h.modes.length>1&&(p=function(e,t,n,r,i,a){var o=e.map(function(){return 0});n.forEach(function(n){var s=t.shapes[n],u=t.data.getRecordAt(n)[r],c=e.indexOf(u);if(-1!==c){var f=function(e,t,n){var r=e[0];return fr.getPointToShapeDistance(r[0],r[1],t,n)}(s,i,a);o[c]+=f}});var s=Math.max.apply(null,o);return e[o.indexOf(s)]}(h.modes,r,l,a,e,n)),f[t]=h.count||0,i.no_dropouts&&c.push(h),u.push(p)}),vi(e,"join-count",f),vi(e,a,u),pp.dataFill(e,n,{field:a,weight_field:"join-count",contiguous:i.contiguous}),i.no_dropouts){var l=function(e,n,r){var i=ai(n.data.getRecords(),r),a=ai(e.data.getRecords(),r);return t.difference(i,a)}(e,r,a);l.length>0&&function(e,n,r,i){var a=e.data.getRecords(),o=[],s=[];r.map(function(e){var t=function(e,t){var n=-1,r=0;return t.forEach(function(t,i){var a=t.values.indexOf(e),o=a>-1?t.counts[a]:0;o>r&&(n=i,r=o)}),n}(e,i);t>-1&&-1===s.indexOf(t)?(a[t][n]=e,s.push(t)):o.push(e)}),xt("Restored",s.length,"dropout value"+t.pluralSuffix(s.length)),o.length>0&&xt("Failed to restore dropout value(s):",o.join(", "))}(e,a,l,c)}}(e,n,a,i)},pp.rotate=EI,pp.lines=function(e,n,r){return(r=r||{}).callouts?(Ti(e),function(e,t,n){var r=e.data?e.data.getRecords():null,i=Ji(e).width()/50,a=function(e){return[e,[e[0]+i,e[1]]]},o={type:"FeatureCollection",features:e.shapes.map(function(e,t){return{type:"Feature",properties:r?r[t]:null,geometry:{type:"MultiLineString",coordinates:e.map(a)}}})},s=Kv(o),u=to(t,[s]);return Ui(u[0],e.name,null,n),u}(e,n,r)):"point"==e.geometry_type?function(e,n,r){var i=r.groupby?function(e,n,r){var i,a=[],o=xp([n],e.data),s=t.defaults({fields:[n]},r),u=Sp(e.data.getRecords(),o,s);return e.shapes.forEach(function(e,t){var n=o(t);n in a==!1&&(a[n]=[]),a[n].push(e)}),i=a.map(function(e,t){return{type:"Feature",properties:u[t],geometry:e.length>1?kI(e):null}}),{type:"FeatureCollection",features:i}}(e,r.groupby,r):kI(e.shapes),a=Kv(i),o=to(n,[a]);return Ui(o[0],e,null,r),o}(e,n,r):r.segments?[II(e,n)]:r.arcs?[MI(e,n)]:"polygon"==e.geometry_type?CI(e,n.arcs,r):void Ri(e,"Command requires a polygon or point layer")};var TI=Object.freeze({__proto__:null,createLineLayer:PI,extractInnerLines:OI,polygonsToLines:CI});function LI(e,t,n){var r;return vI(t,"stere,sterea,ups,ortho,gnom,laea,nsper,tpers,geos,nicol")||n.clip_angle||t.clip_angle?r=function(e,t,n){var r=n.clip_angle||t.clip_angle||function(e){var t=mI(e);if("nsper"==t||"geos"==t)return function(e){var t=parseFloat(e.params.h.param);if(!t||t<0)return 0;var n=180*Math.acos(e.a/(e.a+t))/Math.PI;return n*=.995}(e);if("tpers"==t)return xt("Automatic clipping is not supported for the Tilted Perspective projection"),0;return{gnom:60,laea:179,ortho:89.85,nicol:89.85,stere:142,sterea:142,ups:10.5}[t]||0}(t);if(!r)return null;Mt(`Using clip angle of ${+r.toFixed(2)} degrees`);var i=function(e,t){return gI(e,t)}(e,r),a=function(e){var t=180/Math.PI;return[e.lam0*t,e.phi0*t]}(t);t.clip_angle=r;var o=Fx(a,i,0,n);return Kv(o)}(e,t,n):(function(e){return vI(e,"merc,bertin1953")}(t)||n.clip_bbox)&&(r=RI(t,n)),r||null}function zI(e,t,n){var r=LI(e,t,n);return r||(r=RI(t,{clip_bbox:[-180,-90,180,90]})),VI(r,e,t,{no_clip:!1,quiet:!0}),r}function RI(e,t){var n=t.clip_bbox||DI(e),r=function(e){var t=mI(e);if("bertin1953"==t)return[-16.5,-42];if(("tmerc"==t||"utm"==t||"etmerc"==t)&&0!==e.lam0)return[180*e.lam0/Math.PI];return null}(e);n||vt("Missing expected clip bbox.");var i=Kv(eI(n,t=Object.assign({interval:.5},t)));return r&&EI(i,{rotation:r,invert:!0}),i}function DI(e){var t=.001,n=[-179,-90,179,90];return{tmerc:n,utm:n,etmerc:n,merc:[-180,-89,180,89],lcc:[-180,-89,180,89],bertin1953:[-180+t,-90+t,180-t,90-t]}[mI(e)]}function jI(e,n,r,i){if(!Na(n)||i.no_clip)return!1;var a,o,s,u=function(e,t,n){var r=oa(180*n.lam0/Math.PI);if(e.arcs&&(i=n,yI(i)&&0!==i.lam0)&&function(e,t){var n=0;return e.arcs.forEachSegment(function(e,r,i,a){var o=i[e],s=i[r];(o<=t&&s>=t||o>=t&&s<=t)&&n++}),n>0}(e,r))return function(e,t){var n=e.layers.filter(wi);if(0===n.length)return;var r=1e-8,i=[t-r,-91,t+r,91],a=Kv(eI(i,{interval:.5}));$E(n,a,e,"erase")}(e,r),ho(e),!0;var i;return!1}(e,0,r),c=!1,f=(vI(o=r,"merc,lcc")&&(s=DI(o)),s);return f?function(e,n){No(e,function(e,r){return[t.clamp(e,n[0],n[2]),t.clamp(r,n[1],n[3])]})}(e,f):a=function(e,t,n){return LI(e,t,n)}(n,r,i),a&&(c=function(e,t){var n=e.layers.filter(function(n){return xi(n)&&!function(e,t,n){var r=Ji(e,t.arcs),i=!1;return n.layers[0].shapes.forEach(function(e,t){i=i||kn(r,e,n.arcs)}),i}(n,e,t)});if(n.length>0)return $E(n,t,e,"clip"),!0;return!1}(e,a)),u||c}function FI(e,t){var n,r,i,a,o;return e in s("mproj").internal.pj_list==!1?e:(i=["lcc","aea"].includes(e),a=["tmerc","etmerc"].includes(e),n="+proj="+e,(i||a)&&(r=function(e){Na(Ia(e))||bt("Expected unprojected data");return wo(e).toArray()}(t),o=$l(r),xt(`Converted "${e}" to "${n+=" "+(a?BI(r,o):UI(r,o))}"`)),n)}function UI(e,t){var n=(e[0]+e[2])/2,r=e[3]-e[1],i=e[1]+1/6*r,a=e[1]+5/6*r;return`+lon_0=${n.toFixed(t)} +lat_1=${i.toFixed(t)} +lat_2=${a.toFixed(t)}`}function BI(e,t){var n=(e[0]+e[2])/2,r=(e[1]+e[3])/2;return`+lon_0=${n.toFixed(t)} +lat_0=${r.toFixed(t)}`}var GI=Object.freeze({__proto__:null,expandProjDefn:FI,getCenterParams:BI,getConicParams:UI});function qI(e,t){var n,r,i={};return/\.prj$/i.test(e)?((n=Xb(e,{}))&&(i.prj=n.info.prj,i.crs=Ra(i.prj)),i):t&&(r=t.findSingleLayer(e))?Ma(n=r.dataset):wa(e)}function VI(e,t,n,r){var i=ha(t,n),a=0,o=0,s=jI(e,t,n,r);e.layers.forEach(function(e){Si(e)&&(o+=JI(e,i))}),e.arcs&&(a=r.densify?ZM(e.arcs,i):ZI(e.arcs,i)),s&&$I(e),a>0&&!r.quiet&&xt(`Removed ${a} ${1==a?"path":"paths"} containing unprojectable vertices.`),o>0&&!r.quiet&&xt(`Removed ${o} unprojectable ${1==o?"point":"points"}.`),e.info.crs=n}function $I(e){vd(e.layers.filter(e=>"polygon"==e.geometry_type),e,{allow_overlaps:!0,rebuild_topology:!0,no_arc_dissolve:!0,quiet:!0,verbose:!1}),ho(e)}function JI(e,t){var n=0;return Pr(e.shapes,function(e){var r=t(e[0],e[1]);return r||n++,r}),n}function WI(e,t){for(var n,r=e.getVertexData(),i=r.xx,a=r.yy,o=r.zz,s=e.getRetainedInterval(),u=0,c=i.length;u<c;u++)(n=t(i[u],a[u]))||vt("Unprojectable point:",i[u],a[u]),i[u]=n[0],a[u]=n[1];e.updateVertexData(r.nn,i,a,o),e.setRetainedInterval(s)}function ZI(e,t){return qM(e,function(e,n,r,i,a,o){var s=t(n,r);if(!s)return!1;e(s)})}pp.proj=function(e,n,r){var i,a;r.init&&((i=qI(r.init,n)).crs||bt("Unknown projection source:",r.init),Ea(e,i)),r.match?a=qI(r.match,n):r.crs&&(a=wa(FI(r.crs,e))),a&&function(e,n,r){var i=qc(),a=[],o={info:e.info||{}};n.crs||bt("Missing projection data");if(!Ao(e))return void Ea(e,n);var s=Ma(e);s.crs||bt("Unable to project -- source coordinate system is unknown");if(ya(s.crs,n.crs))return void xt("Source and destination CRS are the same");e.arcs&&(e.arcs.flatten(),o.arcs=i?e.arcs.getCopy():e.arcs);o.layers=e.layers.map(function(e){return i&&(a.push(e),e=Gi(e)),e}),VI(o,s.crs,n.crs,r||{}),Ea(o,n),e.arcs=o.arcs,a.forEach(function(e,n){t.extend(e,o.layers[n])})}(e,a,r)};var YI=Object.freeze({__proto__:null,cleanProjectedPathLayers:$I,fetchCrsInfo:qI,projectArcs:WI,projectArcs2:ZI,projectDataset:VI,projectPointLayer:JI});function HI(e,n,r){var i=r.interval||10;Math.round(i)==i&&i>0!=!1||bt("Invalid interval:",i),e.lam0,Math.PI;var a=i>10?1:.5,o=i,s=i,u=Math.round(360/o),c=Math.round(180/s)+1,f=t.range(u,-180+o,o),l=t.range(c,-90,s),h=[],p=[],d=function(e){return yI(e)}(e)?function(e){var t=function(e){return 0===e.lam0?180:oa(180*e.lam0/Math.PI)}(e),n=2e-8;return 180==t?[-180,180]:[t-n,t+n]}(e):null;return f.forEach(function(e){d&&(g(e,d[0])||g(e,d[1]))||m(e,e%90==0)}),d&&!n&&(m(d[0],!0),m(d[1],!0)),l.forEach(function(e){!function(e){var t=$M([[-180,e],[180,e]],a);p.push(KI(t,{type:"parallel",value:e}))}(e)}),{type:"FeatureCollection",features:h.concat(p)};function g(e,t){return Math.abs(e-t)<i/5}function m(e,t){var n=s<=15?s:0;y(e,-90+n,90-n),t&&n>0&&(y(e,-90,-90+n),y(e,90-n,90))}function y(e,t,n){var r=$M([[e,t],[e,n]],a);h.push(KI(r,{type:"meridian",value:XI(e)}))}}function XI(e){return+e.toFixed(3)||0}function KI(e,t){return{type:"Feature",properties:t,geometry:{type:"LineString",coordinates:e}}}function QI(e){return ak(e).length>0}function ek(e){var t=rk(e);t.active=!0,t.complete=!0}function tk(e){rk(e).active=!1}function nk(e){return rk(e).complete}function rk(e){var t=ak(e);return t[t.length-1]}function ik(e){var t=ak(e);return 0===t.length||t.every(e=>e.active)}function ak(e){return e.control=e.control||{stack:[]},e.control.stack}function ok(e,t){!nk(e)&&function(e,t){return!t.expression||gM(t.expression,e,t)()}(e.catalog,t)?ek(e):tk(e)}function sk(e,n,r,i){var a=jE([e],n,r,i),o=Vp(a,i),s=a.layers.pop();n.arcs=a.arcs,lI(e,s);var u=new fd({shapes:e.shapes.concat(s.shapes)},o,{flat:!1}),c=t.extend({},i);c.min_overlap_area&&(c.min_overlap_area=ih(c.min_overlap_area,Ia(n)));var f=function(e,n,r,i){var a,o,s,u=function(e,t){return function(n){for(var r,i=[],a=0;a<n.length;a++)(r=n[a]-e)>=0&&r<t&&i.push(r);return i}}(e.shapes.length,n.shapes.length);i.largest_overlap&&(a=function(e,n){var r=e.shapes.length;return function(e,i){var a=n.getTileIdsByShapeId(e),o=0,s=-1;return i.forEach(function(e,i){var u=n.getTileIdsByShapeId(e+r),c=fk(t.intersection(a,u),n);c>=o&&(s=e,o=c)}),-1==s&&vt("Geometry error"),[s]}}(e,r));i.min_overlap_pct&&(s=function(e,n,r){r.nodes.arcs;var i=n.shapes.length;return function(n,a){var o=r.getTileIdsByShapeId(n),s=fk(o,r);return a.filter(function(n,a){var u=r.getTileIdsByShapeId(n+i);return(fk(t.intersection(o,u),r)/s||0)>=e})}}(i.min_overlap_pct,e,r));i.min_overlap_area&&(o=function(e,n,r){r.nodes.arcs;var i=n.shapes.length;return function(n,a){var o=r.getTileIdsByShapeId(n);return a.filter(function(n,a){var s=r.getTileIdsByShapeId(n+i);return fk(t.intersection(o,s),r)>=e})}}(i.min_overlap_area,e,r));return function(e){for(var n,c=r.getTileIdsByShapeId(e),f=[],l=0;l<c.length;l++)n=r.getSourceIdsByTileId(c[l]),n=u(n),f=f.length>0?f.concat(n):n;return(f=t.uniq(f)).length>1&&i.largest_overlap&&(f=a(e,f)),o&&(f=o(e,f)),s&&(f=s(e,f)),f}}(e,s,u,c),l=bM(e,s.data,f,c);return i.interpolate&&(i.duplication&&bt("duplication and interpolate options cannot be used together"),function(e,t,n,r){var i=function(e,t,n,r){var i=r.planar?fr.getPlanarShapeArea:fr.getShapeArea,a=e.shapes.length,o=n.mosaic,s=n.nodes.arcs,u=o.map(function(e,t){return{area:i(e,s),weights:null,sourceIds:null}});return t.shapes.forEach(function(e,t){for(var r,o,c=n.getTileIdsByShapeId(t+a),f=i(e,s),l=0;l<c.length;l++)o=(r=u[c[l]]).area/f,r.weights||(r.weights=[],r.sourceIds=[]),r.weights.push(o),r.sourceIds.push(t)}),u}(e,t,n,r),a=r.interpolate,o=t.data.getRecords(),s=[],u=[];a.forEach(function(e){var t=ei(e,o);"number"==t?s.push(e):"string"==t||"boolean"==t?u.push(e):xt(`"${e}" field appears to contain ${t}-type data. No interpolation method is available.`)}),e.data.getRecords().forEach(function(e,t){var r,c,f=n.getTileIdsByShapeId(t),l=[];for(r=0;r<f.length;r++)l.push(i[f[r]]);for(r=0;r<s.length;r++)e[c=a[r]]=uk(c,l,o);for(r=0;r<u.length;r++)e[c=a[r]]=ck(c,l,o)})}(e,s,u,i)),l}function uk(e,t,n){for(var r,i,a=0,o=0;o<t.length;o++)if((r=t[o]).sourceIds)for(var s=0;s<r.sourceIds.length;s++)i=n[r.sourceIds[s]],a+=r.weights[s]*i[e];return a}function ck(e,t,n){for(var r,i,a,o=[],s=[],u=0;u<t.length;u++)if((i=t[u]).sourceIds)for(var c=0;c<i.sourceIds.length;c++)r=n[i.sourceIds[c]][e],-1==(a=s.indexOf(r))?(s.push(r),o.push(i.area)):o[a]+=i.area;var f=Math.max.apply(null,o),l=o.indexOf(f);return-1==l?null:s[l]}function fk(e,t){for(var n=t.nodes.arcs,r=0,i=0;i<e.length;i++)r+=fr.getShapeArea(t.mosaic[e[i]],n);return r}function lk(e,t,n){if(!e)return null;var r=e.map(function(e){return function(e,t){var n=bn(e,t,!1)/2,r=0,i=null;xr(e,t,function(e,t,a,o){var s=a[e],u=o[e],c=a[t],f=o[t];if(!i){if(n>0==!1)return[s,u];var l,h=cn(s,u,c,f);r+h>=n&&(i=[(1-(l=(n-r)/h))*s+l*c,(1-l)*u+l*f]),r+=h}}),i||Ct("[findPathMidpoint()] defective path:",e);return i}(e,t)});return r}function hk(e,t,n){var r=!t.isPlanar(),i=e?1==e.length?e[0]:function(e,t,n){var r=0,i=null;return e.forEach(function(e){var a=fr.calcPathLen(e,t,n);a>r&&(r=a,i=e)}),i}(e,t,r):null;if(!i)return null;var a=t.getSimpleShapeBounds(i);return sl(a.centerX(),a.centerY(),[i],t,r)}function pk(e,t,n){var r=n.inner?zh:fr.getShapeCentroid;return e.shapes.map(function(e){var n=r(e,t);return n?[[n.x,n.y]]:null})}function dk(e){var n;if(t.isFiniteNumber(e))return e;if(t.isString(e)&&""!==e){if(n=+e,t.isFiniteNumber(n))return n;if(n=Mh(e),t.isFiniteNumber(n))return n}return NaN}function gk(e){var n=/^(lng|long?|longitude|x)$/i;return t.find(e,function(e){return n.test(e)})}function mk(e){var n=/^(lat|latitude|y)$/i;return t.find(e,function(e){return n.test(e)})}function yk(e,t){return e||bt("Layer is missing a data table"),t.x&&t.y&&e.fieldExists(t.x)&&e.fieldExists(t.y)||bt("Missing x,y data fields"),e.getRecords().map(function(e){var n=dk(e[t.x]),r=dk(e[t.y]);return isNaN(n)||isNaN(r)?null:[[n,r]]})}pp.graticule=function(e,t){var n,r,i=t.name||t.polygon&&"polygon"||"graticule";return e&&!Ta(e)?((r=Ma(e)).crs||bt("Coordinate system is unknown, unable to create a graticule"),n=t.polygon?function(e,t){var n=Sa("wgs84");return zI(n,e,t)}(r.crs,t):function(e,t){var n=Sa("wgs84"),r=function(e,t,n){var r=LI(e,t,n);return r&&(VI(r,e,t,{no_clip:!1,quiet:!0}),r.layers[0].geometry_type="polyline"),r||null}(n,e,{}),i=Kv(HI(e,!!r,t));VI(i,n,e,{no_clip:!1}),r&&(i=function(e,t){var n=io([e,t]),r=n.layers.pop(),i=n.layers[0],a=i.data.getRecords();return r.shapes.forEach(function(e){i.shapes.push(e),a.push({type:"outline",value:null})}),n}(i,r));return Ka(i),vd(i.layers,i,{verbose:!1}),i}(r.crs,t),Ea(n,r)):(n=t.polygon?function(e){var t=Sa("wgs84");return zI(t,t,e)}(t):function(e){var t=Sa("wgs84"),n=Kv(HI(t,!1,e));return n}(t),Ea(n,wa("wgs84"))),n.layers[0].name=i,n},pp.printHelp=function(e){Et(Mv().getHelpMessage(e.command))},pp.if=function(e,t){!function(e){ak(e).push({active:!1,complete:!ik(e)})}(e),ok(e,t)},pp.elif=function(e,t){QI(e)||bt("-elif command must be preceded by an -if command."),ok(e,t)},pp.else=function(e){QI(e)||bt("-else command must be preceded by an -if command."),nk(e)?tk(e):ek(e)},pp.endif=function(e){QI(e)||bt("-endif command must be preceded by an -if command."),function(e){ak(e).pop()}(e)},pp.ignore=function(e,t,n){n.empty&&Ci(e)&&_t("Layer is empty, stopping processing")},pp.include=function(e){var n,r,a;if(e.file||bt("Missing name of a JS file to load"),Lf.checkFileExists(e.file,e.input),"string"==typeof(n=Lf.readFile(e.file,"utf8",e.input))){/^\s*\{[\s\S]*\}\s*$/.test(n)||bt("Expected a JavaScript object containing key:value pairs");try{(a=np()).require=require,r=Function("ctx","with(ctx) {return ("+n+");}").call({},a)}catch(e){bt(e.name,"in JS source:",e.message)}}else"object"==typeof n&&(r=n);t.extend(i("defs"),r)},pp.inlay=function(e,t,n,r){var i=jE(e,n,t,r),a=i.layers[i.layers.length-1];Ri(a),e.forEach(Ri);var o={layer:Bi(a),dataset:i},s=pp.eraseLayers(e,o,i,r).map(function(e){var t=Bi(a),n=pp.mergeLayers([e,t],{force:!0})[0];return n.name=e.name,n});return n.arcs=i.arcs,s},pp.innerlines=function(e,t,n){n=n||{},Ri(e);var r=DS(e,t,{where:n.where}),i=OI(e.shapes,r),a=PI(i,null);return 0===i.length&&xt("No shared boundaries were found"),Ui(a,e,null,n),a},pp.inspect=function(e,n,r){var i,a=function(e,n,r){var i,a=ki(e),o=[];r.expression||bt("Missing a JS expression for selecting a feature");return i=ap(r.expression,e,n),t.repeat(a,function(e){var t=i(e);Ch(t,"Expression must return true or false"),!0===t&&o.push(e)}),o}(e,n,r);i=1==a.length?function(e,n,r){var i="Feature "+e+"\n";return i+=function(e,n,r){var i,a,o=n.shapes?n.shapes[e]:null,s=n.geometry_type;if(!o||!s)return"Geometry: [null]\n";a="Geometry\n Type: "+s+"\n","point"==s?a+=" Points: "+o.length+"\n":"polyline"==s?a+=" Parts: "+o.length+"\n":"polygon"==s&&(i=function(e,t){for(var n,r={rings:e.length,cw:0,ccw:0,area:0},i=0;i<e.length;i++)(n=fr.getPlanarPathArea(e[i],t))>0?r.cw++:n<0&&r.ccw++,r.area+=n;t.isPlanar()||(r.sph_area=fr.getSphericalShapeArea(e,t));return r}(o,r),a+=t.format(" Rings: %d cw, %d ccw\n",i.cw,i.ccw),a+=" Planar area: "+i.area+"\n",i.sph_area&&(a+=" Spherical area: "+i.sph_area+" sq. meters\n"));return a}(e,n,r),i+=oM(aM(n,e)),i}(a[0],e,n):t.format("Expression matched %d feature%s. Select one feature for details",a.length,t.pluralSuffix(a.length)),xt(i)},pp.createPointLayer=function(e,n,r){var i=Fi(e,r),a=n.arcs;r.intersections?(!function(e){var t=e.getFilteredPointCount(),n=e.size(),r=t-n,i=Ol(e),a=Math.ceil(i/10),o=10*i,s=Nl(e);console.log("points:",t,"arcs:",n,"segs:",r),[a,i,o,s].forEach(function(t){console.time(t+" stripes"),Il(e,{stripes:t}),console.timeEnd(t+" stripes")})}(a),i=e):r.interpolated?i.shapes=function(e,t,n){var r,i=oh(n.interval,Ia(t));i>0==!1&&bt("Invalid interpolation interval:",n.interval);"polyline"!=e.geometry_type&&bt("Expected a polyline layer");return e.shapes.map(function(e,t){return r=[],e&&e.forEach(a),r.length>0?r:null});function a(e){var n=function(e,t,n){var r,i,a,o,s,u=t.getShapeIter(e),c=t.isPlanar()?fr.distance2D:fr.greatCircleDistance,f=[],l=0;u.hasNext()&&(f.push([u.x,u.y]),r=u.x,i=u.y);for(;u.hasNext();){for(a=c(r,i,u.x,u.y);l+a>=n;)o=(n-l)/a,s=H_(r,i,u.x,u.y,o),l=0,f.push(s),a=c(r=s[0],i=s[1],u.x,u.y);l+=a,r=u.x,i=u.y}l>0&&f.push([r,i]);return f}(e,t.arcs,i);r=r.concat(n)}}(e,n,r):r.vertices?i.shapes=function(e,t){var n,r;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],r={},(e||[]).forEach(a),n.length>0?n:null});function i(e){var t=e.x+"~"+e.y;t in r==!1&&(r[t]=!0,n.push([e.x,e.y]))}function a(e){for(var n=t.getShapeIter(e);n.hasNext();)i(n)}}(e,a):r.vertices2?i.shapes=function(e,t){var n;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],(e||[]).forEach(r),n.length>0?n:null});function r(e){for(var r=t.getShapeIter(e);r.hasNext();)n.push([r.x,r.y])}}(e,a):r.endpoints?i.shapes=function(e,t){var n,r;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],r={},(e||[]).forEach(a),n.length>0?n:null});function i(e){var t=e.x+"~"+e.y;t in r==!1&&(r[t]=!0,n.push([e.x,e.y]))}function a(e){for(var n=0;n<e.length;n++)i(t.getVertex(e[n],0)),i(t.getVertex(e[n],-1))}}(e,a):r.x||r.y?i.shapes=yk(e.data,r):"polygon"==e.geometry_type?i.shapes=pk(e,a,r):r.midpoints?(zi(e),i.shapes=function(e,t){return e.shapes.map(function(e){return lk(e,t)})}(e,a)):"polyline"==e.geometry_type?i.shapes=function(e,t){return e.shapes.map(function(e){var n=hk(e,t);return n?[[n.x,n.y]]:null})}(e,a):e.geometry_type?bt("Expected a polygon or polyline layer"):i.shapes=function(e){var t=e?e.getFields():[],n={x:gk(t),y:mk(t)};return yk(e,n)}(e.data),i.geometry_type="point";var o=i.shapes.reduce(function(e,t){return t||e++,e},0);return o>0&&xt(t.format("%,d of %,d points are null",o,i.shapes.length)),e.data&&(i.data=r.no_replace?e.data.clone():e.data),i};var vk=Object.freeze({__proto__:null,coordinateFromValue:dk,findXField:gk,findYField:mk,pointsFromPolygons:pk});function bk(e,t){return{geometry_type:"point",shapes:pk(e,t.arcs,{inner:!0}),data:e.data}}function _k(e,t,n,r){return r.point_method?function(e,t,n,r){var i,a,o=n.layer,s=n.dataset;return e.shapes.length>o.shapes.length?(a=fI(i=bk(e,t),o,s.arcs,r),e.data=i.data):(i=bk(o,s),a=cI(e,t.arcs,i,r)),a}(e,t,n,r):sk(e,t,n,r)}function xk(e,t){return{geometry_type:"point",shapes:e.shapes.map(function(e){return lk(e,t.arcs)}),data:e.data}}function wk(e){e.point_method||bt('The "point-method" flag is required for polyline-polygon joins')}class Sk{constructor(e=[],t=Ak){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,r=t[e];for(;e>0;){const i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=t[r];const o=r+1;if(o<this.length&&n(t[o],a)<0&&(r=o,a=t[o]),n(a,i)>=0)break;t[e]=a,e=r}t[e]=i}}function Ak(e,t){return e<t?-1:e>t?1:0}var Ek=Math.PI/180;function Mk(e,t,n,r){var i=r.minLng,a=r.maxLng,o=r.minLat,s=r.maxLat;if(e>=i&&e<=a)return t<o?kk((t-o)*Ek):t>s?kk((t-s)*Ek):0;var u=Math.min(kk((e-i)*Ek),kk((e-a)*Ek)),c=function(e,t){var n=1-2*t;return n<=0?e>0?90:-90:Math.atan(Math.tan(e*Ek)/n)/Ek}(t,u);return c>o&&c<s?Ck(u,n,t,c):Math.min(Ck(u,n,t,o),Ck(u,n,t,s))}function Ik(e,t){return e.dist-t.dist}function kk(e){var t=Math.sin(e/2);return t*t}function Ck(e,t,n,r){return t*Math.cos(r*Ek)*e+kk((n-r)*Ek)}function Pk(e,t,n,r,i){return Ck(kk((e-n)*Ek),i,t,r)}function Ok(e,t,n){Li(e);var r=Jt(e),i=n.max_distance?ah(n.max_distance,t):.001,a=function(e,t,n){var r=!!t&&Na(t),i=t&&t.to_meter||1;if(r)return function(t){return function(e,t,n,r,i){var a=1,o=[];void 0===r&&(r=1/0),void 0!==i&&(a=kk(i/6371));for(var s,u,c,f=new Sk([],Ik),l={left:0,right:e.ids.length-1,axis:0,minLng:-180,minLat:-90,maxLng:180,maxLat:90},h=Math.cos(n*Ek);l;){if((s=l.right)-(u=l.left)<=e.nodeSize)for(var p=u;p<=s;p++)c=e.points[e.ids[p]],f.push({i:e.ids[p],item:c,dist:Pk(t,n,e.coords[2*p],e.coords[2*p+1],h)});else{var d=u+s>>1,g=e.coords[2*d],m=e.coords[2*d+1];c=e.points[e.ids[d]],f.push({i:e.ids[d],item:c,dist:Pk(t,n,g,m,h)});var y=(l.axis+1)%2,v={left:u,right:d-1,axis:y,minLng:l.minLng,minLat:l.minLat,maxLng:0===l.axis?g:l.maxLng,maxLat:1===l.axis?m:l.maxLat,dist:0},b={left:d+1,right:s,axis:y,minLng:0===l.axis?g:l.minLng,minLat:1===l.axis?m:l.minLat,maxLng:l.maxLng,maxLat:l.maxLat,dist:0};v.dist=Mk(t,n,h,v),b.dist=Mk(t,n,h,b),f.push(v),f.push(b)}for(;f.length&&f.peek().item;){var _=f.pop();if(_.dist>a)return o;if(o.push(_.i),o.length===r)return o}l=f.pop()}return o}(e,t[0],t[1],1/0,n/1e3)};return function(t){return e.within(t[0],t[1],n/i)}}(new(s("kdbush"))(r),t,i),o=new Ml(r.length);this.lookupByMultiPoint=function(e){var t,n,r,i,s=[];for(n=0,i=e?e.length:0;n<i;n++)for(t=e[n],s=a(t),r=0;r<s.length;r++)o.setId(s[r]);return s=o.getIds(),o.clear(),s}}function Nk(e,t,n,r){var i=function(e,t,n,r){var i=e.shapes,a=new Ok(t,n,r);return function(e){var t=a.lookupByMultiPoint(i[e]);return t.length>0?t:null}}(e,t,n,r);return lI(e,t),bM(e,t.data,i,r)}function Tk(e,t,n){var r=n.keys,i=r[0],a=r[1],o=function(e,t,n,r){e||bt("Target layer is missing an attribute table");n||bt("Source layer is missing an attribute table");var i,a,o=e.getRecords(),s=n.getRecords(),u=function(e,t){for(var n,r={},i=0,a=e.length;i<a;i++)(n=e[i][t])in r==!1?r[n]=i:Array.isArray(r[n])?r[n].push(i):r[n]=[r[n],i];return r}(s,r);if(0==s.length)return function(e){return[]};Pi(n,r,"External table is missing a field named:"),Pi(e,t,"Target layer is missing key field:"),i=ei(r,n.getRecords()),a=ei(t,o),Lk(r,i),Lk(t,a),i!=a&&bt("Join keys have mismatched data types:",a,"and",i);return function(e){var n=o[e],r=n?n[t]:null,i=null;return n&&r in u&&(i=u[r],Array.isArray(i)||(i=[i])),i}}(e.data,i,t,a);return _M(r),bM(e,t,o,n)}function Lk(e,t){t&&"object"!=t||bt("["+e+"] field has an unsupported data type. Expected string or number.")}pp.join=function(e,n,r,i){var a,o,s;r&&r.dataset||bt("Missing a joinable data source"),i.keys?(2!=i.keys.length&&bt("Expected two key fields: a target field and a source field"),r.layer.data||bt("Source layer is missing attribute data"),s=Tk(e,r.layer.data,i)):(r.layer.data||Wi(r.layer),ka([n,r.dataset]),a=r.layer.geometry_type,o=e.geometry_type,"point"==a&&"polygon"==o?s=cI(e,n.arcs,r.layer,i):"polygon"==a&&"point"==o?s=fI(e,r.layer,r.dataset.arcs,i):"point"==a&&"point"==o?s=Nk(e,r.layer,Ia(n),i):"polygon"==a&&"polygon"==o?s=_k(e,n,r,i):"polyline"==a&&"polygon"==o?s=function(e,t,n,r){wk(r);var i=xk(n.layer,n.dataset);return cI(e,t.arcs,i,r)}(e,n,r,i):"polygon"==a&&"polyline"==o?s=function(e,t,n,r){wk(r);var i=xk(e,t),a=fI(i,n.layer,n.dataset.arcs,r);return e.data=i.data,a}(e,n,r,i):bt(t.format("Unable to join %s geometry to %s geometry",a||"null",o||"null"))),s.unmatched&&n.layers.push(s.unmatched),s.unjoined&&n.layers.push(s.unjoined)};var zk=Object.freeze({__proto__:null,joinAttributesToFeatures:Tk});function Rk(e,t,n){var r="hex2"!=n.type,i=t*Math.sqrt(3)/2,a=function(e,t){var n=r?e[2]-e[0]:e[3]-e[1],i=Math.ceil((2*n+t)/(3*t)),a=Math.ceil(i/2),o=Math.floor(i/2);return[a,o]}(e,t),o=function(e,t){var n=r?e[3]-e[1]:e[2]-e[0],i=Math.ceil(1+2*n/(t*Math.sqrt(3))),a=Math.ceil(i/2),o=Math.floor(i/2);return[a,o]}(e,t),s=function(){var n=function(e){return r?[e[0],e[2]]:[e[1],e[3]]}(e),i=n[1]-n[0],o=(1.5*(a[0]+a[1])*t+.5*t-i)/2,s=n[0]-o+t;return s}(),u=function(){var t=function(e){return r?[e[1],e[3]]:[e[0],e[2]]}(e),n=t[1]-t[0],a=((o[0]+o[1]+1)*i-n)/2,s=t[0]-a+i;return s}();function c(e,t){var n=o[0]+o[1],r=Math.floor(e/2)*n,i=e%2==1;return i&&(r+=o[1]),r+=t,(e<0||t<0)&&vt("negative grid index"),(i&&t>=o[1]||!i&&t>=o[0])&&vt("out-of-bounds minor axis index"),(i&&e>=a[1]||!i&&e>=a[0])&&vt("out-of-bounds major axis index"),r}function f(e){var t=o[0]+o[1],n=Math.floor(e/t),r=2*n,i=e-n*t;return i>=o[0]&&(r++,i-=o[0]),[r,i]}function l(e,n){var[r,a]=function(e,n){var r=s-1.5*t,a=u-i+0,o=Math.floor((e-r)/(1.5*t)),c=Math.floor((n-a)/i),f=Dk(o)!=Dk(c),l=r+1.5*o*t+.5*t,h=l+.5*t,p=a+c*i,d=p+i,g=f?or(l,p,h,d,e,n):or(h,p,l,d,e,n),m=g>0?o-1:o,y=Math.floor(c/2);return[m,y]}(e,n);return c(r,a)}function h(e){var[t,n]=f(e);return p(t,n)}function p(e,n){var r=Dk(e)?i:0;return[s+1.5*e*t,u+r+n*i*2]}function d(e,n,r){var[a,o]=p(e,n);return[a-(r?t:t/2),o-(r?0:i)]}function g(e){var[t,n]=f(e),r=Dk(t)?0:-1,i=d(t,n,!1);return[i,d(t,n,!1),d(t,n,!0),d(t,n+1,!1),d(t+1,n+1+r,!0),d(t+1,n+1+r,!1),d(t+1,n+r,!0),i]}return function(e,t,n){n.type,n.aligned}(0,0,n),{cells:function(){return o[0]*a[0]+o[1]*a[1]},colRowToIdx:c,idxToColRow:f,pointToIdx:function(e){return r?l(e[0],e[1]):l(e[1],e[0])},idxToPoint:function(e){var t=h(e);return r?t:jk(t)},idxToBBox:function(e){var n=function(e){var n=h(e);return[n[0]-t,n[1]-i,n[0]+t,n[1]+i]}(e);return r?n:[n[1],n[0],n[3],n[2]]},makeCellPolygon:function(e,t){var n={type:"Polygon",coordinates:[g(e)]};return r||function(e){for(var t=0,n=e?e.coordinates.length:0;t<n;t++)e.coordinates[t].forEach(jk)}(n),n},forEachNeighbor:function(e,t,n){var r;r=Dk(e)?0:-1,n(e,t+1),n(e+1,t+r+1),n(e+1,t+r),n(e,t-1),n(e-1,t+r+1)}}}function Dk(e){return e%2!=0}function jk(e){return e[1],e[1]=e[0],e[0]=e[1],e}function Fk(e,t,n){return[(Math.floor(e/n)-1)*n,(Math.ceil(t/n)+1)*n]}function Uk(e,t,n){var r=t-e,i=(Math.ceil(r/n)*n-r)/2+n;return[e-i,t+i]}function Bk(e,t,n){var r=n&&n.aligned?function(e,t){var n=Fk(e[0],e[2],t),r=Fk(e[1],e[3],t);return[n[0],r[0],n[1],r[1]]}(e,t):function(e,t){var n=Uk(e[0],e[2],t),r=Uk(e[1],e[3],t);return[n[0],r[0],n[1],r[1]]}(e,t),i=r[0],a=r[1],o=r[2]-i,s=r[3]-a,u=Math.round(o/t),c=Math.round(s/t);function f(e,t){return e<0||t<0||e>=u||t>=c?-1:t*u+e}function l(e){return[e%u,Math.floor(e/u)]}function h(e){var[n,r]=l(e);return[i+(n+.5)*t,a+(r+.5)*t]}function p(e){var n=l(e);return[i+n[0]*t,a+n[1]*t,i+(n[0]+1)*t,a+(n[1]+1)*t]}return{cells:function(){return u*c},colRowToIdx:f,pointToIdx:function(e){var t=function(e){var t=e[0]-i;return Math.floor(t/o*u)}(e),n=function(e){var t=e[1]-a;return Math.floor(t/s*c)}(e);return f(t,n)},idxToColRow:l,idxToBBox:p,idxToPoint:h,makeCellPolygon:function(e,t){var n=t.circles?function(e,t){var n=h(e),r=t.cell_margin>0?t.cell_margin:1e-6,i=t.interval/2*(1-r),a=t.vertices||20;return Bx(n,i,a,K_)}(e,t):function(e,t){var n=p(e),r=t.interval*(t.cell_margin||0),i=n[0]+r,a=n[1]+r,o=n[2]-r,s=n[3]-r;return[[i,a],[i,s],[o,s],[o,a],[i,a]]}(e,t);return{type:"Polygon",coordinates:[n]}},forEachNeighbor:function(e,t,n){n(e+1,t+1),n(e+1,t),n(e+1,t-1),n(e,t+1),n(e,t-1),n(e-1,t+1),n(e-1,t),n(e-1,t-1)}}}function Gk(e,n,r){var i={},a=n?Ia(n):null;return r.interval?i.interval=oh(r.interval,a):bt("Missing required interval option"),r.bbox?i.bbox=r.bbox:n?(n=t.defaults({layers:e},n),i.bbox=wo(n).toArray()):bt("Missing grid bbox"),i.width=i.bbox[2]-i.bbox[0],i.height=i.bbox[3]-i.bbox[1],i.type=r.type||"square",i}function qk(e){var t=[];return e.forEach(function(e){e.forEach(function(e){t.push({type:"Point",coordinates:e})})}),{type:"GeometryCollection",geometries:t}}function Vk(e){var t,n,r,i,a,o,s,u,c,f,l=[],h=e.length-2;for(s=0;s<h;s++)for(u=(f=s%2==0)?0:2,c=f?0:-1;t=e[s][u],n=e[s+1][u+c],r=e[s+2][u],i=e[s+2][u+1],a=e[s+1][u+2+c],o=e[s][u+1],i&&a;u+=3)l.push({type:"Polygon",coordinates:[[t,n,r,i,a,o,t]]});return{type:"GeometryCollection",geometries:l}}function $k(e){for(var t,n,r=e.interval,i=Math.sqrt(3)*r/2,a=r/2,o=e.width+2*r,s=e.height+2*i,u=-i,c=[];u<s;){for(t=c.length%2==0?0:-a,n=[],c.push(n);t<o;)n.push([t,u]),t+=r;u+=i}return c}function Jk(e){for(var t,n,r=0,i=[],a=e.interval,o=e.width+a,s=e.height+a;r<s;){for(t=0,n=[],i.push(n);t<o;)n.push([t,r]),t+=a;r+=a}return i}function Wk(e,t){var n=function(e){var t={Point:r,Polygon:n};return e.geometries.reduce(function(e,n){var r=(0,t[n.type])(n);return e?(i(e,r[0],r[1]),i(e,r[2],r[3]),e):r},null);function n(e){return e.coordinates[0].reduce(function(e,t){return e?(i(e,t[0],t[1]),e):[t[0],t[1],t[0],t[1]]},null)}function r(e){var t=e.coordinates;return[t[0],t[1],t[0],t[1]]}function i(e,t,n){t<e[0]&&(e[0]=t),n<e[1]&&(e[1]=n),t>e[2]&&(e[2]=t),n>e[3]&&(e[3]=n)}}(e);!function(e,t,n){e.geometries.forEach(function(e){"Point"==e.type&&(e.coordinates=[e.coordinates[0]+t,e.coordinates[1]+n]),"Polygon"==e.type&&(e.coordinates[0]=e.coordinates[0].map(function(e){return[e[0]+t,e[1]+n]}))})}(e,(t[2]+t[0])/2-(n[2]+n[0])/2,(t[3]+t[1])/2-(n[3]+n[1])/2)}function Zk(e,t,n,r){var i=cn(e[0],e[1],n[0],n[1]);if(i>=t+r)return 0;var a=t*t,o=r*r,s=(a-o+i*i)/(2*i),u=i-s;return i<=Math.abs(t-r)?Math.PI*Math.min(a,o):a*Math.acos(s/t)-s*Math.sqrt(a-s*s)+o*Math.acos(u/r)-u*Math.sqrt(o-u*u)}function Yk(e,t,n){var r=Ca,i=new Ml(t.cells()),a=new r(e.length),o=[];return e.forEach(function(e){var r=function(e,t){return[e[0]-t,e[1]-t,e[0]+t,e[1]+t]}(e,n);!function(e,t,n){var r=n.pointToIdx(e),[i,a]=n.idxToColRow(r);Hk(i,a,n,t),n.forEachNeighbor(i,a,function(e,r){Hk(e,r,n,t)})}(e,i,t),a.add.apply(a,r)}),a.finish(),function(e){if(!i.hasId(e))return o;var n=t.idxToBBox(e);return a.search.apply(a,n)}}function Hk(e,t,n,r){var i=n.colRowToIdx(e,t);i>-1&&r.setId(i)}function Xk(e){var t=e.interval*Math.sqrt(1/Math.PI);return e.radius>0?e.radius:t}function Kk(e,t,n){for(var r,i,a=[],o=0,s=0;s<e.length;s++)(r=t[s])>0!=!1&&(o+=r,a.push(e[s]));return i={weight:o},n&&n(a,i),i}function Qk(e,t,n,r,i){for(var a,o=[],s=t*Math.sqrt(1/Math.PI),u=t*t,c=0;c<r.length;c++)a=Zk(e,s,n[r[c]],i)/u,o.push(a);return o}pp.mosaic=function(e,t,n){var r=e[0];(!r||e.length>1)&&bt("Command takes a single target layer"),Ri(r);var i=Vp(t,n);i.setArcFilter(pr(r.shapes,i.arcs));var a,o=new fd(r,i,{flat:!1}),s=o.mosaic,u={name:"name"in r?r.name:void 0,shapes:s,geometry_type:"polygon"};return n.calc&&(r.data||Wi(r),a=Ap(r.data.getRecords(),o.getSourceIdsByTileId,s.length,n),u.data=new di(a)),[u]},pp.polygonGrid=function(e,n,r){Aa(n);var i=function(e){var n,r;"square"==e.type?n=function(e){for(var t,n,r,i,a=[],o=0,s=e.length-1;o<s;o++)for(var u=0,c=e[o].length-1;u<c;u++)t=e[o][u],n=e[o+1][u],r=e[o+1][u+1],i=e[o][u+1],a.push({type:"Polygon",coordinates:[[t,n,r,i,t]]});return{type:"GeometryCollection",geometries:a}}(Jk(e)):"hex"==e.type?n=Vk($k(e)):"hex2"==e.type?(n=Vk($k(function(e){var n=e.bbox;return t.defaults({width:e.height,height:e.width,bbox:[n[1],n[0],n[3],n[2]]},e)}(e))),n.geometries.forEach(function(e){e.coordinates[0]=e.coordinates[0].map(function(e){return[e[1],e[0]]})})):bt("Unsupported grid type");return Wk(n,e.bbox),Ka(r=Kv(n,{})),r}(Gk(e,n,r));return i.info=yo(n.info),Ui(i.layers[0],null,"grid",r),r.debug&&i.layers.push(pp.pointGrid2(e,n,r)),i},pp.polygonGrid2=function(e,t,n){Aa(t);var r=function(e,t){var n,r;"square"==e.type?r=Bk(e.bbox,e.interval,t):"hex"==e.type?r=Rk(e.bbox,e.interval,t):bt("Unsupported grid type");for(var i=[],a=0,o=r.cells();a<o;a++)i.push({type:"Feature",properties:null,geometry:r.makeCellPolygon(a,t)});return Ka(n=Kv({type:"FeatureCollection",features:i},{})),n}(Gk(e,t,n),n);return r.info=yo(t.info),Ui(r.layers[0],null,"grid",n),r},pp.pointGrid2=function(e,t,n){var r,i=Gk(e,t,n);"square"==i.type?r=qk(Jk(i)):"hex"==i.type?r=qk($k(i)):bt("Unsupported grid type"),Wk(r,i.bbox);var a=Kv(r,{});return n.name&&(a.layers[0].name=n.name),a.layers[0]},pp.pointGrid=function(e,t){var n,r,i=function(e,t){var n={},r=e?Ia(e):null;t.interval?n.interval=oh(t.interval,r):t.rows>0&&t.cols>0&&(n.rows=t.rows,n.cols=t.cols);t.bbox?n.bbox=t.bbox:n.bbox=e?wo(e).toArray():[-180,-90,180,90];return n}(e,t),a=(n=function(e){var t,n,r,i,a,o,s,u,c,f=e.bbox,l=f[2]-f[0],h=f[3]-f[1],p=[];for(e.interval>0?(i=e.interval,a=e.interval,n=Math.round(l/i)-1,r=Math.round(h/a)-1,o=f[0]+(l-n*i)/2,s=f[1]+(h-r*a)/2):e.rows>0&&e.cols>0&&(i=l/(n=e.cols),a=h/(r=e.rows),o=f[0]+i/2,s=f[1]+a/2),i>0!=0&&a>0!=0||bt("Invalid grid parameters"),c=s;c<=f[3];){for(u=o,p.push(t=[]);u<=f[2];)t.push([u,c]),u+=i;c+=a}return p}(i),r=[],n.forEach(function(e,t){for(var n=0;n<e.length;n++)r.push([e[n]])}),{geometry_type:"point",shapes:r});return Ui(a,null,"grid",t),a},pp.pointToGrid=function(e,t,n){e.forEach(Ti),n.interval>0==!1&&bt("Expected a non-negative interval parameter"),n.radius;var r=wo(t).toArray(),i=[t],a=e.map(function(e){qi(e)>0&&bt("This command requires single points");var t=function(e,t,n){for(var r,i,a=Jt(e),o=n.interval,s=Bk(t,o,n),u=Xk(n),c=Yk(a,s,u),f={type:"FeatureCollection",features:[]},l=n.calc?bp(e.data,n.calc):null,h=0,p=s.cells();h<p;h++)(r=c(h)).length&&(i=Kk(r,Qk(s.idxToPoint(h),o,a,r,u),l)).weight>.05!=!1&&(i.id=h,f.features.push({type:"Feature",properties:i,geometry:s.makeCellPolygon(h,n)}));return Kv(f,{})}(e,r,n),a=t.layers[0];return i.push(t),Ui(a,e,"grid",n),a}),o=io(i);return Ka(o),t.arcs=o.arcs,a};var eC=Object.freeze({__proto__:null,calcCellProperties:Kk,calcWeights:Qk,getPointCircleRadius:Xk});function tC(e,t,n){var r=n.gap_tolerance?oh(n.gap_tolerance,Ia(t)):0,i=t.arcs,a=pr(e.shapes,i),o=new lo(t.arcs,a),s=function(e,t){return e.findDanglingEndpoints().filter(function(n){return fr.calcPathLen([n.arc],e.arcs)>t})}(o,r);if(0===s.length)return o;var u=function(e,t){for(var n=[],r=0,i=e.size();r<i;r++)n.push(t(r)?[[r]]:null);return n}(i,a),c=new Vf(u,i),f=s.reduce(function(e,t){var n=function(e,t,n,r){var i=Yt(e.arc),a=null;return t.forEach(function(t){var o;t!=i&&(Yt(t)>=n.size()||(o=fr.getPointToPathInfo(e.point[0],e.point[1],[t],n))&&o.distance<=r&&(!a||o.distance<a.distance)&&(a=o))}),a}(t,c.findPointEnclosureCandidates(t.point,r),i,r);return n&&e.push(function(e,t,n){var r=n.getVertex(t,-1),i=[r.x,r.y],a=n.getVertex(t,-2),o=[a.x,a.y],s=e.segment[0],u=e.segment[1],c=fr.findClosestPointOnSeg(i[0],i[1],s[0],s[1],u[0],u[1]);f=c,l=s,h=u,f[0]==l[0]&&f[1]==l[1]||f[0]==h[0]&&f[1]==h[1]||(c=function(e,t){var n=fr.distance2D(e[0],e[1],t[0],t[1]),r=(n+1e-6)/n;return[e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1])]}(o,c),fr.segmentIntersection(o[0],o[1],c[0],c[1],s[0],s[1],u[0],u[1])||(c=function(e,t,n){return fr.distance2D(e[0],e[1],t[0],t[1])<fr.distance2D(e[0],e[1],n[0],n[1])?t:n}(o,s,u)));var f,l,h;return{arc:t,point:c}}(n,t.arc,i)),e},[]);return t.arcs=function(e,t){var n=e.getVertexData();return t.forEach(function(t){var r=e.indexOfVertex(t.arc,-1);n.xx[r]=t.point[0],n.yy[r]=t.point[1]}),e.updateVertexData(n.nn,n.xx,n.yy,n.zz),e}(i,f),Vp(t,{})}async function nC(e,n,r){dM(n,r=r||np());var a=i("defs")||{};r.global=a,t.extend(r,r.global);var o=await async function(e,t){var n=function(e){var t=[];return iC(e).forEach(function(e,n){n%2==1&&t.push(e.substring(1,e.length-1))}),t}(e).map(e=>rC(e,t)),r=await Promise.all(n);return function(e,t){var n=iC(e);return n.reduce(function(e,n,r){return e+=r%2==1?t.length?t.shift():"":n},"")}(e,r)}(e,r);return function(e,t){var n=/([$_a-z][$_a-z0-9]*)\(/gi;return Array.from(e.matchAll(n)).some(e=>e[1]in t)}(o,r)&&(o=await rC(o,r)),o}async function rC(e,t){var n;try{n=Function("ctx","with(ctx) {return ("+e+");}").call({},t)}catch(e){bt(e.name,"in JS source:",e.message)}return n}function iC(e){for(var t,n=0,r=[],i="",a=0,o=e.length;a<o;a++)"{"==(t=e.charAt(a))&&(0==n&&(r.push(i),i=""),n++),i+=t,"}"==t&&(--n<0?n++:0==n&&aC(i)?i=r.pop()+i:0==n&&(r.push(i),i=""));return r.push(i),r}function aC(e){try{JSON.parse(e)}catch(e){return!1}return!0}function oC(e){return Array.isArray(e)&&t.isObject(e[0])?e.map(function(e){return{name:e.name,options:Object.assign({},e.options)}}):(t.isString(e)&&(e=gv(e)),Mv().parseArgv(e))}function sC(e){var t=e.replace(/^mapshaper\b/,"").trim();return Mv(),t=t.split(/\n+/g).map(function(e){return/^[a-z][\w-]*/i.exec(e=e.trim())&&(e="-"+e),e}).join(" ")}pp.polygons=function(e,t,n){return e.forEach(zi),n.no_cuts||Vp(t,n),e.map(function(e){return"polyline"!=e.geometry_type&&bt("Expected a polyline layer"),n.from_rings?function(e,t){var n=t.arcs,r=0;Pr(e.shapes,function(e){return fr.pathIsClosed(e,n)?e:(r++,null)}),r>0&&xt("Removed",r,"open "+(1==r?"ring":"rings"));return e.geometry_type="polygon",$f(e,n),e}(e,t):function(e,t,n){var r;r=n.no_cuts?new lo(t.arcs):tC(e,t,n);r.setArcFilter(pr(e.shapes,r.arcs));var i=td(r);return{geometry_type:"polygon",name:e.name,shapes:i.mosaic}}(e,t,n)})},pp.print=function(e){Et(e||"")},pp.renameLayers=function(e,n,r){n&&n.join("").indexOf("=")>-1?function(e,n){var r=function(e){return(e||[]).reduce(function(e,n){var r=n.split("="),i=t.trimQuotes(r[0]),a=t.trimQuotes(r[1]||"");return a||bt("Invalid name assignment:",n),e[a]=i,e},{})}(e);n.forEachLayer(function(e){r[e.name]&&(e.name=r[e.name])})}(n,r):function(e,t){var n=e&&e.length||0,r="",i="";t.forEach(function(a,o){o<n&&(r=e[o]),r&&n<t.length&&o>=n-1&&(i=(i||0)+1),a.name=r+i})}(n,e)},pp.require=async function(e){var t,n,r,a=i("defs");e.module||bt("Missing module name or path to module"),Lf.isFile(e.module)?t=e.module:Lf.isFile(e.module+".js")?t=e.module+".js":n=e.module;try{if((r=await import(t?s("url").pathToFileURL(t):n)).default&&(r=r.default),"function"==typeof r){var o=r(zP);o&&function(e){try{return GM(e),!0}catch(e){}return!1}(o)&&pp.registerCommand(o.name,o)}}catch(e){r||bt("Unable to load external module:",e.message,At(e))}n||e.alias?a[e.alias||n]=r:Object.assign(a,r)};var uC=Object.freeze({__proto__:null,parseCommands:oC,parseConsoleCommands:function(e){var t=oC(sC(e));return t.forEach(function(e){["i","include","require","external"].includes(e.name)&&bt("The "+e.name+" command cannot be run in the web console.")}),t},standardizeConsoleCommands:sC});function cC(e){return"i"==e||"join"==e||"erase"==e||"clip"==e||"include"==e}function fC(e){var t=2*e.size(),n=new lo(e).size();return e.getPointCount()-t+n}pp.run=async function(e,n,r){var i,a,o;r.expression||bt("Missing expression parameter"),(o=np()).io=function(){async function e(e,r){return t.isPromise(r)&&(r=await r),n._cache[e]=r,e}var n={_cache:{},addInputFile:e,ifile:e};return n}(),(i=await nC(r.expression,n,o))&&!t.isString(i)&&bt("Expected a string containing mapshaper commands; received:",i),i&&(xt(`command: [${Ut(i,150)}]`),(a=oC(i)).forEach(function(e){cC(e.name)&&(e.options.input=o.io._cache)}),await t.promisify(yP)(a,e))},pp.shape=function(e,t){var n,r;return t.coordinates?n=function(e){var t,n,r,i,a=[],o=e.offsets||[],s=e.coordinates;s.length>=2==!1&&bt("Invalid coordinates parameter.");for(n=0;n<s.length;n+=2)r=s[n],i=s[n+1],a.push([r,i]);for(n=0;n<o.length;n+=2)r+=o[n],i+=o[n+1],a.push([r,i]);_d.pathIsRing(a)?t="Polygon":e.closed&&a.length>=3?(t="Polygon",a.push(a[0])):t="LineString";return{type:t,coordinates:"Polygon"==t?[a]:a}}(t):"circle"==t.type?n=function(e){e.radius>0==!1&&e.radius_angle>0==!1&&bt("Missing required radius parameter.");var t=e.center||[0,0],n=e.radius||gI(Sa("wgs84"),e.radius_angle);return Fx(t,n,0,{geometry_type:e.geometry||"polygon"})}(t):"rectangle"==t.type&&t.bbox?n=function(e){var t=e.bbox,n=t[0],r=t[1],i=t[2],a=t[3],o=.5,s=[],u="polyline"==e.geometry?"LineString":"Polygon";return c(n,r,n,a),c(n,a,i,a),c(i,a,i,r),c(i,r,n,r),s.push([n,r]),{type:u,coordinates:"Polygon"==u?[s]:s};function c(e,t,n,r){for(var i=n-e,a=r-t,u=Math.ceil(Math.max(Math.abs(i)/o,Math.abs(a)/o)),c=i/u,f=a/u,l=0;l<u;l++)s.push([e+l*c,t+l*f])}}(t):bt("Missing coordinates parameter"),r=Kv(n,{}),t.rotation&&bI(r,t.rotation),r.layers[0].name=t.name||t.type||"shape",r};var lC={};function hC(e,n){var r=NC(n),i={dp:"Ramer-Douglas-Peucker",visvalingam:"Visvalingam",weighted_visvalingam:"Weighted Visvalingam"}[r]||"Unknown",a=PC(e,n),o=function(e,n){var r,i=n?function(e,t,n,r,i,a){var o=[],s=[],u=[];return fr.convLngLatToSph([e,n,i],[t,r,a],o,s,u),fr.pointSegDistSq3D(o[0],s[0],u[0],o[1],s[1],u[1],o[2],s[2],u[2])}:fr.pointSegDistSq,a=n?fr.signedAngleSph:fr.signedAngle,o=0,s=0,u=0,c=0,f=0,l=-1,h=-1,p=[],d=[],g=e.getVertexData().zz;return e.forEachSegment(function(e,t,n,r){var m,y,v,b,_,x,w,S,A;if(m=n[e],y=r[e],v=n[t],b=r[t],e==h&&((S=a(n[l],r[l],m,y,v,b))>Math.PI&&(S=2*Math.PI-S),isNaN(S)||d.push(180*S/Math.PI)),l=e,h=t,g[e]<1/0&&s++,!((w=t-e-1)<1))if(o+=w,m==v&&y==b)u++;else{for(_=0;++e<t;)A=i(n[e],r[e],m,y,v,b),_=Math.max(_,A);x=Math.sqrt(_),f+=x,p.push(x),c=Math.max(c,x)}}),r={angleMean:0,displacementMean:0,displacementMax:c,collapsedRings:u,removed:o,retained:s,uniqueCount:fC(e),removableCount:o+s},d.length>0&&(r.angleMean=t.sum(d)/d.length,r.angleQuartiles=[t.findValueByPct(d,.75),t.findValueByPct(d,.5),t.findValueByPct(d,.25)]),p.length>0&&(r.displacementMean=f/p.length,r.displacementQuartiles=[t.findValueByPct(p,.75),t.findValueByPct(p,.5),t.findValueByPct(p,.25)]),r}(e,a),s=(o.removed+o.collapsedRings)/o.uniqueCount||0,u=o.removed/o.removableCount||0,c=o.angleQuartiles,f=o.displacementQuartiles,l=["Simplification statistics"];l.push(t.format("Method: %s (%s) %s",i,a?"spherical":"planar","weighted_visvalingam"==r?"(weighting="+lC.getWeightCoefficient(n)+")":"")),l.push(t.format("Removed vertices: %,d",o.removed+o.collapsedRings)),l.push(t.format(" %.1f% of %,d unique coordinate locations",100*s,o.uniqueCount)),l.push(t.format(" %.1f% of %,d filterable coordinate locations",100*u,o.removableCount)),l.push(t.format("Simplification threshold: %.4f %s",e.getRetainedInterval(),a?"meters":"")),l.push(t.format("Collapsed rings: %,d",o.collapsedRings)),l.push("Displacement statistics"),l.push(t.format(" Mean displacement: %.4f",o.displacementMean)),l.push(t.format(" Max displacement: %.4f",o.displacementMax)),f&&l.push(t.format(" Quartiles: %.2f, %.2f, %.2f",f[0],f[1],f[2])),l.push("Vertex angle statistics"),l.push(t.format(" Mean angle: %.2f degrees",o.angleMean)),c&&l.push(t.format(" Quartiles: %.2f, %.2f, %.2f",c[0],c[1],c[2])),xt(l.join("\n "))}function pC(e){var n,r=Il(e),i=dC(e,r),a=r.length,o=i.length,s=a>o?a-o:0;a>0&&(n=t.format("Repaired %'i intersection%s",s,t.pluralSuffix(s)),o>0&&(n+=t.format("; %'i intersection%s could not be repaired",o,t.pluralSuffix(o))),xt(n))}function dC(e,t){for(;gC(e,t)>0;)t=Il(e);return t}function gC(e,n){var r,i,a,o,s=e.getVertexData(),u=e.getRetainedInterval(),c=0,f=0;for(i=mC(n,u,s.zz),t.sortOn(i,"z",!0);i.length>0;)for(1==(r=bC(a=i.pop(),u,s.xx,s.yy,s.zz)).length&&(r=vC(r[0],u,s.zz),c++),o=0;o<r.length;o++)yC(i,r[o]);return++f>5e5?(Mt("Caught an infinite loop at intersection:",a),0):c}function mC(e,t,n){return e.reduce(function(e,r){var i=function(e,t,n){var r,i=vr(n,t,e.a[0],e.a[1]),a=vr(n,t,e.b[0],e.b[1]);r=-1==i&&-1==a?null:-1==a||-1!=i&&n[i]>n[a]?{a:e.a,b:e.b,z:n[i]}:{a:e.b,b:e.a,z:n[a]};return r}(r,t,n);return null!==i&&e.push(i),e},[])}function yC(e,t){for(var n=e.length;n>0&&!(e[n-1].z<=t.z);)e[n]=e[n-1],n--;e[n]=t}function vC(e,t,n){for(var r=[],i=e.a[0],a=e.a[1],o=e.z,s=i+1;s<=a;s++)n[s]!=o&&s!=a||(r.push({a:[i,s],b:e.b,z:o}),s!=a&&(n[s]=t),i=s);return r.length<2&&vt("Error in unwindIntersection()"),r}function bC(e,t,n,r,i){var a=function(e,t,n,r,i){var a=_C(e.a,t,n,r,i);return a=a.concat(_C(e.b,t,n,r,i)),a}(e,t,n,r,i);return mC(Tl(a,n,r),t,i)}function _C(e,t,n,r,i){var a,o,s,u=[];e[0]<=e[1]?(a=e[0],o=e[1]):(a=e[1],o=e[0]),s=a;for(var c=a+1;c<=o;c++)i[c]>=t&&(n[s]<n[c]?u.push(s,c):u.push(c,s),s=c);return u}lC.getArcCalculator=function(e,n){var r=new kM,i=t.expandoBuffer(Int32Array),a=t.expandoBuffer(Int32Array),o=n?function(t,n,r,i,a,o){return e(i[t],a[t],o[t],i[n],a[n],o[n],i[r],a[r],o[r])}:function(t,n,r,i,a){return e(i[t],a[t],i[n],a[n],i[r],a[r])};return function(e,t,s,u){var c,f,l,h,p=e.length,d=i(p),g=a(p),m=-1/0;for(u&&!n?vt("[visvalingam] Received z-axis data for 2D simplification"):!u&&n?vt("[visvalingam] Missing z-axis data for 3D simplification"):e.length>t.length&&vt("[visvalingam] Incompatible data arrays:",e.length,t.length),l=0;l<p;l++)h=l+1,c=(f=l-1)<0||h>=p?1/0:o(f,l,h,t,s,u),e[l]=c,g[l]=h,d[l]=f;for(r.init(e);r.size()>0&&(c=e[l=r.pop()])!==1/0;)c<m?e[l]=m:m=c,f=d[l],h=g[l],f>0&&(c=o(d[f],f,h,t,s,u),r.updateValue(f,c)),h<p-1&&(c=o(f,h,g[h],t,s,u),r.updateValue(h,c)),g[f]=h,d[h]=f}},lC.standardMetric=fr.triangleArea,lC.standardMetric3D=fr.triangleArea3D,lC.getWeightedMetric=function(e){var t=lC.getWeightFunction(e);return function(e,n,r,i,a,o){var s=fr.triangleArea(e,n,r,i,a,o),u=fr.cosine(e,n,r,i,a,o);return t(u)*s}},lC.getWeightedMetric3D=function(e){var t=lC.getWeightFunction(e);return function(e,n,r,i,a,o,s,u,c){var f=fr.triangleArea3D(e,n,r,i,a,o,s,u,c),l=fr.cosine3D(e,n,r,i,a,o,s,u,c);return t(l)*f}},lC.getWeightCoefficient=function(e){return e&&t.isNumber(e&&e.weighting)?e.weighting:.7},lC.getWeightFunction=function(e){var t=lC.getWeightCoefficient(e);return function(e){return-e*t+1}},lC.weight=function(e){return.7*-e+1},lC.getEffectiveAreaSimplifier=function(e){var t=e?lC.standardMetric3D:lC.standardMetric;return lC.getPathSimplifier(t,e)},lC.getWeightedSimplifier=function(e,t){var n=t?lC.getWeightedMetric3D(e):lC.getWeightedMetric(e);return lC.getPathSimplifier(n,t)},lC.getPathSimplifier=function(e,t){return lC.scaledSimplify(lC.getArcCalculator(e,t))},lC.scaledSimplify=function(e){return function(t,n,r,i){e(t,n,r,i);for(var a=1,o=t.length-1;a<o;a++)t[a]=.65*Math.sqrt(t[a])}};var xC=Object.freeze({__proto__:null,postSimplifyRepair:pC,repairIntersections:dC}),wC={};function SC(e,t){t.forEach(function(t){"polygon"==t.geometry_type&&function(e,t){t.forEach(function(t){AC(e,t)})}(e,t.shapes)})}function AC(e,t){for(var n,r,i=0,a=t?t.length:0,o=0;o<a;o++)(r=e.getSimpleShapeBounds(t[o]).area())>i&&(n=t[o],i=r);n&&0!==n.length?function(e,t){var n,r=e.getRetainedInterval(),i=1e-10;e.setRetainedInterval(1/0),n=fr.getPlanarPathArea(t,e);for(;n<=i;){if(0===EC(e,t)){Mt("[protectMultiRing()] Failed on ring:",t);break}n=fr.getPlanarPathArea(t,e)}e.setRetainedInterval(r)}(e,n):Mt("[protectShape()] Invalid shape:",t)}function EC(e,t){for(var n,r,i,a,o,s,u=0,c=e.getVertexData(),f=0;f<t.length;f++)(r=t[f])<0&&(r=~r),s=(o=c.ii[r])+c.nn[r]-1,-1!=(i=vr(c.zz,1/0,o,s))&&(a=c.zz[i])>u&&(u=a,n=r);return u>0?(s=(o=c.ii[n])+c.nn[n]-1,MC(c.zz,u,1/0,o,s)):0}function MC(e,t,n,r,i){for(var a=0,o=r;o<=i;o++)e[o]===t&&(e[o]=n,a++);return a}wC.metricSq3D=fr.pointSegDistSq3D,wC.metricSq=fr.pointSegDistSq,wC.calcArcData=function(e,t,n,r){var i=e.length,a=!!r;e[0]=e[i-1]=1/0,i>2&&function i(o,s,u,c){var f,l,h=t[o],p=n[o],d=t[s],g=n[s];a&&(f=r[o],l=r[s]);for(var m,y=0,v=0,b=0,_=0,x=o+1;x<s;x++)(m=a?wC.metricSq3D(t[x],n[x],r[x],h,p,f,d,g,l):wC.metricSq(t[x],n[x],h,p,d,g))>=y&&(y=m,v=x);c<y&&(y=c);v-o>1&&(b=i(o,v,u+1,y));s-v>1&&(_=i(v,s,u+1,y));1==u&&h==d&&p==g&&(y=Math.max(b,_));return e[v]=Math.sqrt(y),y}(0,i-1,1,Number.MAX_VALUE)};var IC=Object.freeze({__proto__:null,keepEveryPolygon:SC,protectShape:AC,replaceInArray:MC});function kC(e,n){var r=e.arcs;n.keep_shapes&&SC(r,e.layers),!n.no_repair&&r.getRetainedInterval()>0&&pC(r),n.stats&&hC(r,n),e.info=t.defaults({simplify:n},e.info)}function CC(e,n){return n=n||{},t.defaults({method:NC(n),spherical:PC(e.arcs,n)},n)}function PC(e,t){return!t.planar&&!e.isPlanar()}function OC(e,n){var r=function(e){var t;"dp"==e.method?t=wC.calcArcData:"visvalingam"==e.method?t=lC.getEffectiveAreaSimplifier(e.spherical):"weighted_visvalingam"==e.method?t=lC.getWeightedSimplifier(e,e.spherical):bt("Unsupported simplify method:",e.method);return t}(n);e.setThresholds(new Float64Array(e.getPointCount())),n.spherical?(!function(e,n){var r=t.expandoBuffer(Float64Array),i=t.expandoBuffer(Float64Array),a=t.expandoBuffer(Float64Array);e.forEach3(function(e,t,o,s){var u=e.length,c=r(u),f=i(u),l=a(u);fr.convLngLatToSph(e,t,c,f,l),n(o,c,f,l)})}(e,r),LC(e)):function(e,t){e.forEach3(function(e,n,r,i){t(r,e,n)})}(e,r),n.lock_box&&function(e){var t=e.getBounds();t.padBounds(-1e-14,-1e-14,-1e-14,-1e-14),TC(e,t.toArray(),!0)}(e)}function NC(e){var t=e.method;return(!t||"weighted"==t||"visvalingam"==t&&e.weighting)&&(t="weighted_visvalingam"),t}function TC(e,t,n){var r=e.getBounds().toArray();!0!==fr.containsBounds(t,r)&&e.forEach3(function(e,r,i){for(var a,o,s=n?1/0:0,u=0,c=i.length;u<c;u++)a=e[u],o=r[u],(a>=t[2]||a<=t[0]||o<=t[1]||o>=t[3])&&(0===s&&(s=zC(i)),i[u]!==1/0&&(i[u]=s))})}function LC(e){TC(e,ra(1e-12),!1)}function zC(e){for(var t,n=0,r=0,i=e.length;r<i;r++)(t=e[r])>n&&t<1/0&&(n=t);return n}function RC(e){var n,r,i;return t.isNumber(e)?(r=e,i=e):t.isString(e)&&(n=e.split(/[x ,]/),r=Number(n[0])||0,i=2==n.length?Number(n[1])||0:r),r>=0&&i>=0&&r+i>0||bt("Invalid simplify resolution:",e),[r,i]}function DC(e,t,n,r){return 0!==e&&n/r>e/t||0===t?n/e:r/t}function jC(e,t,n){return DC(e,t,fr.degreesToMeters(n.width())*Math.cos(n.centerY()*fr.D2R),fr.degreesToMeters(n.height()))}function FC(e,t,n){var r=Ia(t);return PC(t.arcs,n)?ah(e,r):oh(e,r)}function UC(e,t,n){var r,i=RC(e),a=t.getBounds();return r=PC(t,n)?jC(i[0],i[1],a):DC(i[0],i[1],a.width(),a.height()),r*=.5}pp.simplify=function(e,n){var r=e.arcs;if(r&&0!==r.size()){if(OC(r,n=CC(e,n)),n.percentage||0===n.percentage)r.setRetainedPct(t.parsePercent(n.percentage));else if(n.interval||0===n.interval)r.setRetainedInterval(FC(n.interval,e,n));else if(n.resolution)r.setRetainedInterval(UC(n.resolution,r,n));else{if(n.presimplify)return;bt("Missing a simplification amount")}kC(e,n)}};var BC=Object.freeze({__proto__:null,calcPlanarInterval:DC,calcSphericalInterval:jC,convertSimplifyInterval:FC,convertSimplifyResolution:UC,finalizeSimplification:kC,getSimplifyMethod:NC,getStandardSimplifyOpts:CC,parseSimplifyResolution:RC,protectWorldEdges:LC,simplifyPaths:OC,useSphericalSimplify:PC});function GC(e,t){var n;return t?e.data&&e.data.fieldExists(t)?function(n){var r=e.data.getRecords()[n];return r?qC(r[t]):""}:(e={name:e.name,data:e.data},n=ap(t,e,null),function(e){return qC(n(e))}):function(t){return(e&&e.name||"split")+"-"+(t+1)}}function qC(e){return String(e)}pp.sortFeatures=function(e,n,r){var i=ki(e),a=!r.descending,o=ap(r.expression,e,n),s=[];t.repeat(i,function(e){s.push(o(e))});var u=t.getSortedIds(s,a);e.shapes&&t.reorderArray(e.shapes,u),e.data&&t.reorderArray(e.data.getRecords(),u)},pp.snap=function(e,n){var r,i=0,a=0,o=e.dataset,s=o.arcs,u=s&&s.getBounds();u&&u.hasBounds()||bt("Dataset is missing path data"),s.flatten(),n.fix_geometry&&(r=s&&Dl(s)),n.precision?Hl(o,n.precision):i=n.interval?oh(n.interval,Ia(o)):Bn(u.toArray()),i>0&&n.endpoints?(a=Vn(s,i),xt(t.format("Snapped %s endpoint%s",a,t.pluralSuffix(a)))):i>0&&(a=qn(s,i),xt(t.format("Snapped %s point%s",a,t.pluralSuffix(a)))),(a>0||n.precision)&&(r&&r(s),s.dedupCoords(),Ka(o))},pp.splitLayer=function(e,n,r){var i,a,o,s=r||{},u=s.no_replace?Bi(e):e,c=u.data?u.data.getRecords():null,f=u.shapes,l={},h=[],p=ki(u);return s.ids?(a=s.ids,o=new Set(a),i=function(e){return o.has(e)?"1":"2"}):i=GC(u,n),0===p?[u]:(t.repeat(p,function(e){var t,n=i(e);n in l==!1?(l[n]=h.length,t={geometry_type:u.geometry_type,name:n,data:c?new di:null,shapes:f?[]:null},h.push(t)):t=h[l[n]],f&&t.shapes.push(f[e]),c&&t.data.getRecords().push(c[e])}),h)};var VC=Object.freeze({__proto__:null,getSplitNameFunction:GC});pp.stop=function(e){!function(e){e.stopped=!0}(e)},pp.svgStyle=function(e,t,n){var r;0!==ki(e)&&(e.data||Wi(e),n.where&&(r=ap(n.where,e,t.arcs)),n.clear&&e.data.getFields().filter(cg).forEach(e.data.deleteField,e.data),Object.keys(n).forEach(function(t){var i=t.replace("_","-");if(cg(i)){var a=pg(n[t].trim(),i,e);bi(e).getRecords().forEach(function(e,t){r&&!r(t)?i in e==!1&&(e[i]=void 0):e[i]=a(t)})}}))};var $C=Vl(.01);function JC(e){return e.fill||"magenta"}function WC(e,t){return"polyline"==e.type?e.stroke=function(e){return e.stroke||e.fill||"magenta"}(t):e.fill=JC(t),t.opacity&&(e.opacity=t.opacity),e}function ZC(e){return 0===e.radius||0===e.length||0===e.r?0:e.radius||e.length||e.r||5}function YC(e,n){var r=e&&t.isNumber(e[0]),i=!r&&e&&Array.isArray(e[0]);if(r)return n(e);for(var a=0;a<e.length;a++)i&&YC(e[a],n)}function HC(e){YC(e,function(e){e[1]=-e[1]})}function XC(e,t,n){YC(e,function(e){e[0]=e[0]*t+n[0],e[1]=e[1]*t+n[1]})}function KC(e,t){if(t){var n=m_(t,1,[0,0],[0,0]);YC(e,function(e){var t=n(e[0],e[1]);e[0]=t[0],e[1]=t[1]})}}function QC(e,t){var n="stick"==t,r=e.direction||0,i=e["stem-taper"]||0,a=e["stem-curve"]||0,o=function(e,t){var n=function(e){var t=(r=e["head-angle"]||40,1/Math.tan(Math.PI*r/180/2)/2),n={stemWidth:e["stem-width"]||2,stemLen:e["stem-length"]||0,headWidth:e["head-width"],headLen:e["head-length"]};var r;0===n.headWidth?n.headLen=0:n.headWidth>0==!1&&(n.headLen>0?n.headWidth=n.headLen/t:0===n.headLen?n.headWidth=0:n.headWidth=3*n.stemWidth);n.headLen>=0==!1&&(n.headLen=n.headWidth*t);return n}(e),r=Math.max(e.radius||e.length||e.r||0),i=Math.max(r,n.headLen,0),a=1;i>=0&&(a=function(e,t,n){var r=n["min-stem-ratio"]>=0?n["min-stem-ratio"]:0,i=n["stem-length"]||0,a=1-r,o=t/e,s=1;o>a?s=a/o:i+t>e&&(s=e/(i+t));return s||0}(i,n.headLen,e),n.stemWidth*=a,n.headWidth*=a,n.headLen*=a,n.stemLen=t?r:i-n.headLen);n.headWidth<n.stemWidth&&n.headWidth>0&&bt("Arrow head must be at least as wide as the stem.");return n}(e,n);if(!o)return null;var s,u,c,f=o.stemLen,l=o.headLen,h=n?Math.max(f,l):f+l,p=o.headWidth/2,d=o.stemWidth/2,g=d*(1-i);if(a){r>0&&(a=-a);var m=Math.abs(a)/180*Math.PI,y=a>0?1:-1,v=g*Math.cos(m),b=g*Math.sin(m)*-y;if(u=f*Math.sin(m/2)*y,c=f*Math.cos(m/2),n)s=eP(-v,-b,u,c);else{var _=eP(-v,-b,-d+u,c),x=eP(v,b,d+u,c);s=_.concat(x.reverse())}}else u=0,c=f,s=n?[[0,0],[0,f]]:[[-g,0],[g,0]];return n?(s=[s],l>0&&s.push([[-p+u,f-l],[u,f],[p+u,f-l]])):(s.push([d+u,c]),l>0&&s.push([p+u,c],[u,l+c],[-p+u,c]),s.push([-d+u,c],s[0].concat()),s=[s]),"end"==e.anchor?XC(s,1,[-u,-h]):"middle"==e.anchor&&XC(s,1,[.5*-u,.5*-c-.25*h]),KC(s,r),e.flipped&&HC(s),s}function eP(e,t,n,r){if(t>r)return[[e*r/t,r]];for(var i=n-e,a=r-t,o=a-(a*a-i*i)/(2*a),s=Math.sqrt(i*i+a*a)/2,u=Math.PI-2*Math.asin(s/o),c=180*u/Math.PI,f=o/Math.tan(u/2),l=n>e?1:-1,h=Math.round(c/5)+2,p=u/(h+1),d=[[n,r]],g=1;g<=h;g++){var m=g*p/2,y=Math.sin(m),v=y*f*2,b=y*v,_=Math.cos(m)*v;d.push([n-b*l,r-_])}return d.push([e,t]),d}function tP(e){var t,n,r=ZC(e),i=+e.sides||function(e){return{circle:72,triangle:3,square:4,pentagon:5,hexagon:6,heptagon:7,octagon:8,nonagon:9,decagon:10}[e]||4}(e.type),a=i%2==1,o=[];if(r>0==!1)return null;i>=3==!1&&bt(`Invalid number of sides (${i})`),("b"==e.orientation||e.flipped||e.rotated)&&(a=!a),n=a?0:.5;for(var s=0;s<i;s++)t=(s+n)/i*360,o.push(K_(0,0,t,r));return o.push(o[0].concat()),[o]}function nP(e){var t,n,r=ZC(e),i=e.points||e.sides&&e.sides/2||5,a=2*i,o=function(e){var t=360/e,n=function(e){var t=1,n=Math.ceil(e/2)-2,r=Math.floor((n+t)/2);return function(e,t){var n=360/e,r=n*(t+1);return 180-r}(e,r)}(e),r=Math.PI/180*t/2,i=Math.PI/180*n/2,a=Math.tan(i)/(Math.tan(i)+Math.tan(r))/Math.cos(r);return a}(i)*r,s="b"==e.orientation||e.flipped||e.rotated?0:1,u=[];if(r>0==!1)return null;i<5&&bt(`Invalid number of points for a star (${i})`);for(var c=0;c<a;c++)n=c%2==0?o:r,t=(c+s)/a*360,u.push(K_(0,0,t,n));return u.push(u[0].concat()),[u]}function rP(e){var n=Array.isArray(e)?e:mv(e);return t.genericSort(n,!0),t.uniq(n)}function iP(e,t,n){var r;return"MultiPolygon"==n||"Polygon"==n?r={type:"polygon",coordinates:"Polygon"==n?e:Cg(e)}:"LineString"==n||"MultiLineString"==n?r={type:"polyline","stroke-width":t["stroke-width"]||2,coordinates:"LineString"==n?[e]:e}:vt("Unsupported type:",n),WC(r,t),function(e){YC(e,function(e){e[0]=$C(e[0]),e[1]=$C(e[1])})}(r.coordinates),r}pp.symbols=function(e,n,r){Li(e);var i,a=r.no_replace?Bi(e):e,o=!!r.geographic;o&&(Aa(n),i=r.pixel_scale||function(e){var t=Ji(e);return(t.width()||t.height()||1e3)/800}(a));var s,u,c=bi(a).getRecords(),f=lg(a,r),l=a.shapes.map(function(e,n){if(!e)return null;var a=f(n),s=c[n]||{};if(o||"circle"!=a.type)if(o||"ring"!=a.type){var u,l="Polygon";if("arrow"==a.type&&"stick"==r.arrow_style?(u=function(e){return QC(e,"stick")}(a),l="MultiLineString"):"arrow"==a.type?u=function(e){return QC(e,"standard")}(a):"ring"==a.type?(u=function(e){for(var n,r,i=rP(e.radii||"2"),a=[],o=t.isOdd(i.length),s=0;s<i.length;s++)n=tP({type:"circle",radius:i[s]}),(!o||s>0)&&(r=n,(n=tP({type:"circle",radius:i[++s]})).push(r[0])),a.push(n);return a}(a),l="MultiPolygon"):u="star"==a.type?nP(a):tP(a),!u)return null;if(KC(u,+a.rotation||0),o||HC(u),+r.scale&&XC(u,+r.scale,[0,0]),o)return XC(u,i,e[0]),a.fill&&(s.fill=a.fill),a.stroke&&(s.stroke=a.stroke),a.opacity&&(s.opacity=a.opacity),function(e,t){return{type:t,coordinates:e}}(u,l);s["svg-symbol"]=iP(u,a,l)}else s["svg-symbol"]=function(e,n){var r=+n.scale||1,i=rP(e.radii||"2").map(function(e){return e*r}),a=t.isOdd(i.length),o=JC(e),s=n.opacity||void 0,u=[];a&&u.push({type:"circle",fill:o,opacity:s,r:i.shift()});for(var c=0;c<i.length;c+=2)u.push({type:"circle",fill:"none",stroke:o,opacity:s,"stroke-width":ql(i[c+1]-i[c]),r:ql(.5*i[c+1]+.5*i[c])});return{type:"group",parts:u}}(a,r);else s["svg-symbol"]=function(e,t){var n=ZC(e);return+t.scale&&(n*=+t.scale),WC({type:"circle",r:n},e)}(a,r)});return o?(u=function(e,t){var n=e.map(function(e,n){return t[n],{type:"Feature",properties:t[n]||null,geometry:e}});return Kv({type:"FeatureCollection",features:n})}(l,c),(s=Po(e,n,u,r)).data=a.data):s=a,[s]};var aP=Object.freeze({__proto__:null});function oP(e,t,n){for(var r,i=0;i<e.length;i++)if((r=e[i])>=t&&r<t+n)return r-t;return-1}function sP(e,t,n){for(var r=0;r<t.length;r++)e.push(n?n[t[r]]:null)}function uP(e,t,n){return ap(e,t,n)}function cP(e,n,r){var i,a,o,s,u,c=mp(e,n,r),f=[];return Ch(c,"Expression must evaluate to true or false"),c?(a=Ji(e,n),i=function(e,n,r){var i,a,o=e.data?e.data.getRecords():null,s=e.shapes;i={geometry_type:e.geometry_type,shapes:[],data:o?[]:null},a={geometry_type:e.geometry_type,shapes:[],data:o?[]:null};var u=r&&r.width()>r.height(),c=s.map(function(e){var t=n.getMultiShapeBounds(e);return u?t.centerX():t.centerY()}),f=t.range(c.length);f.sort(function(e,t){return c[e]-c[t]}),f.forEach(function(e,t){var n=t<s.length/2?i:a;n.shapes.push(s[e]),o&&n.data.push(o[e])}),o&&(i.data=new di(i.data),a.data=new di(a.data));return[i,a]}(e,n,a),(o=i[0]).shapes.length>1&&o.shapes.length<e.shapes.length?t.merge(f,cP(o,n,r)):f.push(o),(s=i[1]).shapes.length>1&&s.shapes.length<e.shapes.length?t.merge(f,cP(s,n,r)):f.push(s)):f.push(e),u=GC(e),f.forEach(function(n,r){n.name=u(r),t.defaults(n,e)}),f}async function fP(e,n){var r,i,a,o,s,u,c,f,l,h,p=e.name,d=e.options;if(function(e,t){return!!function(e){return!0===e.stopped}(t)||!function(e){return["if","elif","else","endif"].includes(e)}(e)&&!ik(t)}(p,n))return g(null);if("comment"==p)return pp.comment(d),g(null);n||(n=new u_),n.startCommand(e);try{ed.start(),"rename-layers"==p?c=(s=n.catalog.findCommandTargets(d.target||"*")).reduce(function(e,t){return e.concat(t.layers)},[]):"o"==p?s=n.catalog.findCommandTargets(d.target||d.combine_layers&&"*"):!function(e){return"rotate"==e||"info"==e||"proj"==e||"require"==e||"drop"==e||"target"==e||"if"==e||"elif"==e||"else"==e||"endif"==e||"run"==e||"i"==e||"snap"==e||"frame"==e||"comment"==e}(p)?((s=n.catalog.findCommandTargets(d.target)).length>1&&("merge-layers"==p||"union"==p)&&(s=ro(s,n.catalog)),1==s.length?(f=(u=s[0].dataset).arcs,c=s[0].layers,n.catalog.setDefaultTarget(c,u)):s.length>1&&bt("This command does not support targetting layers from different datasets")):s=n.catalog.findCommandTargets(d.target),0===s.length&&(d.target&&bt(t.format("Missing target: %s\nAvailable layers: %s",d.target,o_(n.catalog))),function(e){return"graticule"==e||"i"==e||"help"==e||"point-grid"==e||"shape"==e||"rectangle"==e||"frame"==e||"require"==e||"run"==e||"define"==e||"include"==e||"print"==e||"comment"==e||"if"==e||"elif"==e||"else"==e||"endif"==e||"stop"==e||"add-shape"==e||"scalebar"==e}(p)||bt("No data is available")),d.source&&(r=r_(t_(d.source,s),n.catalog,d)),"add-shape"==p?(u||(c=(u={info:{},layers:[]}).layers,n.catalog.addDataset(u)),a=pp.addShape(c,u,d)):"affine"==p?pp.affine(c,u,d):"alpha-shapes"==p?a=f_(pp.alphaShapes,c,u,d):"buffer"==p?a=f_(pp.buffer,c,u,d):"data-fill"==p?f_(pp.dataFill,c,f,d):"cluster"==p?f_(pp.cluster,c,f,d):"calc"==p?i=pp.calc(c,f,d):"check-geometry"==p?f_(pp.checkGeometry,c,u,d):"classify"==p?f_(pp.classify,c,u,d):"clean"==p?pp.cleanLayers(c,u,d):"clip"==p?a=pp.clipLayers(c,r,u,d):"colorizer"==p?a=pp.colorizer(d):"dashlines"==p?f_(pp.dashlines,c,u,d):"define"==p?pp.define(n.catalog,d):"dissolve"==p?a=f_(pp.dissolve,c,f,d):"dissolve2"==p?a=pp.dissolve2(c,u,d):"divide"==p?pp.divide(c,u,r,d):"dots"==p?a=f_(pp.dots,c,f,d):"drop"==p?pp.drop2(n.catalog,s,d):"each"==p?f_(pp.evaluateEachFeature,c,u,d.expression,d):"erase"==p?a=pp.eraseLayers(c,r,u,d):"explode"==p?a=f_(pp.explodeFeatures,c,f,d):"filter"==p?a=f_(pp.filterFeatures,c,f,d):"filter-fields"==p?f_(pp.filterFields,c,d.fields,d):"filter-geom"==p?f_(pp.filterGeom,c,f,d):"filter-islands"==p?f_(pp.filterIslands,c,u,d):"filter-islands2"==p?f_(pp.filterIslands2,c,u,d):"filter-points"==p?f_(pp.filterPoints,c,u,d):"filter-slivers"==p?f_(pp.filterSlivers,c,u,d):"frame"==p?pp.frame(n.catalog,s,d):"fuzzy-join"==p?f_(pp.fuzzyJoin,c,f,r,d):"graticule"==p?n.catalog.addDataset(pp.graticule(u,d)):"grid"==p?i=pp.polygonGrid(c,u,d):"grid2"==p?i=pp.polygonGrid2(c,u,d):"help"==p?pp.printHelp(e.options):"i"==p?(d.replace&&(n.catalog=new a_),(u=await pp.importFiles(n.catalog,e.options))&&(a=u.layers)):"if"==p||"elif"==p?pp[p](n,d):"else"==p||"endif"==p?pp[p](n):"ignore"==p?f_(pp.ignore,c,u,d):"include"==p?pp.include(d):"info"==p?i=pp.info(s,d):"inlay"==p?a=pp.inlay(c,r,u,d):"inspect"==p?f_(pp.inspect,c,f,d):"innerlines"==p?a=f_(pp.innerlines,c,f,d):"join"==p?f_(pp.join,c,u,r,d):"lines"==p?a=f_(pp.lines,c,u,d):"merge-layers"==p?a=pp.mergeAndFlattenLayers(c,u,d):"mosaic"==p?a=pp.mosaic(c,u,d):"o"==p?(o=await Ay(n.catalog,s,d),d.final&&(n.catalog=new a_),await zf(o,d)):"point-grid"==p?(a=[pp.pointGrid(u,d)],u||n.catalog.addDataset({layers:a})):"point-to-grid"==p?a=pp.pointToGrid(c,u,d):"points"==p?a=f_(pp.createPointLayer,c,u,d):"polygons"==p?a=pp.polygons(c,u,d):"print"==p?pp.print(e._.join(" ")):"proj"==p?(await la(d),n.resumeCommand(),s.forEach(function(e){pp.proj(e.dataset,n.catalog,d)})):"rectangle"==p?r||d.bbox||0===s.length?n.catalog.addDataset(pp.rectangle(r||s?.[0],d)):a=pp.rectangle2(s[0],d):"rectangles"==p?a=f_(pp.rectangles,c,u,d):"rename-fields"==p?f_(pp.renameFields,c,d.fields):"rename-layers"==p?pp.renameLayers(c,d.names,n.catalog):"require"==p?await pp.require(d):"rotate"==p?s.forEach(function(e){pp.rotate(e.dataset,d)}):"run"==p?await pp.run(n,s,d):"scalebar"==p?pp.scalebar(n.catalog,d):"shape"==p?n.catalog.addDataset(pp.shape(u,d)):"shapes"==p?a=f_(pp.shapes,c,u,d):"simplify"==p?d.variable?pp.variableSimplify(c,u,d):pp.simplify(u,d):"slice"==p?a=pp.sliceLayers(c,r,u,d):"snap"==p?function(e,n){var r=t.toArray(arguments).slice(2);n.forEach(function(t){e.apply(null,[t].concat(r))&&vt("Unexpected output from command")})}(pp.snap,s,d):"sort"==p?f_(pp.sortFeatures,c,f,d):"split"==p?a=f_(pp.splitLayer,c,d.expression,d):"stop"==p?pp.stop(n):"split-on-grid"==p?a=f_(pp.splitLayerOnGrid,c,f,d):"stitch"==p?pp.stitch(u):"style"==p?f_(pp.svgStyle,c,u,d):"symbols"==p?a=f_(pp.symbols,c,u,d):"subdivide"==p?a=f_(pp.subdivideLayer,c,f,d.expression):"target"==p?pp.target(n.catalog,d):"union"==p?a=pp.union(c,u,d):"uniq"==p?f_(pp.uniq,c,f,d):pp.runExternalCommand(e,n.catalog),"name"in d&&a&&a.forEach(function(e){e.name=d.name}),i?(n.catalog.addDataset(i),a=i.layers,c&&!d.no_replace&&c.forEach(function(e){n.catalog.deleteLayer(e,u)})):a&&u&&a!=u.layers&&(d.no_replace?(l=a,h=c||[],t.some(h,function(e){return l.indexOf(e)>-1})&&vt("Command returned invalid output"),u.layers=u.layers.concat(a)):(ko(u,c,a),("clip"==p||"erase"==p||"rectangle"==p||"rectangles"==p||"filter"==p&&d.cleanup)&&!d.no_cleanup&&ho(u)),d.apart?n.catalog.setDefaultTargets(vo(u,a).map(function(e){return{dataset:e,layers:e.layers.concat()}})):n.catalog.setDefaultTarget(a,u)),u&&Mo(u)}catch(e){return g(e)}return g(null);function g(e){if(n.endCommand(),Mt("-",ed.stop()),e)throw e;return n}}pp.target=function(e,t){var n=(t.type||"").toLowerCase().replace("linestring","polyline"),r=t.target||"*",i=e.findCommandTargets(r,n);n&&-1=="polygon,polyline,point".split(",").indexOf(n)&&bt("Invalid layer type:",t.type),0===i.length&&bt("No layers were matched (pattern: "+r+(n?" type: "+n:"")+")"),(t.name||""===t.name)&&(i[0].layers[0].name=t.name),t.combine?i=function(e,t){var n=[],r=[];e.forEach(function(e){n.push(e.dataset),t.removeDataset(e.dataset),r=r.concat(e.layers)});var i=io(n);return t.addDataset(i),[{dataset:i,layers:r}]}(i,e):t.isolate&&(i=function(e,t){var n=[];e.forEach(function(e){n.push(e.dataset),e.layers.forEach(function(n){t.removeLayer(n,e.dataset)})})}(i,e)),e.setDefaultTargets(i)},pp.union=function(e,n,r){e.length<2&&bt("Command requires at least two target layers"),e.forEach(Ri);var i=Vp(n,r),a=[],o=[],s=[];e.forEach(function(e,t){var n=e.data?e.data.getFields():[];r.fields&&(n=r.fields.indexOf("*")>1?n:n.filter(function(e){return r.fields.indexOf(e)>-1})),s.push({layer:e,fields:n,records:e.data?e.data.getRecords():null,offset:o.length,size:e.shapes.length}),a=a.concat(n),o=o.concat(e.shapes)});var u=t.uniqifyNames(a,function(e,t){return e+"_"+t}),c=new fd({shapes:o},i,{flat:!1}),f=c.mosaic,l=f.map(function(e,t){for(var n,r,i,a=c.getSourceIdsByTileId(t),o=[],f=0,l=s.length;f<l;f++)i=-1==(r=oP(a,(n=s[f]).offset,n.size))||null===n.records?null:n.records[r],sP(o,n.fields,i);return function(e,t){for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}(u,o)});return[{name:"union",geometry_type:"polygon",shapes:f,data:new di(l)}]},pp.uniq=function(e,n,r){var i=ki(e),a=ap(r.expression,e,n),o=r.max_count||1,s={},u=[],c=!!r.verbose,f=!!r.invert,l=!!r.index,h=e.data?e.data.getRecords():null,p=function(e,t){return u[t]};t.repeat(i,function(e){var n,r=a(e),i=r in s?s[r]+1:1,p=i<=o;l?(p=!0,(n=h&&h[e])&&(n.index=i)):f&&(p=!p),u[e]=p,s[r]=i,c&&!p&&xt(t.format("Removing feature %i key: [%s]",e,r))}),e.shapes&&(e.shapes=e.shapes.filter(p)),h&&(e.data=new di(h.filter(p))),!1!==r.verbose&&xt(t.format("Retained %,d of %,d features",ki(e),i))},pp.variableSimplify=function(e,n,r){var i,a,o=e[0],s=n.arcs;1!=e.length&&bt("Variable simplification requires a single target layer"),wi(o)||bt("Target layer is missing path data"),OC(s,r=CC(n,r)),r.interval?i=function(e,t,n,r){var i=ap(e,t,n.arcs);return function(e){return FC(i(e),n,r)}}(r.interval,o,n,r):r.percentage?i=function(e,n,r){var i=uP(e,n,r.arcs),a=qa(r.arcs);return function(e){var n=i(e),r=t.parsePercent(n);return a(r)}}(r.percentage,o,n):r.resolution?i=function(e,t,n,r){var i=uP(e,t,n.arcs);return function(e){return UC(i(e),n.arcs,r)}}(r.resolution,o,n,r):bt("Missing a simplification expression"),a=function(e,n,r){var i,a=new Float64Array(n.size()),o=-1;t.initializeArray(a,o),e.shapes.forEach(function(e,t){i=r(t),br(e||[],c)});for(var s=0,u=a.length;s<u;s++)a[s]==o&&(a[s]=0);return a;function c(e){var t=e<0?~e:e,n=a[t];(n>i||n==o)&&(a[t]=i)}}(o,s,i),function(e,t){e.getVertexData().zz,e.forEach2(function(e,n,r,i,a,o){for(var s=t[e],u=1;u<r-1;u++)o[n+u]>=s&&(o[n+u]=1/0)})}(s,a),s.setRetainedInterval(1e20),kC(n,r),s.flatten()},pp.splitLayerOnGrid=function(e,n,r){var i,a=e.shapes,o=e.geometry_type,s=!!r.id_field,u=r.id_field||"__split__",c=function(e,n,r){var i=e.xmin,a=e.ymin,o=e.width(),s=e.height();r>0!=!1&&n>0!=!1||bt("Invalid grid parameters");o>0!=!1&&s>0!=!1||(n=1,r=1);return function(e){var u=Math.floor((e.centerX()-i)/o*n),c=Math.floor((e.centerY()-a)/s*r);return u=t.clamp(u,0,n-1)||0,"r"+(c=t.clamp(c,0,r-1)||0)+"c"+u}}(Ji(e,n),r.cols,r.rows);return o||bt("Layer has no geometry"),e.data||(e.data=new di(a.length)),i=e.data.getRecords(),e.shapes.forEach(function(e,t){var r="point"==o?Vt([e]):n.getMultiShapeBounds(e),a=r.hasBounds()?c(r):"";(i[t]=i[t]||{})[u]=a}),s?e:pp.splitLayer(e,u).filter(function(e){var t=e.data.getRecordAt(0)[u];return e.name=t,e.data.deleteField(u),!!t})},pp.subdivideLayer=function(e,t,n){return cP(e,t,n)};var lP="0.6.113";function hP(e){var t=gP.apply(null,arguments);if(mP(e,t,function(e){t.callback(e)}),t.promise)return t.promise}function pP(e){var n=gP.apply(null,arguments),r=n.callback,i=n.output=[];if(mP(e,n,function(e){return e?r(e):n.legacy?r(null,function(e){if(e.length>1)return t.pluck(e,"content");if(1==e.length)return e[0].content;return null}(i)):r(null,function(e){return e.reduce(function(e,t){return e[t.filename]=t.content,e},{})}(i))}),n.promise)return n.promise}function dP(e){var t,n=gP.apply(null,arguments),r=s("path").join("/Users/zhang/code/emap/node_modules/mapshaper","bin/mapshaper"),i=parseFloat(n.options.xl)||8;if(i<1||i>64)return Nt(t=new Error("Unsupported heap size:"+i+"GB")),n.callback(t),n.promise;yt()||(e+=" -quiet");var a=Math.round(1e3*i),o=[`"${ht.execPath}"`,"--max-old-space-size="+a,`"${r}"`,e].join(" "),u=s("child_process").exec(o,{},function(e,t,r){n.callback(e)});return u.stdout.pipe(ht.stdout),u.stderr.pipe(ht.stderr),n.promise?n.promise:void 0}function gP(e,n,r){var i={options:{}};return t.isFunction(n)?i.callback=n:t.isFunction(r)?(i.callback=r,i.legacy=n&&null!=hf(n),i.input=n):i.promise=new Promise(function(e,t){i.callback=function(n,r){n?t(n):e(r)}}),!i.legacy&&t.isObject(n)&&(n.xl?i.options=n:i.input=n),i}function mP(e,n,r){var i,a=n.output||null,o=n.input;try{i=oC(e)}catch(e){return Nt(e),r(e)}if(n.legacy&&(xt("Warning: deprecated input format"),i=function(e,n){var r=t.find(e,function(e){return"i"==e.name}),i=t.find(e,function(e){return"o"==e.name});r||(r={name:"i",options:{}},e.unshift(r));r.options.files=["__input__"],r.options.input={__input__:n},i||e.push({name:"o",options:{}});return e}(i,o),o=null),0===i.length)return r(new Tt("No commands to run"));if(0===(i=bP(i)).length)return c(null);i.forEach(function(e){cC(e.name)&&o&&(e.options.input=o),a&&("o"==e.name||"info"==e.name&&e.options.save_to)&&(e.options.output=a)});var s=i[i.length-1];qc()||"o"!=s.name||(s.options.final=!0);var u=function(e){var n=e[0],r=n.options;if("i"!=n.name||r.stdin||r.merge_files||r.combine_files||!r.files||r.files.length<2)return[e];return r.files.map(function(n){var i=[{name:"i",options:t.defaults({files:[n],replace:!0},r)}];return i.push.apply(i,e.slice(1)),i})}(i);function c(e,t){t&&QI(t)&&xt("Warning: -if command is missing a matching -endif"),(e=vP(e))&&Nt(e),r(e,t)}t.reduceAsync(u,null,function(e,t,n){yP(t,new u_,function(e,t){e=vP(e),n(e,t)})},c)}function yP(e,n,r){if(n||(n=new u_),e=function(e,t){var n={VERBOSE:!1,QUIET:!1,DEBUG:!1},r=t.filter(function(e){if("verbose"==e.name)n.VERBOSE=!0;else if("quiet"==e.name)n.QUIET=!0;else{if("debug"!=e.name)return!0;n.DEBUG=!0}return!1});return e.initSettings(n),r}(n,e),qc()||function(){var e=/^--max-old-space-size=([0-9]+)$/,t=ht.execArgv.find(function(t){return e.test(t)});t&&xt("Allocating",e.exec(t)[1]/1e3,"GB of heap memory")}(),0===(e=bP(e)).length)return r(null);t.reduceAsync(e,n,function(e,t,n){fP(t,e).then(function(e){n(null,e)}).catch(function(e){n(e)})},r)}function vP(e){return e&&"NonFatalError"==e.name?(Nt(e),null):e}function bP(e){return e.filter(function(e){if("version"==e.name)Et(lP);else if("encodings"==e.name)Zr();else if("colors"==e.name)_E(),Et("Built-in color schemes (from d3):"),Et("Categorical\n"+Rt(bE.categorical)),Et("\nSequential\n"+Rt(bE.sequential)),Et("\nDiverging\n"+Rt(bE.diverging)),Et("\nMulti-hue/rainbow\n"+Rt(bE.rainbow));else{if("projections"!=e.name)return!0;La()}return!1})}var _P=Object.freeze({__proto__:null,applyCommands:pP,runAndRemoveInfoCommands:bP,runCommands:hP,runCommandsXL:dP,runParsedCommands:yP,testCommands:function(e,t){mP(e,{},function(e,n){var r,i=n?n.catalog.getDefaultTargets():[];!e&&i.length>0&&(r=i[0].dataset),t(e,r)})}}),xP=Vl(.01);function wP(e){return" "+xP(e[0])+" "+xP(e[1])}function SP(e){return e.length>2&&"C"==e[2]}function AP(e){if(0===e.length)return"";var t,n,r,i="M",a=!1;for(n=0,r=e.length;n<r;n++)SP(t=e[n])?(i+=" C"+wP(t)+wP(e[++n])+wP(e[++n]),a=!0):a?(i+=" L"+wP(t),a=!1):i+=wP(t);return i}var EP=Object.freeze({__proto__:null,stringifyLineStringCoords:AP,stringifyPolygonCoords:function(e){for(var t=[],n=0;n<e.length;n++)t.push(AP(e[n])+" Z");return t.length>0?t.join(" "):""}});function MP(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}function IP(e,t,n){var r=n[0],i=n[2];return e>i[0]?(t>i[1]?4:t>=r[1]&&5)||6:e>=r[0]?(t>i[1]?3:t>=r[1]&&8)||7:(t>i[1]?2:t>=r[1]&&1)||0}function kP(e){return 0==e||2==e||4==e||6==e}function CP(e,t){return t<8&&t>=0?(t+8-2*e)%8:t}function PP(e,t,n){e.push(function(e,t){if(kP(e))return t[e/2].concat();vt("Invalid corner sector:",e)}(t,n))}function OP(e,t,n,r){var i,a,o=t?IP(t[0],t[1],r):-1,s=IP(n[0],n[1],r);8==o&&8==s?e.push(n):o==s||(-1==o?8==s?e.push(n):kP(s)&&PP(e,s,r):8==o?(TP(e,t,n,r),kP(s)&&PP(e,s,r)):8==s?(TP(e,t,n,r),e.push(n)):(r=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3];return 0===e?t=[n,r,i,a]:1==e?t=[r,i,a,n]:2==e?t=[i,a,n,r]:3==e?t=[a,n,r,i]:vt("Invalid rotation number"),t}(i=(a=o)>1&&a<8?Math.floor(a/2):0,r),o=CP(i,o),s=CP(i,s),0==o?0===s||1===s||7===s||(2==s||6==s?PP(e,s,r):3==s?TP(e,t,n,r)||PP(e,2,r):4==s?(TP(e,t,n,r)||(fr.orient2D(t[0],t[1],n[0],n[1],r[0][0],r[0][1])>1?PP(e,6,r):PP(e,2,r)),PP(e,s,r)):5==s&&(TP(e,t,n,r)||PP(e,6,r))):1==o?2==s||0===s?PP(e,s,r):3==s?TP(e,t,n,r)||PP(e,2,r):4==s?(TP(e,t,n,r)||PP(e,2,r),PP(e,4,r)):5==s?TP(e,t,n,r):6==s?(TP(e,t,n,r)||PP(e,0,r),PP(e,6,r)):7==s&&(TP(e,t,n,r)||PP(e,0,r)):vt("Sector error")))}function NP(e,t,n,r,i){var a=fr.segmentIntersection(t[0],t[1],n[0],n[1],r[0],r[1],i[0],i[1]);a&&e.push(a)}function TP(e,t,n,r){var i=[];return NP(i,t,n,r[0],r[1]),NP(i,t,n,r[0],r[3]),NP(i,t,n,r[1],r[2]),NP(i,t,n,r[2],r[3]),i.length>0&&(e.push.apply(e,i),!0)}var LP={};LP.svg=Object.assign({},hm,EP,Tg,Rg,Gg),Object.assign(LP,{Job:u_,Dbf:Tm,DbfReader:Rv,DouglasPeucker:wC,parseGeoJSON:hb,geojson:_d,json:{parse:function(e){var t=Lb(k(e)?new Ty(e):e,0);yb(t);var n=Sb(t);return yb(t),t.peek()!=ib&&db(t.peek(),t.index()),n}},ShpType:ay,topojson:uy,Visvalingam:lC,ArcCollection:Wa,Bounds:qt,clipIterByBounds:function(e,t){for(var n,r,i,a,o=[],s=function(e){return[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin]]}(t);e.hasNext();)OP(o,r,n=[e.x,e.y],s),r=n,i||(i=n);return(a=MP(i,n))&&o.length>0&&!MP(o[0],o[o.length-1])&&o.push(o[0].concat()),(a&&o.length<4||o.length<2)&&(o=[]),o},CommandParser:Av,DataTable:di,editArcs:qM,Heap:kM,IdLookupIndex:function(e){var t=new Uint32Array(e);this.setId=function(n,r){n>=0&&r>=0&&r<e-1?t[n]=r+1:vt("Invalid value")},this.hasId=function(e){return this.getId(e)>-1},this.getId=function(n){return n>=0&&n<e?t[n]-1:-1}},NodeCollection:lo,parseDMS:Mh,formatDMS:kh,PathIndex:Vf,PolygonIndex:qf,ShpReader:Vv,Transform:Gt}),Object.assign(LP,Uh,jS,go,tn,VE,Nm,vp,hp,s_,XE,DE,QE,ta,Mp,To,pi,Fv,iy,sv,Vy,ev,Yr,hy,Py,ip,cp,jf,e_,$o,zy,Mf,jM,rI,$d,om,ax,Td,nb,Hc,Gb,pM,Qp,zk,_p,yM,MM,Fb,_y,IC,sa,Zi,TI,Bt,uo,hd,Sv,Sy,FE,cf,Yb,uC,fo,Hf,Al,dl,Yv,Bp,Mr,dI,vk,eC,Zt,Tp,md,sd,nd,BS,q_,cd,TE,xC,YI,Da,GI,tI,yi,Xl,_P,em,cr,Rl,Ga,Tr,Gv,sy,Xv,BC,Lh,Ja,gh,Yn,i_,VC,Vc,o,Qf,Pm,_g,aP,Zh,my,ab,eo,fh,ng,gm,ul,Tf);var zP={runCommands:hP,applyCommands:pP,runCommandsXL:dP,enableLogging:mt};Object.assign(zP,{cli:Lf,cmd:pp,geom:fr,utils:t,internal:LP}),e.exports?e.exports=zP:"object"==typeof window&&window&&(window.mapshaper=zP)}()}(pt);var Pa=t(pt.exports);export{Pa as default};
|
|
1
|
+
function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var r={exports:{}},i=n(Object.freeze({__proto__:null,default:{}}));function a(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function u(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,t="/"===r.charAt(0))}return(t?"/":"")+(e=a(y(e.split("/"),function(e){return!!e}),!t).join("/"))||"."}function c(e){var t=f(e),n="/"===b(e,-1);return(e=a(y(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function f(e){return"/"===e.charAt(0)}function l(){return c(y(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=u(e).substr(1),t=u(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}var c=[];for(s=o;s<r.length;s++)c.push("..");return(c=c.concat(i.slice(o))).join("/")}function p(e){var t=s(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function d(e,t){var n=s(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function g(e){return s(e)[3]}var m={extname:g,basename:d,dirname:p,sep:"/",delimiter:":",relative:h,join:l,isAbsolute:f,normalize:c,resolve:u};function y(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var v,b="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)},_=n(Object.freeze({__proto__:null,basename:d,default:m,delimiter:":",dirname:p,extname:g,isAbsolute:f,join:l,normalize:c,relative:h,resolve:u,sep:"/"}));v=r,function(){var e=Math.abs,t=Math.floor,n=Math.sin,r=Math.cos,a=Math.tan,o=Math.asin,s=Math.acos,u=Math.atan,c=Math.atan2,f=Math.sqrt,l=Math.pow,h=Math.exp,p=Math.log,d=Math.hypot,g=Math.sinh,m=Math.cosh,y=Math.min,b=Math.max,x=1/0,w=Math.PI,S=57.29577951308232,A=.017453292519943295,E=6378137,M=.0066943799901413165,I=w/4,k=w/2,C=1.5*w,P=2*w,O=2/w,N=-45,T=-47,L=1e-10,z={last_errno:0,debug_level:0,logger:null},R=["no arguments in initialization list","no options found in 'init' file","invalid init= string","projection not named","unknown projection id","effective eccentricity = 1","unknown unit conversion id","invalid boolean param argument","unknown elliptical parameter name","reciprocal flattening (1/f) = 0","|radius reference latitude| > 90","squared eccentricity < 0","major axis or radius = 0 or not given","latitude or longitude exceeded limits","invalid x or y","improperly formed DMS value","non-convergent inverse meridional dist","non-convergent inverse phi2","acos/asin: |arg| >1+1e-14","tolerance condition error","conic lat_1 = -lat_2","lat_1 >= 90","lat_1 = 0","lat_ts >= 90","no distance between control points","projection not selected to be rotated","W <= 0 or M <= 0","lsat not in 1-5 range","path not in range","h <= 0","k <= 0","lat_0 = 0 or 90 or alpha = 90","lat_1=lat_2 or lat_1=0 or lat_2=90","elliptical usage required","invalid UTM zone number","arg(s) out of range for Tcheby eval","failed to find projection to be rotated","failed to load datum shift file","both n & m must be spec'd and > 0","n <= 0, n > 1 or not specified","lat_1 or lat_2 not specified","|lat_1| == |lat_2|","lat_0 is pi/2 from mean lat","unparseable coordinate system definition","geocentric transformation missing z or ellps","unknown prime meridian conversion id","illegal axis orientation combination","point not within available datum shift grids","invalid sweep axis, choose x or y","invalid value for h","point outside of projection domain"];function D(){var e=z.last_errno;e&&(e>0||!function(e){return j.indexOf(e)>-1}(e))&&q(e)}var j=[-14,-15,-17,-18,-19,-20,-27,-48];function F(e){z.last_errno=e}function U(){F(-20)}function B(){F(-20)}function G(e){q(e)}function q(e){F(e),V()}function V(e,t){var n;throw t||(t={}),t.code||(t.code=z.last_errno||0),e||(n=t.code,e=R[~n]||"unknown error"),z.last_errno=0,new $(e,t)}function $(e,t){var n=new Error(e);return n.name="ProjError",Object.keys(t).forEach(function(e){n[e]=t[e]}),n}function J(e){return W(e)*A}function W(e){var t=/(-?[0-9.]+)d?([0-9.]*)'?([0-9.]*)"?([nsew]?)$/i.exec(e),n=NaN;return t&&(n=+(t[1]||"0")+ +(t[2]||"0")/60+ +(t[3]||"0")/3600,/[ws]/i.test(t[4])&&(n=-n)),isNaN(n)&&q(-16),n}function Z(e){return Y(e)}function Y(e){return parseFloat(e)}function H(e,t){var n,r,i=t[0],a=e[t.substr(1)],o=void 0!==a;return"t"==i?n=o:o?(r=a.param,a.used=!0,"i"==i?n=parseInt(r):"d"==i?n=Z(r):"r"==i?n=J(r):"s"==i?n=String(r):"b"==i&&("T"==r||"t"==r||!0===r?n=!0:("F"==r||"f"==r||F(-8),n=!1))):n={i:0,b:!1,d:0,r:0,s:""}[i],void 0===n&&V("invalid request to pj_param, fatal"),n}function X(e){for(var t,n=/\+([a-z][a-z0-9_]*(?:=[^\s]*)?)/gi,r={};t=n.exec(e);)K(r,t[1]);return r}function K(e,t){var n,r,i=t.split("=");1==i.length?(n=t,r=!0):(n=i[0],r=t.substr(i[0].length+1)),e[n]={used:!1,param:r}}var Q={};function ee(e,t,n,r){Q[t]={init:e,name:n,description:r}}function te(e){return!e||e.is_latlong}function ne(e){var t=!1,n="";return"datum"in e.params?(t=!0,n+=ie(e,"datum")):"R"in e.params?n+=ie(e,"R"):"ellps"in e.params?n+=ie(e,"ellps"):"a"in e.params?(n+=ie(e,"a"),"b"in e.params?n+=ie(e,"b"):"es"in e.params?n+=ie(e,"es"):"f"in e.params?n+=ie(e,"f"):n+=" +es="+e.es):G(-13),t||(n+=ie(e,"towgs84"),n+=ie(e,"nadgrids")),n+=ie(e,"R_A"),n+=ie(e,"R_V"),n+=ie(e,"R_a"),n+=ie(e,"R_lat_a"),n+=ie(e,"R_lat_g"),n+=ie(e,"pm")}function re(e){var t="datum,ellps,a,b,es,rf,f,towgs84,nadgrids,R,R_A,R_V,R_a,R_lat_a,R_lat_g,pm,init,no_defs".split(","),n="";return Object.keys(e.params).forEach(function(r){-1==t.indexOf(r)&&(n+=ie(e,r))}),(n+=ne(e)).trim()}function ie(e,t){var n="";return t in e.params&&(n=" +"+t,!0!==e.params[t].param&&(n+="="+H(e.params,"s"+t))),n}var ae=[["WGS84","towgs84=0,0,0","WGS84","WGS_1984"],["GGRS87","towgs84=-199.87,74.79,246.62","GRS80","Greek_Geodetic_Reference_System_1987"],["NAD83","towgs84=0,0,0","GRS80","North_American_Datum_1983"],["NAD27","nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat","clrk66","North_American_Datum_1927"],["potsdam","towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7","bessel","Potsdam Rauenberg 1950 DHDN"],["carthage","towgs84=-263.0,6.0,431.0","clrk80ign","Carthage 1934 Tunisia"],["hermannskogel","towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232","bessel","Hermannskogel"],["ire65","towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15","mod_airy","Ireland 1965"],["nzgd49","towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993","intl","New Zealand Geodetic Datum 1949"],["OSGB36","towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894","airy","OSGB 1936"],[null,null,null,null]],oe=[["greenwich","0dE"],["lisbon","9d07'54.862\"W"],["paris","2d20'14.025\"E"],["bogota","74d04'51.3\"W"],["madrid","3d41'16.58\"W"],["rome","12d27'8.4\"E"],["bern","7d26'22.5\"E"],["jakarta","106d48'27.79\"E"],["ferro","17d40'W"],["brussels","4d22'4.71\"E"],["stockholm","18d3'29.8\"E"],["athens","23d42'58.815\"E"],["oslo","10d43'22.5\"E"],[null,null]];function se(e){var t=ae.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],defn:t[1],ellipse_id:t[2],name:t[3]}:null}var ue=[["MERIT","a=6378137.0","rf=298.257","MERIT 1983"],["SGS85","a=6378136.0","rf=298.257","Soviet Geodetic System 85"],["GRS80","a=6378137.0","rf=298.257222101","GRS 1980(IUGG, 1980)"],["IAU76","a=6378140.0","rf=298.257","IAU 1976"],["airy","a=6377563.396","b=6356256.910","Airy 1830"],["APL4.9","a=6378137.0","rf=298.25","Appl. Physics. 1965"],["NWL9D","a=6378145.0","rf=298.25","Naval Weapons Lab., 1965"],["mod_airy","a=6377340.189","b=6356034.446","Modified Airy"],["andrae","a=6377104.43","rf=300.0","Andrae 1876 (Den., Iclnd.)"],["aust_SA","a=6378160.0","rf=298.25","Australian Natl & S. Amer. 1969"],["GRS67","a=6378160.0","rf=298.2471674270","GRS 67(IUGG 1967)"],["bessel","a=6377397.155","rf=299.1528128","Bessel 1841"],["bess_nam","a=6377483.865","rf=299.1528128","Bessel 1841 (Namibia)"],["clrk66","a=6378206.4","b=6356583.8","Clarke 1866"],["clrk80","a=6378249.145","rf=293.4663","Clarke 1880 mod."],["clrk80ign","a=6378249.2","rf=293.4660212936269","Clarke 1880 (IGN)."],["CPM","a=6375738.7","rf=334.29","Comm. des Poids et Mesures 1799"],["delmbr","a=6376428","rf=311.5","Delambre 1810 (Belgium)"],["engelis","a=6378136.05","rf=298.2566","Engelis 1985"],["evrst30","a=6377276.345","rf=300.8017","Everest 1830"],["evrst48","a=6377304.063","rf=300.8017","Everest 1948"],["evrst56","a=6377301.243","rf=300.8017","Everest 1956"],["evrst69","a=6377295.664","rf=300.8017","Everest 1969"],["evrstSS","a=6377298.556","rf=300.8017","Everest (Sabah & Sarawak)"],["fschr60","a=6378166","rf=298.3","Fischer (Mercury Datum) 1960"],["fschr60m","a=6378155","rf=298.3","Modified Fischer 1960"],["fschr68","a=6378150","rf=298.3","Fischer 1968"],["helmert","a=6378200","rf=298.3","Helmert 1906"],["hough","a=6378270.0","rf=297","Hough"],["intl","a=6378388.0","rf=297","International 1909 (Hayford)"],["krass","a=6378245.0","rf=298.3","Krasovsky 1940"],["kaula","a=6378163","rf=298.24","Kaula 1961"],["lerch","a=6378139","rf=298.257","Lerch 1979"],["mprts","a=6397300","rf=191","Maupertius 1738"],["new_intl","a=6378157.5","b=6356772.2","New International 1967"],["plessis","a=6376523","b=6355863","Plessis 1817 (France)"],["SEasia","a=6378155.0","b=6356773.3205","Southeast Asia"],["walbeck","a=6376896.0","b=6355834.8467","Walbeck"],["WGS60","a=6378165.0","rf=298.3","WGS 60"],["WGS66","a=6378145.0","rf=298.25","WGS 66"],["WGS72","a=6378135.0","rf=298.26","WGS 72"],["WGS84","a=6378137.0","rf=298.257223563","WGS 84"],["sphere","a=6370997.0","b=6370997.0","Normal Sphere (r=6370997)"],[null,null,null,null]];function ce(e){var t=ue.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],major:t[1],ell:t[2],name:t[3]}:null}var fe=[["km","1000","Kilometer"],["m","1","Meter"],["dm","1/10","Decimeter"],["cm","1/100","Centimeter"],["mm","1/1000","Millimeter"],["kmi","1852.0","International Nautical Mile"],["in","0.0254","International Inch"],["ft","0.3048","International Foot"],["yd","0.9144","International Yard"],["mi","1609.344","International Statute Mile"],["fath","1.8288","International Fathom"],["ch","20.1168","International Chain"],["link","0.201168","International Link"],["us-in","1/39.37","U.S. Surveyor's Inch"],["us-ft","0.304800609601219","U.S. Surveyor's Foot"],["us-yd","0.914401828803658","U.S. Surveyor's Yard"],["us-ch","20.11684023368047","U.S. Surveyor's Chain"],["us-mi","1609.347218694437","U.S. Surveyor's Statute Mile"],["ind-yd","0.91439523","Indian Yard"],["ind-ft","0.30479841","Indian Foot"],["ind-ch","20.11669506","Indian Chain"],[null,null,null]];function le(e){var t=fe.reduce(function(t,n){return e===n[0]?n:t},null);return t?{id:t[0],to_meter:t[1],name:t[2]}:null}var he={},pe={};function de(e){return pe[e]||null}function ge(e){var t,n,r,a,o,s,u,c,f=e.split(":"),l=f[0],h=f[1];return h&&l||G(-3),(t=de(l=l.toLowerCase()))||(n=l,a=i,s=(o=_).join(o.dirname("/Users/zhang/code/emap/node_modules/mproj/dist"),"../nad"),u=o.join(s,n.toUpperCase()),c=o.join(s,n.toLowerCase()),a.existsSync(u)?r=a.readFileSync(u,"utf8"):a.existsSync(c)?r=a.readFileSync(c,"utf8"):V("unable to read from 'init' file named "+n),t=r,pe[l]=t),t?function(e,t){var n,r,i="",a="";return(n=e.indexOf("<"+t+">"))>-1&&((r=e.lastIndexOf("#",n))>-1&&(a=e.substring(r+1,n).trim(),/\n/.test(a)&&(a="")),i=(i=(i=" "+(i=(i=(i=(i=(i=e.substr(n+t.length+2)).substr(0,i.indexOf("<"))).replace(/#.*/g,"")).replace(/[\s]+/g," ")).replace(/\+title=[^+]*[^ +]/g,function(e){return e.replace(/ /g,"\t")}))).replace(/ (?=[a-z])/gi," +")).replace(/\t/g," ").trim()),i?{opts:i,comment:a}:null}(t,h):null}function me(t){var r,i,a=X(t),o={params:a,is_latlong:!1,is_geocent:!1,is_long_wrap_set:!1,long_wrap_center:0,axis:"enu",gridlist:null,gridlist_count:0,vgridlist_geoid:null,vgridlist_geoid_count:0};return Object.keys(a).length||G(-1),H(a,"tinit")&&function(e,t){var n=he[t.toLowerCase()]||null;n||function(e,t){he[e.toLowerCase()]=t}(t,n=ge(t)),n||G(-2),ye(e,n.opts)}(a,H(a,"sinit")),(r=H(a,"sproj"))||G(-4),(i=Q[r])||G(-5),H(a,"bno_defs")||function(e){ye(e,"+ellps=WGS84")}(o.params),function(e){var t,n,r,i,a=484813681109536e-20,o=e.datum_params=[0,0,0,0,0,0,0];e.datum_type=0,(t=H(e.params,"sdatum"))&&((n=se(t))||G(-9),n.ellipse_id&&K(e.params,"ellps="+n.ellipse_id),n.defn&&K(e.params,n.defn)),(r=H(e.params,"snadgrids"))&&"@null"!=r&&V("+nadgrids is not implemented"),H(e.params,"scatalog")&&V("+catalog is not implemented"),(i=H(e.params,"stowgs84"))&&(i.split(",").forEach(function(e,t){o[t]=Z(e)||0}),0!=o[3]||0!=o[4]||0!=o[5]||0!=o[6]?(e.datum_type=2,o[3]*=a,o[4]*=a,o[5]*=a,o[6]=o[6]/1e6+1):e.datum_type=1)}(o),function(t){var r,i,a,o,s,u=.16666666666666666,c=t.params,l=0,h=0;H(c,"tR")?l=H(c,"dR"):((r=H(c,"sellps"))&&((i=ce(r))||G(-9),K(c,i.major),K(c,i.ell)),l=H(c,"da"),H(c,"tes")?h=H(c,"des"):H(c,"te")?h=(a=H(c,"de"))*a:H(c,"trf")?((a=H(c,"drf"))||G(-10),h=(a=1/a)*(2-a)):H(c,"tf")?h=(a=H(c,"df"))*(2-a):H(c,"tb")&&(h=1-(o=H(c,"db"))*o/(l*l)),o||(o=l*f(1-h)),H(c,"bR_A")?(l*=1-h*(u+h*(.04722222222222222+.022156084656084655*h)),h=0):H(c,"bR_V")?l*=1-h*(u+h*(.06944444444444445+.04243827160493827*h)):H(c,"bR_a")?(l=.5*(l+o),h=0):H(c,"bR_g")?(l=f(l*o),h=0):H(c,"bR_h")?(l+o===0&&G(-20),l=2*l*o/(l+o),h=0):(s=H(c,"tR_lat_a")||H(c,"tR_lat_g"))&&(a=n(H(c,s?"rR_lat_a":"rR_lat_g")),e(a)>k&&G(-11),a=1-h*a*a,l*=s?.5*(1-h+a)/(a*f(a)):f(1-h)/a,h=0)),h<0&&G(-12),l<=0&&G(-13),t.es=h,t.a=l}(o),o.a_orig=o.a,o.es_orig=o.es,o.e=f(o.es),o.ra=1/o.a,o.one_es=1-o.es,o.one_es||G(-6),o.rone_es=1/o.one_es,function(e){return 1==e.datum_type&&e.datum_params[0]==e.datum_params[1]==e.datum_params[2]===0&&6378137==e.a&&Math.abs(e.es-.00669437999)<5e-11}(o)&&(o.datum_type=4),o.geoc=!!o.es&&H(a,"bgeoc"),o.over=H(a,"bover"),o.has_geoid_vgrids=H(a,"tgeoidgrids"),o.has_geoid_vgrids&&H(a,"sgeoidgrids"),o.is_long_wrap_set=H(a,"tlon_wrap"),o.is_long_wrap_set&&(o.long_wrap_center=H(a,"rlon_wrap"),e(o.long_wrap_center)<10*P==0&&G(-14)),H(a,"saxis")&&function(e){var t="ewnsud",n=H(e.params,"saxis");3!=n.length&&G(T),-1!=t.indexOf(n[0])&&-1!=t.indexOf(n[1])&&-1!=t.indexOf(n[2])||G(T),e.axis=n}(o),o.lam0=H(a,"rlon_0"),o.phi0=H(a,"rlat_0"),o.x0=H(a,"dx_0"),o.y0=H(a,"dy_0"),H(a,"tk_0")?o.k0=H(a,"dk_0"):H(a,"tk")?o.k0=H(a,"dk"):o.k0=1,o.k0<=0&&G(-31),function(e){var t,n,r,i=e.params;(t=H(i,"sunits"))&&((r=le(t))||G(-7),n=r.to_meter),n||(n=H(i,"sto_meter"))?(e.to_meter=ve(n),e.fr_meter=1/e.to_meter):e.to_meter=e.fr_meter=1,n=null,(t=H(i,"svunits"))&&((r=le(t))||G(-7),n=r.to_meter),n||H(i,"svto_meter")?(e.vto_meter=ve(n),e.vfr_meter=1/e.vto_meter):(e.vto_meter=e.to_meter,e.vfr_meter=e.fr_meter)}(o),function(e){var t,n,r,i=e.params;(t=H(i,"spm"))?(n=function(e){var t=oe.reduce(function(t,n){return n[0]===e?n:t},null);return t?{id:t[0],definition:t[1]}:null}(t),r=J(n?n.definition:t),isNaN(r)&&G(-46),e.from_greenwich=r):e.from_greenwich=0}(o),i.init(o),o}function ye(e,t){var n=X(t),r=["datum","ellps","a","b","rf","f"].reduce(function(t,n){return t||n in e},!1);Object.keys(n).forEach(function(t){t in e||"ellps"==t&&r||(e[t]=n[t])})}function ve(e){var t=e.split("/"),n=Y(t[0]);return t.length>1&&(n/=Y(t[1])),n}function be(e,t){var n=0,r=e*e,i=t*t;return e<=0&&(n|=4),t<=0&&(n|=8),e<t&&(n|=16),n?null:{a:e,b:t,a2:r,b2:i,e2:(r-i)/r,ep2:(r-i)/i}}function _e(e,t,i,a,o){var s,u,c,l,h=0,p=i[t],d=a[t],g=o[t];return d<-k&&d>-1.001*k?d=-k:d>k&&d<1.001*k?d=k:(d<-k||d>k)&&(h|=1),h||(p>w&&(p-=2*w),u=n(d),l=r(d),c=u*u,s=e.a/f(1-e.e2*c),i[t]=(s+g)*l*r(p),a[t]=(s+g)*l*n(p),o[t]=(s*(1-e.e2)+g)*u),h}function xe(t,n,r,i,a){var o,s,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E=1e-12,M=r[n],I=i[n],C=a[n];if(h=f(M*M+I*I),p=f(M*M+I*I+C*C),h/t.a<E){if(s=0,p/t.a<E)return r[n]=0,i[n]=k,a[n]=-t.b,0}else s=c(I,M);d=C/p,g=h/p,m=1/f(1-t.e2*(2-t.e2)*g*g),b=g*(1-t.e2)*m,_=d*m,A=0;do{A++,l=h*b+C*_-(y=t.a/f(1-t.e2*_*_))*(1-t.e2*_*_),v=t.e2*y/(y+l),S=(w=d*(m=1/f(1-v*(2-v)*g*g)))*b-(x=g*(1-v)*m)*_,b=x,_=w}while(S*S>1e-24&&A<30);o=u(w/e(x)),r[n]=s,i[n]=o,a[n]=l}function we(e,t,n){var r=n.length>2,i=[n[0]],a=[n[1]],o=[r?n[2]:0];e.is_latlong&&(i[0]*=A,a[0]*=A),z.last_errno=0,Se(e,t,i,a,o),(z.last_errno||i[0]==x)&&V(null,{point:n}),t.is_latlong&&(i[0]*=S,a[0]*=S),n[0]=i[0],n[1]=a[0],r&&(n[2]=o[0])}function Se(e,t,n,r,i){var a,o,s=n.length,u={},c={};if("enu"!=e.axis&&Ae(e.axis,!1,n,r,i),1!=e.vto_meter&&i)for(a=0;a<s;a++)i[a]*=e.vto_meter;if(e.is_geocent){if(i||G(N),1!=e.to_meter)for(a=0;a<s;a++)n[a]!=x&&(n[a]*=e.to_meter,r[a]*=e.to_meter);Ee(e.a_orig,e.es_orig,n,r,i)}else if(!e.is_latlong)if(e.inv3d||e.inv||V("source projection not invertible"),e.inv3d)V("inverse 3d transformations not supported");else for(a=0;a<s;a++)c.x=n[a],c.y=r[a],o=Ce(c,e),n[a]=o.lam,r[a]=o.phi,D();if(0!==e.from_greenwich)for(a=0;a<s;a++)n[a]!=x&&(n[a]+=e.from_greenwich);if(e.has_geoid_vgrids&&i&&V("vgrid transformation not supported"),function(e,t,n,r,i){var a,o,s,u,c=n.length;0!=e.datum_type&&0!=t.datum_type&&(function(e,t){return e.datum_type==t.datum_type&&(!(e.a_orig!=t.a_orig||Math.abs(e.es_orig-t.es_orig)>5e-11)&&(1==e.datum_type?e.datum_params[0]==t.datum_params[0]&&e.datum_params[1]==t.datum_params[1]&&e.datum_params[2]==t.datum_params[2]:2==e.datum_type?e.datum_params[0]==t.datum_params[0]&&e.datum_params[1]==t.datum_params[1]&&e.datum_params[2]==t.datum_params[2]&&e.datum_params[3]==t.datum_params[3]&&e.datum_params[4]==t.datum_params[4]&&e.datum_params[5]==t.datum_params[5]&&e.datum_params[6]==t.datum_params[6]:3!=e.datum_type||H(e.params,"snadgrids")==H(t.params,"snadgrids")))}(e,t)||(a=e.a_orig,o=e.es_orig,s=t.a_orig,u=t.es_orig,i||(i=new Float64Array(c)),3==e.datum_type&&(V("gridshift not implemented"),a=E,o=M),3==t.datum_type&&(s=E,u=M),o==u&&a==s&&1!=e.datum_type&&2!=e.datum_type&&1!=t.datum_type&&2!=t.datum_type||(Me(a,o,n,r,i),1!=e.datum_type&&2!=e.datum_type||function(e,t,n,r){var i,a,o,s,u,c,f,l,h=t.length,p=e.datum_params,d=p[0],g=p[1],m=p[2];if(1==e.datum_type)for(l=0;l<h;l++)t[l]!=x&&(t[l]+=d,n[l]+=g,r[l]+=m);else if(2==e.datum_type)for(s=p[3],u=p[4],c=p[5],f=p[6],l=0;l<h;l++)t[l]!=x&&(i=f*(t[l]-c*n[l]+u*r[l])+d,a=f*(c*t[l]+n[l]-s*r[l])+g,o=f*(-u*t[l]+s*n[l]+r[l])+m,t[l]=i,n[l]=a,r[l]=o)}(e,n,r,i),1!=t.datum_type&&2!=t.datum_type||function(e,t,n,r){var i,a,o,s,u,c,f,l,h=t.length,p=e.datum_params,d=p[0],g=p[1],m=p[2];if(1==e.datum_type)for(l=0;l<h;l++)t[l]!=x&&(t[l]-=d,n[l]-=g,r[l]-=m);else if(2==e.datum_type)for(s=p[3],u=p[4],c=p[5],f=p[6],l=0;l<h;l++)t[l]!=x&&(i=(t[l]-d)/f,a=(n[l]-g)/f,o=(r[l]-m)/f,t[l]=i+c*a-u*o,n[l]=-c*i+a+s*o,r[l]=u*i-s*a+o)}(t,n,r,i),Ee(s,u,n,r,i),3==t.datum_type&&pj_apply_gridshift_2(t,1,n,r,i))))}(e,t,n,r,i),t.has_geoid_vgrids&&i&&V("vgrid transformation not supported"),0!==t.from_greenwich)for(a=0;a<s;a++)n[a]!=x&&(n[a]-=t.from_greenwich);if(t.is_geocent){if(i||G(N),Me(t.a_orig,t.es_orig,n,r,i),1!=t.fr_meter)for(a=0;a<s;a++)n[a]!=x&&(n[a]*=t.fr_meter,r[a]*=t.fr_meter)}else if(t.is_latlong){if(t.is_latlong&&t.is_long_wrap_set)for(a=0;a<s;a++)if(n[a]!=x){for(;n[a]<t.long_wrap_center-w;)n[a]+=P;for(;n[a]>t.long_wrap_center+w;)n[a]-=P}}else if(t.fwd3d)V("3d transformation not supported");else for(a=0;a<s;a++)u.lam=n[a],u.phi=r[a],o=ke(u,t),n[a]=o.x,r[a]=o.y,D();if(1!=t.vto_meter&&i)for(a=0;a<s;a++)i[a]*=t.vfr_meter;return"enu"!=t.axis&&Ae(t.axis,!0,n,r,i),1==s?z.last_errno:0}function Ae(e,t,n,r,i){var a,o,s,u,c,f,l=n.length,h=0;if(t){for(s=0;s<l;s++)if(a=n[s],o=r[s],a!=x)for(i&&(h=i[s]),u=0;u<3;u++)if(2!=u||i)switch(f=0==u?n:1==u?r:i,e[u]){case"e":f[s]=a;break;case"w":f[s]=-a;break;case"n":f[s]=o;break;case"s":f[s]=-o;break;case"u":f[s]=h;break;case"d":f[s]=-h;break;default:G(T)}}else for(s=0;s<l;s++)if(a=n[s],o=r[s],a!=x)for(i&&(h=i[s]),u=0;u<3;u++)switch(c=0==u?a:1==u?o:h,e[u]){case"e":n[s]=c;break;case"w":n[s]=-c;break;case"n":r[s]=c;break;case"s":r[s]=-c;break;case"u":i&&(i[s]=c);break;case"d":i&&(i[s]=-c);break;default:G(T)}}function Ee(e,t,n,r,i){var a,o,s=n.length;for((o=be(e,0==t?e:e*f(1-t)))||G(N),a=0;a<s;a++)n[a]!=x&&xe(o,a,n,r,i)}function Me(e,t,n,r,i){var a,o,s=n.length;for((o=be(e,0===t?e:e*f(1-t)))||G(N),a=0;a<s;a++)n[a]!=x&&_e(o,a,n,r,i)&&(n[a]=r[a]=x)}function Ie(n){var r=6.283185307179586,i=3.141592653589793;return e(n)>3.14159265359&&(n+=i,n-=r*t(n/r),n-=i),n}function ke(t,n){var r={x:0,y:0},i=e(t.phi)-k;return i<=1e-12&&e(t.lam)<=10?(z.last_errno=0,e(i)<=1e-12?t.phi=t.phi<0?-k:k:n.geoc&&(t.phi=u(n.rone_es*a(t.phi))),t.lam-=n.lam0,n.over||(t.lam=Ie(t.lam)),n.fwd?(n.fwd(t,r),r.x=n.fr_meter*(n.a*r.x+n.x0),r.y=n.fr_meter*(n.a*r.y+n.y0)):r.x=r.y=x):F(-14),!z.last_errno&&isFinite(r.x)&&isFinite(r.y)||(r.x=r.y=x),r}function Ce(t,n){var r={lam:0,phi:0};return t.x<x&&t.y<x?(z.last_errno=0,n.inv?(t.x=(t.x*n.to_meter-n.x0)*n.ra,t.y=(t.y*n.to_meter-n.y0)*n.ra,n.inv(t,r),r.lam+=n.lam0,n.over||(r.lam=Ie(r.lam)),n.geoc&&e(e(r.phi)-k)>1e-12&&(r.phi=u(n.one_es*a(r.phi)))):r.lam=r.phi=x):F(-15),!z.last_errno&&isFinite(r.lam)&&isFinite(r.phi)||(r.lam=r.phi=x),r}function Pe(e,n,r,i){var a,o,s;for((e<0||e>=9)&&(e=3),a=1,s=0;s<e;s++)a*=10;return o=3600*a,function(s){var u,c,f,l,h="",p="",d="";return s===x||isNaN(s)?"":(s<0?(s=-s,(f=i||"")||(h="-")):f=r||"",c=(s=t(s*o+.5))/a%60,u=(s=t(s/(60*a)))%60,l=t(s/60)+"d",d=c.toFixed(e),d=(c=parseFloat(d))?(n?d:String(c))+'"':"",(c||u)&&2==(p=String(u)+"'").length&&n&&(p="0"+p),h+l+p+d+f)}}function Oe(e,t,n){var r,i,a,o,s,u;return"string"!=typeof e?Tn:("string"!=typeof t?(i="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",a=e,r=t):(i=e,a=t,r=n),u=Ne(o=me(i),s=me(a)),r?u(r):{forward:u,inverse:Ne(s,o)})}function Ne(e,t){return function(n){var r=Array.isArray(n);return n=r?n.concat():[n.x,n.y],we(e,t,n),r||(n={x:n[0],y:n[1]}),n}}function Te(e){var t=e.proj in Q?Q[e.proj].name:"",n=re(e),r=Ke(e);return{PROJCS:{NAME:t?r.NAME+" / "+t:"unnamed",GEOGCS:r,PROJECTION:"custom_proj4",PARAMETER:[],UNIT:Je(e),EXTENSION:["PROJ4",n+" +wktext"]}}}function Le(e){var t=e.EXTENSION;return t&&"PROJ4"==t[0]?(t[1]||"").replace(" +wktext",""):null}Oe.WGS84="+proj=longlat +datum=WGS84",Oe.toPoint=function(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t};var ze=[],Re=[];function De(e){return"string"==typeof e}function je(e){var t=Ue(e,Re);return t||(t=function(e){return Le(e)?Le:null}(e)),t||Ve("unsupported WKT definition: "+(e.NAME||"[unknown]")),t}function Fe(e){var t=Ue(e,ze);return t||(t=Te),t||Ve("unsupported projection: "+function(e){return Be(e)||"[unknown]"}(e)),t}function Ue(e,t){for(var n=0;n<t.length;n++)if((0,t[n][0])(e))return t[n][1];return null}function Be(e){return H(e.params,"sproj")}function Ge(e){return e.replace(/[-_ \/]+/g,"_").toLowerCase()}function qe(e){var t;return Array.isArray(e)?t=e:e&&e.length>0&&(t=e.split(",")),t}function Ve(e){throw new Error(e)}function $e(e){return{to_meter:e.UNIT[1]}}function Je(e){return["Meter",e.to_meter||1]}function We(e,t){var n,r,i=e.DATUM,a=i.SPHEROID,o=function(e){var t,n={northamerican1983:"NAD83",newzealand1949:"nzgd49"},r=Ze(e.NAME);if(r in n)return n[r];for(var i=0;i<ae.length&&Ze((t=ae[i])[3])!=r&&Ze(t[0])!=r;i++);return t?t[0]:null}(i),s=function(e){var t,n={international1924:"intl"},r=Ze(e[0]);if(r in n)return n[r];if(/^grs1980/.test(r))return"GRS80";if("sphere"==r)return null;for(var i=0;i<ue.length&&Ze((t=ue[i])[3])!=r&&Ze(t[0])!=r;i++);return t?t[0]:null}(a),u=t&&t.aux_sphere,c=a[1],f=a[2];return Ye(e.UNIT,"degree"),u?n="+a="+a[1]:o?n="+datum="+o:s?n="+ellps="+s:(n="+a="+c,f>0&&(n+=" +rf="+f)),!i.TOWGS84||u||o||(n+=" +towgs84="+i.TOWGS84.join(",")),((r=e.PRIMEM?e.PRIMEM[1]:0)>0||r<0)&&(n+=" +pm="+r),n}function Ze(e){return(e||"").replace(/^(GCS|D)_/i,"").replace(/[ _]/g,"").toLowerCase()}function Ye(e,t){e&&e[0].toLowerCase()!=t&&Ve("unexpected geographic units: "+geogcs.UNIT[0])}function He(e){return function(){return"+proj="+e}}function Xe(e){return function(t){var n,r;return[e.PROJECTION(t),e.PARAMETER(t),e.GEOGCS?e.GEOGCS(t):We(t.GEOGCS),(n=$e(t),r="",1!=n.to_meter&&(r="+to_meter="+n.to_meter),r),"+no_defs"].filter(function(e){return!!e}).join(" ")}}function Ke(e){return{NAME:tt(e),DATUM:Qe(e),PRIMEM:["Greenwich",0],UNIT:["degree",.017453292519943295]}}function Qe(e){var t={NAME:rt(e),SPHEROID:et(e)},n=H(e.params,"stowgs84");return/[1-9]/.test(n)&&(t.TOWGS84=n),t}function et(e){var t;return t=H(e.params,"trf")?H(e.params,"drf"):e.es?1/(1-Math.sqrt(1-e.es)):0,[nt(e),e.a,t]}function tt(e){var t;return te(e)&&(t=ut(e)),t||(t=it(e),t=/^[a-z]+$/.test(t)?t[0].toUpperCase()+t.substr(1):t.toUpperCase()),t||"UNK"}function nt(e){var t=ce(function(e){var t=it(e),n=t?se(t):null;return(n?n.ellipse_id:H(e.params,"sellps"))||""}(e));return t?t.name:"Unknown ellipsoid"}function rt(e){var t=se(it(e));return t&&t.name||"Unknown datum"}function it(e){return H(e.params,"sdatum")}function at(e){return Fe(e)(e)}function ot(e,t){return st({PROJECTION:e,PARAMETER:Ot(t)})}function st(e){return function(t){var n={GEOGCS:e.GEOGCS&&e.GEOGCS(t)||Ke(t),PROJECTION:De(e.PROJECTION)?e.PROJECTION:e.PROJECTION(t),PARAMETER:e.PARAMETER(t),UNIT:Je(t)};return n.NAME=e.NAME&&e.NAME(t,n)||function(e,t){var n=ut(e);return n||t.GEOGCS.NAME+" / "+t.PROJECTION}(t,n),{PROJCS:n}}}function ut(e){var t;return H(e.params,"tinit")&&(t=ge(H(e.params,"sinit"))),t?t.comment:""}function ct(e,t,n){var r=lt(t),i=function(e,t){return Xe({PROJECTION:He(e),PARAMETER:Pt(t)})}(e,n);pt(r,i)}function ft(e,t,n){dt(ht(e),ot(t,n))}function lt(e){var t=qe(e).map(Ge);return function(e){var n=e.PROJECTION[0];return t.indexOf(Ge(n))>-1}}function ht(e){return function(t){var n=Be(t);return n&&n==e}}function pt(e,t){"function"!=typeof e&&Ve("Missing WKT parser test"),"function"!=typeof t&&Ve("Missing WKT parse function"),Re.push([e,t])}function dt(e,t){"function"!=typeof e&&Ve("Missing WKT maker test"),"function"!=typeof t&&Ve("Missing WKT maker function"),ze.push([e,t])}pt(function(e){return gt.test(Ge(e.NAME))},function(e){return Xe({PROJECTION:He("utm"),PARAMETER:function(e){var t=gt.exec(Ge(e.NAME)),n="+zone="+t[1];return"s"==t[2].toLowerCase()&&(n+=" +south"),n}})(e)}),pt(function(e){return mt.test(Ge(e.NAME))},function(e){return Xe({PROJECTION:He("ups"),PARAMETER:function(e){var t=mt.exec(Ge(e.NAME));return"south"==t[1].toLowerCase()?"+south":""}})(e)}),dt(ht("utm"),function(e){return st({NAME:yt,PROJECTION:function(){return"Transverse_Mercator"},PARAMETER:bt})(e)}),dt(ht("ups"),function(e){return st({NAME:vt,PROJECTION:function(){return"Polar_Stereographic"},PARAMETER:_t})(e)});var gt=/UTM_zone_([0-9]{1,2})(N|S)/i,mt=/UPS_(North|South)/i;function yt(e,t){return t.GEOGCS.NAME+" / UTM zone "+H(e.params,"szone")+(H(e.params,"tsouth")?"S":"N")}function vt(e,t){return t.GEOGCS.NAME+" / UPS "+(H(e.params,"tsouth")?"South":"North")}function bt(e){return[["latitude_of_origin",0],["central_meridian",180*e.lam0/w],["scale_factor",e.k0],["false_easting",e.x0],["false_northing",e.y0]]}function _t(e){return[["latitude_of_origin",-90],["central_meridian",0],["scale_factor",.994],["false_easting",2e6],["false_northing",2e6]]}function xt(e){return H(e.params,"tlat_ts")&&0!=H(e.params,"dlat_ts")}function wt(e){return 0===e.es&&6378137==e.a}pt(lt("Mercator_2SP,Mercator_1SP,Mercator,Mercator_Auxiliary_Sphere"),Xe({GEOGCS:function(e){var t=function(e){return/(Web_Mercator|Pseudo_Mercator)/i.test(Ge(e.NAME))}(e)?{aux_sphere:!0}:null;return We(e.GEOGCS,t)},PROJECTION:He("merc"),PARAMETER:function(e){return Pt(function(e){var t=kt(e,"standard_parallel_1");return t&&0!=t[1]}(e)?"lat_ts,lat_0b":"lat_tsb,lat_ts")(e)}})),dt(ht("merc"),st({GEOGCS:function(e){return wt(e)?Ke(me("+proj=longlat +datum=WGS84")):null},PROJECTION:function(e){return xt(e)?"Mercator_2SP":"Mercator_1SP"},PARAMETER:function(e){return Ot(xt(e)?"lat_ts,lat_0b":"lat_tsb")(e)},NAME:function(e){return wt(e)?"WGS 84 / Pseudo-Mercator":null}}));var St=[["x_0","false_easting","m"],["y_0","false_northing","m"],["k_0","scale_factor","f"],["lat_0","latitude_of_center"],["lon_0","central_meridian"]],At={lat_0b:["lat_0","latitude_of_origin"],lat_0c:["lat_0",null],lat_0d:["lat_0","standard_parallel_1"],lat_1:["lat_1","standard_parallel_1"],lat_1b:["lat_1","latitude_of_point_1"],lat_1c:["lat_1","latitude_of_origin"],lat_2:["lat_2","standard_parallel_2"],lat_2b:["lat_2","latitude_of_point_2"],lat_ts:["lat_ts","standard_parallel_1"],lat_tsb:["lat_ts","latitude_of_origin"],lonc:["lonc","central_meridian"],lon_1:["lon_1","longitude_of_point_1"],lon_2:["lon_2","longitude_of_point_2"],alpha:["alpha","azimuth"],gamma:["gamma","rectified_grid_angle"],h:["h","height","f"]},Et={longitude_of_center:"central_meridian",latitude_of_origin:"latitude_of_center",latitude_of_center:"latitude_of_origin",longitude_of_1st_point:"longitude_of_point_1",longitude_of_2nd_point:"longitude_of_point_2",latitude_of_1st_point:"latitude_of_point_1",latitude_of_2nd_point:"latitude_of_point_2",k:"k_0"};function Mt(e,t,n){for(var r=0;r<n.length;r++)if(n[r][t]===e)return n[r];return null}function It(e,t,n){var r=null;return!(r=Mt(e=e.toLowerCase(),t,n))&&e in Et&&(r=Mt(Et[e],t,n)),r}function kt(e,t){for(var n,r=e.PARAMETER||[],i=0;i<r.length;i++)if(t===(n=r[i][0].toLowerCase())||t===Et[n])return r[i];return null}function Ct(e){var t=null;return e&&(t=qe(e).reduce(function(e,t){var n=At[t];return n||Ve("missing parameter rule: "+t),e.push(n),e},[])),(t||[]).concat(St)}function Pt(e){return function(t){var n=[],r=Ct(e),i=$e(t);return(t.PARAMETER||[]).forEach(function(e){var t,a=It(e[0],1,r);a?(t=function(e,t,n){var r=e[0];if("m"==e[2]&&(t*=n.to_meter),!("x_0,y_0,lat_0,lon_0".indexOf(r)>-1&&0===t||"k_0"==r&&1==t))return"+"+r+"="+t}(a,e[1],i),t&&n.push(t)):function(e){console.error("[wkt] "+e)}("unhandled parameter: "+e[0])}),n.join(" ")}}function Ot(e){return function(t){var n=[],r=Ct(e);return Object.keys(t.params).forEach(function(e){var i,a=It(e,0,r);a&&a[1]&&(i=H(t.params,"s"+e),n.push(function(e,t,n){var r,i=e[2];return r="m"==i?parseFloat(t)/n:"f"==i?parseFloat(t):W(t),[e[1],r]}(a,i,t.to_meter)))}),n}}function Nt(e){return!("lat_1"in e.params&&"lat_2"in e.params)}function Tt(e){return"omerc"==Be(e)&&("alpha"in e.params||"gamma"in e.params)}function Lt(e){return Tt(e)&&("no_uoff"in e.params||"no_off"in e.params)}function zt(e){return H(e.params,"tlat_ts")}function Rt(e){var t=JSON.stringify(jt(e));return t=(t=t.replace(/\["([A-Z0-9]+)",/g,"$1[")).replace(/"(EAST|NORTH|SOUTH|WEST)"/g,"$1")}function Dt(e){return"NAME,PROJCS,GEOGCS,GEOCCS,DATUM,SPHEROID,PRIMEM,PROJECTION,PARAMETER,UNIT,AXIS".indexOf(e)+1||999}function jt(e,t){var n,r=[];return t=t||0,function(e){return Object.keys(e).sort(function(e,t){return Dt(e)-Dt(t)})}(e).forEach(function(i){var a=e[i];!function(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}(a)?"NAME"==i?r.push(De(a)?a:a[0]):"PARAMETER"==i||"AXIS"==i?a.forEach(function(e){r.push([i].concat(e))}):De(a)?r.push([i,a]):Array.isArray(a)?r.push([i].concat(a)):((n={})[i]=a,Ve("Incorrectly formatted WKT element: "+JSON.stringify(n))):r.push([i].concat(jt(a,t+1)))}),0===t&&1==r.length&&(r=r[0]),r}function Ft(e){var t={};return Ut(e).forEach(function(e){Gt(e,t)}),t}function Ut(e){var t;e="["+(e=(e=(e=Bt(e)).replace(/([A-Z0-9]+)\[(?![^"]*[^\[,"]")/g,'["$1",')).replace(/, *([a-zA-Z]+) *(?=[,\]])/g,',"$1"'))+"]";try{t=JSON.parse(e)}catch(e){Ve("unparsable WKT format")}return t}function Bt(e){var t=0;return e.replace(/"+/g,function(e){var n=t%2==0;return t+=e.length,'"'==e||'""'==e&&n?e:n?'"'+e.substring(1).replace(/""/g,'\\"'):e.replace(/""/g,'\\"')})}function Gt(e,t){var n,r=e[0];if("GEOGCS"==r||"GEOCCS"==r||"PROJCS"==r||"DATUM"==r||"VERTCS"==r)for(t[r]={NAME:e[1]},n=2;n<e.length;n++){if(!Array.isArray(e[n]))throw Ve("WKT parse error");Gt(e[n],t[r])}else"AXIS"==r||"PARAMETER"==r?(r in t==0&&(t[r]=[]),t[r].push(e.slice(1))):t[r]=e.slice(1);return t}pt(lt("Lambert_Conformal_Conic,Lambert_Conformal_Conic_1SP,Lambert_Conformal_Conic_2SP"),Xe({PROJECTION:He("lcc"),PARAMETER:function(e){return Pt(function(e){return!kt(e,"standard_parallel_2")}(e)?"lat_1c":"lat_0b,lat_1,lat_2")(e)}})),dt(ht("lcc"),st({PROJECTION:function(e){return Nt(e)?"Lambert_Conformal_Conic_1SP":"Lambert_Conformal_Conic_2SP"},PARAMETER:function(e){return Ot(Nt(e)?"lat_1c,lat_0c":"lat_0b,lat_1,lat_2")(e)}})),pt(lt("Hotine_Oblique_Mercator,Hotine_Oblique_Mercator_Azimuth_Natural_Origin"),Xe({PROJECTION:He("omerc"),PARAMETER:function(e){return Pt("alpha,gamma,lonc")(e)+" +no_uoff"}})),dt(Lt,ot("Hotine_Oblique_Mercator","alpha,gamma,lonc")),ct("omerc","Oblique_Mercator,Hotine_Oblique_Mercator_Azimuth_Center","alpha,gamma,lonc"),dt(function(e){return Tt(e)&&!Lt(e)},ot("Oblique_Mercator","alpha,gamma,lonc")),ct("omerc","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","lat_1b,lat_2b,lon_1,lon_2"),dt(function(e){return"omerc"==Be(e)&&"lat_2"in e.params&&"lon_2"in e.params},ot("Hotine_Oblique_Mercator_Two_Point_Natural_Origin","lat_1b,lat_2b,lon_1,lon_2")),pt(lt("Stereographic,Polar_Stereographic,Stereographic_North_Pole,Stereographic_South_Pole"),Xe({PROJECTION:He("stere"),PARAMETER:function(e){var t=Pt("lat_ts,lat_tsb")(e),n=/lat_ts=([^ ]+)/.exec(t);return n&&-1==t.indexOf("lat_0=")&&(t="+lat_0="+(parseFloat(n[1])<0?-90:90)+" "+t),t}})),dt(ht("stere"),st({PROJECTION:function(e){return zt(e)?"Polar_Stereographic":"Stereographic"},PARAMETER:function(e){return zt(e)?Ot("lat_tsb,lat_0c")(e):Ot("lat_0b")(e)}})),ft("vandg","VanDerGrinten"),pt(lt("VanDerGrinten,Van_der_Grinten_I"),Xe({PROJECTION:He("vandg"),PARAMETER:function(e){var t=Pt("")(e);return t&&(t+=" "),t+"+R_A"}})),[["aitoff","Aitoff","lat1"],["aea","Albers_Conic_Equal_Area,Albers","lat_1,lat_2"],["aeqd","Azimuthal_Equidistant"],["bonne","Bonne","lat_1"],["cass","Cassini_Soldner,Cassini"],["cea","Cylindrical_Equal_Area","lat_ts"],["eck1","Eckert_I"],["eck2","Eckert_II"],["eck3","Eckert_III"],["eck4","Eckert_IV"],["eck5","Eckert_V"],["eck6","Eckert_VI"],["eqdc","Equidistant_Conic","lat_1,lat_2"],["eqc","Plate_Carree,Equirectangular,Equidistant_Cylindrical","lat_ts"],["gall","Gall_Stereographic"],["gnom","Gnomonic"],["laea","Lambert_Azimuthal_Equal_Area"],["loxim","Loximuthal","lat_1"],["mill","Miller_Cylindrical"],["moll","Mollweide"],["nsper","Vertical_Near_Side_Perspective","h"],["nzmg","New_Zealand_Map_Grid","lat_0b"],["ortho","Orthographic","lat_0b"],["poly","Polyconic"],["robin","Robinson"],["sinu","Sinusoidal"],["sterea","Oblique_Stereographic,Double_Stereographic"],["tmerc","Transverse_Mercator,Gauss_Kruger","lat_0b"],["tpeqd","Two_Point_Equidistant","lat_1b,lat_2b,lon_1,lon_2"],["wag1","Wagner_I"],["wag2","Wagner_II"],["wag3","Wagner_III","lat_ts"],["wag4","Wagner_IV"],["wag5","Wagner_V"],["wag6","Wagner_VI"],["wag7","Wagner_VII"],["wink1","Winkel_I","lat_ts"],["wink2","Winkel_II"],["wintri","Winkel_Tripel","lat_1"]].forEach(function(e){var t=e[2]||null;ct(e[0],e[1],t),ft(e[0],e[1].split(",")[0],t)});var qt,Vt,$t={};function Jt(e,t,n){var r;return t>=1e-7?n*(e/(1-(r=t*e)*r)-.5/t*p((1-r)/(1+r))):e+e}function Wt(e,t,n){return t/f(1-n*e*e)}function Zt(t,i,a){var s,u,l,h,g,m,y,v,b,_,w,S,A,E;t.fwd=function(e,i){var a,o=e.lam;(a=l-(y?u*Jt(n(e.phi),t.e,t.one_es):g*n(e.phi)))<0&&U(),a=h*f(a),i.x=a*n(o*=u),i.y=m-a*r(o)},t.inv=function(i,a){var f=i.x,v=m-i.y,b=d(f,v);0!=b?(u<0&&(b=-b,f=-f,v=-v),a.phi=b/h,y?(a.phi=(l-a.phi*a.phi)/u,e(s-e(a.phi))>1e-7?(a.phi=function(t,i,a){var s,u,c,f,l,h,d=15,g=1e-7,m=1e-10;if(s=o(.5*t),i<g)return s;h=d;do{s+=l=.5*(f=1-(c=i*(u=n(s)))*c)*f/r(s)*(t/a-u/f+.5/i*p((1-c)/(1+c)))}while(e(l)>m&&--h);return h?s:x}(a.phi,t.e,t.one_es))==x&&B():a.phi=a.phi<0?-k:k):e(a.phi=(l-a.phi*a.phi)/g)<=1?a.phi=o(a.phi):a.phi=a.phi<0?-k:k,a.lam=c(f,v)/u):(a.lam=0,a.phi=u>0?k:-k)},e(i+a)<L&&q(-21),u=b=n(i),v=r(i),_=e(i-a)>=L,(y=t.es>0)?(Yt(t.es),E=Wt(b,v,t.es),A=Jt(b,t.e,t.one_es),_&&(S=Wt(b=n(a),v=r(a),t.es),w=Jt(b,t.e,t.one_es),u=(E*E-S*S)/(w-A)),s=1-.5*t.one_es*p((1-t.e)/(1+t.e))/t.e,m=(h=1/u)*f((l=E*E+u*A)-u*Jt(n(t.phi0),t.e,t.one_es))):(_&&(u=.5*(u+n(a))),m=(h=1/u)*f((l=v*v+(g=u+u)*b)-g*n(t.phi0)))}function Yt(e){var t,n=.046875,r=.01953125,i=.01068115234375,a=[];return a[0]=1-e*(.25+e*(n+e*(r+e*i))),a[1]=e*(.75-e*(n+e*(r+e*i))),a[2]=(t=e*e)*(.46875-e*(.013020833333333334+.007120768229166667*e)),a[3]=(t*=e)*(.3645833333333333-.005696614583333333*e),a[4]=t*e*.3076171875,a}function Ht(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}function Xt(t,i,a){var o,s,u,c=1/(1-i);u=t;for(var l=10;l>0;--l)if(s=1-i*(o=n(u))*o,u-=s=(Ht(u,o,r(u),a)-t)*(s*f(s))*c,e(s)<1e-11)return u;return F(z),u}function Kt(t){var n=e(t);return n>=1?(n>1.00000000000001&&F(-19),t<0?-k:k):o(t)}function Qt(t){var n=e(t);return n>=1?(n>1.00000000000001&&F(-19),t<0?w:0):s(t)}function en(e){return e<=0?0:f(e)}function tn(t,n){return e(t)<1e-50&&e(n)<1e-50?0:c(t,n)}function nn(t){var i=t.opaque||{mode:0};t.inv=function(t,a){var o,u,c,f,h,p,d,g,m,y,v,b,_,x,S,A,E,M=1e-12,I=0;if(e(t.x)<M&&e(t.y)<M)return a.phi=0,void(a.lam=0);a.phi=t.y,a.lam=t.x;do{o=0;do{for(b=n(.5*a.lam),S=r(.5*a.lam),_=n(a.phi),c=1-(u=(x=r(a.phi))*S)*u,f=2*(u=s(u)/l(c,1.5))*c*x*b,h=u*c*_,p=2*(b*S*_*x/c-u*_*b),d=x*x*b*b/c+u*x*S*_*_,g=_*_*S/c+u*b*b*x,m=.5*(_*x*b/c-u*_*x*x*b*S),i.mode&&(f=.5*(f+a.lam*i.cosphi1),h=.5*(h+a.phi),p*=.5,d=.5*(d+i.cosphi1),g=.5*(g+1),m*=.5),f-=t.x,v=((h-=t.y)*p-f*g)/(y=p*m-g*d),y=(f*m-h*d)/y;v>w;)v-=w;for(;v<-w;)v+=w;a.phi-=y,a.lam-=v}while((e(y)>M||e(v)>M)&&o++<10);a.phi>k&&(a.phi-=2*(a.phi-k)),a.phi<-k&&(a.phi-=2*(a.phi+k)),e(e(a.phi)-k)<M&&!i.mode&&(a.lam=0),(u=s(r(a.phi)*r(c=.5*a.lam)))?(A=2*u*r(a.phi)*n(c)*(E=1/n(u)),E*=u*n(a.phi)):A=E=0,i.mode&&(A=.5*(A+a.lam*i.cosphi1),E=.5*(E+a.phi))}while((e(t.x-A)>M||e(t.y-E)>M)&&I++<20)},t.fwd=function(e,t){var a,o;(o=s(r(e.phi)*r(a=.5*e.lam)))?(t.x=2*o*r(e.phi)*n(a)*(t.y=1/n(o)),t.y*=o*n(e.phi)):t.x=t.y=0,i.mode&&(t.x=.5*(t.x+e.lam*i.cosphi1),t.y=.5*(t.y+e.phi))},t.es=0}function rn(t,r,i){t.es=0,t.fwd=function(t,a){var o,s,u=2.4674011002723395;a.y=r?k*n(t.phi):t.phi,(o=e(t.lam))>=1e-10?(i&&o>=k?a.x=f(u-t.phi*t.phi+1e-10)+o-k:(s=.5*(u/o+o),a.x=o-s+f(s*s-a.y*a.y)),t.lam<0&&(a.x=-a.x)):a.x=0}}function an(e){var t,n=[];return n[0]=.3333333333333333*e,t=e*e,n[0]+=.17222222222222222*t,n[1]=.06388888888888888*t,t*=e,n[0]+=.10257936507936508*t,n[1]+=.0664021164021164*t,n[2]=.01677689594356261*t,n}function on(e,t){var r=e+e;return e+t[0]*n(r)+t[1]*n(r+r)+t[2]*n(r+r+r)}function sn(e,t){e.es=0,e.fwd=function(e,n){n.y=t.C_y*e.phi,n.x=t.C_x*e.lam*(t.A+en(1-t.B*e.phi*e.phi))},e.inv=function(e,n){n.phi=e.y/t.C_y,n.lam=e.x/(t.C_x*(t.A+en(1-t.B*n.phi*n.phi)))}}function un(t){var i,o,s,l,h,y,v=[],b=[],_=[],w=[];function S(e,t){for(var i,a=2*r(2*t),o=e.length-1,s=e[o],u=0;--o>=0;)i=a*s-u+e[o],u=s,s=i;return t+i*n(2*t)}function A(e,t,i){for(var a,o,s=n(t),u=r(t),c=g(i),f=m(i),l=2*u*f,h=-2*s*c,p=e.length-1,d=e[p],y=0,v=0,b=0;--p>=0;)a=v,o=y,d=l*(v=d)-a-h*(y=b)+e[p],b=h*v-o+l*y;return[(l=s*f)*d-(h=u*c)*b,l*b+h*d]}t.es<=0&&q(-34),h=l=(s=t.es/(1+f(1-t.es)))/(2-s),v[0]=l*(2+l*(-2/3+l*(l*(116/45+l*(26/45+l*(-2854/675)))-2))),b[0]=l*(l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))-2),h*=l,v[1]=h*(7/3+l*(l*(-227/45+l*(2704/315+l*(2323/945)))-1.6)),b[1]=h*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),h*=l,v[2]=h*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),b[2]=h*(-26/15+l*(34/21+l*(1.6+l*(-12686/2835)))),h*=l,v[3]=h*(4279/630+l*(-332/35+l*(-399572/14175))),b[3]=h*(1237/630+l*(l*(-24832/14175)-2.4)),h*=l,v[4]=h*(4174/315+l*(-144838/6237)),b[4]=h*(-734/315+l*(109598/31185)),h*=l,v[5]=h*(601676/22275),b[5]=h*(444337/155925),h=l*l,i=t.k0/(1+l)*(1+h*(1/4+h*(1/64+h/256))),_[0]=l*(l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))-.5),w[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),_[1]=h*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),w[1]=h*(13/48+l*(l*(557/1440+l*(281/630+l*(-1983433/1935360)))-.6)),h*=l,_[2]=h*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),w[2]=h*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),h*=l,_[3]=h*(-4397/161280+l*(11/504+l*(830251/7257600))),w[3]=h*(49561/161280+l*(-179/168+l*(6601661/7257600))),h*=l,_[4]=h*(-4583/161280+l*(108847/3991680)),w[4]=h*(34729/80640+l*(-3418889/1995840)),h*=l,_[5]=h*(-20648693/638668800),w[5]=.6650675310896665*h,y=S(b,t.phi0),o=-i*(y+function(e,t){for(var i,a=2*r(t),o=e.length-1,s=e[o],u=0;--o>=0;)i=a*s-u+e[o],u=s,s=i;return n(t)*i}(w,2*y)),t.fwd=function(t,s){var u,f,l,h,g,m,y,v=t.phi,_=t.lam;v=S(b,v),u=n(v),f=r(v),h=n(_),l=r(_),v=c(u,l*f),_=c(h*f,d(u,f*l)),m=a(_),y=function(e){var t=1+e,n=t-1;return 0===n?e:e*p(t)/n}((y=e(m))*(1+y/(d(1,y)+1))),g=A(w,2*v,2*(_=m<0?-y:y)),v+=g[0],_+=g[1],e(_)<=2.623395162778?(s.y=i*v+o,s.x=i*_):s.x=s.y=x},t.inv=function(t,a){var s,f,l,h,p,m=t.y,y=t.x;m=(m-o)/i,e(y/=i)<=2.623395162778?(m+=(p=A(_,2*m,2*y))[0],y+=p[1],y=u(g(y)),s=n(m),f=r(m),h=n(y),l=r(y),y=c(h,l*f),m=c(s*l,d(h,l*f)),a.phi=S(v,m),a.lam=y):a.phi=a.lam=x}}function cn(t){var i;t.es?(i=Yt(t.es),t.fwd=function(e,a){var o,s;a.y=Ht(e.phi,o=n(e.phi),s=r(e.phi),i),a.x=e.lam*s/f(1-t.es*o*o)},t.inv=function(a,o){var s=e(o.phi=Xt(a.y,t.es,i));s<k?(s=n(o.phi),o.lam=a.x*f(1-t.es*s*s)/r(o.phi)):s-L<k?o.lam=0:B()}):fn(t,0,1)}function fn(t,i,a){var o,s;o=(s=f((i+1)/a))/(i+1),t.es=0,t.fwd=function(t,u){var c,f,l;if(i){for(c=a*n(t.phi),l=8;l&&(t.phi-=f=(i*t.phi+n(t.phi)-c)/(i+r(t.phi)),!(e(f)<1e-7));--l);l||U()}else t.phi=1!=a?Kt(a*n(t.phi)):t.phi;u.x=o*t.lam*(i+r(t.phi)),u.y=s*t.phi},t.inv=function(e,t){e.y/=s,t.phi=i?Kt((i*e.y+n(e.y))/a):1!=a?Kt(n(e.y)/a):e.y,t.lam=e.x/(o*(i+r(e.y)))}}function ln(e){pn(e,hn(0,k))}function hn(e,t){var r=n(t),i=t+t,a=f(P*r/(i+n(i)));return{C_x:2*a/w,C_y:a/r,C_p:i+n(i)}}function pn(t,i){t.fwd=function(t,a){var o,s,u;for(o=i.C_p*n(t.phi),u=10;u&&(t.phi-=s=(t.phi+n(t.phi)-o)/(1+r(t.phi)),!(e(s)<1e-7));--u);u?t.phi*=.5:t.phi=t.phi<0?-k:k,a.x=i.C_x*t.lam*r(t.phi),a.y=i.C_y*n(t.phi)},t.inv=function(t,a){a.phi=Kt(t.y/i.C_y),a.lam=t.x/(i.C_x*r(a.phi)),e(a.lam)-w<L?(a.phi+=a.phi,a.phi=Kt((a.phi+n(a.phi))/i.C_p)):a.lam=a.phi=x},t.es=0}function dn(r,i){var a,s,u,c,h,p=[[0,-1],[1,0]],d=[[-1,0],[0,-1]],g=[[0,1],[-1,0]],m=[[[1,0],[0,1]],p,d,g,g,d,p],v=1e-15;function _(r,i){var a=r.lam,s=r.phi,u=o(2/3);if(e(s)<=u)i.x=a,i.y=3*w/8*n(s);else{var c,l=f(3*(1-e(n(s)))),h=t(2*a/w+2);h>=4&&(h=3),c=-3*I+k*h,i.x=c+(a-c)*l,i.y=A(s)*I*(2-l)}}function S(n,r){var i=n.x,a=n.y,s=I;if(e(a)<=s)r.lam=i,r.phi=o(8*a/(3*w));else if(e(a)<k){var u,c,f=t(2*i/w+2);f>=4&&(f=3),u=-3*I+k*f,c=2-4*e(a)/w,r.lam=u+(i-u)/c,r.phi=A(a)*o(1-l(c,2)/3)}else r.lam=-w,r.phi=A(a)*k}function A(e){return e>0?1:e<0?-1:0}function E(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case-1:return 4;case-2:return 5;case-3:return 6}return 0}function M(e,t){return function(e,t,n){var r,i,a,o,s,u=0,c=e.length;for(s=0;s<c;s++)if(t==e[s][0]&&n==e[s][1])return!0;for(r=e[0][0],i=e[0][1],s=1;s<c;s++)a=e[s%c][0],o=e[s%c][1],n>y(i,o)&&n<=b(i,o)&&t<=b(r,a)&&i!=o&&(r==a||t<=(n-i)*(a-r)/(o-i)+r)&&u++,r=a,i=o;return u%2!=0}(h,e,t)}function C(t,r,i){if(i)return on(r,c);var a=Jt(n(r),t.e,1-t.es)/u;return e(a)>1&&(a=A(a)),o(a)}function P(e,t,n,r){var i,a,o,s,u,c,f=0,l=function(e,t,n,r,i){var a,o={};if(o.x=e,o.y=t,i){if(t>I)o.region="north",o.x=-3*I+n*k,o.y=k,e-=n*k;else{if(!(t<-I))return o.region="equatorial",o.cn=0,o;o.region="south",o.x=-3*I+r*k,o.y=-k,e-=r*k}"north"==o.region?o.cn=t>=-e-I-v&&t<e+5*I-v?(n+1)%4:t>-e-I+v&&t>=e+5*I-v?(n+2)%4:t<=-e-I+v&&t>e+5*I+v?(n+3)%4:n:"south"==o.region&&(o.cn=t<=e+I+v&&t>-e-5*I+v?(r+1)%4:t<e+I-v&&t<=-e-5*I+v?(r+2)%4:t>=e+I-v&&t<-e-5*I-v?(r+3)%4:r)}else{if(t>I)o.region="north",a=k;else{if(!(t<-I))return o.region="equatorial",o.cn=0,o;o.region="south",a=-k}e<-k?(o.cn=0,o.x=-3*I,o.y=a):e>=-k&&e<0?(o.cn=1,o.x=-I,o.y=a):e>=0&&e<k?(o.cn=2,o.x=I,o.y=a):(o.cn=3,o.x=3*I,o.y=a)}return o}(e.x,e.y,t,n,r);if("equatorial"==l.region)return e.x=l.x,void(e.y=l.y);i=[e.x,e.y],a=[l.x,l.y],r?"north"==l.region?(f=t,c=m[E(-1*(l.cn-f))]):(f=n,c=m[E(l.cn-f)]):"north"==l.region?(f=t,c=m[E(l.cn-f)]):(f=n,c=m[E(-1*(l.cn-f))]),s=function(e,t){return[e[0]-t[0],e[1]-t[1]]}(i,a),u=function(e,t){var n,r,i=[0,0];for(n=0;n<2;n++)for(r=0;r<2;r++)i[n]+=e[n][r]*t[r];return i}(c,s),o=function(e,t){return[e[0]+t[0],e[1]+t[1]]}(u,[-3*I+(r?l.cn:0)*k,k]),e.x=o[0],e.y=o[1]}i?(a=H(r.params,"inorth_square"),s=H(r.params,"isouth_square"),(a<0||a>3)&&q(-47),(s<0||s>3)&&q(-47),h=[[-w-v,I+v],[a*k-w-v,I+v],[a*k-w-v,3*I+v],[(a+1)*k-w+v,3*I+v],[(a+1)*k-w+v,I+v],[w+v,I+v],[w+v,-I-v],[(s+1)*k-w+v,-I-v],[(s+1)*k-w+v,-3*I-v],[s*k-w-v,-3*I-v],[s*k-w-v,-I-v],[-w-v,-I-v]],0!=r.es?(c=an(r.es),u=Jt(1,r.e,r.one_es),r.a=r.a*f(.5*u),r.ra=1/r.a,r.fwd=function(e,t){return e.phi=C(r,e.phi,0),_(e,t),P(t,a,s,0)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);P(e,a,s,1),S(e,t),t.phi=C(r,t.phi,1)}):(r.fwd=function(e,t){_(e,t),P(t,a,s,0)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);P(e,a,s,1),S(e,t)})):(h=[[-w-v,I],[-3*I,k+v],[-k,I+v],[-I,k+v],[0,I+v],[I,k+v],[k,I+v],[3*I,k+v],[w+v,I],[w+v,-I],[3*I,-k-v],[k,-I-v],[I,-k-v],[0,-I-v],[-I,-k-v],[-k,-I-v],[-3*I,-k-v],[-w-v,-I]],0!=r.es?(c=an(r.es),u=Jt(1,r.e,r.one_es),r.a=r.a*f(.5*u),r.ra=1/r.a,r.fwd=function(e,t){e.phi=C(r,e.phi,0),_(e,t)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);S(e,t),t.phi=C(r,t.phi,1)}):(r.fwd=function(e,t){_(e,t)},r.inv=function(e,t){if(!M(e.x,e.y))return t.lam=x,t.phi=x,void F(-15);S(e,t)}))}function gn(e){e.x0=0,e.y0=0,e.is_latlong=!0,e.fwd=function(t,n){n.x=t.lam/e.a,n.y=t.phi/e.a},e.inv=function(t,n){n.lam=t.x*e.a,n.phi=t.y*e.a}}function mn(e,t,n){return t*=n,a(.5*(k-e))/l((1-t)/(1+t),.5*n)}function yn(t,r){var i,a,o=.5*r,s=k-2*u(t),c=15;do{i=r*n(s),s+=a=k-2*u(t*l((1-i)/(1+i),o))-s}while(e(a)>1e-10&&--c);return c<=0&&F(-18),s}function vn(e,t){var n,r,i,a=t.length-1;for(r=t[a][0],i=t[a][1];--a>=0;)n=r,r=t[a][0]+e.r*n-e.i*i,i=t[a][1]+e.r*i+e.i*n;return{r:e.r*r-e.i*i,i:e.r*i+e.i*r}}function bn(e,t,n){var r,i,a,o,s,u=!0,c=t.length-1;for(i=o=t[c][0],r=a=t[c][1];--c>=0;)u?u=!1:(o=i+e.r*(s=o)-e.i*a,a=r+e.r*a+e.i*s),i=t[c][0]+e.r*(s=i)-e.i*r,r=t[c][1]+e.r*r+e.i*s;return n.r=i+e.r*o-e.i*a,n.i=r+e.r*a+e.i*o,{r:e.r*i-e.i*r,i:e.r*r+e.i*i}}function _n(t,i){var o,s,f,h,p=1e-12;0!=t.es?(o=t.e*n(t.phi0),s=2*u(a(.5*(k+t.phi0))*l((1-o)/(1+o),.5*t.e))-k):s=t.phi0,h=n(s),f=r(s),t.inv=function(o,s){var g,m,y,v,b,_,w,S={},A={},E={},M=0,I=0,C=0,P=0;for(S.r=o.x,S.i=o.y,g=20;g&&((m=bn(S,i,A)).r-=o.x,m.i-=o.y,y=A.r*A.r+A.i*A.i,E.r=-(m.r*A.r+m.i*A.i)/y,E.i=-(m.i*A.r-m.r*A.i)/y,S.r+=E.r,S.i+=E.i,!(e(E.r)+e(E.i)<=p));--g);if(g){if(M=d(S.r,S.i),v=2*u(.5*M),I=n(v),C=r(v),s.lam=t.lam0,e(M)<=p)return s.lam=0,void(s.phi=t.phi0);for(P=b=Kt(C*h+S.i*I*f/M),g=20;g&&(_=t.e*n(P),P+=w=2*u(a(.5*(k+b))*l((1+_)/(1-_),.5*t.e))-k-P,!(e(w)<=p));--g);}g?(s.phi=P,s.lam=c(S.r*I,M*f*C-S.i*h*I)):s.lam=s.phi=x},t.fwd=function(e,o){var s,c,p,d,g,m,y,v={};s=n(e.lam),c=r(e.lam),p=t.e*n(e.phi),d=2*u(a(.5*(k+e.phi))*l((1-p)/(1+p),.5*t.e))-k,g=n(d),m=r(d),y=2/(1+h*g+f*m*c),v.r=y*m*s,v.i=y*(f*g-h*m*c),v=vn(v,i),o.x=v.r,o.y=v.i}}function xn(t,i,a,s){var u,l,h,p,g,m,y,v,b,_,x,w,S=!isNaN(a)&&!isNaN(s);i<=0&&q(-30),S&&(b=r(s),_=n(s),w=r(a),x=n(a)),e(e(t.phi0)-k)<L?u=t.phi0<0?1:0:e(t.phi0)<L?u=2:(u=3,l=n(t.phi0),h=r(t.phi0)),m=i/t.a,g=1/(p=1+m),y=(p+1)*(v=1/m),t.fwd=function(e,t){var i,a,o,s,c;switch(o=n(e.phi),a=r(e.phi),i=r(e.lam),u){case 3:t.y=l*o+h*a*i;break;case 2:t.y=a*i;break;case 1:t.y=-o;break;case 0:t.y=o}switch(t.y<g&&U(),t.y=m/(p-t.y),t.x=t.y*a*n(e.lam),u){case 3:t.y*=h*o-l*a*i;break;case 2:t.y*=o;break;case 0:i=-i;case 1:t.y*=a*i}S&&(c=1/((s=t.y*b+t.x*_)*x*v+w),t.x=(t.x*b-t.y*_)*w*c,t.y=s*c)},t.inv=function(r,i){var a,s,g,v,A,E;if(S&&(E=1/(m-r.y*x),v=m*r.x*E,A=m*r.y*w*E,r.x=v*b+A*_,r.y=A*b-v*_),a=d(r.x,r.y),(g=1-a*a*y)<0&&B(),g=(p-f(g))/(m/a+a/m),s=f(1-g*g),e(a)<=L)i.lam=0,i.phi=t.phi0;else{switch(u){case 3:i.phi=o(s*l+r.y*g*h/a),r.y=(s-l*n(i.phi))*a,r.x*=g*h;break;case 2:i.phi=o(r.y*g/a),r.y=s*a,r.x*=g;break;case 0:i.phi=o(s),r.y=-r.y;break;case 1:i.phi=-o(s)}i.lam=c(r.x,r.y)}},t.es=0}function wn(e,t){var n=.79788456,r=.1013211836*(t?2:4);e.es=0,e.fwd=function(e,t){t.x=n*e.lam*(1-r*e.phi*e.phi),t.y=n*e.phi},e.inv=function(e,t){t.phi=e.y/n,t.lam=e.x/(n*(1-r*t.phi*t.phi))}}function Sn(e,t,i){e.es=0,e.fwd=function(e,a){e.phi=Kt(.883883476*n(e.phi)),a.x=t*e.lam*r(e.phi),a.x/=r(e.phi*=.333333333333333),a.y=i*n(e.phi)},e.inv=function(e,a){a.phi=Kt(e.y/i),a.lam=e.x*r(a.phi)/t,a.phi*=3,a.lam/=r(a.phi),a.phi=Kt(1.13137085*n(a.phi))}}function An(e,t){var n=t?1.5:2,r=t?.5:1,i=1.01346,a=1.2158542;e.es=0,e.fwd=function(e,t){t.x=i*e.lam*(n-r*f(1+a*e.phi*e.phi)),t.y=i*e.phi},e.inv=function(e,t){t.phi=e.y/i,t.lam=e.x/(i*(n-r*f(1+a*t.phi*t.phi)))}}function En(t,r){var i,a,o,s,u,c=1.732050807568877;r?(o=.44329,s=.80404,i=6,a=5.61125,u=3):(o=1.01346,s=.9191,i=4,a=2.147143718212938,u=2),t.es=0,t.fwd=function(t,r){var l,h,d,g;for(l=a*n(t.phi),t.phi*=1.10265779,g=10;g&&(h=f(1+t.phi*t.phi),t.phi-=d=((i-h)*t.phi-p(t.phi+h)-l)/(i-2*h),!(e(d)<1e-10));--g);g||(t.phi=l<0?-c:c),r.x=o*t.lam*(u-f(1+t.phi*t.phi)),r.y=s*t.phi},t.inv=function(e,t){var n;t.phi=e.y/s,n=f(1+t.phi*t.phi),t.lam=e.x/(o*(u-n)),t.phi=Kt(((i-n)*t.phi-p(t.phi+n))/a)}}function Mn(t){return function(i){!function(t,i){var o,s,l,h,p,g,m,y,v,b,_=1e-10;switch(H(t.params,"tlat_1")&&H(t.params,"tlat_2")?(l=H(t.params,"rlat_1"),h=H(t.params,"rlat_2"),y=.5*(h+l),(e(o=.5*(h-l))<_||e(y)<_)&&q(-42)):q(-41),i){case"TISSOT":p=n(y),s=r(o),m=f(((g=p/s+s/p)-2*n(t.phi0))/p);break;case"MURD1":g=n(o)/(o*a(y))+y,m=g-t.phi0,p=n(y);break;case"MURD2":g=(s=f(r(o)))/a(y),m=g+a(y-t.phi0),p=n(y)*s;break;case"MURD3":g=o/(a(y)*a(o))+y,m=g-t.phi0,p=n(y)*n(o)*a(o)/(o*o);break;case"EULER":p=n(y)*n(o)/o,g=(o*=.5)/(a(o)*a(y))+y,m=g-t.phi0;break;case"PCONIC":p=n(y),b=r(o),v=1/a(y),e(o=t.phi0-y)-_>=k&&q(-43),m=b*(v-a(o));break;case"VITK1":p=(s=a(o))*n(y)/o,g=o/(s*a(y))+y,m=g-t.phi0}function x(e,t){var o;switch(i){case"MURD2":o=g+a(y-e.phi);break;case"PCONIC":o=b*(v-a(e.phi-y));break;default:o=g-e.phi}t.x=o*n(e.lam*=p),t.y=m-o*r(e.lam)}function w(e,t){var n;switch(n=d(e.x,e.y=m-e.y),p<0&&(n=-n,e.x=-e.x,e.y=-e.y),t.lam=c(e.x,e.y)/p,i){case"PCONIC":t.phi=u(v-n/b)+y;break;case"MURD2":t.phi=y-u(n-g);break;default:t.phi=g-n}}t.inv=w,t.fwd=x,t.es=0}(i,t)}}function In(t,i){var s,h,p,g,m,y,v,b,_=1e-10;if(b=e((h=e(t.phi0))-k)<_?t.phi0<0?0:1:h>_?2:3,i=e(i),t.es){switch(b){case 1:case 0:e(i-k)<_?v=2*t.k0/f(l(1+t.e,1+t.e)*l(1-t.e,1-t.e)):(v=r(i)/mn(i,h=n(i),t.e),h*=t.e,v/=f(1-h*h));break;case 3:case 2:h=n(t.phi0),s=2*u(x(t.phi0,h,t.e))-k,h*=t.e,v=2*t.k0*r(t.phi0)/f(1-h*h),m=n(s),y=r(s)}t.fwd=function(e,i){var a,o,s,c,f,l=0,h=0;switch(a=r(e.lam),o=n(e.lam),f=n(e.phi),(2==b||3==b)&&(l=n(s=2*u(x(e.phi,f,t.e))-k),h=r(s)),b){case 2:c=v/(y*(1+m*l+y*h*a)),i.y=c*(y*l-m*h*a),i.x=c*h;break;case 3:c=v/(1+h*a),i.y=c*l,i.x=c*h;break;case 0:e.phi=-e.phi,a=-a,f=-f;case 1:i.x=v*mn(e.phi,f,t.e),i.y=-i.x*a}i.x=i.x*o},t.inv=function(i,s){s.phi;var f,h,p,g,_=0,x=0,w=0,S=0;switch(p=d(i.x,i.y),b){case 2:case 3:f=r(_=2*c(p*y,v)),h=n(_),x=o(0==p?f*m:f*m+i.y*h*y/p),_=a(.5*(k+x)),i.x*=h,i.y=p*y*f-i.y*m*h,S=k,w=.5*t.e;break;case 1:i.y=-i.y;case 0:x=k-2*u(_=-p/v),S=-k,w=-.5*t.e}for(g=0;g<8;g++,x=s.phi)if(h=t.e*n(x),s.phi=2*u(_*l((1+h)/(1-h),w))-S,e(x-s.phi)<1e-10)return 0==b&&(s.phi=-s.phi),void(s.lam=0==i.x&&0==i.y?0:c(i.x,i.y));B()}}else{switch(b){case 2:p=n(t.phi0),g=r(t.phi0);case 3:v=2*t.k0;break;case 0:case 1:v=e(i-k)>=_?r(i)/a(I-.5*i):2*t.k0}t.fwd=function(t,i){var o=t.phi,s=n(o),u=r(o),c=r(t.lam),f=n(t.lam);switch(b){case 3:case 2:i.y=3==b?1+u*c:1+p*s+g*u*c,i.y<=_&&U(),i.x=(i.y=v/i.y)*u*f,i.y*=3==b?s:g*s-p*u*c;break;case 1:c=-c,o=-o;case 0:e(o-k)<1e-8&&U(),i.x=f*(i.y=v*a(I+.5*o)),i.y*=c}},t.inv=function(i,a){var s,f,l,h;switch(l=n(s=2*u((f=d(i.x,i.y))/v)),h=r(s),a.lam=0,b){case 3:e(f)<=_?a.phi=0:a.phi=o(i.y*l/f),0==h&&0==i.x||(a.lam=c(i.x*l,h*f));break;case 2:e(f)<=_?a.phi=t.phi0:a.phi=o(h*p+i.y*l*g/f),0==(s=h-p*n(a.phi))&&0==i.x||(a.lam=c(i.x*l*g,s*f));break;case 1:i.y=-i.y;case 0:e(f)<=_?a.phi=t.phi0:a.phi=o(0==b?-h:h),a.lam=0==i.x&&0==i.y?0:c(i.x,i.y)}}}function x(e,t,n){return t*=n,a(.5*(k+e))*l((1-t)/(1+t),.5*n)}}function kn(e,t){return l((1-e)/(1+e),t)}function Cn(e,t,i,o){var s=i/t,c=t,f=1/i;e.inv=function(e,t){var n;e.y/=c,n=r(t.phi=o?u(e.y):Kt(e.y)),t.phi/=f,t.lam=e.x/(s*r(t.phi)),o?t.lam/=n*n:t.lam*=n},e.fwd=function(e,t){var i;t.x=s*e.lam*r(e.phi),t.y=c,e.phi*=f,i=r(e.phi),o?(t.x*=i*i,t.y*=a(e.phi)):(t.x/=i,t.y*=n(e.phi))},e.es=0}function Pn(t){var i,a,u,l=1e-10,d=.5,g=.16666666666666666,m=.08333333333333333,y=.05,v=.03333333333333333,b=.023809523809523808,_=.017857142857142856;t.es?((u=Yt(t.es))||e_error_0(),a=Ht(t.phi0,n(t.phi0),r(t.phi0),u),i=t.es/(1-t.es),t.fwd=function(o,s){var c,h,p,d,x,w;o.lam<-k||o.lam>k?F(-14):(c=n(o.phi),h=r(o.phi),p=e(h)>l?c/h:0,p*=p,d=h*o.lam,x=d*d,d/=f(1-t.es*c*c),w=i*h*h,s.x=t.k0*d*(1+g*x*(1-p+w+y*x*(5+p*(p-18)+w*(14-58*p)+b*x*(61+p*(p*(179-p)-479))))),s.y=t.k0*(Ht(o.phi,c,h,u)-a+c*d*o.lam*.5*(1+m*x*(5-p+w*(9+4*w)+v*x*(61+p*(p-58)+w*(270-330*p)+_*x*(1385+p*(p*(543-p)-3111)))))))},t.inv=function(o,s){var c,l,h,p,x,w,S;s.phi=Xt(a+o.y/t.k0,t.es,u),e(s.phi)>=k?(s.phi=o.y<0?-k:k,s.lam=0):(w=n(s.phi),h=r(s.phi),S=e(h)>1e-10?w/h:0,c=i*h*h,p=o.x*f(l=1-t.es*w*w)/t.k0,l*=S,S*=S,x=p*p,s.phi-=l*x/(1-t.es)*d*(1-x*m*(5+S*(3-9*c)+c*(1-4*c)-x*v*(61+S*(90-252*c+45*S)+46*c-x*_*(1385+S*(3633+S*(4095+1575*S)))))),s.lam=p*(1-x*g*(1+2*S+c-x*y*(5+S*(28+24*S+8*c)+6*c-x*b*(61+S*(662+S*(1320+720*S))))))/h)}):(i=t.k0,a=.5*i,t.fwd=function(o,u){var c,h;o.lam<-k||o.lam>k?F(-14):(h=r(o.phi),c=h*n(o.lam),e(e(c)-1)<=l&&U(),u.x=a*p((1+c)/(1-c)),u.y=h*r(o.lam)/f(1-c*c),(c=e(u.y))>=1?c-1>l?U():u.y=0:u.y=s(u.y),o.phi<0&&(u.y=-u.y),u.y=i*(u.y-t.phi0))},t.inv=function(e,n){var a=h(e.x/i),s=.5*(a-1/a);a=r(t.phi0+e.y/i),n.phi=o(f((1-a*a)/(1+s*s))),e.y<0&&-n.phi+t.phi0<0&&(n.phi=-n.phi),n.lam=s||a?c(s,a):0})}function On(e,t){var i=.8773826753,a=1.139753528477/t;e.es=0,e.fwd=function(e,o){var s=Kt(t*n(e.phi));o.x=i*e.lam*r(s),o.y=a*s},e.inv=function(e,o){e.y/=a,o.phi=Kt(n(e.y)/t),o.lam=e.x/(i*r(e.y))}}function Nn(t,n){t.fwd=function(t,r){var i,a,o,s;o=e(O*t.phi),s=(s=1-o*o)<0?0:f(s),e(t.lam)<1e-10?(r.x=0,r.y=w*(t.phi<0?-o:o)/(1+s)):(a=.5*e(w/t.lam-t.lam/w),n?(i=o/(1+s),r.x=w*(f(a*a+1-i*i)-a),r.y=w*i):(i=(s*f(1+a*a)-a*s*s)/(1+a*a*o*o),r.x=w*i,r.y=w*f(1-i*(i+2*a)+1e-10)),t.lam<0&&(r.x=-r.x),t.phi<0&&(r.y=-r.y))},t.es=0}$t.Constants={},$t.Math={},$t.Accumulator={},(qt=$t.Constants).WGS84={a:6378137,f:1/298.257223563},qt.version={major:1,minor:48,patch:0},qt.version_string="1.48",(Vt=$t.Math).digits=53,Vt.epsilon=Math.pow(.5,Vt.digits-1),Vt.degree=Math.PI/180,Vt.sq=function(e){return e*e},Vt.hypot=function(e,t){var n,r;return e=Math.abs(e),t=Math.abs(t),n=Math.max(e,t),r=Math.min(e,t)/(n||1),n*Math.sqrt(1+r*r)},Vt.cbrt=function(e){var t=Math.pow(Math.abs(e),1/3);return e<0?-t:t},Vt.log1p=function(e){var t=1+e,n=t-1;return 0===n?e:e*Math.log(t)/n},Vt.atanh=function(e){var t=Math.abs(e);return t=Vt.log1p(2*t/(1-t))/2,e<0?-t:t},Vt.copysign=function(e,t){return Math.abs(e)*(t<0||0===t&&1/t<0?-1:1)},Vt.sum=function(e,t){var n=e+t,r=n-t,i=n-r;return{s:n,t:-((r-=e)+(i-=t))}},Vt.polyval=function(e,t,n,r){for(var i=e<0?0:t[n++];--e>=0;)i=i*r+t[n++];return i},Vt.AngRound=function(e){if(0===e)return e;var t=1/16,n=Math.abs(e);return n=n<t?t-(t-n):n,e<0?-n:n},Vt.AngNormalize=function(e){return(e%=360)<=-180?e+360:e<=180?e:e-360},Vt.LatFix=function(e){return Math.abs(e)>90?Number.NaN:e},Vt.AngDiff=function(e,t){var n=Vt.sum(Vt.AngNormalize(-e),Vt.AngNormalize(t)),r=Vt.AngNormalize(n.s),i=n.t;return Vt.sum(180===r&&i>0?-180:r,i)},Vt.sincosd=function(e){var t,n,r,i,a,o;switch(t=e%360,t-=90*(n=Math.floor(t/90+.5)),t*=this.degree,r=Math.sin(t),i=Math.cos(t),3&n){case 0:a=r,o=i;break;case 1:a=i,o=-r;break;case 2:a=-r,o=-i;break;default:a=-i,o=r}return e&&(a+=0,o+=0),{s:a,c:o}},Vt.atan2d=function(e,t){var n,r,i=0;switch(Math.abs(e)>Math.abs(t)&&(n=t,t=e,e=n,i=2),t<0&&(t=-t,++i),r=Math.atan2(e,t)/this.degree,i){case 1:r=(e>=0?180:-180)-r;break;case 2:r=90-r;break;case 3:r=-90+r}return r},function(e,t){e.Accumulator=function(e){this.Set(e)},e.Accumulator.prototype.Set=function(t){t||(t=0),t.constructor===e.Accumulator?(this._s=t._s,this._t=t._t):(this._s=t,this._t=0)},e.Accumulator.prototype.Add=function(e){var n=t.sum(e,this._t),r=t.sum(n.s,this._s);n=n.t,this._s=r.s,this._t=r.t,0===this._s?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(t){var n;return t?((n=new e.Accumulator(this)).Add(t),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1}}($t.Accumulator,$t.Math),$t.Geodesic={},$t.GeodesicLine={},$t.PolygonArea={},function(e,t,n,r,i){var a,o,s,u,c,f,l,h,p,d,g,m=20+r.digits+10,y=r.epsilon,v=200*y,b=Math.sqrt(y),_=y*v,x=1e3*b;e.tiny_=Math.sqrt(Number.MIN_VALUE),e.nC1_=6,e.nC1p_=6,e.nC2_=6,e.nC3_=6,e.nC4_=6,a=e.nC3_*(e.nC3_-1)/2,o=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=32671,e.LONG_UNROLL=32768,e.OUT_MASK=32640|e.LONG_UNROLL,e.SinCosSeries=function(e,t,n,r){var i=r.length,a=i-(e?1:0),o=2*(n-t)*(n+t),s=1&a?r[--i]:0,u=0;for(a=Math.floor(a/2);a--;)s=o*(u=o*s-u+r[--i])-s+r[--i];return e?2*t*n*s:n*(s-u)},s=function(e,t){var n,i,a,o,s,u,c,f,l,h,p,d,g=r.sq(e),m=r.sq(t),y=(g+m-1)/6;return 0===m&&y<=0?n=0:(u=y,(s=(i=g*m/4)*(i+2*(o=y*(a=r.sq(y)))))>=0?(c=i+o,c+=c<0?-Math.sqrt(s):Math.sqrt(s),u+=(f=r.cbrt(c))+(0!==f?a/f:0)):(l=Math.atan2(Math.sqrt(-s),-(i+o)),u+=2*y*Math.cos(l/3)),h=Math.sqrt(r.sq(u)+m),d=((p=u<0?m/(h-u):u+h)-m)/(2*h),n=p/(Math.sqrt(p+r.sq(d))+d)),n},u=[1,4,64,0,256],e.A1m1f=function(e){var t=Math.floor(3);return(r.polyval(t,u,0,r.sq(e))/u[t+1]+e)/(1-e)},c=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1_;++i)a=Math.floor((e.nC1_-i)/2),n[i]=s*r.polyval(a,c,u,o)/c[u+a+1],u+=a+2,s*=t},f=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1p_;++i)a=Math.floor((e.nC1p_-i)/2),n[i]=s*r.polyval(a,f,u,o)/f[u+a+1],u+=a+2,s*=t},l=[-11,-28,-192,0,256],e.A2m1f=function(e){var t=Math.floor(3);return(r.polyval(t,l,0,r.sq(e))/l[t+1]-e)/(1+e)},h=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC2_;++i)a=Math.floor((e.nC2_-i)/2),n[i]=s*r.polyval(a,h,u,o)/h[u+a+1],u+=a+2,s*=t},e.Geodesic=function(e,t){if(this.a=e,this.f=t,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/r.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(r.sq(this.a)+r.sq(this._b)*(0===this._e2?1:(this._e2>0?r.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*b/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(6),this._C3x=new Array(a),this._C4x=new Array(o),this.A3coeff(),this.C3coeff(),this.C4coeff()},p=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var e,t,n=0,i=0;for(e=5;e>=0;--e)t=Math.min(6-e-1,e),this._A3x[i++]=r.polyval(t,p,n,this._n)/p[n+t+1],n+=t+2},d=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var t,n,i,a=0,o=0;for(t=1;t<e.nC3_;++t)for(n=e.nC3_-1;n>=t;--n)i=Math.min(e.nC3_-n-1,n),this._C3x[o++]=r.polyval(i,d,a,this._n)/d[a+i+1],a+=i+2},g=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var t,n,i,a=0,o=0;for(t=0;t<e.nC4_;++t)for(n=e.nC4_-1;n>=t;--n)i=e.nC4_-n-1,this._C4x[o++]=r.polyval(i,g,a,this._n)/g[a+i+1],a+=i+2},e.Geodesic.prototype.A3f=function(e){return r.polyval(5,this._A3x,0,e)},e.Geodesic.prototype.C3f=function(t,n){var i,a,o=1,s=0;for(i=1;i<e.nC3_;++i)a=e.nC3_-i-1,o*=t,n[i]=o*r.polyval(a,this._C3x,s,t),s+=a+1},e.Geodesic.prototype.C4f=function(t,n){var i,a,o=1,s=0;for(i=0;i<e.nC4_;++i)a=e.nC4_-i-1,n[i]=o*r.polyval(a,this._C4x,s,t),s+=a+1,o*=t},e.Geodesic.prototype.Lengths=function(t,n,r,i,a,o,s,u,c,f,l,h,p){var d,g,m,y,v={},b=0,_=0,x=0,w=0;if((l&=e.OUT_MASK)&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(x=e.A1m1f(t),e.C1f(t,h),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(w=e.A2m1f(t),e.C2f(t,p),b=x-w,w=1+w),x=1+x),l&e.DISTANCE)d=e.SinCosSeries(!0,o,s,h)-e.SinCosSeries(!0,r,i,h),v.s12b=x*(n+d),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(_=b*n+(x*d-w*(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))));else if(l&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(g=1;g<=e.nC2_;++g)p[g]=x*h[g]-w*p[g];_=b*n+(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))}return l&e.REDUCEDLENGTH&&(v.m0=b,v.m12b=u*(i*o)-a*(r*s)-i*s*_),l&e.GEODESICSCALE&&(m=i*s+r*o,y=this._ep2*(c-f)*(c+f)/(a+u),v.M12=m+(y*o-s*_)*r/a,v.M21=m-(y*r-i*_)*o/u),v},e.Geodesic.prototype.InverseStart=function(t,n,i,a,o,u,c,f,l,h,p){var d,g,m,y,b,_,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R={},D=a*n-o*t,j=o*n+a*t;return R.sig12=-1,d=a*n,d+=o*t,(g=j>=0&&D<.5&&o*c<.5)?(y=r.sq(t+a),y/=y+r.sq(n+o),R.dnm=Math.sqrt(1+this._ep2*y),m=c/(this._f1*R.dnm),b=Math.sin(m),_=Math.cos(m)):(b=f,_=l),R.salp1=o*b,R.calp1=_>=0?D+o*t*r.sq(b)/(1+_):d-o*t*r.sq(b)/(1-_),S=r.hypot(R.salp1,R.calp1),A=t*a+n*o*_,g&&S<this._etol2?(R.salp2=n*b,R.calp2=D-n*a*(_>=0?r.sq(b)/(1+_):1-_),w=r.hypot(R.salp2,R.calp2),R.salp2/=w,R.calp2/=w,R.sig12=Math.atan2(S,A)):Math.abs(this._n)>.1||A>=0||S>=6*Math.abs(this._n)*Math.PI*r.sq(n)||(z=Math.atan2(-f,-l),this.f>=0?(C=(k=r.sq(t)*this._ep2)/(2*(1+Math.sqrt(1+k))+k),E=z/(I=this.f*n*this.A3f(C)*Math.PI),M=d/(I*n)):(P=o*n-a*t,O=Math.atan2(d,P),M=c/(I=((E=(N=this.Lengths(this._n,Math.PI+O,t,-n,i,a,o,u,n,o,e.REDUCEDLENGTH,h,p)).m12b/(n*o*N.m0*Math.PI)-1)<-.01?d/E:-this.f*r.sq(n)*Math.PI)/n)),M>-v&&E>-1-x?this.f>=0?(R.salp1=Math.min(1,-E),R.calp1=-Math.sqrt(1-r.sq(R.salp1))):(R.calp1=Math.max(E>-v?0:-1,E),R.salp1=Math.sqrt(1-r.sq(R.calp1))):(T=s(E,M),L=I*(this.f>=0?-E*T/(1+T):-M*(1+T)/T),b=Math.sin(L),_=-Math.cos(L),R.salp1=o*b,R.calp1=d-o*t*r.sq(b)/(1-_))),R.salp1<=0?(R.salp1=1,R.calp1=0):(w=r.hypot(R.salp1,R.calp1),R.salp1/=w,R.calp1/=w),R},e.Geodesic.prototype.Lambda12=function(t,n,i,a,o,s,u,c,f,l,h,p,d,g){var m,y,v,b,_,x,w,S,A,E,M,I,k,C={};return 0===t&&0===c&&(c=-e.tiny_),y=u*n,v=r.hypot(c,u*t),C.ssig1=t,b=y*t,C.csig1=_=c*n,m=r.hypot(C.ssig1,C.csig1),C.ssig1/=m,C.csig1/=m,C.salp2=o!==n?y/o:u,C.calp2=o!==n||Math.abs(a)!==-t?Math.sqrt(r.sq(c*n)+(n<-t?(o-n)*(n+o):(t-a)*(t+a)))/o:Math.abs(c),C.ssig2=a,x=y*a,C.csig2=w=C.calp2*o,m=r.hypot(C.ssig2,C.csig2),C.ssig2/=m,C.csig2/=m,C.sig12=Math.atan2(Math.max(0,C.csig1*C.ssig2-C.ssig1*C.csig2),C.csig1*C.csig2+C.ssig1*C.ssig2),S=Math.max(0,_*x-b*w),A=_*w+b*x,M=Math.atan2(S*l-A*f,A*l+S*f),I=r.sq(v)*this._ep2,C.eps=I/(2*(1+Math.sqrt(1+I))+I),this.C3f(C.eps,g),E=e.SinCosSeries(!0,C.ssig2,C.csig2,g)-e.SinCosSeries(!0,C.ssig1,C.csig1,g),C.domg12=-this.f*this.A3f(C.eps)*y*(C.sig12+E),C.lam12=M+C.domg12,h&&(0===C.calp2?C.dlam12=-2*this._f1*i/t:(k=this.Lengths(C.eps,C.sig12,C.ssig1,C.csig1,i,C.ssig2,C.csig2,s,n,o,e.REDUCEDLENGTH,p,d),C.dlam12=k.m12b,C.dlam12*=this._f1/(C.calp2*o))),C},e.Geodesic.prototype.Inverse=function(t,n,i,a,o){var s,u;return o||(o=e.STANDARD),o===e.LONG_UNROLL&&(o|=e.STANDARD),o&=e.OUT_MASK,u=(s=this.InverseInt(t,n,i,a,o)).vals,o&e.AZIMUTH&&(u.azi1=r.atan2d(s.salp1,s.calp1),u.azi2=r.atan2d(s.salp2,s.calp2)),u},e.Geodesic.prototype.InverseInt=function(t,n,i,a,o){var s,u,c,f,l,h,p,d,g,v,b,x,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R,D,j,F,U,B,G,q,V,$,J,W,Z,Y,H,X,K,Q,ee,te,ne,re,ie,ae,oe,se,ue,ce,fe,le,he,pe,de,ge,me,ye,ve,be,_e,xe={};if(xe.lat1=t=r.LatFix(t),xe.lat2=i=r.LatFix(i),t=r.AngRound(t),i=r.AngRound(i),u=(s=r.AngDiff(n,a)).t,s=s.s,o&e.LONG_UNROLL?(xe.lon1=n,xe.lon2=n+s+u):(xe.lon1=r.AngNormalize(n),xe.lon2=r.AngNormalize(a)),s=(c=s>=0?1:-1)*r.AngRound(s),u=r.AngRound(180-s-c*u),A=s*r.degree,E=(f=r.sincosd(s>90?u:s)).s,M=(s>90?-1:1)*f.c,(l=Math.abs(t)<Math.abs(i)?-1:1)<0&&(c*=-1,f=t,t=i,i=f),t*=h=t<0?1:-1,i*=h,f=r.sincosd(t),p=this._f1*f.s,d=f.c,p/=f=r.hypot(p,d),d/=f,d=Math.max(e.tiny_,d),f=r.sincosd(i),g=this._f1*f.s,v=f.c,g/=f=r.hypot(g,v),v/=f,v=Math.max(e.tiny_,v),d<-p?v===d&&(g=g<0?p:-p):Math.abs(g)===-p&&(v=d),w=Math.sqrt(1+this._ep2*r.sq(p)),S=Math.sqrt(1+this._ep2*r.sq(g)),N=new Array(e.nC1_+1),T=new Array(e.nC2_+1),L=new Array(e.nC3_),(z=-90===t||0===E)&&(C=E,O=0,D=p,j=(k=M)*d,F=g,U=(P=1)*v,I=Math.atan2(Math.max(0,j*F-D*U),j*U+D*F),b=(R=this.Lengths(this._n,I,D,j,w,F,U,S,d,v,o|e.DISTANCE|e.REDUCEDLENGTH,N,T)).s12b,x=R.m12b,0!==(o&e.GEODESICSCALE)&&(xe.M12=R.M12,xe.M21=R.M21),I<1||x>=0?(I<3*e.tiny_&&(I=x=b=0),x*=this._b,b*=this._b,xe.a12=I/r.degree):z=!1),he=2,!z&&0===p&&(this.f<=0||u>=180*this.f))k=P=0,C=O=1,b=this.a*A,I=G=A/this._f1,x=this._b*Math.sin(I),o&e.GEODESICSCALE&&(xe.M12=xe.M21=Math.cos(I)),xe.a12=s/this._f1;else if(!z)if(I=(R=this.InverseStart(p,d,w,g,v,S,A,E,M,N,T)).sig12,C=R.salp1,k=R.calp1,I>=0)O=R.salp2,P=R.calp2,q=R.dnm,b=I*this._b*q,x=r.sq(q)*this._b*Math.sin(I/q),o&e.GEODESICSCALE&&(xe.M12=xe.M21=Math.cos(I/q)),xe.a12=I/r.degree,G=A/(this._f1*q);else{for(V=0,$=e.tiny_,J=1,W=e.tiny_,Z=-1,Y=!1,H=!1;V<m&&(X=(R=this.Lambda12(p,d,w,g,v,S,C,k,E,M,V<20,N,T,L)).lam12,O=R.salp2,P=R.calp2,I=R.sig12,D=R.ssig1,j=R.csig1,F=R.ssig2,U=R.csig2,B=R.eps,de=R.domg12,K=R.dlam12,!H&&Math.abs(X)>=(Y?8:1)*y);++V)X>0&&(V<20||k/C>Z/W)?(W=C,Z=k):X<0&&(V<20||k/C<J/$)&&($=C,J=k),V<20&&K>0&&(Q=-X/K,ee=Math.sin(Q),(ne=C*(te=Math.cos(Q))+k*ee)>0&&Math.abs(Q)<Math.PI)?(k=k*te-C*ee,C=ne,C/=f=r.hypot(C,k),k/=f,Y=Math.abs(X)<=16*y):(C=($+W)/2,k=(J+Z)/2,C/=f=r.hypot(C,k),k/=f,Y=!1,H=Math.abs($-C)+(J-k)<_||Math.abs(C-W)+(k-Z)<_);re=o|(o&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),b=(R=this.Lengths(B,I,D,j,w,F,U,S,d,v,re,N,T)).s12b,x=R.m12b,0!==(o&e.GEODESICSCALE)&&(xe.M12=R.M12,xe.M21=R.M21),x*=this._b,b*=this._b,xe.a12=I/r.degree,o&e.AREA&&(be=Math.sin(de),he=E*(_e=Math.cos(de))-M*be,pe=M*_e+E*be)}return o&e.DISTANCE&&(xe.s12=0+b),o&e.REDUCEDLENGTH&&(xe.m12=0+x),o&e.AREA&&(ie=C*d,0!==(ae=r.hypot(k,C*p))&&0!==ie?(D=p,j=k*d,F=g,U=P*v,B=(se=r.sq(ae)*this._ep2)/(2*(1+Math.sqrt(1+se))+se),ue=r.sq(this.a)*ae*ie*this._e2,D/=f=r.hypot(D,j),j/=f,F/=f=r.hypot(F,U),U/=f,ce=new Array(e.nC4_),this.C4f(B,ce),fe=e.SinCosSeries(!1,D,j,ce),le=e.SinCosSeries(!1,F,U,ce),xe.S12=ue*(le-fe)):xe.S12=0,!z&&he>1&&(he=Math.sin(G),pe=Math.cos(G)),!z&&pe>-.7071&&g-p<1.75?(de=1+pe,ge=1+d,me=1+v,oe=2*Math.atan2(he*(p*me+g*ge),de*(p*g+ge*me))):(ve=P*k+O*C,0===(ye=O*k-P*C)&&ve<0&&(ye=e.tiny_*k,ve=-1),oe=Math.atan2(ye,ve)),xe.S12+=this._c2*oe,xe.S12*=l*c*h,xe.S12+=0),l<0&&(f=C,C=O,O=f,f=k,k=P,P=f,o&e.GEODESICSCALE&&(f=xe.M12,xe.M12=xe.M21,xe.M21=f)),{vals:xe,salp1:C*=l*c,calp1:k*=l*h,salp2:O*=l*c,calp2:P*=l*h}},e.Geodesic.prototype.GenDirect=function(n,r,i,a,o,s){return s?s===e.LONG_UNROLL&&(s|=e.STANDARD):s=e.STANDARD,a||(s|=e.DISTANCE_IN),new t.GeodesicLine(this,n,r,i,s).GenPosition(a,o,s)},e.Geodesic.prototype.Direct=function(e,t,n,r,i){return this.GenDirect(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirect=function(e,t,n,r,i){return this.GenDirect(e,t,n,!0,r,i)},e.Geodesic.prototype.Line=function(e,n,r,i){return new t.GeodesicLine(this,e,n,r,i)},e.Geodesic.prototype.DirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!0,r,i)},e.Geodesic.prototype.GenDirectLine=function(n,r,i,a,o,s){var u;return s||(s=e.STANDARD|e.DISTANCE_IN),a||(s|=e.DISTANCE_IN),(u=new t.GeodesicLine(this,n,r,i,s)).GenSetDistance(a,o),u},e.Geodesic.prototype.InverseLine=function(n,i,a,o,s){var u,c,f;return s||(s=e.STANDARD|e.DISTANCE_IN),u=this.InverseInt(n,i,a,o,e.ARC),f=r.atan2d(u.salp1,u.calp1),s&e.OUT_MASK&e.DISTANCE_IN&&(s|=e.DISTANCE),(c=new t.GeodesicLine(this,n,i,f,s,u.salp1,u.calp1)).SetArc(u.vals.a12),c},e.Geodesic.prototype.Polygon=function(e){return new n.PolygonArea(this,e)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)}($t.Geodesic,$t.GeodesicLine,$t.PolygonArea,$t.Math,$t.Constants),function(e,t,n){t.GeodesicLine=function(t,r,i,a,o,s,u){var c,f,l,h,p,d;o||(o=e.STANDARD|e.DISTANCE_IN),this.a=t.a,this.f=t.f,this._b=t._b,this._c2=t._c2,this._f1=t._f1,this.caps=o|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=n.LatFix(r),this.lon1=i,void 0===s||void 0===u?(this.azi1=n.AngNormalize(a),c=n.sincosd(n.AngRound(this.azi1)),this.salp1=c.s,this.calp1=c.c):(this.azi1=a,this.salp1=s,this.calp1=u),c=n.sincosd(n.AngRound(this.lat1)),l=this._f1*c.s,f=c.c,l/=c=n.hypot(l,f),f/=c,f=Math.max(e.tiny_,f),this._dn1=Math.sqrt(1+t._ep2*n.sq(l)),this._salp0=this.salp1*f,this._calp0=n.hypot(this.calp1,this.salp1*l),this._ssig1=l,this._somg1=this._salp0*l,this._csig1=this._comg1=0!==l||0!==this.calp1?f*this.calp1:1,c=n.hypot(this._ssig1,this._csig1),this._ssig1/=c,this._csig1/=c,this._k2=n.sq(this._calp0)*t._ep2,h=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(h),this._C1a=new Array(e.nC1_+1),e.C1f(h,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),p=Math.sin(this._B11),d=Math.cos(this._B11),this._stau1=this._ssig1*d+this._csig1*p,this._ctau1=this._csig1*d-this._ssig1*p),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(h,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(h),this._C2a=new Array(e.nC2_+1),e.C2f(h,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),t.C3f(h,this._C3a),this._A3c=-this.f*this._salp0*t.A3f(h),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),t.C4f(h,this._C4a),this._A4=n.sq(this.a)*this._calp0*this._salp0*t._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=Number.NaN},t.GeodesicLine.prototype.GenPosition=function(t,r,i){var a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P,O={};return i?i===e.LONG_UNROLL&&(i|=e.STANDARD):i=e.STANDARD,i&=this.caps&e.OUT_MASK,O.lat1=this.lat1,O.azi1=this.azi1,O.lon1=i&e.LONG_UNROLL?this.lon1:n.AngNormalize(this.lon1),t?O.a12=r:O.s12=r,t||this.caps&e.DISTANCE_IN&e.OUT_MASK?(u=0,c=0,t?(a=r*n.degree,o=(I=n.sincosd(r)).s,s=I.c):(h=r/(this._b*(1+this._A1m1)),p=Math.sin(h),d=Math.cos(h),a=h-((u=-e.SinCosSeries(!0,this._stau1*d+this._ctau1*p,this._ctau1*d-this._stau1*p,this._C1pa))-this._B11),o=Math.sin(a),s=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,u=e.SinCosSeries(!0,f,l,this._C1a),a-=((1+this._A1m1)*(a+(u-this._B11))-r/this._b)/Math.sqrt(1+this._k2*n.sq(f)),o=Math.sin(a),s=Math.cos(a))),f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,S=Math.sqrt(1+this._k2*n.sq(f)),i&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((t||Math.abs(this.f)>.01)&&(u=e.SinCosSeries(!0,f,l,this._C1a)),c=(1+this._A1m1)*(u-this._B11)),y=this._calp0*f,0===(v=n.hypot(this._salp0,this._calp0*l))&&(v=l=e.tiny_),x=this._salp0,w=this._calp0*l,t&&i&e.DISTANCE&&(O.s12=this._b*((1+this._A1m1)*a+c)),i&e.LONGITUDE&&(b=this._salp0*f,_=l,m=n.copysign(1,this._salp0),g=((i&e.LONG_UNROLL?m*(a-(Math.atan2(f,l)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(m*b,_)-Math.atan2(m*this._somg1,this._comg1))):Math.atan2(b*this._comg1-_*this._somg1,_*this._comg1+b*this._somg1))+this._A3c*(a+(e.SinCosSeries(!0,f,l,this._C3a)-this._B31)))/n.degree,O.lon2=i&e.LONG_UNROLL?this.lon1+g:n.AngNormalize(n.AngNormalize(this.lon1)+n.AngNormalize(g))),i&e.LATITUDE&&(O.lat2=n.atan2d(y,this._f1*v)),i&e.AZIMUTH&&(O.azi2=n.atan2d(x,w)),i&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(A=e.SinCosSeries(!0,f,l,this._C2a),E=(1+this._A2m1)*(A-this._B21),M=(this._A1m1-this._A2m1)*a+(c-E),i&e.REDUCEDLENGTH&&(O.m12=this._b*(S*(this._csig1*f)-this._dn1*(this._ssig1*l)-this._csig1*l*M)),i&e.GEODESICSCALE&&(I=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+S),O.M12=s+(I*f-l*M)*this._ssig1/this._dn1,O.M21=s-(I*this._ssig1-this._csig1*M)*f/S)),i&e.AREA&&(k=e.SinCosSeries(!1,f,l,this._C4a),0===this._calp0||0===this._salp0?(C=x*this.calp1-w*this.salp1,P=w*this.calp1+x*this.salp1):(C=this._calp0*this._salp0*(s<=0?this._csig1*(1-s)+o*this._ssig1:o*(this._csig1*o/(1+s)+this._ssig1)),P=n.sq(this._salp0)+n.sq(this._calp0)*this._csig1*l),O.S12=this._c2*Math.atan2(C,P)+this._A4*(k-this._B41)),t||(O.a12=a/n.degree),O):(O.a12=Number.NaN,O)},t.GeodesicLine.prototype.Position=function(e,t){return this.GenPosition(!1,e,t)},t.GeodesicLine.prototype.ArcPosition=function(e,t){return this.GenPosition(!0,e,t)},t.GeodesicLine.prototype.GenSetDistance=function(e,t){e?this.SetArc(t):this.SetDistance(t)},t.GeodesicLine.prototype.SetDistance=function(t){var n;this.s13=t,n=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+n.a12},t.GeodesicLine.prototype.SetArc=function(t){var n;this.a13=t,n=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+n.s12}}($t.Geodesic,$t.GeodesicLine,$t.Math),function(e,t,n,r){var i,a;i=function(e,t){var r;return e=n.AngNormalize(e),t=n.AngNormalize(t),r=n.AngDiff(e,t).s,e<=0&&t>0&&r>0?1:t<=0&&e>0&&r<0?-1:0},a=function(e,t){return((t%=720)>=0&&t<360||t<-360?0:1)-((e%=720)>=0&&e<360||e<-360?0:1)},e.PolygonArea=function(e,n){this._geod=e,this.a=this._geod.a,this.f=this._geod.f,this._area0=4*Math.PI*e._c2,this.polyline=n||!1,this._mask=t.LATITUDE|t.LONGITUDE|t.DISTANCE|(this.polyline?t.NONE:t.AREA|t.LONG_UNROLL),this.polyline||(this._areasum=new r.Accumulator(0)),this._perimetersum=new r.Accumulator(0),this.Clear()},e.PolygonArea.prototype.Clear=function(){this.num=0,this._crossings=0,this.polyline||this._areasum.Set(0),this._perimetersum.Set(0),this._lat0=this._lon0=this.lat=this.lon=Number.NaN},e.PolygonArea.prototype.AddPoint=function(e,t){var n;0===this.num?(this._lat0=this.lat=e,this._lon0=this.lon=t):(n=this._geod.Inverse(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(n.s12),this.polyline||(this._areasum.Add(n.S12),this._crossings+=i(this.lon,t)),this.lat=e,this.lon=t),++this.num},e.PolygonArea.prototype.AddEdge=function(e,t){var n;this.num&&(n=this._geod.Direct(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(t),this.polyline||(this._areasum.Add(n.S12),this._crossings+=a(this.lon,n.lon2)),this.lat=n.lat2,this.lon=n.lon2),++this.num},e.PolygonArea.prototype.Compute=function(e,t){var n,a,o={number:this.num};return this.num<2?(o.perimeter=0,this.polyline||(o.area=0),o):this.polyline?(o.perimeter=this._perimetersum.Sum(),o):(n=this._geod.Inverse(this.lat,this.lon,this._lat0,this._lon0,this._mask),o.perimeter=this._perimetersum.Sum(n.s12),(a=new r.Accumulator(this._areasum)).Add(n.S12),1&this._crossings+i(this.lon,this._lon0)&&a.Add((a.Sum()<0?1:-1)*this._area0/2),e||a.Negate(),t?a.Sum()>this._area0/2?a.Add(-this._area0):a.Sum()<=-this._area0/2&&a.Add(+this._area0):(a.Sum()>=this._area0||a<0)&&a.Add(-this._area0),o.area=a.Sum(),o)},e.PolygonArea.prototype.TestPoint=function(e,t,n,r){var a,o,s,u,c={number:this.num+1};if(0===this.num)return c.perimeter=0,this.polyline||(c.area=0),c;for(c.perimeter=this._perimetersum.Sum(),o=this.polyline?0:this._areasum.Sum(),s=this._crossings,u=0;u<(this.polyline?1:2);++u)a=this._geod.Inverse(0===u?this.lat:e,0===u?this.lon:t,0!==u?this._lat0:e,0!==u?this._lon0:t,this._mask),c.perimeter+=a.s12,this.polyline||(o+=a.S12,s+=i(0===u?this.lon:t,0!==u?this._lon0:t));return this.polyline||(1&s&&(o+=(o<0?1:-1)*this._area0/2),n||(o*=-1),r?o>this._area0/2?o-=this._area0:o<=-this._area0/2&&(o+=this._area0):o>=this._area0?o-=this._area0:o<0&&(o+=this._area0),c.area=o),c},e.PolygonArea.prototype.TestEdge=function(e,t,n,r){var o,s,u,c={number:this.num?this.num+1:0};return 0===this.num||(c.perimeter=this._perimetersum.Sum()+t,this.polyline||(s=this._areasum.Sum(),u=this._crossings,s+=(o=this._geod.Direct(this.lat,this.lon,e,t,this._mask)).S12,u+=a(this.lon,o.lon2),o=this._geod.Inverse(o.lat2,o.lon2,this._lat0,this._lon0,this._mask),c.perimeter+=o.s12,s+=o.S12,1&(u+=i(o.lon2,this._lon0))&&(s+=(s<0?1:-1)*this._area0/2),n||(s*=-1),r?s>this._area0/2?s-=this._area0:s<=-this._area0/2&&(s+=this._area0):s>=this._area0?s-=this._area0:s<0&&(s+=this._area0),c.area=s)),c}}($t.PolygonArea,$t.Geodesic,$t.Math,$t.Accumulator),ee(function(e){var t=H(e.params,"rlat_1"),n=H(e.params,"rlat_2");Zt(e,t,n)},"aea","Albers Equal Area","Conic Sph&Ell\nlat_1= lat_2="),ee(function(e){var t=H(e.params,"rlat_1"),n=H(e.params,"bsouth")?-k:k;Zt(e,t,n)},"leac","Lambert Equal Area Conic","Conic, Sph&Ell\nlat_1= south"),ee(function(t){var i,o,u,l,h,p,g,m=1e-10;if(t.phi0=H(t.params,"rlat_0"),e(e(t.phi0)-k)<m?(h=t.phi0<0?1:0,i=t.phi0<0?-1:1,o=0):e(t.phi0)<m?(h=2,i=0,o=1):(h=3,i=n(t.phi0),o=r(t.phi0)),t.es)if(g=new $t.Geodesic.Geodesic(t.a,t.es/(1+f(t.one_es))),p=Yt(t.es),H(t.params,"bguam"))u=Ht(t.phi0,i,o,p),t.inv=function(e,i){var o,s,c;for(o=.5*e.x*e.x,i.phi=t.phi0,c=0;c<3;++c)s=t.e*n(i.phi),i.phi=Xt(u+e.y-o*a(i.phi)*(s=f(1-s*s)),t.es,p);i.lam=e.x*s/r(i.phi)},t.fwd=function(e,i){var a,o,s;a=r(e.phi),o=n(e.phi),s=1/f(1-t.es*o*o),i.x=e.lam*a*s,i.y=Ht(e.phi,o,a,p)-u+.5*e.lam*e.lam*a*o*s};else{switch(h){case 0:l=Ht(k,1,0,p);break;case 1:l=Ht(-k,-1,0,p);break;case 2:case 3:t.inv=v,t.fwd=y,f(1-t.es*i*i),t.e,f(t.one_es)}t.inv=v,t.fwd=y}else t.inv=function(e,a){var s,u,f,l=e.x,p=e.y;if((u=d(l,p))>w)u-m>w&&B(),u=w;else if(u<m)return a.phi=t.phi0,void(a.lam=0);3==h||2==h?(f=n(u),s=r(u),2==h?(a.phi=Kt(p*f/u),l*=f,p=s*u):(a.phi=Kt(s*i+p*f*o/u),p=(s-i*n(a.phi))*u,l*=f*o),a.lam=0==p?0:c(l,p)):0==h?(a.phi=k-u,a.lam=c(l,-p)):(a.phi=u-k,a.lam=c(l,p))},t.fwd=function(t,a){var u,c,f;switch(f=n(t.phi),c=r(t.phi),u=r(t.lam),h){case 2:case 3:a.y=2==h?c*u:i*f+o*c*u,e(e(a.y)-1)<1e-14?a.y<0?U():a.x=a.y=0:(a.y=s(a.y),a.y/=n(a.y),a.x=a.y*c*n(t.lam),a.y*=2==h?f:o*f-i*c*u);break;case 0:t.phi=-t.phi,u=-u;case 1:e(t.phi-k)<m&&U(),a.x=(a.y=k+t.phi)*n(t.lam),a.y*=u}};function y(i,a){var o,s,u,c,f,d,y,v,b,_,x;switch(o=r(i.lam),s=r(i.phi),u=n(i.phi),h){case 0:o=-o;case 1:a.x=(c=e(l-Ht(i.phi,u,s,p)))*n(i.lam),a.y=c*o;break;case 2:case 3:if(e(i.lam)<m&&e(i.phi-t.phi0)<m){a.x=a.y=0;break}v=t.phi0/A,y=t.lam0/A,_=i.phi/A,b=(i.lam+t.lam0)/A,f=(x=g.Inverse(v,y,_,b,g.AZIMUTH)).azi1*A,d=x.s12,a.x=d*n(f)/t.a,a.y=d*r(f)/t.a}}function v(e,n){var r,i,a,o,s,u,y,v;if((r=d(e.x,e.y))<m)return n.phi=t.phi0,n.lam=0,n;3==h||2==h?(o=e.x*t.a,s=e.y*t.a,u=t.phi0/A,y=t.lam0/A,i=c(o,s)/A,a=f(o*o+s*s),v=g.Direct(u,y,i,a,g.STANDARD),n.phi=v.lat2*A,n.lam=v.lon2*A,n.lam-=t.lam0):(n.phi=Xt(0==h?l-r:l+r,t.es,p),n.lam=c(e.x,0==h?-e.y:e.y))}},"aeqd","Azimuthal Equidistant","Azi, Sph&Ell\nlat_0 guam"),ee(function(t){var i,o,s,u,c,f,l=1e-10;t.es=0,t.fwd=function(t,f){var h,d,g,m,y,v,b,_;switch(h=n(t.lam),d=r(t.lam),u){case 2:case 3:m=n(t.phi),_=(g=r(t.phi))*d,3==u&&(_=i*m+o*_),!c&&_<-l&&U(),b=e(v=1-_)>l?-p(y=.5*(1+_))/v-s/y:.5-s,f.x=b*g*h,f.y=3==u?b*(o*m-i*g*d):b*m;break;case 1:case 0:t.phi=e(p_halfpi-t.phi),!c&&t.phi-l>k&&U(),(t.phi*=.5)>l?(y=a(t.phi),b=-2*(p(r(t.phi))/y+y*s),f.x=b*h,f.y=b*d,0==u&&(f.y=-f.y)):f.x=f.y=0}},c=H(t.params,"bno_cut"),f=.5*(k-H(t.params,"rlat_b")),e(f)<l?s=-.5:(s=1/a(f),s*=s*p(r(f))),e(e(t.phi0)-k)<l?t.phi0<0?(p_halfpi=-k,u=1):(p_halfpi=k,u=0):e(t.phi0)<l?u=2:(u=3,i=n(t.phi0),o=r(t.phi0))},"airy","Airy","Misc Sph, no inv.\nno_cut lat_b="),ee(function(e){var t=e.opaque={mode:1};H(e.params,"tlat_1")?0===(t.cosphi1=r(H(e.params,"rlat_1")))&&q(-22):t.cosphi1=.6366197723675814,nn(e)},"wintri","Winkel Tripel","Misc Sph\nlat_1"),ee(nn,"aitoff","Aitoff","Misc Sph"),ee(function(e){e.fwd=function(e,t){var i,o,s,u,c,l,h,p=4/3,d=e.lam;i=a(.5*e.phi),s=1+(o=f(1-i*i))*r(d*=.5),u=n(d)*o/s,l=i/s,t.x=p*u*(3+(c=u*u)-3*(h=l*l)),t.y=p*l*(3+3*c-h)},e.es=0},"august","August Epicycloidal","Misc Sph, no inv."),ee(function(e){rn(e,!1,!1)},"apian","Apian Globular I","Misc Sph, no inv."),ee(function(e){rn(e,!1,!0)},"ortel","Ortelius Oval","Misc Sph, no inv."),ee(function(e){rn(e,!0,!1)},"bacon","Bacon Globular","Misc Sph, no inv."),ee(function(e){var t,i,a,s;e.es=0,e.fwd=function(e,u){var l,h,p,d,g,m;return e.lam+=-16.5*A,h=r(e.phi),p=r(e.lam)*h,d=n(e.lam)*h,m=(g=n(e.phi))*t+p*i,e.lam=c(d*a-m*s,p*t-g*i),m=m*a+d*s,e.phi=o(m),e.lam=Ie(e.lam),e.lam+e.phi<-1.4&&(l=(e.lam-e.phi+1.6)*(e.lam+e.phi+1.4)/8,e.lam+=l,e.phi-=.8*l*n(e.phi+w/2)),h=r(e.phi),l=f(2/(1+h*r(e.lam/2))),u.x=1.68*l*h*n(e.lam/2),u.y=l*n(e.phi),l=(1-r(e.lam*e.phi))/12,u.y<0&&(u.x*=1+l),u.y>0&&(u.y*=1+l/1.5*u.x*u.x),u},e.lam0=0,e.phi0=-42*A,t=r(e.phi0),i=n(e.phi0),a=1,s=0},"bertin1953","Bertin 1953","Misc., Sph., NoInv."),ee(function(t){var i=f(2);t.fwd=function(t,a){var o,s,u,c;if(o=t.phi,e(e(t.phi)-k)<1e-7)a.x=0;else{for(u=n(o)*w,c=20;c&&(o-=s=(o+n(o)-u)/(1+r(o)),!(e(s)<1e-7));--c);o*=.5,a.x=2.00276*t.lam/(1/r(t.phi)+1.11072/r(o))}a.y=.49931*(t.phi+i*n(o))},t.es=0},"boggs","Boggs Eumorphic","PCyl., no inv., Sph."),ee(function(t){var i,o,s,u,l,h,p=1e-10;i=H(t.params,"rlat_1"),e(i)<p&&q(-23),t.es?(l=Yt(t.es),u=Ht(i,s=n(i),h=r(i),l),s=h/(f(1-t.es*s*s)*s),t.inv=function(i,a){var o,h;h=d(i.x,i.y=s-i.y),a.phi=Xt(s+u-h,t.es,l),(o=e(a.phi))<k?(o=n(a.phi),a.lam=h*c(i.x,i.y)*f(1-t.es*o*o)/r(a.phi)):e(o-k)<=p?a.lam=0:B()},t.fwd=function(e,i){var a,o,c;a=s+u-Ht(e.phi,o=n(e.phi),c=r(e.phi),l),o=c*e.lam/(a*f(1-t.es*o*o)),i.x=a*n(o),i.y=s-a*r(o)}):(o=e(i)+p>=k?0:1/a(i),t.inv=function(t,n){var a=d(t.x,t.y=o-t.y);n.phi=o+i-a,e(n.phi)>k&&B(),e(e(n.phi)-k)<=p?n.lam=0:n.lam=a*c(t.x,t.y)/r(n.phi)},t.fwd=function(t,a){var s,u;u=o+i-t.phi,e(u)>p?(a.x=u*n(s=t.lam*r(t.phi)/u),a.y=o-u*r(s)):a.x=a.y=0})},"bonne","Bonne (Werner lat_1=90)","Conic Sph&Ell\nlat_1="),ee(function(e){var t,i,s=.16666666666666666,u=.008333333333333333,l=.041666666666666664,h=.06666666666666667;e.es?(i=Yt(e.es),t=Ht(e.phi0,n(e.phi0),r(e.phi0),i),e.fwd=function(o,c){var h,p,d,g,m,y;c.y=Ht(o.phi,h=n(o.phi),g=r(o.phi),i),h=1/f(1-e.es*h*h),y=a(o.phi),p=y*y,d=o.lam*g,g*=e.es*g/(1-e.es),m=d*d,c.x=h*d*(1-m*p*(s-(8-p+8*g)*m*u)),c.y-=t-h*y*m*(.5+(5-p+6*g)*m*l)},e.inv=function(o,s){var u,c,p,d,g,m,y;y=Xt(t+o.y,e.es,i),m=a(y),c=m*m,u=n(y),p=1/(1-e.es*u*u),u=f(p),p*=(1-e.es)*u,d=o.x/u,g=d*d,s.phi=y-u*m/p*g*(.5-(1+3*c)*g*l),s.lam=d*(1+c*g*((1+3*c)*g*h-.3333333333333333))/r(y)}):(e.fwd=function(t,i){i.x=o(r(t.phi)*n(t.lam)),i.y=c(a(t.phi),r(t.lam))-e.phi0},e.inv=function(t,i){var s=t.y+e.phi0;i.phi=o(n(s)*r(t.x)),i.lam=c(a(t.x),r(s))})},"cass","Cassini","Cyl, Sph&Ell"),ee(function(t){var i,a,s=0;H(t.params,"tlat_ts")&&(t.k0=r(s=H(t.params,"rlat_ts")),t.k0<0&&q(-24)),t.es?(s=n(s),t.k0/=f(1-t.es*s*s),t.e=f(t.es),(a=an(t.es))||e_error_0(),i=Jt(1,t.e,t.one_es),t.fwd=function(e,r){r.x=t.k0*e.lam,r.y=.5*Jt(n(e.phi),t.e,t.one_es)/t.k0},t.inv=function(e,n){n.phi=on(o(2*e.y*t.k0/i),a),n.lam=e.x/t.k0}):(t.fwd=function(e,r){r.x=t.k0*e.lam,r.y=n(e.phi)/t.k0},t.inv=function(n,r){var i,a=n.x,s=n.y;(i=e(s*=t.k0))-L<=1?(r.phi=i>=1?s<0?-k:k:o(s),r.lam=a/t.k0):B()})},"cea","Equal Area Cylindrical","Cyl, Sph&Ell\nlat_ts="),ee(function(t){var i,a,o,s,u,l,h,p=1/3,d=[];for(l=0;l<3;++l)d[l]={p:{}},d[l].phi=H(t.params,"rlat_"+(l+1)),d[l].lam=H(t.params,"rlon_"+(l+1)),d[l].lam=Ie(d[l].lam-t.lam0),d[l].cosphi=r(d[l].phi),d[l].sinphi=n(d[l].phi);for(l=0;l<3;++l)h=2==l?0:l+1,d[l].v=g(d[h].phi-d[l].phi,d[l].cosphi,d[l].sinphi,d[h].cosphi,d[h].sinphi,d[h].lam-d[l].lam),d[l].v.r||q(-25);function g(t,i,a,o,s,u){var l,h,p,d={};return l=r(u),e(t)>1||e(u)>1?d.r=Qt(cs1*s+i*o*l):(h=n(.5*t),p=n(.5*u),d.r=2*Kt(f(h*h+i*o*p*p))),e(d.r)>1e-9?d.Az=c(o*n(u),i*s-a*o*l):d.r=d.Az=0,d}function m(e,t,n){return Qt(.5*(e*e+t*t-n*n)/(e*t))}o=m(d[0].v.r,d[2].v.r,d[1].v.r),s=m(d[0].v.r,d[1].v.r,d[2].v.r),u=w-o,a=2*(d[0].p.y=d[1].p.y=d[2].v.r*n(o)),d[2].p.y=0,d[0].p.x=-(d[1].p.x=.5*d[0].v.r),i=d[2].p.x=d[0].p.x+d[2].v.r*r(o),t.es=0,t.fwd=function(e,t){var o,c,f,l,h,y,v,b=[];for(o=n(e.phi),c=r(e.phi),l=0;l<3&&(b[l]=g(e.phi-d[l].phi,d[l].cosphi,d[l].sinphi,c,o,e.lam-d[l].lam),b[l].r);++l)b[l].Az=Ie(b[l].Az-d[l].v.Az);if(l<3)y=d[l].p.x,v=d[l].p.y;else{for(y=i,v=a,l=0;l<3;++l)h=2==l?0:l+1,f=m(d[l].v.r,b[l].r,b[h].r),b[l].Az<0&&(f=-f),l?1==l?(f=s-f,y-=b[l].r*r(f),v-=b[l].r*n(f)):(f=u-f,y+=b[l].r*r(f),v+=b[l].r*n(f)):(y+=b[l].r*r(f),v-=b[l].r*n(f));y*=p,v*=p}t.x=y,t.y=v}},"chamb","Chamberlin Trimetric","Misc Sph, no inv.\nlat_1= lon_1= lat_2= lon_2= lat_3= lon_3="),ee(function(e){var t=1/3;e.inv=function(e,n){n.phi=3*o(.32573500793527993*e.y),n.lam=1.0233267079464885*e.x/(2*r((n.phi+n.phi)*t)-1)},e.fwd=function(e,i){e.phi*=t,i.x=.9772050238058398*e.lam*(2*r(e.phi+e.phi)-1),i.y=3.0699801238394655*n(e.phi)},e.es=0},"crast","Craster Parabolic (Putnins P4)","PCyl., Sph."),ee(function(e){var t=.5253,i=.7264,a=1/Math.sqrt(t*i),s=.9701,u=p(22*A),c=d(0),l=n(u),h=r(u);function p(e){return o(i*n(e)+.4188*f(t*i))}function d(e){return t*e}H(e.params,"tlon_0")||(e.lam0=11.023*A),e.es=0,e.fwd=function(e,t){var i=p(e.phi),o=d(e.lam),g=n(i),m=r(i),y=n(o-c),v=r(o-c),b=f(2/(1+n(u)*g+h*m*v));t.x=a*b*m*y*s,t.y=a*b*(h*g-l*m*v)/s}},"cupola","Cupola","PCyl., Sph., NoInv."),ee(function(t){t.fwd=function(t,n){var i=e(t.lam);n.y=t.phi,n.x=t.lam,n.x*=r((.95+i*(i*i*.0016666666666666666-.08333333333333333))*(t.phi*(.9+.03*t.phi*t.phi*t.phi*t.phi)))},t.es=0},"denoy","Denoyer Semi-Elliptical","PCyl, Sph., no inv."),ee(function(t){var n=.9213177319235613,r=.3183098861837907;t.es=0,t.fwd=function(t,i){i.x=n*t.lam*(1-r*e(t.phi)),i.y=n*t.phi},t.inv=function(t,i){i.phi=t.y/n,i.lam=t.x/(n*(1-r*e(i.phi)))}},"eck1","Eckert I","PCyl Sph"),ee(function(t){var r=.46065886596178063,i=1.4472025091165353;t.es=0,t.fwd=function(t,a){a.x=r*t.lam*(a.y=f(4-3*n(e(t.phi)))),a.y=i*(2-a.y),t.phi<0&&(a.y=-a.y)},t.inv=function(t,n){n.lam=t.x/(r*(n.phi=2-e(t.y)/i)),n.phi=.3333333333333333*(4-n.phi*n.phi),e(n.phi)>=1?e(n.phi)>1.0000001?B():n.phi=n.phi<0?-k:k:n.phi=o(n.phi),t.y<0&&(n.phi=-n.phi)}},"eck2","Eckert II","PCyl Sph"),ee(function(e){sn(e,{C_x:.4222382003157712,C_y:.8444764006315424,A:1,B:.4052847345693511})},"eck3","Eckert III","PCyl Sph"),ee(function(e){sn(e,{C_x:.94745,C_y:.94745,A:0,B:.3039635509270133})},"wag6","Wagner VI","PCyl Sph"),ee(function(e){sn(e,{C_x:.8660254037844,C_y:1,A:0,B:.3039635509270133})},"kav7","Kavraisky VII","PCyl Sph"),ee(function(e){sn(e,{C_x:1.8949,C_y:.94745,A:-.5,B:.3039635509270133})},"putp1","Putnins P1","PCyl Sph"),ee(function(t){var i=.4222382003157712,a=1.3265004281770023,o=3.5707963267948966;t.es=0,t.fwd=function(t,s){var u,c,f,l,h;for(u=o*n(t.phi),c=t.phi*t.phi,t.phi*=.895168+c*(.0218849+.00826809*c),h=6;h&&(l=r(t.phi),f=n(t.phi),t.phi-=c=(t.phi+f*(l+2)-u)/(1+l*(l+2)-f*f),!(e(c)<1e-7));--h);h?(s.x=i*t.lam*(1+r(t.phi)),s.y=a*n(t.phi)):(s.x=i*t.lam,s.y=t.phi<0?-a:a)},t.inv=function(e,t){var s;t.phi=Kt(e.y/a),t.lam=e.x/(i*(1+(s=r(t.phi)))),t.phi=Kt((t.phi+n(t.phi)*(s+2))/o)}},"eck4","Eckert IV","PCyl Sph"),ee(function(e){e.es=0,e.fwd=function(e,t){t.x=.4410127717245515*(1+r(e.phi))*e.lam,t.y=.882025543449103*e.phi},e.inv=function(e,t){t.lam=2.267508027238226*e.x/(1+r(t.phi=1.133754013619113*e.y))}},"eck5","Eckert V","PCyl Sph"),ee(function(e){var t=r(H(e.params,"rlat_ts"));t<=0&&q(-24),e.es=0,e.fwd=function(n,r){r.x=t*n.lam,r.y=n.phi-e.phi0},e.inv=function(n,r){r.lam=n.x/t,r.phi=n.y+e.phi0}},"eqc","Equidistant Cylindrical (Plate Caree)","Cyl, Sph\nlat_ts=[, lat_0=0]"),ee(function(t){var i,a,o,s,u,f,l,h,p,g,m,y,v;i=H(t.params,"rlat_1"),a=H(t.params,"rlat_2"),e(i+a)<L&&q(-21),(l=Yt(t.es))||e_error_0(),o=g=n(i),p=r(i),m=e(i-a)>=L,(h=t.es>0)?(v=Wt(g,p,t.es),y=Ht(i,g,p,l),m&&(g=n(a),p=r(a),o=(v-Wt(g,p,t.es))/(Ht(a,g,p,l)-y)),u=(f=y+v/o)-Ht(t.phi0,n(t.phi0),r(t.phi0),l)):(m&&(o=(p-r(a))/(a-i)),f=i+r(i)/o,u=f-t.phi0),t.fwd=function(e,t){s=f-(h?Ht(e.phi,n(e.phi),r(e.phi),l):e.phi),t.x=s*n(e.lam*=o),t.y=u-s*r(e.lam)},t.inv=function(e,n){0!=(s=d(e.x,e.y=u-e.y))?(o<0&&(s=-s,e.x=-e.x,e.y=-e.y),n.phi=f-s,h&&(n.phi=Xt(n.phi,t.es,l)),n.lam=c(e.x,e.y)/o):(n.lam=0,n.phi=o>0?k:-k)}},"eqdc","Equidistant Conic","Conic, Sph&Ell\nlat_1= lat_2="),ee(function(e){var t=1.340264,n=-.081106,r=893e-6,i=.003796,a=Math.sqrt(3)/2;e.es=0,e.fwd=function(e,o){var s=Math.asin(a*Math.sin(e.phi)),u=s*s,c=u*u*u;o.x=e.lam*Math.cos(s)/(a*(t+3*n*u+c*(7*r+9*i*u))),o.y=s*(t+n*u+c*(r+i*u))},e.inv=function(e,o){var s,u,c,f,l=e.y;for(f=0;f<12&&(l-=c=(l*(t+n*(s=l*l)+(u=s*s*s)*(r+i*s))-e.y)/(t+3*n*s+u*(7*r+9*i*s)),!(Math.abs(c)<1e-9));++f);u=(s=l*l)*s*s,o.lam=a*e.x*(t+3*n*s+u*(7*r+9*i*s))/Math.cos(l),o.phi=Math.asin(Math.sin(l)/a)}},"eqearth","Equal Earth","PCyl., Sph."),ee(un,"etmerc","Extended Transverse Mercator","Cyl, Sph\nlat_ts=(0)\nlat_0=(0)"),ee(function(e){e.fwd=function(e,t){t.x=.7071067811865476*e.lam,t.y=1.7071067811865475*a(.5*e.phi)},e.inv=function(e,t){t.lam=1.4142135623730951*e.x,t.phi=2*u(.585786437626905*e.y)},e.es=0},"gall","Gall (Gall Stereographic)","Cyl, Sph"),ee(function(e){e.is_geocent=!0,e.x0=0,e.y0=0,e.fwd=function(e,t){t.x=e.lam,t.y=e.phi},e.inv=function(e,t){t.phi=e.y,t.lam=e.x}},"geocent","Geocentric",""),ee(function(e){var t,i,o,s,l,h,p,g=H(e.params,"dh"),m=H(e.params,"ssweep");m?"x"==m?p=1:"y"==m?p=0:q(-49):p=0,((l=g/e.a)<=0||l>1e10)&&q(-50),h=(s=1+l)*s-1,0!=e.es?(t=f(e.one_es),i=e.one_es,o=e.rone_es,e.inv=function(e,n){var i,g,m,y,v,b;i=-1,p?(m=a(e.y/l),g=a(e.x/l)*d(1,m)):(g=a(e.x/l),m=a(e.y/l)*d(1,g));var _=(v=2*s*i)*v-4*(y=g*g+(y=m/t)*y+i*i)*h;_<0&&q(-51),b=(-v-f(_))/(2*y),i=s+b*i,g*=b,m*=b,n.lam=c(g,i),n.phi=u(m*r(n.lam)/i),n.phi=u(o*a(n.phi))},e.fwd=function(e,c){var f,h,g,m,y;e.phi=u(i*a(e.phi)),f=t/d(t*r(e.phi),n(e.phi)),h=f*r(e.lam)*r(e.phi),g=f*n(e.lam)*r(e.phi),m=f*n(e.phi),(s-h)*h-g*g-m*m*o<0&&q(-51),y=s-h,p?(c.x=l*u(g/d(m,y)),c.y=l*u(m/y)):(c.x=l*u(g/y),c.y=l*u(m/d(g,y)))}):(t=i=o=1,e.inv=function(e,t){var n,i,o,d,g,m;n=-1,p?(o=a(e.y/l),i=a(e.x/l)*f(1+o*o)):(i=a(e.x/l),o=a(e.y/l)*f(1+i*i));var y=(g=2*s*n)*g-4*(d=i*i+o*o+n*n)*h;y<0&&q(-51),m=(-g-f(y))/(2*d),n=s+m*n,i*=m,o*=m,t.lam=c(i,n),t.phi=u(o*r(t.lam)/n)},e.fwd=function(e,t){var i=r(e.phi),a=r(e.lam)*i,o=n(e.lam)*i,c=n(e.phi);i=s-a,p?(t.x=l*u(o/d(c,i)),t.y=l*u(c/i)):(t.x=l*u(o/i),t.y=l*u(c/d(o,i)))})},"geos","Geostationary Satellite View","Azi, Sph&Ell"),ee(function(e){var t=s(H(e.params,"tlat_1")?H(e.params,"rlat_1"):0),i=n(t),o=r(t);function s(e){return Kt(a(.5*e))}e.fwd=function(e,t){var a=.5*e.lam,u=s(e.phi),c=n(u),f=r(u),l=r(a);i*c+o*f*l>=0?(t.x=f*n(a),t.y=o*c-i*f*l):U()},e.es=0},"gilbert","Gilbert Two World Perspective","PCyl., Sph., NoInv.\nlat_1="),ee(function(e){e.fwd=function(e,t){var n=e.phi*e.phi;t.y=e.phi*(1+.08333333333333333*n),t.x=e.lam*(1-.162388*n),n=e.lam*e.lam,t.x*=.87-952426e-9*n*n},e.es=0},"gins8","Ginsburg VIII (TsNIIGAiK)","PCyl, Sph., no inv."),ee(function(e){H(e.params,"tn"),H(e.params,"tm")?fn(e,H(e.params,"dm"),H(e.params,"dn")):q(-99)},"gn_sinu","General Sinusoidal Series","PCyl, Sph.\nm= n="),ee(cn,"sinu","Sinusoidal (Sanson-Flamsteed)","PCyl, Sph&Ell"),ee(function(e){fn(e,1,2.5707963267948966)},"eck6","Eckert VI","PCyl, Sph.\nm= n="),ee(function(e){fn(e,.5,1.7853981633974483)},"mbtfps","McBryde-Thomas Flat-Polar Sinusoidal","PCyl, Sph."),ee(function(t){var i,a,s=1e-10;e(e(t.phi0)-k)<s?a=t.phi0<0?1:0:e(t.phi0)<s?a=2:(a=3,sinph0=n(t.phi0),i=r(t.phi0)),t.inv=function(r,l){var h,p,g,m=r.x,y=r.y;if(h=d(m,y),g=n(l.phi=u(h)),p=f(1-g*g),e(h)<=s)l.phi=t.phi0,l.lam=0;else{switch(a){case 3:l.phi=p*sinph0+y*g*i/h,e(l.phi)>=1?l.phi=l.phi>0?k:-k:l.phi=o(l.phi),y=(p-sinph0*n(l.phi))*h,m*=g*i;break;case 2:l.phi=y*g/h,e(l.phi)>=1?l.phi=l.phi>0?k:-k:l.phi=o(l.phi),y=p*h,m*=g;break;case 1:l.phi-=k;break;case 0:l.phi=k-l.phi,y=-y}l.lam=c(m,y)}},t.fwd=function(e,t){var o,u,c;switch(c=n(e.phi),u=r(e.phi),o=r(e.lam),a){case 2:t.y=u*o;break;case 3:t.y=sinph0*c+i*u*o;break;case 1:t.y=-c;break;case 0:t.y=c}switch(t.y<=s&&U(),t.x=(t.y=1/t.y)*u*n(e.lam),a){case 2:t.y*=c;break;case 3:t.y*=i*c-sinph0*u*o;break;case 0:o=-o;case 1:t.y*=u*o}},t.es=0},"gnom","Gnomonic","Azi, Sph."),ee(ln,"moll","Mollweide","PCyl Sph"),ee(function(e){pn(e,hn(0,w/3))},"wag4","Wagner IV","PCyl Sph"),ee(function(e){pn(e,{C_x:.90977,C_y:1.65014,C_p:3.00896})},"wag5","Wagner V","PCyl Sph"),ee(function(t){var n,r,i,a,o=.0528,s=.7109307819790236;t.es=0,cn(t),n=t.fwd,r=t.inv,ln(t),i=t.fwd,a=t.inv,t.fwd=function(t,r){e(t.phi)<s?n(t,r):(i(t,r),r.y-=t.phi>0?o:-o)},t.inv=function(t,n){e(t.y)<=s?r(t,n):(t.y+=t.y>0?o:-o,a(t,n))}},"goode","Goode Homolosine","PCyl, Sph."),ee(function(t){var i,a,o;t.inv=function(t,n){var r=f(1-.25*i*i*t.x*t.x-.25*t.y*t.y);e(2*r*r-1)<1e-10?(n.lam=x,n.phi=x,pj_errno=-14):(n.lam=tn(i*t.x*r,2*r*r-1)/i,n.phi=Kt(r*t.y))},t.fwd=function(e,t){var s,u;u=f(2/(1+(s=r(e.phi))*r(e.lam*=i))),t.x=a*u*s*n(e.lam),t.y=o*u*n(e.phi)},t.es=0,H(t.params,"tW")?(i=e(H(t.params,"dW")))<=0&&q(-27):i=.5,H(t.params,"tM")?(a=e(H(t.params,"dM")))<=0&&q(-27):a=1,o=1/a,a/=i},"hammer","Hammer & Eckert-Greifendorff","Misc Sph,\nW= M="),ee(function(t){var i=1.000001;t.inv=function(t,a){var s=t.y*(t.y<0?.5179951515653813:.5686373742600607);e(s)>1?e(s)>i?B():s=s>0?k:-k:s=o(s),a.lam=1.1764705882352942*t.x/r(s),s+=s,a.phi=(s+n(s))*(t.y<0?.4102345310814193:.3736990601468637),e(a.phi)>1?e(a.phi)>i?B():a.phi=a.phi>0?k:-k:a.phi=o(a.phi)},t.fwd=function(t,i){var a,o,s;for(o=n(t.phi)*(t.phi<0?2.43763:2.67595),s=20;s&&(t.phi-=a=(t.phi+n(t.phi)-o)/(1+r(t.phi)),!(e(a)<1e-7));--s);i.x=.85*t.lam*r(t.phi*=.5),i.y=n(t.phi)*(t.phi<0?1.93052:1.75859)},t.es=0},"hatano","Hatano Asymmetrical Equal Area","PCyl., Sph."),ee(dn,"healpix","HEALPix","Sph., Ellps."),ee(function(e){dn(e,!0)},"rhealpix","rHEALPix","Sph., Ellps.\nnorth_square= south_square="),ee(function(t){var i,a=n(.5),u=o(a),l=2*f(w/(i=w+4*u*2)),h=.5*l*(2+f(3));t.es=0,t.fwd=function(t,a){var o,s,p=1-n(t.phi);if(p&&p<2){var d,g,m,y,v,b=k-t.phi,_=25;do{g=n(b),m=r(b),v=u+c(g,2-m),b-=d=(b-1*u-2*g+(y=5-4*m)*v-.5*p*i)/(4*g*v)}while(e(d)>1e-12&&--_>0);o=l*f(y),s=t.lam*v/w}else o=l*(1+p),s=t.lam*u/w;a.x=o*n(s),a.y=h-o*r(s)},t.inv=function(e,t){var r=e.x,a=e.y,p=r*r+(a-=h)*a,d=(5-p/(l*l))/4,g=s(d),m=n(g),y=u+c(m,2-d);t.lam=o(r/f(p))*w/y,t.phi=o(1-2*(g-1*u-2*m+(5-4*d)*y)/i)}},"hill","Hill Eucyclic","PCyl., Sph."),ee(function(t){var i,s,h,p,d,g,m,y,v,b=.785398163397448,_=1.37008346281555;t.a=6377397.155,t.e=f(t.es=.006674372230614),H(t.params,"tlat_0")||(t.phi0=.863937979737193),H(t.params,"tlon_0")||(t.lam0=.4334234309119251),H(t.params,"tk")||(t.k0=.9999),v=1,H(t.params,"tczech")||(v=-1),p=f(1+t.es*l(r(t.phi0),4)/(1-t.es)),i=o(n(t.phi0)/p),h=l((1+t.e*n(t.phi0))/(1-t.e*n(t.phi0)),p*t.e/2),d=a(i/2+b)/l(a(t.phi0/2+b),p)*h,s=f(1-t.es)/(1-t.es*l(n(t.phi0),2)),g=n(_),m=t.k0*s/a(_),y=.5286277629901559,t.inv=function(i,s){var h,x,w,S,A,E,M,I;M=i.x,i.x=i.y,i.y=M,i.x*=v,i.y*=v,A=f(i.x*i.x+i.y*i.y),S=c(i.y,i.x)/n(_),w=2*(u(l(m/A,1/g)*a(_/2+b))-b),h=o(r(y)*n(w)-n(y)*r(w)*r(S)),x=o(r(w)*n(S)/r(h)),s.lam=t.lam0-x/p,E=h,I=0;do{s.phi=2*(u(l(d,-1/p)*l(a(h/2+b),1/p)*l((1+t.e*n(E))/(1-t.e*n(E)),t.e/2))-b),e(E-s.phi)<1e-15&&(I=1),E=s.phi}while(0===I);s.lam-=t.lam0},t.fwd=function(e,i){var s,c,f,h,x,w,S;s=l((1+t.e*n(e.phi))/(1-t.e*n(e.phi)),p*t.e/2),c=2*(u(d*l(a(e.phi/2+b),p)/s)-b),f=-e.lam*p,h=o(r(y)*n(c)+n(y)*r(c)*r(f)),x=o(r(c)*n(f)/r(h)),w=g*x,S=m*l(a(_/2+b),g)/l(a(h/2+b),g),i.y=S*r(w),i.x=S*n(w),i.y*=v,i.x*=v}},"krovak","Krovak","PCyl., Ellps."),ee(function(t){var i,a,s,u,l,h,p,g,m,y,v,b=1e-10;if(y=e(t.phi0),m=e(y-k)<b?t.phi0<0?1:0:e(y)<b?2:3,t.es){switch(t.e=f(t.es),l=Jt(1,t.e,t.one_es),t.es,g=an(t.es),m){case 0:case 1:h=1;break;case 2:h=1/(p=f(.5*l)),s=1,u=.5*l;break;case 3:p=f(.5*l),v=n(t.phi0),i=Jt(v,t.e,t.one_es)/l,a=f(1-i*i),h=r(t.phi0)/(f(1-t.es*v*v)*p*a),u=(s=p)/h,s*=h}t.inv=function(e,s){var u,f,y,v,_=0;switch(m){case 2:case 3:if(e.x/=h,e.y*=h,(v=d(e.x,e.y))<b)return s.lam=0,s.phi=t.phi0,s;f=2*o(.5*v/p),u=r(f),f=n(f),e.x*=f,3==m?(_=u*i+e.y*f*a/v,e.y=v*a*u-e.y*i*f):(_=e.y*f/v,e.y=v*u);break;case 0:e.y=-e.y;case 1:if(!(y=e.x*e.x+e.y*e.y))return s.lam=0,s.phi=t.phi0,s;_=1-y/l,1==m&&(_=-_)}return s.lam=c(e.x,e.y),s.phi=on(o(_),g),s},t.fwd=function(o,c){var h,p,d,g,y=0,v=0,_=0;switch(h=r(o.lam),p=n(o.lam),d=n(o.phi),g=Jt(d,t.e,t.one_es),(3==m||2==m)&&(v=f(1-(y=g/l)*y)),m){case 3:_=1+i*y+a*v*h;break;case 2:_=1+v*h;break;case 0:_=k+o.phi,g=l-g;break;case 1:_=o.phi-k,g=l+g}switch(e(_)<b&&U(),m){case 3:case 2:3==m?(_=f(2/_),c.y=u*_*(a*y-i*v*h)):(_=f(2/(1+v*h)),c.y=_*y*u),c.x=s*_*v*p;break;case 0:case 1:g>=0?(_=f(g),c.x=_*p,c.y=h*(1==m?_:-_)):c.x=c.y=0}}}else 3==m&&(i=n(t.phi0),a=r(t.phi0)),t.inv=function(s,u){var f,l=0,h=0;switch(f=d(s.x,s.y),(u.phi=.5*f)>1&&B(),u.phi=2*o(u.phi),(3==m||2==m)&&(h=n(u.phi),l=r(u.phi)),m){case 2:u.phi=e(f)<=b?0:o(s.y*h/f),s.x*=h,s.y=l*f;break;case 3:u.phi=e(f)<=b?t.phi0:o(l*i+s.y*h*a/f),s.x*=h*a,s.y=(l-n(u.phi)*i)*f;break;case 0:s.y=-s.y,u.phi=k-u.phi;break;case 1:u.phi-=k}u.lam=0!=s.y||2!=m&&3!=m?c(s.x,s.y):0},t.fwd=function(o,s){var u,c,l;switch(l=n(o.phi),c=r(o.phi),u=r(o.lam),m){case 2:case 3:s.y=2==m?1+c*u:1+i*l+a*c*u,s.y<=b&&U(),s.y=f(2/s.y),s.x=s.y*c*n(o.lam),s.y*=2==m?l:a*l-i*c*u;break;case 0:u=-u;case 1:e(o.phi+t.phi0)<b&&U(),s.y=I-.5*o.phi,s.y=2*(1==m?r(s.y):n(s.y)),s.x=s.y*n(o.lam),s.y*=u}}},"laea","Lambert Azimuthal Equal Area","Azi, Sph&Ell"),ee(gn,"lonlat","Lat/long (Geodetic)",""),ee(gn,"longlat","Lat/long (Geodetic alias)",""),ee(gn,"latlon","Lat/long (Geodetic alias)",""),ee(gn,"latlong","Lat/long (Geodetic alias)",""),ee(function(t){var i,o,s,h,g,m,y,v,b,_,w,S=1e-10;t.inv=function(e,n){var r,i=e.x,a=e.y;i/=t.k0,a/=t.k0,0!=(r=d(i,a=y-a))?(m<0&&(r=-r,i=-i,a=-a),b?(n.phi=yn(l(r/v,1/m),t.e),n.phi==x&&B()):n.phi=2*u(l(v/r,1/m))-k,n.lam=c(i,a)/m):(n.lam=0,n.phi=m>0?k:-k)},t.fwd=function(i,o){var s,u=i.lam;e(e(i.phi)-k)<S?(i.phi*m<=0&&U(),s=0):s=v*(b?l(mn(i.phi,n(i.phi),t.e),m):l(a(I+.5*i.phi),-m)),u*=m,o.x=t.k0*(s*n(u)),o.y=t.k0*(y-s*r(u))},h=H(t.params,"rlat_1"),H(t.params,"tlat_2")?g=H(t.params,"rlat_2"):(g=h,H(t.params,"tlat_0")||(t.phi0=h)),e(h+g)<S&&q(-21),m=o=n(h),i=r(h),s=e(h-g)>=S,(b=0!=t.es)?(t.e=f(t.es),w=Wt(o,i,t.es),_=mn(h,o,t.e),s&&(o=n(g),m=p(w/Wt(o,r(g),t.es)),m/=p(_/mn(g,o,t.e))),v=y=w*l(_,-m)/m,y*=e(e(t.phi0)-k)<S?0:l(mn(t.phi0,n(t.phi0),t.e),m)):(s&&(m=p(i/r(g))/p(a(I+.5*g)/a(I+.5*h))),v=i*l(a(I+.5*h),m)/m,y=e(e(t.phi0)-k)<S?0:v*l(a(I+.5*t.phi0),-m))},"lcc","Lambert Conformal Conic","Conic, Sph&Ell\nlat_1= and lat_2= or lat_0="),ee(function(t){var n,i,o,s=1e-8;n=H(t.params,"rlat_1"),i=r(n),o=a(I+.5*n),i<s&&q(-22),t.fwd=function(t,r){r.y=t.phi-n,e(r.y)<s?r.x=t.lam*i:(r.x=I+.5*t.phi,e(r.x)<s||e(e(r.x)-k)<s?r.x=0:r.x=t.lam*r.y/p(a(r.x)/o))},t.inv=function(t,r){r.phi=t.y+n,e(t.y)<s?r.lam=t.x/i:(r.lam=I+.5*r.phi,e(r.lam)<s||e(e(r.lam)-k)<s?r.lam=0:r.lam=t.x*p(a(r.lam)/o)/t.y)},t.es=0},"loxim","Loximuthal","PCyl Sph"),ee(function(t){var i=.9525793444156804,a=.9258200997725514,s=3.401680257083045,u=2/3,c=1/3,f=1.0000001;t.fwd=function(e,t){e.phi=o(i*n(e.phi)),t.x=a*e.lam*(2*r(u*e.phi)-1),t.y=s*n(c*e.phi)},t.inv=function(t,c){c.phi=t.y/s,e(c.phi)>=1?e(c.phi)>f?B():c.phi=c.phi<0?-k:k:c.phi=o(c.phi),c.lam=t.x/(a*(2*r(u*(c.phi*=3))-1)),e(c.phi=n(c.phi)/i)>=1?e(c.phi)>f?B():c.phi=c.phi<0?-k:k:c.phi=o(c.phi)},t.es=0},"mbt_fpp","McBride-Thomas Flat-Polar Parabolic","Cyl., Sph."),ee(function(t){var i=1.000001;t.fwd=function(t,i){var a,o,s;for(o=1.7071067811865475*n(t.phi),s=20;s&&(t.phi-=a=(n(.5*t.phi)+n(t.phi)-o)/(.5*r(.5*t.phi)+r(t.phi)),!(e(a)<1e-7));--s);i.x=.3124597141037825*t.lam*(1+2*r(t.phi)/r(.5*t.phi)),i.y=1.874758284622695*n(.5*t.phi)},t.inv=function(t,a){var s;a.phi=.533402096794177*t.y,e(a.phi)>1?e(a.phi)>i?B():a.phi<0?(s=-1,a.phi=-w):(s=1,a.phi=w):a.phi=2*o(s=a.phi),a.lam=3.2004125807650623*t.x/(1+2*r(a.phi)/r(.5*a.phi)),a.phi=.585786437626905*(s+n(a.phi)),e(a.phi)>1?e(a.phi)>i?B():a.phi=a.phi<0?-k:k:a.phi=o(a.phi)},t.es=0},"mbt_fpq","McBryde-Thomas Flat-Polar Quartic","Cyl., Sph."),ee(function(t){var i=.45503,a=1.36509,o=1.41546,s=.22248,u=1.44492,c=1/3;t.fwd=function(t,f){var l,h,p,d;for(l=o*n(t.phi),d=10;d&&(p=t.phi/a,t.phi-=h=(i*n(p)+n(t.phi)-l)/(c*r(p)+r(t.phi)),!(e(h)<1e-7));--d);p=t.phi/a,f.x=s*t.lam*(1+3*r(t.phi)/r(p)),f.y=u*n(p)},t.inv=function(e,t){var c;t.phi=a*(c=Kt(e.y/u)),t.lam=e.x/(s*(1+3*r(t.phi)/r(c))),t.phi=Kt((i*n(c)+n(t.phi))/o)},t.es=0},"mbt_fps","McBryde-Thomas Flat-Pole Sine (No. 2)","Cyl., Sph."),ee(function(t){var i=1e-10,o=0,s=H(t.params,"tlat_ts");s&&(o=H(t.params,"rlat_ts"))>=k&&q(-24),t.es?(s&&(t.k0=Wt(n(o),r(o),t.es)),t.inv=function(e,n){n.phi=yn(h(-e.y/t.k0),t.e),n.phi===x&&B(),n.lam=e.x/t.k0},t.fwd=function(r,a){e(e(r.phi)-k)<=i&&U(),a.x=t.k0*r.lam,a.y=-t.k0*p(mn(r.phi,n(r.phi),t.e))}):(t.inv=function(e,n){n.phi=k-2*u(h(-e.y/t.k0)),n.lam=e.x/t.k0},t.fwd=function(n,r){e(e(n.phi)-k)<=i&&U(),r.x=t.k0*n.lam,r.y=t.k0*p(a(I+.5*n.phi))})},"merc","Mercator","Cyl, Sph&Ell\nlat_ts="),ee(function(t){t.k0=1,t.inv=function(e,n){n.phi=k-2*u(h(-e.y/t.k0)),n.lam=e.x/t.k0},t.fwd=function(n,r){e(e(n.phi)-k)<=L&&U(),r.x=t.k0*n.lam,r.y=t.k0*p(a(I+.5*n.phi))}},"webmerc","Web Mercator / Pseudo Mercator","Cyl, Ell"),ee(function(e){e.fwd=function(e,t){t.x=e.lam,t.y=1.25*p(a(I+.4*e.phi))},e.inv=function(e,t){t.lam=e.x,t.phi=2.5*(u(h(.8*e.y))-I)},e.es=0},"mill","Miller Cylindrical","Cyl, Sph"),ee(function(e){e.lam0=20*A,e.phi0=18*A,e.es=0,_n(e,[[.9245,0],[0,0],[.01943,0]])},"mil_os","Miller Oblated Stereographic","Azi(mod)"),ee(function(e){e.lam0=-165*A,e.phi0=-10*A,e.es=0,_n(e,[[.721316,0],[0,0],[-.0088162,-.00617325]])},"lee_os","Lee Oblated Stereographic","Azi(mod)"),ee(function(e){e.lam0=-96*A,e.phi0=39*A,e.es=0,e.a=6370997,_n(e,[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]])},"gs48","Mod Stereographic of 48 U.S.","Azi(mod)"),ee(function(e){var t;e.lam0=-152*A,e.phi0=64*A,0!=e.es?(t=[[.9945303,0],[.0052083,-.0027404],[.0072721,.0048181],[-.0151089,-.1932526],[.0642675,-.1381226],[.3582802,-.2884586]],e.a=6378206.4,e.e=f(e.es=.00676866)):(t=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],e.a=6370997),_n(e,t)},"alsk","Mod Stereographic of Alaska","Azi(mod)"),ee(function(e){var t;e.lam0=-120*A,e.phi0=45*A,0!=e.es?(t=[[.9827497,0],[.0210669,.0053804],[-.1031415,-.0571664],[-.0323337,-.0322847],[.0502303,.1211983],[.0251805,.0895678],[-.0012315,-.1416121],[.0072202,-.1317091],[-.0194029,.0759677],[-.0210072,.0834037]],e.a=6378206.4,e.e=f(e.es=.00676866)):(t=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],e.a=6370997),_n(e,t)},"gs50","Mod Stereographic of 50 U.S.","Azi(mod)"),ee(function(t){var n=.8707,r=-.131979,i=-.013791,a=.003971,o=-.001529,s=1.007226,u=.015085,c=-.044475,f=.028874,l=-.005916,h=s,p=3*u,d=7*c,g=9*f,m=11*l,y=.8707*.52*w;t.es=0,t.fwd=function(e,t){var h,p;p=(h=e.phi*e.phi)*h,t.x=e.lam*(n+h*(r+h*(i+p*h*(a+h*o)))),t.y=e.phi*(s+h*(u+p*(c+f*h+l*p)))},t.inv=function(t,v){var b,_,x,w,S=t.x,A=t.y;for(A>y?A=y:A<-y&&(A=-y),b=A;b-=_=(b*(s+(x=b*b)*(u+(w=x*x)*(c+f*x+l*w)))-A)/(h+x*(p+w*(d+g*x+m*w))),!(e(_)<1e-11););v.phi=b,x=b*b,v.lam=S/(n+x*(r+x*(i+x*x*x*(a+x*o))))}},"natearth","Natural Earth","PCyl., Sph."),ee(function(t){var n=.84719,r=-.13063,i=-.04515,a=.05494,o=-.02326,s=.00331,u=1.01183,c=-.02625,f=.01926,l=-.00396,h=u,p=9*c,d=.45334622460635143*w;t.es=0,t.fwd=function(e,t){var h,p,d;d=(h=e.phi*e.phi)*(p=h*h),t.x=e.lam*(n+r*h+d*d*(i+a*h+o*p+s*d)),t.y=e.phi*(u+p*p*(c+f*h+l*p))},t.inv=function(t,g){var m,y,v,b,_,x=t.x,w=t.y;for(w>d?w=d:w<-d&&(w=-d),m=w;m-=y=(m*(u+(b=(v=m*m)*v)*b*(c+f*v+l*b))-w)/(h+b*b*(p+.21186*v+-.05148*b)),!(e(y)<1e-11););g.phi=m,_=(v=m*m)*(b=v*v),g.lam=x/(n+r*v+_*_*(i+a*v+o*b+s*_))}},"natearth2","Natural Earth 2","PCyl., Sph."),ee(function(t){t.inv=function(e,t){t.lam=2*e.x/(1+r(e.y)),t.phi=Kt(.5*(e.y+n(e.y)))},t.fwd=function(t,i){var a,o,s;for(a=2*n(t.phi),o=t.phi*t.phi,t.phi*=1.00371+o*(-.011412*o-.0935382),s=10;s&&(t.phi-=o=(t.phi+n(t.phi)-a)/(1+r(t.phi)),!(e(o)<1e-7));--s);i.x=.5*t.lam*(1+r(t.phi)),i.y=t.phi},t.es=0},"nell","Nell","PCyl., Sph."),ee(function(t){t.es=0,t.fwd=function(e,t){t.x=.5*e.lam*(1+r(e.phi)),t.y=2*(e.phi-a(.5*e.phi))},t.inv=function(t,n){var i,o,s,u;for(s=.5*t.y,u=9;u>0&&(o=r(.5*n.phi),n.phi-=i=(n.phi-a(n.phi/2)-s)/(1-.5/(o*o)),!(e(i)<1e-7));--u);u?n.lam=2*t.x/(1+r(n.phi)):(n.phi=s<0?-k:k,n.lam=2*t.x)}},"nell_h","Nell-Hammer","PCyl., Sph."),ee(function(t){t.es=0,t.fwd=function(t,i){var a=1e-10;if(e(t.lam)<a)i.x=0,i.y=t.phi;else if(e(t.phi)<a)i.x=t.lam,i.y=0;else if(e(e(t.lam)-k)<a)i.x=t.lam*r(t.phi),i.y=k*n(t.phi);else if(e(e(t.phi)-k)<a)i.x=0,i.y=t.phi;else{var o=k/t.lam-t.lam/k,s=t.phi/k,u=n(t.phi),c=(1-s*s)/(u-s),l=o/c,h=(o*u/c-.5*o)/(1+(l*=l)),p=(u/l+.5*c)/(1+1/l);i.x=r(t.phi),i.x=f(h*h+i.x*i.x/(1+l)),i.x=k*(h+(t.lam<0?-i.x:i.x)),i.y=f(p*p-(u*u/l+c*u-1)/(1+1/l)),i.y=k*(p+(t.phi<0?i.y:-i.y))}}},"nicol","Nicolosi Globular","Misc Sph, no inv"),ee(function(e){xn(e,H(e.params,"dh"))},"nsper","Near-sided perspective","Azi, Sph\nh="),ee(function(e){var t=H(e.params,"dtilt")*A,n=H(e.params,"dazi")*A,r=H(e.params,"dh");xn(e,r,t,n)},"tpers","Tilted perspective","Azi, Sph\ntilt= azi= h="),ee(function(t){var n=[[.7557853228,0],[.249204646,.003371507],[-.001541739,.04105856],[-.10162907,.01727609],[-.26623489,-.36249218],[-.6870983,-1.1651967]],r=[1.5627014243,.5185406398,-.03333098,-.1052906,-.0368594,.007317,.0122,.00394,-.0013],i=[.6399175073,-.1358797613,.063294409,-.02526853,.0117879,-.0055161,.0026906,-.001333,67e-5,-34e-5];t.ra=1/(t.a=6378388),t.lam0=173*A,t.phi0=-41*A,t.x0=251e4,t.y0=6023150,t.inv=function(i,a){var o,s,u,c,f,l,h={r:i.y,i:i.x},p={};for(o=20;o>0&&((f=bn(h,n,p)).r-=i.y,f.i-=i.x,l=p.r*p.r+p.i*p.i,h.r+=u=-(f.r*p.r+f.i*p.i)/l,h.i+=c=-(f.i*p.r-f.r*p.i)/l,!(e(u)+e(c)<=1e-10));--o);if(o>0){for(a.lam=h.i,s=r.length-1,a.phi=r[s],--s;s>=0;--s)a.phi=r[s]+h.r*a.phi;a.phi=t.phi0+h.r*a.phi*.484813681109536}else a.lam=a.phi=x},t.fwd=function(e,r){var a=i.length-1,o={r:i[a]},s=2.0626480624709638*(e.phi-t.phi0);for(--a;a>=0;--a)o.r=i[a]+s*o.r;o.r*=s,o.i=e.lam,o=vn(o,n),r.x=o.i,r.y=o.r}},"nzmg","New Zealand Map Grid","fixed Earth"),ee(function(t){var i,o,s,f,l,h,p,d,g,m,y,v,b,_,w,E=1e-10;i=H(t.params,"so_proj"),o=Q[i],i||q(-26),o&&"ob_tran"!=i||q(-37),t.es=0,s={},Object.keys(t).forEach(function(e){s[e]=t[e]}),o.init(s),s.is_latlong&&1==t.to_meter&&(t.to_meter=A,t.fr_meter=S),H(t.params,"to_alpha")?(d=H(t.params,"ro_lon_c"),g=H(t.params,"ro_lat_c"),m=H(t.params,"ro_alpha"),e(e(g)-k)<=E&&q(-32),f=d+tn(-r(m),-n(m)*n(g)),p=Kt(r(g)*n(m))):H(t.params,"to_lat_p")?(f=H(t.params,"ro_lon_p"),p=H(t.params,"ro_lat_p")):(y=H(t.params,"ro_lon_1"),b=H(t.params,"ro_lat_1"),v=H(t.params,"ro_lon_2"),_=H(t.params,"ro_lat_2"),(e(b-_)<=E||(w=e(b))<=E||e(w-k)<=E||e(e(_)-k)<=E)&&q(-33),f=c(r(b)*n(_)*r(y)-n(b)*r(_)*r(v),n(b)*r(_)*n(v)-r(b)*n(_)*n(y)),p=u(-r(f-y)/a(b))),e(p)>E?(l=r(p),h=n(p),t.fwd=function(e,t){var i,a,o;i=r(e.lam),a=n(e.phi),o=r(e.phi),e.lam=Ie(tn(o*n(e.lam),h*o*i+l*a)+f),e.phi=Kt(h*a-l*o*i),s.fwd(e,t)},t.inv=s.inv?function(e,t){var i,a,o;s.inv(e,t),t.lam!=x&&(i=r(t.lam-=f),a=n(t.phi),o=r(t.phi),t.phi=Kt(h*a+l*o*i),t.lam=tn(o*n(t.lam),h*o*i-l*a))}:null):(t.fwd=function(e,t){var i,a;i=r(e.phi),a=r(e.lam),e.lam=Ie(tn(i*n(e.lam),n(e.phi))+f),e.phi=Kt(-i*a),s.fwd(e,t)},t.inv=s.inv?function(e,t){var i,a;s.inv(e,t),t.lam!=x&&(i=r(t.phi),a=t.lam-f,t.lam=tn(i*n(a),-n(t.phi)),t.phi=Kt(i*r(a)))}:null)},"ob_tran","General Oblique Transformation","Misc Sph\no_proj= plus parameters for projection\no_lat_p= o_lon_p= (new pole) or\no_alpha= o_lon_c= o_lat_c= or\no_lon_1= o_lat_1= o_lon_2= o_lat_2="),ee(function(e){var t,i,s,l,h,p,d,g,m,y,v;d=1/e.k0,g=e.k0,H(e.params,"talpha")?(p=H(e.params,"ralpha"),h=H(e.params,"rlonc"),v=u(-r(p)/(-n(0)*n(p)))+h,m=o(r(0)*n(p))):(t=H(e.params,"rlat_1"),i=H(e.params,"rlat_2"),s=H(e.params,"rlon_1"),l=H(e.params,"rlon_2"),v=c(r(t)*n(i)*r(s)-n(t)*r(i)*r(l),n(t)*r(i)*n(l)-r(t)*n(i)*n(s)),s==-k&&(v=-v),m=u(-r(v-s)/a(t))),e.lam0=v+k,y=r(m),m=n(m),v=n(v),e.es=0,e.fwd=function(e,t){var i;t.y=n(e.lam),i=r(e.lam),t.x=u((a(e.phi)*y+m*t.y)/i),i<0&&(t.x+=w),t.x*=g,t.y=d*(m*n(e.phi)-y*r(e.phi)*t.y)},e.inv=function(e,t){var i,a;e.y/=d,e.x/=g,i=f(1-e.y*e.y),t.phi=o(e.y*m+i*y*(a=n(e.x))),t.lam=c(i*m*a-e.y*y,i*r(e.x))}},"ocea","Oblique Cylindrical Equal Area","Cyl, Sph lonc= alpha= or\nlat_1= lat_2= lon_1= lon_2="),ee(function(t){var i,s,d,g,m,y,v,b,_,S,A,E,M,C,O,N,T,z,R,D,j,F,G,V,$,J,W,Z=1e-7,Y=0,X=0,K=0,Q=0,ee=0,te=0,ne=0,re=0;W=H(t.params,"tno_rot"),0!=(E=H(t.params,"talpha"))&&(ne=H(t.params,"ralpha")),0!=(M=H(t.params,"tgamma"))&&(Y=H(t.params,"rgamma")),E||M?(X=H(t.params,"rlonc"),(re=H(t.params,"tno_off")||H(t.params,"tno_uoff"))&&(H(t.params,"sno_uoff"),H(t.params,"sno_off"))):(K=H(t.params,"rlon_1"),ee=H(t.params,"rlat_1"),Q=H(t.params,"rlon_2"),te=H(t.params,"rlat_2"),(e(ee-te)<=Z||(i=e(ee))<=Z||e(i-k)<=Z||e(e(t.phi0)-k)<=Z||e(e(te)-k)<=Z)&&q(-33)),s=f(t.one_es),e(t.phi0)>L?(b=n(t.phi0),d=r(t.phi0),i=1-t.es*b*b,O=d*d,O=f(1+t.es*O*O/t.one_es),C=O*t.k0*s/i,(m=(g=O*s/(d*f(i)))*g-1)<=0?m=0:(m=f(m),t.phi0<0&&(m=-m)),N=m+=g,N*=l(mn(t.phi0,b,t.e),O)):(O=1/s,C=t.k0,N=g=m=1),E||M?(E?(A=o(n(ne)/g),M||(Y=ne)):ne=o(g*n(A=Y)),t.lam0=X-o(.5*(m-1/m)*a(A))/O):(y=l(mn(ee,n(ee),t.e),O),v=l(mn(te,n(te),t.e),O),m=N/y,_=(v-y)/(v+y),S=((S=N*N)-v*y)/(S+v*y),(i=K-Q)<-w?Q-=P:i>w&&(Q+=P),t.lam0=Ie(.5*(K+Q)-u(S*a(.5*O*(K-Q))/_)/O),A=u(2*n(O*Ie(K-t.lam0))/(m-1/m)),Y=ne=o(g*n(A))),D=n(A),j=r(A),F=n(Y),G=r(Y),z=1/(T=C*(R=1/O)),re?J=0:(J=e(T*u(f(g*g-1)/r(ne))),t.phi0<0&&(J=-J)),V=T*p(a(I-(m=.5*A))),$=T*p(a(I+m)),t.fwd=function(i,a){var o,s,u,f,h,d,g,m;e(e(i.phi)-k)>L?(o=.5*((h=N/l(mn(i.phi,n(i.phi),t.e),O))-(d=1/h)),s=.5*(h+d),f=n(O*i.lam),e(e(u=(o*D-f*j)/s)-1)<L&&U(),m=.5*T*p((1-u)/(1+u)),d=r(O*i.lam),g=e(d)<Z?C*i.lam:T*c(o*j+f*D,d)):(m=i.phi>0?V:$,g=T*i.phi),W?(a.x=g,a.y=m):(g-=J,a.x=m*G+g*F,a.y=g*G-m*F)},t.inv=function(i,a){var o,s,u,p,d,g,m;W?(s=i.y,o=i.x):(s=i.x*G-i.y*F,o=i.y*G+i.x*F+J),p=.5*((u=h(-z*s))-1/u),d=.5*(u+1/u),g=n(z*o),e(e(m=(g*j+p*D)/d)-1)<L?(a.lam=0,a.phi=m<0?-k:k):(a.phi=N/f((1+m)/(1-m)),(a.phi=yn(l(a.phi,1/O),t.e))==x&&B(),a.lam=-R*c(p*j-g*D,r(z*o)))}},"omerc","Oblique Mercator","Cyl, Sph&Ell no_rot\nalpha= [gamma=] [no_off] lonc= or\nlon_1= lat_1= lon_2= lat_2="),ee(function(t){var i=1e-10,a={};e(e(t.phi0)-k)<=i?a.mode=t.phi0<0?1:0:e(t.phi0)>i?(a.mode=3,a.sinph0=n(t.phi0),a.cosph0=r(t.phi0)):a.mode=2,t.fwd=function(o,s){var u,c,f;switch(c=r(o.phi),u=r(o.lam),a.mode){case 2:c*u<-1e-10&&U(),s.y=n(o.phi);break;case 3:a.sinph0*(f=n(o.phi))+a.cosph0*c*u<-1e-10&&U(),s.y=a.cosph0*f-a.sinph0*c*u;break;case 0:u=-u;case 1:e(o.phi-t.phi0)-i>k&&U(),s.y=c*u}s.x=c*n(o.lam)},t.inv=function(n,r){var u,l,h;if((h=u=d(n.x,n.y))>1&&(h-1>i&&B(),h=1),l=f(1-h*h),e(u)<=i)r.phi=t.phi0,r.lam=0;else{switch(a.mode){case 0:n.y=-n.y,r.phi=s(h);break;case 1:r.phi=-s(h);break;case 2:case 3:2==a.mode?(r.phi=n.y*h/u,n.x*=h,n.y=l*u):(r.phi=l*a.sinph0+n.y*h*a.cosph0/u,n.y=(l-a.sinph0*r.phi)*u,n.x*=h*a.cosph0),e(r.phi)>=1?r.phi=r.phi<0?-k:k:r.phi=o(r.phi)}r.lam=0!=n.y||3!=a.mode&&2!=a.mode?c(n.x,n.y):0==n.x?0:n.x<0?-k:k}},t.es=0},"ortho","Orthographic","Azi, Sph."),ee(function(t){var n=1.0148,r=.23185,i=-.14499,a=.02406,o=n,s=5*r,u=7*i,c=908571831.7;t.es=0,t.fwd=function(e,t){var o=e.phi*e.phi;t.x=e.lam,t.y=e.phi*(n+o*o*(r+o*(i+a*o)))},t.inv=function(t,f){var l,h,p,d;for(l=t.y,t.y>c?t.y=c:t.y<-c&&(t.y=-c),d=100;d&&(l-=h=(l*(n+(p=l*l)*p*(r+p*(i+a*p)))-t.y)/(o+p*p*(s+p*(u+.21654*p))),!(e(h)<1e-11));--d);f.phi=l,f.lam=t.x}},"patterson","Patterson Cylindrical","Cyl., Sph."),ee(function(t){var i,s,u=1e-10,c=1e-12;t.es?(s=Yt(t.es),i=Ht(t.phi0,n(t.phi0),r(t.phi0),s),t.fwd=function(a,o){var c,f,l;e(a.phi)<=u?(o.x=a.lam,o.y=-i):(f=n(a.phi),c=e(l=r(a.phi))>u?Wt(f,l,t.es)/f:0,o.x=c*n(a.lam*=f),o.y=Ht(a.phi,f,l,s)-i+c*(1-r(a.lam)))},t.inv=function(l,h){var p,d,g,m,y,v,b,_,x,w,S=l.x,A=l.y;if(e(A+=i)<=u)h.lam=S,h.phi=0;else{for(p=A*A+S*S,h.phi=A,w=20;w>0&&(y=(g=n(h.phi))*(m=r(h.phi)),e(m)<c&&B(),d=g*(_=f(1-t.es*g*g))/m,b=(v=Ht(h.phi,g,m,s))*v+p,_=t.one_es/(_*_*_),h.phi+=x=(v+v+d*b-2*A*(d*v+1))/(t.es*y*(b-2*A*v)/d+2*(A-v)*(d*_-1/y)-_-_),!(e(x)<=c));--w);w||B(),d=n(h.phi),h.lam=o(S*a(h.phi)*f(1-t.es*d*d))/n(h.phi)}}):(i=-t.phi0,t.fwd=function(o,s){var c,f;e(o.phi)<=u?(s.x=o.lam,s.y=i):(c=1/a(o.phi),s.x=n(f=o.lam*n(o.phi))*c,s.y=o.phi-t.phi0+c*(1-r(f)))},t.inv=function(r,i){var s,c,f,l;if(e(r.y=t.phi0+r.y)<=u)i.lam=r.x,i.phi=0;else{i.phi=r.y,s=r.x*r.x+r.y*r.y,l=10;do{f=a(i.phi),i.phi-=c=(r.y*(i.phi*f+1)-i.phi-.5*(i.phi*i.phi+s)*f)/((i.phi-r.y)/f-1)}while(e(c)>1e-10&&--l);l||B(),i.lam=o(r.x*a(i.phi))/n(i.phi)}})},"poly","Polyconic (American)","Conic, Sph&Ell"),ee(function(t){var i=1.8949,a=1.71848,o=.6141848493043784,s=1.0471975511965976;t.es=0,t.fwd=function(t,u){var c,f,l,h,p;for(c=o*n(t.phi),l=t.phi*t.phi,t.phi*=.615709+l*(.00909953+.0046292*l),p=10;p&&(f=r(t.phi),l=n(t.phi),t.phi-=h=(t.phi+l*(f-1)-c)/(1+f*(f-1)-l*l),!(e(h)<1e-10));--p);p||(t.phi=t.phi<0?-s:s),u.x=i*t.lam*(r(t.phi)-.5),u.y=a*n(t.phi)},t.inv=function(e,t){var s;t.phi=Kt(e.y/a),t.lam=e.x/(i*((s=r(t.phi))-.5)),t.phi=Kt((t.phi+n(t.phi)*(s-1))/o)}},"putp2","Putnins P2","PCyl., Sph."),ee(wn,"putp3","Putnins P3","PCyl., Sph."),ee(function(e){wn(e,!0)},"putp3p","Putnins P3'","PCyl., Sph."),ee(function(e){Sn(e,.874038744,3.883251825)},"putp4p","Putnins P4'","PCyl., Sph."),ee(function(e){Sn(e,1,4.442882938)},"weren","Werenskiold I","PCyl., Sph."),ee(An,"putp5","Putnins P5","PCyl., Sph."),ee(function(e){An(e,!0)},"putp5p","Putnins P5'","PCyl., Sph."),ee(En,"putp6","Putnins P6","PCyl., Sph."),ee(function(e){En(e,!0)},"putp6p","Putnins P6'","PCyl., Sph."),ee(function(t){var i,o,l,h;function p(t,n,r){var i,a;return t<1e-10?(i=0,a=0):(a=c(n,r),e(a)<=I?i=0:a>I&&a<=k+I?(i=1,a-=k):a>k+I||a<=-(k+I)?(i=2,a=a>=0?a-w:a+w):(i=3,a+=k)),{area:i,theta:a}}function d(e,t){var n=e+t;return n<-w?n+=P:n>+w&&(n-=P),n}i=t.phi0>=k-I/2?4:t.phi0<=-(k-I/2)?5:e(t.lam0)<=I?0:e(t.lam0)<=k+I?t.lam0>0?1:3:2,0!==t.es&&(t.a,t.a,o=t.a*f(1-t.es),l=1-(t.a-o)/t.a,h=l*l),t.fwd=function(e,o){var c,l,g,m,y,v,b,_,x,S,A,E,M,P;c=0!==t.es?u(h*a(e.phi)):e.phi,l=e.lam,4==i?(m=k-c,l>=I&&l<=k+I?(b=0,g=l-k):l>k+I||l<=-(k+I)?(b=1,g=l>0?l-w:l+w):l>-(k+I)&&l<=-I?(b=2,g=l+k):(b=3,g=l)):5==i?(m=k+c,l>=I&&l<=k+I?(b=0,g=-l+k):l<I&&l>=-I?(b=1,g=-l):l<-I&&l>=-(k+I)?(b=2,g=-l-k):(b=3,g=l>0?-l+w:-l-w)):(1==i?l=d(l,+k):2==i?l=d(l,+w):3==i&&(l=d(l,-k)),A=n(c),E=r(c),M=n(l),_=E*r(l),x=E*M,S=A,0==i?P=p(m=s(_),S,x):1==i?P=p(m=s(x),S,-_):2==i?P=p(m=s(-_),S,-x):3==i?P=p(m=s(-x),S,_):(m=0,P={area:0,theta:0}),g=P.theta,b=P.area),v=u(12/w*(g+s(n(g)*r(I))-k)),y=f((1-r(m))/(r(v)*r(v))/(1-r(u(1/r(g))))),1==b?v+=k:2==b?v+=w:3==b&&(v+=C),o.x=y*r(v),o.y=y*n(v)},t.inv=function(p,g){var m,y,v,b,_,x,S,A,E,M,I,C,P;if(y=u(f(p.x*p.x+p.y*p.y)),m=c(p.y,p.x),p.x>=0&&p.x>=e(p.y)?M=0:p.y>=0&&p.y>=e(p.x)?(M=1,m-=k):p.x<0&&-p.x>=e(p.y)?(M=2,m=m<0?m+w:m-w):(M=3,m+=k),E=w/12*a(m),_=n(E)/(r(E)-1/f(2)),x=u(_),(S=1-(v=r(m))*v*(b=a(y))*b*(1-r(u(1/r(x)))))<-1?S=-1:S>1&&(S=1),4==i)A=s(S),g.phi=k-A,g.lam=0==M?x+k:1==M?x<0?x+w:x-w:2==M?x-k:x;else if(5==i)A=s(S),g.phi=A-k,g.lam=0==M?-x+k:1==M?-x:2==M?-x-k:x<0?-x-w:-x+w;else{var O,N,T;E=(O=S)*O,N=(E+=(T=E>=1?0:f(1-E)*n(x))*T)>=1?0:f(1-E),1==M?(E=N,N=-T,T=E):2==M?(N=-N,T=-T):3==M&&(E=N,N=T,T=-E),1==i?(E=O,O=-N,N=E):2==i?(O=-O,N=-N):3==i&&(E=O,O=N,N=-E),g.phi=s(-T)-k,g.lam=c(N,O),1==i?g.lam=d(g.lam,-k):2==i?g.lam=d(g.lam,-w):3==i&&(g.lam=d(g.lam,+k))}0!==t.es&&(I=g.phi<0?1:0,C=a(g.phi),P=o/f(C*C+h),g.phi=u(f(t.a*t.a-P*P)/(l*P)),I&&(g.phi=-g.phi))}},"qsc","Quadrilateralized Spherical Cube","Azi, Sph."),ee(function(n){var r=c([[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.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,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.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]]),i=c([[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]]),a=.8487,o=1.3523;function s(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))}function u(e,t){return e[1]+t*(e[2]+e[2]+3*t*e[3])}function c(e){return e.map(function(e){return new Float32Array(e)})}n.es=0,n.fwd=function(n,u){var c,f;(c=t(11.459155902616464*(f=e(n.phi))))<0&&U(),c>=18&&(c=17),f=S*(f-.08726646259971647*c),u.x=s(r[c],f)*a*n.lam,u.y=s(i[c],f)*o,n.phi<0&&(u.y=-u.y)},n.inv=function(n,c){var f,l,h,p;if(c.lam=n.x/a,c.phi=e(n.y/o),c.phi>=1)c.phi>1.000001?B():(c.phi=n.y<0?-k:k,c.lam/=r[18][0]);else{if((p=t(18*c.phi))<0||p>=18)return B();for(;;)if(i[p][0]>c.phi)--p;else{if(!(i[p+1][0]<=c.phi))break;++p}for(h=new Float32Array(i[p]),f=5*(c.phi-h[0])/(i[p+1][0]-h[0]),h[0]-=c.phi;f-=l=s(h,f)/u(h,f),!(e(l)<1e-8););c.phi=(5*p+f)*A,n.y<0&&(c.phi=-c.phi),c.lam/=s(r[p],f)}}},"robin","Robinson","PCyl., Sph."),ee(Mn("EULER"),"euler","Euler","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD1"),"murd1","Murdoch I","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD2"),"murd2","Murdoch II","Conic, Sph\nlat_1= and lat_2="),ee(Mn("MURD3"),"murd3","Murdoch III","Conic, Sph\nlat_1= and lat_2="),ee(Mn("PCONIC"),"pconic","Perspective Conic","Conic, Sph\nlat_1= and lat_2="),ee(Mn("TISSOT"),"tissot","Tissot","Conic, Sph\nlat_1= and lat_2="),ee(Mn("VITK1"),"vitk1","Vitkovsky I","Conic, Sph\nlat_1= and lat_2="),ee(function(t){var i,o,s,c,l,d,g,m,y;s=.5*t.e,g=r(t.phi0),g*=g,o=f(1+t.es*g*g*t.rone_es),y=n(t.phi0),l=r(m=Kt(d=y/o)),y*=t.e,i=p(a(I+.5*m))-o*(p(a(I+.5*t.phi0))-s*p((1+y)/(1-y))),c=t.k0*f(t.one_es)/(1-y*y),t.inv=function(f,g){var m,y,v,b,_,x,w,S,A;for(v=2*(u(h(f.y/c))-I),b=f.x/c,_=r(v),m=Kt(l*n(v)+d*_*r(b)),y=Kt(_*n(b)/r(m)),w=(i-p(a(I+.5*m)))/o,A=6;A&&(x=t.e*n(m),m-=S=(w+p(a(I+.5*m))-s*p((1+x)/(1-x)))*(1-x*x)*r(m)*t.rone_es,!(e(S)<1e-10));--A);A?(g.phi=m,g.lam=y/o):B()},t.fwd=function(e,f){var g,m,y,v,b,_;b=t.e*n(e.phi),g=2*u(h(o*(p(a(I+.5*e.phi))-s*p((1+b)/(1-b)))+i))-k,m=o*e.lam,_=r(g),y=Kt(l*n(g)-d*_*r(m)),v=Kt(_*n(m)/r(y)),f.x=c*v,f.y=c*p(a(I+.5*y))}},"somerc","Swiss. Obl. Mercator","Cyl, Ell\nFor CH1903"),ee(function(e){var t=H(e.params,"tlat_ts")?H(e.params,"rlat_ts"):k;In(e,t)},"stere","Stereographic","Azi, Sph&Ell\nlat_ts="),ee(function(e){e.phi0=H(e.params,"bsouth")?-k:k,e.k0=.994,e.x0=2e6,e.y0=2e6,e.lam0=0,e.es||q(-34),In(e,k)},"ups","Universal Polar Stereographic","Azi, Sph&Ell\nsouth"),ee(function(t){var i,s,h,p,g,m,y,v,b,_=(i=t.e,s=t.phi0,h=i*i,p=n(s),g=r(s),m=f(1-h)/(1-h*p*p),y=f(1+h*g*g*g*g/(1-h)),v=o(p/y),b=.5*y*i,{e:i,K:a(.5*v+I)/(l(a(.5*s+I),y)*kn(i*p,b)),C:y,chi:v,ratexp:b,rc:m}),x=_.chi,w=2*_.rc,S=n(x),A=r(x);t.fwd=function(e,i){var o,s,c,f;e=function(e,t){return{phi:2*u(t.K*l(a(.5*e.phi+I),t.C)*kn(t.e*n(e.phi),t.ratexp))-k,lam:t.C*e.lam}}(e,_),s=n(e.phi),o=r(e.phi),c=r(e.lam),f=t.k0*w/(1+S*s+A*o*c),i.x=f*o*n(e.lam),i.y=f*(A*s-S*o*c)},t.inv=function(i,s){var f,h,p,g,m=i.x/t.k0,y=i.y/t.k0;(f=d(m,y))?(h=2*c(f,w),p=n(h),g=r(h),s.phi=o(g*S+y*p*A/f),s.lam=c(m*p,f*A*g-y*S*p)):(s.phi=x,s.lam=0),function(t,r){t.phi;var i,o,s=l(a(.5*t.phi+I)/r.K,1/r.C);for(t.lam/=r.C,i=20;i>0&&(o=2*u(s*kn(r.e*n(t.phi),-.5*r.e))-k,!(e(o-t.phi)<1e-14));--i)t.phi=o;i||F(-17)}(s,_)}},"sterea","Oblique Stereographic Alternative","Azimuthal, Sph&Ell"),ee(function(e){Cn(e,1.50488,1.35439,!1)},"kav5","Kavraisky V","PCyl., Sph."),ee(function(e){Cn(e,2,2,!1)},"qua_aut","Quartic Authalic","PCyl., Sph."),ee(function(e){Cn(e,2,2,!0)},"fouc","Foucaut","PCyl., Sph."),ee(function(e){Cn(e,1.48875,1.36509,!1)},"mbt_s","McBryde-Thomas Flat-Polar Sine (No. 1)","PCyl., Sph."),ee(function(e){e.es=0,e.fwd=function(t,i){i.x=r(t.phi)*n(t.lam)/e.k0,i.y=e.k0*(c(a(t.phi),r(t.lam))-e.phi0)},e.inv=function(t,i){var a;t.y=t.y/e.k0+e.phi0,t.x*=e.k0,a=f(1-t.x*t.x),i.phi=o(a*n(t.y)),i.lam=c(t.x,a*r(t.y))}},"tcea","Transverse Cylindrical Equal Area","Cyl, Sph"),ee(function(e){e.es=0,e.fwd=function(e,t){var r=a(e.phi/2),i=n(I*r);t.x=e.lam*(.74482-.34588*i*i),t.y=1.70711*r},e.inv=function(e,t){var r=e.y/1.70711,i=n(I*r);t.lam=e.x/(.74482-.34588*i*i),t.phi=2*u(r)}},"times","Times","Cyl, Sph"),ee(function(t){H(t.params,"bapprox")?Pn(t):function(t){if(0===t.es)return Pn(t);un(t);var n=t.fwd,r=t.inv;Pn(t);var i=t.fwd,a=t.inv;t.fwd=function(t,r){e(t.lam)>3*A?n(t,r):i(t,r)},t.inv=function(t,n){e(t.x)>.053-.022*t.y*t.y?r(t,n):a(t,n)}}(t)},"tmerc","Transverse Mercator","Cyl, Sph&Ell"),ee(function(e){var n;e.es||q(-34),e.y0=H(e.params,"bsouth")?1e7:0,e.x0=5e5,H(e.params,"tzone")?(n=H(e.params,"izone"))>0&&n<=60?--n:q(-35):(n=t(30*(Ie(e.lam0)+w)/w))<0?n=0:n>=60&&(n=59),e.lam0=(n+.5)*w/30-w,e.k0=.9996,e.phi0=0,un(e)},"utm","Universal Transverse Mercator (UTM)","Cyl, Sph\nzone= south"),ee(function(e){var t,i,o,s,u,f,l,h,p,g,m,y,v,b,_,x,w,S,A,E,M,I,C;E=H(e.params,"rlat_1"),S=H(e.params,"rlon_1"),M=H(e.params,"rlat_2"),A=H(e.params,"rlon_2"),E==M&&S==A&&q(-25),e.lam0=Ie(.5*(S+A)),g=Ie(A-S),t=r(E),o=r(M),i=n(E),s=n(M),f=t*s,l=i*o,u=t*o*n(g),p=Qt(i*s+t*o*r(g)),m=.5*p,I=c(o*n(g),t*s-i*o*r(g)),b=r(C=Kt(t*n(I))),_=n(C),x=Ie(c(t*r(I),i)-m),g*=.5,w=k-c(n(I)*i,r(I))-g,y=a(m),v=.5/n(m),h=.5/p,p*=p,e.fwd=function(e,a){var c,d,m,y,v,b,_;b=n(e.phi),_=r(e.phi),d=Qt(i*b+t*_*r(y=e.lam+g)),m=Qt(s*b+o*_*r(v=e.lam-g)),d*=d,m*=m,a.x=h*(c=d-m),c=p-c,a.y=h*en(4*p*m-c*c),u*b-_*(f*n(y)-l*n(v))<0&&(a.y=-a.y)},e.inv=function(e,t){var i,a,o,s,u,f;o=(i=r(d(e.y,e.x+m)))+(a=r(d(e.y,e.x-m))),s=i-a,t.lam=-c(s,o*y),t.phi=Qt(d(y*o,s)*v),e.y<0&&(t.phi=-t.phi),f=n(t.phi),u=r(t.phi),t.phi=Kt(_*f+b*u*(o=r(t.lam-=x))),t.lam=c(u*n(t.lam),_*u*o-b*f)+w},e.es=0},"tpeqd","Two Point Equidistant","Misc Sph\nlat_1= lon_1= lat_2= lon_2="),ee(function(e){var t,i,a,o,s,u;(o=H(e.params,"dn"))>0&&o<=1==0&&q(-40),a=H(e.params,"dq")/3,s=H(e.params,"ralpha"),u=o*n(s),t=r(s)/f(1-u*u),i=1/(t*o),e.fwd=function(e,s){var u=e.phi=Kt(o*n(e.phi));s.x=t*e.lam*r(e.phi),u*=u,s.y=e.phi*(1+u*a)*i},e.es=0},"urm5","Urmaev V","PCyl., Sph., no inv.\nn= q= alpha="),ee(function(e){var t=H(e.params,"dn");(t<=0||t>1)&&q(-40),On(e,t)},"urmfps","Urmaev Flat-Polar Sinusoidal","PCyl, Sph.\nn="),ee(function(e){On(e,.8660254037844386)},"wag1","Wagner I (Kavraisky VI)","PCyl, Sph."),ee(function(t){var n=1e-10,i=.3333333333333333,u=9.869604401089358,c=19.739208802178716,l=4.934802200544679;t.fwd=function(t,r){var i,s,u,c,l;(l=e(t.phi/k))-n>1&&U(),l>1&&(l=1),e(t.phi)<=n?(r.x=t.lam,r.y=0):e(t.lam)<=n||e(l-1)<n?(r.x=0,r.y=w*a(.5*o(l)),t.phi<0&&(r.y=-r.y)):(s=(i=.5*e(w/t.lam-t.lam/w))*i,u=f(1-l*l),c=(u/=l+u-1)*u,l=u*(2/l-1),l*=l,r.x=u-l,u=l+s,r.x=w*(i*r.x+f(s*r.x*r.x-u*(c-l)))/u,t.lam<0&&(r.x=-r.x),r.y=e(r.x/w),r.y=1-r.y*(r.y+2*i),r.y<-n&&U(),r.y<0?r.y=0:r.y=f(r.y)*(t.phi<0?-w:w))},t.inv=function(t,a){var o,h,p,d,g,m,y,v,b,_,x,S,A;if(S=t.x*t.x,(x=e(t.y))<n)return a.phi=0,o=S*S+c*(S+l),a.lam=e(t.x)<=n?0:.5*(S-u+f(o))/t.x,a;A=t.y*t.y,d=(p=-w*x*((v=S+A)+u))+u*(v-3*A),h=w*x,b=2*f(-i*(m=p/(g=(y=v*v)+P*(x*v+w*(A+w*(x+k))))-i*(d/=g)*d)),(o=e(_=3*(_=.07407407407407407*d*d*d+(h*h-i*d*p)/g)/(m*b)))-n<=1?(_=o>1?_>0?0:w:s(_),a.phi=w*(b*r(_*i+4.188790204786391)-i*d),t.y<0&&(a.phi=-a.phi),o=y+c*(S-A+l),a.lam=e(t.x)<=n?0:.5*(v-u+(o<=0?0:f(o)))/t.x):B()}},"vandg","van der Grinten (I)","Misc Sph"),ee(function(e){Nn(e,!1)},"vandg2","van der Grinten II","Misc Sph, no inv."),ee(function(e){Nn(e,!0)},"vandg3","van der Grinten III","Misc Sph, no inv."),ee(function(t){t.es=0,t.fwd=function(t,n){var r,i,a,o,s,u,c,l,h=1e-10;e(t.phi)<h?(n.x=t.lam,n.y=0):e(t.lam)<h||e(e(t.phi)-k)<h?(n.x=0,n.y=t.phi):(u=(o=.5*((a=e(O*t.phi))*(8-a*(2+(s=a*a)))-5)/(s*(a-1)))*o,c=O*t.lam,c=f((c+=1/c)*c-4),e(t.lam)-k<0&&(c=-c),r=a+o,r=(c*((r*=r)+u-1)+2*f(r*(s+u*(l=c*c)-1)+(1-s)*(s*((i=a+3*o)*i+4*u)+u*(12*a*o+4*u))))/(4*r+l),n.x=k*r,n.y=k*f(1+c*e(r)-r*r),t.lam<0&&(n.x=-n.x),t.phi<0&&(n.y=-n.y))}},"vandg4","van der Grinten IV","Misc Sph, no inv."),ee(function(e){var t=.92483,i=1.38725,a=.88022,o=.8855;e.fwd=function(e,s){e.phi=Kt(a*n(o*e.phi)),s.x=t*e.lam*r(e.phi),s.y=i*e.phi},e.inv=function(e,s){s.phi=e.y/i,s.lam=e.x/(t*r(s.phi)),s.phi=Kt(n(s.phi)/a)/o}},"wag2","Wagner II","PCyl., Sph."),ee(function(e){var t=.6666666666666666,n=H(e.params,"rlat_ts"),i=r(n)/r(2*n/3);e.es=0,e.fwd=function(e,n){n.x=i*e.lam*r(t*e.phi),n.y=e.phi},e.inv=function(e,n){n.phi=e.y,n.lam=e.x/(i*r(t*n.phi))}},"wag3","Wagner III","PCyl., Sph.\nlat_ts="),ee(function(e){e.es=0,e.fwd=function(e,t){var i,a,s;i=o(t.y=.9063077870366499*n(e.phi)),t.x=2.66723*(a=r(i))*n(e.lam/=3),t.y*=1.24104*(s=1/f(.5*(1+a*r(e.lam)))),t.x*=s}},"wag7","Wagner VII","Misc Sph, no inv."),ee(function(e){var t=r(H(e.params,"rlat_ts"));e.fwd=function(e,n){n.x=.5*e.lam*(t+r(e.phi)),n.y=e.phi},e.inv=function(e,n){n.phi=e.y,n.lam=2*e.x/(t+r(n.phi))},e.es=0},"wink1","Winkel I","PCyl., Sph.\nlat_ts="),ee(function(t){var i=r(H(t.params,"rlat_1"));t.fwd=function(t,a){var o,s,u,c=t.phi;for(a.y=c*O,o=w*n(c),c*=1.8,u=10;u&&(c-=s=(c+n(c)-o)/(1+r(c)),!(e(s)<1e-7));--u);u?c*=.5:c=c<0?-k:k,a.x=.5*t.lam*(r(c)+i),a.y=I*(n(c)+a.y)},t.inv=null,t.es=0},"wink2","Winkel II","PCyl., Sph., no inv.\nlat_1=");var Tn=Oe;Tn.pj_init=me,Tn.pj_fwd=ke,Tn.pj_inv=Ce,Tn.pj_transform=Se,Tn.pj_add=ee,Tn.pj_fwd_deg=function(e,t){return ke({lam:e.lam*A,phi:e.phi*A},t)},Tn.pj_inv_deg=function(e,t){var n=Ce(e,t);return{lam:n.lam*S,phi:n.phi*S}},Tn.pj_transform_point=we,Tn.internal={dmstod:W,dmstor:J,get_rtodms:function(e,t,n,r){var i=Pe(e,t,n,r);return function(e){return i(e*S)}},get_dtodms:Pe,get_proj_defn:re,pj_latlong_from_proj:function(e){return me("+proj=latlong"+ne(e))},pj_get_params:X,pj_datums:ae,pj_list:Q,pj_ellps:ue,pj_units:fe,pj_read_init_opts:ge,find_datum:se,DEG_TO_RAD:A,RAD_TO_DEG:S,wkt_parse:Ft,wkt_unpack:Ut,convert_wkt_quotes:Bt,wkt_to_proj4:function(e){var t,n,r=Ft(e);return r.PROJCS?t=je(n=r.PROJCS)(n):r.GEOGCS?t="+proj=longlat "+We(r.GEOGCS):r.GEOCCS?Ve("geocentric coordinates are not supported"):Ve("missing a supported WKT CS type"),t},wkt_from_proj4:function(e){return e.length&&(e=me(e)),Rt(te(e)?{GEOGCS:Ke(e)}:at(e))},wkt_make_projcs:at,wkt_get_geogcs_name:tt,wkt_stringify:Rt,mproj_insert_libcache:function(e,t){pe[e]=t},mproj_search_libcache:de,GeographicLib:$t},v.exports=Tn}();var x=r.exports,w=e({__proto__:null,default:t(x)},[x]);let S=class{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(e,t){let n=this.length++;for(;n>0;){const e=n-1>>1,r=this.values[e];if(t>=r)break;this.ids[n]=this.ids[e],this.values[n]=r,n=e}this.ids[n]=e,this.values[n]=t}pop(){if(0===this.length)return;const e=this.ids,t=this.values,n=e[0],r=--this.length;if(r>0){const n=e[r],i=t[r];let a=0;const o=r>>1;for(;a<o;){const n=1+(a<<1),o=n+1,s=n+(+(o<r)&+(t[o]<t[n]));if(t[s]>=i)break;e[a]=e[s],t[a]=t[s],a=s}e[a]=n,t[a]=i}return n}peek(){return this.length>0?this.ids[0]:void 0}peekValue(){return this.length>0?this.values[0]:void 0}shrink(){this.ids.length=this.values.length=this.length}};const A=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];function E(e,t){let n=0,r=t.length-1;for(;n<r;){const i=n+r>>1;t[i]>e?r=i:n=i+1}return t[n]}function M(e,t,n,r,i,a){if(Math.floor(r/a)>=Math.floor(i/a))return;const o=e[r],s=e[r+i>>1],u=e[i];let c=u;const f=Math.max(o,s);u>f?c=f:f===o?c=Math.max(s,u):f===s&&(c=Math.max(o,u));let l=r-1,h=i+1;for(;;){do{l++}while(e[l]<c);do{h--}while(e[h]>c);if(l>=h)break;I(e,t,n,l,h)}M(e,t,n,r,h,a),M(e,t,n,h+1,i,a)}function I(e,t,n,r,i){const a=e[r];e[r]=e[i],e[i]=a;const o=4*r,s=4*i,u=t[o],c=t[o+1],f=t[o+2],l=t[o+3];t[o]=t[s],t[o+1]=t[s+1],t[o+2]=t[s+2],t[o+3]=t[s+3],t[s]=u,t[s+1]=c,t[s+2]=f,t[s+3]=l;const h=n[r];n[r]=n[i],n[i]=h}function k(e,t){let n=e^t,r=65535^n,i=65535^(e|t),a=e&(65535^t),o=n|r>>1,s=n>>1^n,u=i>>1^r&a>>1^i,c=n&i>>1^a>>1^a;n=o,r=s,i=u,a=c,o=n&n>>2^r&r>>2,s=n&r>>2^r&(n^r)>>2,u^=n&i>>2^r&a>>2,c^=r&i>>2^(n^r)&a>>2,n=o,r=s,i=u,a=c,o=n&n>>4^r&r>>4,s=n&r>>4^r&(n^r)>>4,u^=n&i>>4^r&a>>4,c^=r&i>>4^(n^r)&a>>4,n=o,r=s,i=u,a=c,u^=n&i>>8^r&a>>8,c^=r&i>>8^(n^r)&a>>8,n=u^u>>1,r=c^c>>1;let f=e^t,l=r|65535^(f|n);return f=16711935&(f|f<<8),f=252645135&(f|f<<4),f=858993459&(f|f<<2),f=1431655765&(f|f<<1),l=16711935&(l|l<<8),l=252645135&(l|l<<4),l=858993459&(l|l<<2),l=1431655765&(l|l<<1),(l<<1|f)>>>0}const C=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class P{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const i=C[15&n];if(!i)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new P(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const i=C.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return O(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],u=[];for(;s.length;){const c=s.pop()||0,f=s.pop()||0,l=s.pop()||0;if(f-l<=o){for(let o=l;o<=f;o++){const s=a[2*o],c=a[2*o+1];s>=e&&s<=n&&c>=t&&c<=r&&u.push(i[o])}continue}const h=l+f>>1,p=a[2*h],d=a[2*h+1];p>=e&&p<=n&&d>=t&&d<=r&&u.push(i[h]),(0===c?e<=p:t<=d)&&(s.push(l),s.push(h-1),s.push(1-c)),(0===c?n>=p:r>=d)&&(s.push(h+1),s.push(f),s.push(1-c))}return u}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],u=n*n;for(;o.length;){const c=o.pop()||0,f=o.pop()||0,l=o.pop()||0;if(f-l<=a){for(let n=l;n<=f;n++)z(i[2*n],i[2*n+1],e,t)<=u&&s.push(r[n]);continue}const h=l+f>>1,p=i[2*h],d=i[2*h+1];z(p,d,e,t)<=u&&s.push(r[h]),(0===c?e-n<=p:t-n<=d)&&(o.push(l),o.push(h-1),o.push(1-c)),(0===c?e+n>=p:t+n>=d)&&(o.push(h+1),o.push(f),o.push(1-c))}return s}}function O(e,t,n,r,i,a){if(i-r<=n)return;const o=r+i>>1;N(e,t,o,r,i,a),O(e,t,n,r,o-1,1-a),O(e,t,n,o+1,i,1-a)}function N(e,t,n,r,i,a){for(;i>r;){if(i-r>600){const o=i-r+1,s=n-r+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);N(e,t,n,Math.max(r,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),a)}const o=t[2*n+a];let s=r,u=i;for(T(e,t,r,n),t[2*i+a]>o&&T(e,t,r,i);s<u;){for(T(e,t,s,u),s++,u--;t[2*s+a]<o;)s++;for(;t[2*u+a]>o;)u--}t[2*r+a]===o?T(e,t,r,u):(u++,T(e,t,u,i)),u<=n&&(r=u+1),n<=u&&(i=u-1)}}function T(e,t,n,r){L(e,n,r),L(t,2*n,2*r),L(t,2*n+1,2*r+1)}function L(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function z(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}var R={exports:{}};!function(e){var t,n,r,i;(i={}).Constants={},i.Math={},i.Accumulator={},(t=i.Constants).WGS84={a:6378137,f:1/298.257223563},t.version={major:2,minor:2,patch:0},t.version_string="2.2.0",(n=i.Math).digits=53,n.epsilon=Math.pow(.5,n.digits-1),n.degree=Math.PI/180,n.sq=function(e){return e*e},n.hypot=function(e,t){return Math.sqrt(e*e+t*t)},n.cbrt=Math.cbrt||function(e){var t=Math.pow(Math.abs(e),1/3);return e>0?t:e<0?-t:e},n.log1p=Math.log1p||function(e){var t=1+e,n=t-1;return 0===n?e:e*Math.log(t)/n},n.atanh=Math.atanh||function(e){var t=Math.abs(e);return t=n.log1p(2*t/(1-t))/2,e>0?t:e<0?-t:e},n.copysign=function(e,t){return Math.abs(e)*(t<0||0===t&&1/t<0?-1:1)},n.sum=function(e,t){var n=e+t,r=n-t,i=n-r;return r-=e,{s:n,t:n?0-(r+(i-=t)):n}},n.polyval=function(e,t,n,r){for(var i=e<0?0:t[n++];--e>=0;)i=i*r+t[n++];return i},n.AngRound=function(e){var t=1/16,r=Math.abs(e);return r=r<t?t-(t-r):r,n.copysign(r,e)},n.remainder=function(e,t){return(e%=t)<-t/2?e+t:e<t/2?e:e-t},n.AngNormalize=function(e){var t=n.remainder(e,360);return 180===Math.abs(t)?n.copysign(180,e):t},n.LatFix=function(e){return Math.abs(e)>90?NaN:e},n.AngDiff=function(e,t){var r,i,a=n.sum(n.remainder(-e,360),n.remainder(t,360));return r=(a=n.sum(n.remainder(a.s,360),a.t)).s,i=a.t,0!==r&&180!==Math.abs(r)||(r=n.copysign(r,0===i?t-e:-i)),{d:r,e:i}},n.sincosd=function(e){var t,r,i,a,o,s,u;switch(t=e%360,r=(t-=90*(i=Math.round(t/90)))*this.degree,a=Math.sin(r),o=Math.cos(r),45===Math.abs(t)?(o=Math.sqrt(.5),a=n.copysign(o,r)):30===Math.abs(t)&&(o=Math.sqrt(.75),a=n.copysign(.5,r)),3&i){case 0:s=a,u=o;break;case 1:s=o,u=-a;break;case 2:s=-a,u=-o;break;default:s=-o,u=a}return u+=0,0===s&&(s=n.copysign(s,e)),{s:s,c:u}},n.sincosde=function(e,t){var r,i,a,o,s,u,c;switch(r=e%360,a=Math.round(r/90),i=(r=n.AngRound(r-90*a+t))*this.degree,o=Math.sin(i),s=Math.cos(i),45===Math.abs(r)?(s=Math.sqrt(.5),o=n.copysign(s,i)):30===Math.abs(r)&&(s=Math.sqrt(.75),o=n.copysign(.5,i)),3&a){case 0:u=o,c=s;break;case 1:u=s,c=-o;break;case 2:u=-o,c=-s;break;default:u=-s,c=o}return c+=0,0===u&&(u=n.copysign(u,e+t)),{s:u,c:c}},n.atan2d=function(e,t){var r,i=0;switch(Math.abs(e)>Math.abs(t)&&([e,t]=[t,e],i=2),n.copysign(1,t)<0&&(t=-t,++i),r=Math.atan2(e,t)/this.degree,i){case 1:r=n.copysign(180,e)-r;break;case 2:r=90-r;break;case 3:r=-90+r}return r},function(e,t){e.Accumulator=function(e){this.Set(e)},e.Accumulator.prototype.Set=function(t){t||(t=0),t.constructor===e.Accumulator?(this._s=t._s,this._t=t._t):(this._s=t,this._t=0)},e.Accumulator.prototype.Add=function(e){var n=t.sum(e,this._t),r=t.sum(n.s,this._s);n=n.t,this._s=r.s,this._t=r.t,0===this._s?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(t){var n;return t?((n=new e.Accumulator(this)).Add(t),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(e){this._s=t.remainder(this._s,e),this.Add(0)}}(i.Accumulator,i.Math),i.Geodesic={},i.GeodesicLine={},i.PolygonArea={},function(e,t,n,r,i){var a,o,s,u,c,f,l,h,p,d,g,m=20+r.digits+10,y=r.epsilon,v=200*y,b=Math.sqrt(y),_=y,x=1e3*b;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=6,e.nC1p_=6,e.nC2_=6,e.nC3_=6,e.nC4_=6,a=e.nC3_*(e.nC3_-1)/2,o=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=32671,e.LONG_UNROLL=32768,e.OUT_MASK=32640|e.LONG_UNROLL,e.SinCosSeries=function(e,t,n,r){var i=r.length,a=i-(e?1:0),o=2*(n-t)*(n+t),s=1&a?r[--i]:0,u=0;for(a=Math.floor(a/2);a--;)s=o*(u=o*s-u+r[--i])-s+r[--i];return e?2*t*n*s:n*(s-u)},s=function(e,t){var n,i,a,o,s,u,c,f,l,h,p,d,g=r.sq(e),m=r.sq(t),y=(g+m-1)/6;return 0===m&&y<=0?n=0:(u=y,(s=(i=g*m/4)*(i+2*(o=y*(a=r.sq(y)))))>=0?(c=i+o,c+=c<0?-Math.sqrt(s):Math.sqrt(s),u+=(f=r.cbrt(c))+(0!==f?a/f:0)):(l=Math.atan2(Math.sqrt(-s),-(i+o)),u+=2*y*Math.cos(l/3)),h=Math.sqrt(r.sq(u)+m),d=((p=u<0?m/(h-u):u+h)-m)/(2*h),n=p/(Math.sqrt(p+r.sq(d))+d)),n},u=[1,4,64,0,256],e.A1m1f=function(e){var t=Math.floor(3);return(r.polyval(t,u,0,r.sq(e))/u[t+1]+e)/(1-e)},c=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1_;++i)a=Math.floor((e.nC1_-i)/2),n[i]=s*r.polyval(a,c,u,o)/c[u+a+1],u+=a+2,s*=t},f=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC1p_;++i)a=Math.floor((e.nC1p_-i)/2),n[i]=s*r.polyval(a,f,u,o)/f[u+a+1],u+=a+2,s*=t},l=[-11,-28,-192,0,256],e.A2m1f=function(e){var t=Math.floor(3);return(r.polyval(t,l,0,r.sq(e))/l[t+1]-e)/(1+e)},h=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(t,n){var i,a,o=r.sq(t),s=t,u=0;for(i=1;i<=e.nC2_;++i)a=Math.floor((e.nC2_-i)/2),n[i]=s*r.polyval(a,h,u,o)/h[u+a+1],u+=a+2,s*=t},e.Geodesic=function(e,t){if(this.a=e,this.f=t,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/r.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(r.sq(this.a)+r.sq(this._b)*(0===this._e2?1:(this._e2>0?r.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*b/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(6),this._C3x=new Array(a),this._C4x=new Array(o),this.A3coeff(),this.C3coeff(),this.C4coeff()},p=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var e,t,n=0,i=0;for(e=5;e>=0;--e)t=Math.min(6-e-1,e),this._A3x[i++]=r.polyval(t,p,n,this._n)/p[n+t+1],n+=t+2},d=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var t,n,i,a=0,o=0;for(t=1;t<e.nC3_;++t)for(n=e.nC3_-1;n>=t;--n)i=Math.min(e.nC3_-n-1,n),this._C3x[o++]=r.polyval(i,d,a,this._n)/d[a+i+1],a+=i+2},g=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var t,n,i,a=0,o=0;for(t=0;t<e.nC4_;++t)for(n=e.nC4_-1;n>=t;--n)i=e.nC4_-n-1,this._C4x[o++]=r.polyval(i,g,a,this._n)/g[a+i+1],a+=i+2},e.Geodesic.prototype.A3f=function(e){return r.polyval(5,this._A3x,0,e)},e.Geodesic.prototype.C3f=function(t,n){var i,a,o=1,s=0;for(i=1;i<e.nC3_;++i)a=e.nC3_-i-1,o*=t,n[i]=o*r.polyval(a,this._C3x,s,t),s+=a+1},e.Geodesic.prototype.C4f=function(t,n){var i,a,o=1,s=0;for(i=0;i<e.nC4_;++i)a=e.nC4_-i-1,n[i]=o*r.polyval(a,this._C4x,s,t),s+=a+1,o*=t},e.Geodesic.prototype.Lengths=function(t,n,r,i,a,o,s,u,c,f,l,h,p){var d,g,m,y,v={},b=0,_=0,x=0,w=0;if((l&=e.OUT_MASK)&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(x=e.A1m1f(t),e.C1f(t,h),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(w=e.A2m1f(t),e.C2f(t,p),b=x-w,w=1+w),x=1+x),l&e.DISTANCE)d=e.SinCosSeries(!0,o,s,h)-e.SinCosSeries(!0,r,i,h),v.s12b=x*(n+d),l&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(_=b*n+(x*d-w*(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))));else if(l&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(g=1;g<=e.nC2_;++g)p[g]=x*h[g]-w*p[g];_=b*n+(e.SinCosSeries(!0,o,s,p)-e.SinCosSeries(!0,r,i,p))}return l&e.REDUCEDLENGTH?(v.m0=b,v.m12b=u*(i*o)-a*(r*s)-i*s*_):v.m12b=NaN,l&e.GEODESICSCALE&&(m=i*s+r*o,y=this._ep2*(c-f)*(c+f)/(a+u),v.M12=m+(y*o-s*_)*r/a,v.M21=m-(y*r-i*_)*o/u),v},e.Geodesic.prototype.InverseStart=function(t,n,i,a,o,u,c,f,l,h,p){var d,g,m,y,b,_,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R={},D=a*n-o*t,j=o*n+a*t;return R.sig12=-1,d=a*n,d+=o*t,(g=j>=0&&D<.5&&o*c<.5)?(y=r.sq(t+a),y/=y+r.sq(n+o),R.dnm=Math.sqrt(1+this._ep2*y),m=c/(this._f1*R.dnm),b=Math.sin(m),_=Math.cos(m)):(b=f,_=l),R.salp1=o*b,R.calp1=_>=0?D+o*t*r.sq(b)/(1+_):d-o*t*r.sq(b)/(1-_),S=r.hypot(R.salp1,R.calp1),A=t*a+n*o*_,g&&S<this._etol2?(R.salp2=n*b,R.calp2=D-n*a*(_>=0?r.sq(b)/(1+_):1-_),w=r.hypot(R.salp2,R.calp2),R.salp2/=w,R.calp2/=w,R.sig12=Math.atan2(S,A)):Math.abs(this._n)>.1||A>=0||S>=6*Math.abs(this._n)*Math.PI*r.sq(n)||(z=Math.atan2(-f,-l),this.f>=0?(C=(k=r.sq(t)*this._ep2)/(2*(1+Math.sqrt(1+k))+k),E=z/(I=this.f*n*this.A3f(C)*Math.PI),M=d/(I*n)):(P=o*n-a*t,O=Math.atan2(d,P),M=c/(I=((E=(N=this.Lengths(this._n,Math.PI+O,t,-n,i,a,o,u,n,o,e.REDUCEDLENGTH,h,p)).m12b/(n*o*N.m0*Math.PI)-1)<-.01?d/E:-this.f*r.sq(n)*Math.PI)/n)),M>-v&&E>-1-x?this.f>=0?(R.salp1=Math.min(1,-E),R.calp1=-Math.sqrt(1-r.sq(R.salp1))):(R.calp1=Math.max(E>-v?0:-1,E),R.salp1=Math.sqrt(1-r.sq(R.calp1))):(T=s(E,M),L=I*(this.f>=0?-E*T/(1+T):-M*(1+T)/T),b=Math.sin(L),_=-Math.cos(L),R.salp1=o*b,R.calp1=d-o*t*r.sq(b)/(1-_))),R.salp1<=0?(R.salp1=1,R.calp1=0):(w=r.hypot(R.salp1,R.calp1),R.salp1/=w,R.calp1/=w),R},e.Geodesic.prototype.Lambda12=function(t,n,i,a,o,s,u,c,f,l,h,p,d,g){var m,y,v,b,_,x,w,S,A,E,M,I,k,C={};return 0===t&&0===c&&(c=-e.tiny_),y=u*n,v=r.hypot(c,u*t),C.ssig1=t,b=y*t,C.csig1=_=c*n,m=r.hypot(C.ssig1,C.csig1),C.ssig1/=m,C.csig1/=m,C.salp2=o!==n?y/o:u,C.calp2=o!==n||Math.abs(a)!==-t?Math.sqrt(r.sq(c*n)+(n<-t?(o-n)*(n+o):(t-a)*(t+a)))/o:Math.abs(c),C.ssig2=a,x=y*a,C.csig2=w=C.calp2*o,m=r.hypot(C.ssig2,C.csig2),C.ssig2/=m,C.csig2/=m,C.sig12=Math.atan2(Math.max(0,C.csig1*C.ssig2-C.ssig1*C.csig2),C.csig1*C.csig2+C.ssig1*C.ssig2),S=Math.max(0,_*x-b*w),A=_*w+b*x,M=Math.atan2(S*l-A*f,A*l+S*f),I=r.sq(v)*this._ep2,C.eps=I/(2*(1+Math.sqrt(1+I))+I),this.C3f(C.eps,g),E=e.SinCosSeries(!0,C.ssig2,C.csig2,g)-e.SinCosSeries(!0,C.ssig1,C.csig1,g),C.domg12=-this.f*this.A3f(C.eps)*y*(C.sig12+E),C.lam12=M+C.domg12,h&&(0===C.calp2?C.dlam12=-2*this._f1*i/t:(k=this.Lengths(C.eps,C.sig12,C.ssig1,C.csig1,i,C.ssig2,C.csig2,s,n,o,e.REDUCEDLENGTH,p,d),C.dlam12=k.m12b,C.dlam12*=this._f1/(C.calp2*o))),C},e.Geodesic.prototype.Inverse=function(t,n,i,a,o){var s,u;return o||(o=e.STANDARD),o===e.LONG_UNROLL&&(o|=e.STANDARD),o&=e.OUT_MASK,u=(s=this.InverseInt(t,n,i,a,o)).vals,o&e.AZIMUTH&&(u.azi1=r.atan2d(s.salp1,s.calp1),u.azi2=r.atan2d(s.salp2,s.calp2)),u},e.Geodesic.prototype.InverseInt=function(t,n,i,a,o){var s,u,c,f,l,h,p,d,g,v,x,w,S,A,E,M,I,k,C,P,O,N,T,L,z,R,D,j,F,U,B,G,q,V,$,J,W,Z,Y,H,X,K,Q,ee,te,ne,re,ie,ae,oe,se,ue,ce,fe,le,he,pe,de,ge,me,ye,ve,be,_e,xe,we={};if(we.lat1=t=r.LatFix(t),we.lat2=i=r.LatFix(i),t=r.AngRound(t),i=r.AngRound(i),u=(s=r.AngDiff(n,a)).e,s=s.d,o&e.LONG_UNROLL?(we.lon1=n,we.lon2=n+s+u):(we.lon1=r.AngNormalize(n),we.lon2=r.AngNormalize(a)),u*=c=r.copysign(1,s),E=(s*=c)*r.degree,M=(f=r.sincosde(s,u)).s,I=f.c,u=180-s-u,(l=Math.abs(t)<Math.abs(i)||isNaN(i)?-1:1)<0&&(c*=-1,[i,t]=[t,i]),t*=h=r.copysign(1,-t),i*=h,f=r.sincosd(t),p=this._f1*f.s,d=f.c,p/=f=r.hypot(p,d),d/=f,d=Math.max(e.tiny_,d),f=r.sincosd(i),g=this._f1*f.s,v=f.c,g/=f=r.hypot(g,v),v/=f,v=Math.max(e.tiny_,v),d<-p?v===d&&(g=r.copysign(p,g)):Math.abs(g)===-p&&(v=d),S=Math.sqrt(1+this._ep2*r.sq(p)),A=Math.sqrt(1+this._ep2*r.sq(g)),T=new Array(e.nC1_+1),L=new Array(e.nC2_+1),z=new Array(e.nC3_),(R=-90===t||0===M)&&(P=M,N=0,j=p,F=(C=I)*d,U=g,B=(O=1)*v,k=Math.atan2(Math.max(0,F*U-j*B),F*B+j*U),x=(D=this.Lengths(this._n,k,j,F,S,U,B,A,d,v,o|e.DISTANCE|e.REDUCEDLENGTH,T,L)).s12b,w=D.m12b,o&e.GEODESICSCALE&&(we.M12=D.M12,we.M21=D.M21),k<b||w>=0?((k<3*e.tiny_||k<y&&(x<0||w<0))&&(k=w=x=0),w*=this._b,x*=this._b,we.a12=k/r.degree):R=!1),pe=2,!R&&0===p&&(this.f<=0||u>=180*this.f))C=O=0,P=N=1,x=this.a*E,k=q=E/this._f1,w=this._b*Math.sin(k),o&e.GEODESICSCALE&&(we.M12=we.M21=Math.cos(k)),we.a12=s/this._f1;else if(!R)if(k=(D=this.InverseStart(p,d,S,g,v,A,E,M,I,T,L)).sig12,P=D.salp1,C=D.calp1,k>=0)N=D.salp2,O=D.calp2,V=D.dnm,x=k*this._b*V,w=r.sq(V)*this._b*Math.sin(k/V),o&e.GEODESICSCALE&&(we.M12=we.M21=Math.cos(k/V)),we.a12=k/r.degree,q=E/(this._f1*V);else{for($=0,J=e.tiny_,W=1,Z=e.tiny_,Y=-1,H=!1,X=!1;K=(D=this.Lambda12(p,d,S,g,v,A,P,C,M,I,$<20,T,L,z)).lam12,N=D.salp2,O=D.calp2,k=D.sig12,j=D.ssig1,F=D.csig1,U=D.ssig2,B=D.csig2,G=D.eps,ge=D.domg12,Q=D.dlam12,!X&&Math.abs(K)>=(H?8:1)*y&&$!=m;++$)K>0&&($<20||C/P>Y/Z)?(Z=P,Y=C):K<0&&($<20||C/P<W/J)&&(J=P,W=C),$<20&&Q>0&&(ee=-K/Q,Math.abs(ee)<Math.PI&&(te=Math.sin(ee),(re=P*(ne=Math.cos(ee))+C*te)>0))?(C=C*ne-P*te,P=re,P/=f=r.hypot(P,C),C/=f,H=Math.abs(K)<=16*y):(P=(J+Z)/2,C=(W+Y)/2,P/=f=r.hypot(P,C),C/=f,H=!1,X=Math.abs(J-P)+(W-C)<_||Math.abs(P-Z)+(C-Y)<_);ie=o|(o&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),x=(D=this.Lengths(G,k,j,F,S,U,B,A,d,v,ie,T,L)).s12b,w=D.m12b,o&e.GEODESICSCALE&&(we.M12=D.M12,we.M21=D.M21),w*=this._b,x*=this._b,we.a12=k/r.degree,o&e.AREA&&(_e=Math.sin(ge),pe=M*(xe=Math.cos(ge))-I*_e,de=I*xe+M*_e)}return o&e.DISTANCE&&(we.s12=0+x),o&e.REDUCEDLENGTH&&(we.m12=0+w),o&e.AREA&&(ae=P*d,0!==(oe=r.hypot(C,P*p))&&0!==ae?(j=p,F=C*d,U=g,B=O*v,G=(ue=r.sq(oe)*this._ep2)/(2*(1+Math.sqrt(1+ue))+ue),ce=r.sq(this.a)*oe*ae*this._e2,j/=f=r.hypot(j,F),F/=f,U/=f=r.hypot(U,B),B/=f,fe=new Array(e.nC4_),this.C4f(G,fe),le=e.SinCosSeries(!1,j,F,fe),he=e.SinCosSeries(!1,U,B,fe),we.S12=ce*(he-le)):we.S12=0,R||2!=pe||(pe=Math.sin(q),de=Math.cos(q)),!R&&de>-.7071&&g-p<1.75?(ge=1+de,me=1+d,ye=1+v,se=2*Math.atan2(pe*(p*ye+g*me),ge*(p*g+me*ye))):(be=O*C+N*P,0===(ve=N*C-O*P)&&be<0&&(ve=e.tiny_*C,be=-1),se=Math.atan2(ve,be)),we.S12+=this._c2*se,we.S12*=l*c*h,we.S12+=0),l<0&&([N,P]=[P,N],[O,C]=[C,O],o&e.GEODESICSCALE&&([we.M21,we.M12]=[we.M12,we.M21])),{vals:we,salp1:P*=l*c,calp1:C*=l*h,salp2:N*=l*c,calp2:O*=l*h}},e.Geodesic.prototype.GenDirect=function(n,r,i,a,o,s){return s?s===e.LONG_UNROLL&&(s|=e.STANDARD):s=e.STANDARD,a||(s|=e.DISTANCE_IN),new t.GeodesicLine(this,n,r,i,s).GenPosition(a,o,s)},e.Geodesic.prototype.Direct=function(e,t,n,r,i){return this.GenDirect(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirect=function(e,t,n,r,i){return this.GenDirect(e,t,n,!0,r,i)},e.Geodesic.prototype.Line=function(e,n,r,i){return new t.GeodesicLine(this,e,n,r,i)},e.Geodesic.prototype.DirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!1,r,i)},e.Geodesic.prototype.ArcDirectLine=function(e,t,n,r,i){return this.GenDirectLine(e,t,n,!0,r,i)},e.Geodesic.prototype.GenDirectLine=function(n,r,i,a,o,s){var u;return s||(s=e.STANDARD|e.DISTANCE_IN),a||(s|=e.DISTANCE_IN),(u=new t.GeodesicLine(this,n,r,i,s)).GenSetDistance(a,o),u},e.Geodesic.prototype.InverseLine=function(n,i,a,o,s){var u,c,f;return s||(s=e.STANDARD|e.DISTANCE_IN),u=this.InverseInt(n,i,a,o,e.ARC),f=r.atan2d(u.salp1,u.calp1),s&e.OUT_MASK&e.DISTANCE_IN&&(s|=e.DISTANCE),(c=new t.GeodesicLine(this,n,i,f,s,u.salp1,u.calp1)).SetArc(u.vals.a12),c},e.Geodesic.prototype.Polygon=function(e){return new n.PolygonArea(this,e)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)}(i.Geodesic,i.GeodesicLine,i.PolygonArea,i.Math,i.Constants),function(e,t,n){t.GeodesicLine=function(t,r,i,a,o,s,u){var c,f,l,h,p,d;o||(o=e.STANDARD|e.DISTANCE_IN),this.a=t.a,this.f=t.f,this._b=t._b,this._c2=t._c2,this._f1=t._f1,this.caps=o|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=n.LatFix(r),this.lon1=i,void 0===s||void 0===u?(this.azi1=n.AngNormalize(a),c=n.sincosd(n.AngRound(this.azi1)),this.salp1=c.s,this.calp1=c.c):(this.azi1=a,this.salp1=s,this.calp1=u),c=n.sincosd(n.AngRound(this.lat1)),l=this._f1*c.s,f=c.c,l/=c=n.hypot(l,f),f/=c,f=Math.max(e.tiny_,f),this._dn1=Math.sqrt(1+t._ep2*n.sq(l)),this._salp0=this.salp1*f,this._calp0=n.hypot(this.calp1,this.salp1*l),this._ssig1=l,this._somg1=this._salp0*l,this._csig1=this._comg1=0!==l||0!==this.calp1?f*this.calp1:1,c=n.hypot(this._ssig1,this._csig1),this._ssig1/=c,this._csig1/=c,this._k2=n.sq(this._calp0)*t._ep2,h=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(h),this._C1a=new Array(e.nC1_+1),e.C1f(h,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),p=Math.sin(this._B11),d=Math.cos(this._B11),this._stau1=this._ssig1*d+this._csig1*p,this._ctau1=this._csig1*d-this._ssig1*p),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(h,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(h),this._C2a=new Array(e.nC2_+1),e.C2f(h,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),t.C3f(h,this._C3a),this._A3c=-this.f*this._salp0*t.A3f(h),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),t.C4f(h,this._C4a),this._A4=n.sq(this.a)*this._calp0*this._salp0*t._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(t,r,i){var a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P,O={};return i?i===e.LONG_UNROLL&&(i|=e.STANDARD):i=e.STANDARD,i&=this.caps&e.OUT_MASK,O.lat1=this.lat1,O.azi1=this.azi1,O.lon1=i&e.LONG_UNROLL?this.lon1:n.AngNormalize(this.lon1),t?O.a12=r:O.s12=r,t||this.caps&e.DISTANCE_IN&e.OUT_MASK?(u=0,c=0,t?(a=r*n.degree,o=(I=n.sincosd(r)).s,s=I.c):(h=r/(this._b*(1+this._A1m1)),p=Math.sin(h),d=Math.cos(h),a=h-((u=-e.SinCosSeries(!0,this._stau1*d+this._ctau1*p,this._ctau1*d-this._stau1*p,this._C1pa))-this._B11),o=Math.sin(a),s=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,u=e.SinCosSeries(!0,f,l,this._C1a),a-=((1+this._A1m1)*(a+(u-this._B11))-r/this._b)/Math.sqrt(1+this._k2*n.sq(f)),o=Math.sin(a),s=Math.cos(a))),f=this._ssig1*s+this._csig1*o,l=this._csig1*s-this._ssig1*o,S=Math.sqrt(1+this._k2*n.sq(f)),i&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((t||Math.abs(this.f)>.01)&&(u=e.SinCosSeries(!0,f,l,this._C1a)),c=(1+this._A1m1)*(u-this._B11)),y=this._calp0*f,0===(v=n.hypot(this._salp0,this._calp0*l))&&(v=l=e.tiny_),x=this._salp0,w=this._calp0*l,t&&i&e.DISTANCE&&(O.s12=this._b*((1+this._A1m1)*a+c)),i&e.LONGITUDE&&(b=this._salp0*f,_=l,m=n.copysign(1,this._salp0),g=((i&e.LONG_UNROLL?m*(a-(Math.atan2(f,l)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(m*b,_)-Math.atan2(m*this._somg1,this._comg1))):Math.atan2(b*this._comg1-_*this._somg1,_*this._comg1+b*this._somg1))+this._A3c*(a+(e.SinCosSeries(!0,f,l,this._C3a)-this._B31)))/n.degree,O.lon2=i&e.LONG_UNROLL?this.lon1+g:n.AngNormalize(n.AngNormalize(this.lon1)+n.AngNormalize(g))),i&e.LATITUDE&&(O.lat2=n.atan2d(y,this._f1*v)),i&e.AZIMUTH&&(O.azi2=n.atan2d(x,w)),i&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(A=e.SinCosSeries(!0,f,l,this._C2a),E=(1+this._A2m1)*(A-this._B21),M=(this._A1m1-this._A2m1)*a+(c-E),i&e.REDUCEDLENGTH&&(O.m12=this._b*(S*(this._csig1*f)-this._dn1*(this._ssig1*l)-this._csig1*l*M)),i&e.GEODESICSCALE&&(I=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+S),O.M12=s+(I*f-l*M)*this._ssig1/this._dn1,O.M21=s-(I*this._ssig1-this._csig1*M)*f/S)),i&e.AREA&&(k=e.SinCosSeries(!1,f,l,this._C4a),0===this._calp0||0===this._salp0?(C=x*this.calp1-w*this.salp1,P=w*this.calp1+x*this.salp1):(C=this._calp0*this._salp0*(s<=0?this._csig1*(1-s)+o*this._ssig1:o*(this._csig1*o/(1+s)+this._ssig1)),P=n.sq(this._salp0)+n.sq(this._calp0)*this._csig1*l),O.S12=this._c2*Math.atan2(C,P)+this._A4*(k-this._B41)),t||(O.a12=a/n.degree),O):(O.a12=NaN,O)},t.GeodesicLine.prototype.Position=function(e,t){return this.GenPosition(!1,e,t)},t.GeodesicLine.prototype.ArcPosition=function(e,t){return this.GenPosition(!0,e,t)},t.GeodesicLine.prototype.GenSetDistance=function(e,t){e?this.SetArc(t):this.SetDistance(t)},t.GeodesicLine.prototype.SetDistance=function(t){var n;this.s13=t,n=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+n.a12},t.GeodesicLine.prototype.SetArc=function(t){var n;this.a13=t,n=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+n.s12}}(i.Geodesic,i.GeodesicLine,i.Math),function(e,t,n,r){var i,a,o,s;i=function(e,t){var r=n.AngDiff(e,t).d;return e=n.AngNormalize(e),t=n.AngNormalize(t),r>0&&(e<0&&t>=0||e>0&&0===t)?1:r<0&&e>=0&&t<0?-1:0},a=function(e,t){return(0<=(t%=720)&&t<360||t<-360?0:1)-(0<=(e%=720)&&e<360||e<-360?0:1)},o=function(e,t,n,r,i){return e.Remainder(t),1&n&&e.Add((e.Sum()<0?1:-1)*t/2),r||e.Negate(),i?e.Sum()>t/2?e.Add(-t):e.Sum()<=-t/2&&e.Add(+t):e.Sum()>=t?e.Add(-t):e.Sum()<0&&e.Add(+t),0+e.Sum()},s=function(e,t,r,i,a){return e=n.remainder(e,t),1&r&&(e+=(e<0?1:-1)*t/2),i||(e*=-1),a?e>t/2?e-=t:e<=-t/2&&(e+=t):e>=t?e-=t:e<0&&(e+=t),0+e},e.PolygonArea=function(e,n){this._geod=e,this.a=this._geod.a,this.f=this._geod.f,this._area0=4*Math.PI*e._c2,this.polyline=n||!1,this._mask=t.LATITUDE|t.LONGITUDE|t.DISTANCE|(this.polyline?t.NONE:t.AREA|t.LONG_UNROLL),this.polyline||(this._areasum=new r.Accumulator(0)),this._perimetersum=new r.Accumulator(0),this.Clear()},e.PolygonArea.prototype.Clear=function(){this.num=0,this._crossings=0,this.polyline||this._areasum.Set(0),this._perimetersum.Set(0),this._lat0=this._lon0=this.lat=this.lon=NaN},e.PolygonArea.prototype.AddPoint=function(e,t){var n;0===this.num?(this._lat0=this.lat=e,this._lon0=this.lon=t):(n=this._geod.Inverse(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(n.s12),this.polyline||(this._areasum.Add(n.S12),this._crossings+=i(this.lon,t)),this.lat=e,this.lon=t),++this.num},e.PolygonArea.prototype.AddEdge=function(e,t){var n;this.num&&(n=this._geod.Direct(this.lat,this.lon,e,t,this._mask),this._perimetersum.Add(t),this.polyline||(this._areasum.Add(n.S12),this._crossings+=a(this.lon,n.lon2)),this.lat=n.lat2,this.lon=n.lon2),++this.num},e.PolygonArea.prototype.Compute=function(e,t){var n,a,s={number:this.num};return this.num<2?(s.perimeter=0,this.polyline||(s.area=0),s):this.polyline?(s.perimeter=this._perimetersum.Sum(),s):(n=this._geod.Inverse(this.lat,this.lon,this._lat0,this._lon0,this._mask),s.perimeter=this._perimetersum.Sum(n.s12),(a=new r.Accumulator(this._areasum)).Add(n.S12),s.area=o(a,this._area0,this._crossings+i(this.lon,this._lon0),e,t),s)},e.PolygonArea.prototype.TestPoint=function(e,t,n,r){var a,o,u,c,f={number:this.num+1};if(0===this.num)return f.perimeter=0,this.polyline||(f.area=0),f;for(f.perimeter=this._perimetersum.Sum(),o=this.polyline?0:this._areasum.Sum(),u=this._crossings,c=0;c<(this.polyline?1:2);++c)a=this._geod.Inverse(0===c?this.lat:e,0===c?this.lon:t,0!==c?this._lat0:e,0!==c?this._lon0:t,this._mask),f.perimeter+=a.s12,this.polyline||(o+=a.S12,u+=i(0===c?this.lon:t,0!==c?this._lon0:t));return this.polyline||(f.area=s(o,this._area0,u,n,r)),f},e.PolygonArea.prototype.TestEdge=function(e,t,n,r){var o,u,c,f={number:this.num?this.num+1:0};return 0===this.num||(f.perimeter=this._perimetersum.Sum()+t,this.polyline||(u=this._areasum.Sum(),c=this._crossings,u+=(o=this._geod.Direct(this.lat,this.lon,e,t,this._mask)).S12,c+=a(this.lon,o.lon2),c+=i(o.lon2,this._lon0),o=this._geod.Inverse(o.lat2,o.lon2,this._lat0,this._lon0,this._mask),f.perimeter+=o.s12,u+=o.S12,f.area=s(u,this._area0,c,n,r))),f}}(i.PolygonArea,i.Geodesic,i.Math,i.Accumulator),r=i,e.exports?e.exports=r:window.geodesic=r}(R);var D=R.exports,j=e({__proto__:null,default:t(D)},[D]);const F=globalThis;"undefined"==typeof window&&(F.window=F.window||{},F.window.document||(F.window.document={}));const U=F.window.modules=F.window.modules||{};U.mproj=w,U.flatbush=class e{static from(t,n=0){if(n%8!=0)throw new Error("byteOffset must be 8-byte aligned.");if(!t||void 0===t.byteLength||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[r,i]=new Uint8Array(t,n+0,2);if(251!==r)throw new Error("Data does not appear to be in a Flatbush format.");const a=i>>4;if(3!==a)throw new Error(`Got v${a} data when expected v3.`);const o=A[15&i];if(!o)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,n+2,1),[u]=new Uint32Array(t,n+4,1);return new e(u,s,o,void 0,t,n)}constructor(e,t=16,n=Float64Array,r=ArrayBuffer,i,a=0){if(void 0===e)throw new Error("Missing required argument: numItems.");if(isNaN(e)||e<=0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.byteOffset=a;let o=e,s=o;this._levelBounds=[4*o];do{o=Math.ceil(o/this.nodeSize),s+=o,this._levelBounds.push(4*s)}while(1!==o);this.ArrayType=n,this.IndexArrayType=s<16384?Uint16Array:Uint32Array;const u=A.indexOf(n),c=4*s*n.BYTES_PER_ELEMENT;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this._boxes=new n(i,a+8,4*s),this._indices=new this.IndexArrayType(i,a+8+c,s),this._pos=4*s,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1];else{const i=this.data=new r(8+c+s*this.IndexArrayType.BYTES_PER_ELEMENT);this._boxes=new n(i,8,4*s),this._indices=new this.IndexArrayType(i,8+c,s),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(i,0,2).set([251,48+u]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}this._queue=new S}add(e,t,n=e,r=t){const i=this._pos>>2,a=this._boxes;return this._indices[i]=i,a[this._pos++]=e,a[this._pos++]=t,a[this._pos++]=n,a[this._pos++]=r,e<this.minX&&(this.minX=e),t<this.minY&&(this.minY=t),n>this.maxX&&(this.maxX=n),r>this.maxY&&(this.maxY=r),i}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);const e=this._boxes;if(this.numItems<=this.nodeSize)return e[this._pos++]=this.minX,e[this._pos++]=this.minY,e[this._pos++]=this.maxX,void(e[this._pos++]=this.maxY);const t=this.maxX-this.minX||1,n=this.maxY-this.minY||1,r=new Uint32Array(this.numItems);for(let i=0,a=0;i<this.numItems;i++){const o=e[a++],s=e[a++],u=e[a++],c=e[a++],f=Math.floor(65535*((o+u)/2-this.minX)/t),l=Math.floor(65535*((s+c)/2-this.minY)/n);r[i]=k(f,l)}M(r,e,this._indices,0,this.numItems-1,this.nodeSize);for(let t=0,n=0;t<this._levelBounds.length-1;t++){const r=this._levelBounds[t];for(;n<r;){const t=n;let i=e[n++],a=e[n++],o=e[n++],s=e[n++];for(let t=1;t<this.nodeSize&&n<r;t++)i=Math.min(i,e[n++]),a=Math.min(a,e[n++]),o=Math.max(o,e[n++]),s=Math.max(s,e[n++]);this._indices[this._pos>>2]=t,e[this._pos++]=i,e[this._pos++]=a,e[this._pos++]=o,e[this._pos++]=s}}}search(e,t,n,r,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=[],s=[];for(;void 0!==a;){const u=Math.min(a+4*this.nodeSize,E(a,this._levelBounds));for(let c=a;c<u;c+=4){const u=this._boxes[c];if(n<u)continue;const f=this._boxes[c+1];if(r<f)continue;const l=this._boxes[c+2];if(e>l)continue;const h=this._boxes[c+3];if(t>h)continue;const p=0|this._indices[c>>2];a>=4*this.numItems?o.push(p):(void 0===i||i(p,u,f,l,h))&&s.push(p)}a=o.pop()}return s}neighbors(e,t,n=1/0,r=1/0,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=this._queue,s=[],u=r*r;e:for(;void 0!==a;){const r=Math.min(a+4*this.nodeSize,E(a,this._levelBounds));for(let n=a;n<r;n+=4){const r=0|this._indices[n>>2],s=this._boxes[n],c=this._boxes[n+1],f=this._boxes[n+2],l=this._boxes[n+3],h=e<s?s-e:e>f?e-f:0,p=t<c?c-t:t>l?t-l:0,d=h*h+p*p;d>u||(a>=4*this.numItems?o.push(r<<1,d):(void 0===i||i(r))&&o.push(1+(r<<1),d))}for(;o.length&&1&o.peek();){if(o.peekValue()>u)break e;if(s.push(o.pop()>>1),s.length===n)break e}a=o.length?o.pop()>>1:void 0}return o.clear(),s}},U.kdbush=P,U["geographiclib-geodesic"]=j;var B="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},G=[],q=[],V="undefined"!=typeof Uint8Array?Uint8Array:Array,$=!1;function J(){$=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)G[t]=e[t],q[e.charCodeAt(t)]=t;q["-".charCodeAt(0)]=62,q["_".charCodeAt(0)]=63}function W(e){return G[e>>18&63]+G[e>>12&63]+G[e>>6&63]+G[63&e]}function Z(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(W(r));return i.join("")}function Y(e){var t;$||J();for(var n=e.length,r=n%3,i="",a=[],o=16383,s=0,u=n-r;s<u;s+=o)a.push(Z(e,s,s+o>u?u:s+o));return 1===r?(t=e[n-1],i+=G[t>>2],i+=G[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=G[t>>10],i+=G[t>>4&63],i+=G[t<<2&63],i+="="),a.push(i),a.join("")}function H(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,c=u>>1,f=-7,l=n?i-1:0,h=n?-1:1,p=e[t+l];for(l+=h,a=p&(1<<-f)-1,p>>=-f,f+=s;f>0;a=256*a+e[t+l],l+=h,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=r;f>0;o=256*o+e[t+l],l+=h,f-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=c}return(p?-1:1)*o*Math.pow(2,a-r)}function X(e,t,n,r,i,a){var o,s,u,c=8*a-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=f?(s=0,o=f):o+l>=1?(s=(t*u-1)*Math.pow(2,i),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[n+p]=255&o,p+=d,o/=256,c-=8);e[n+p-d]|=128*g}var K={}.toString,Q=Array.isArray||function(e){return"[object Array]"==K.call(e)};function ee(){return ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function te(e,t){if(ee()<t)throw new RangeError("Invalid typed array length");return ne.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=ne.prototype:(null===e&&(e=new ne(t)),e.length=t),e}function ne(e,t,n){if(!(ne.TYPED_ARRAY_SUPPORT||this instanceof ne))return new ne(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ae(this,e)}return re(this,e,t,n)}function re(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);ne.TYPED_ARRAY_SUPPORT?(e=t).__proto__=ne.prototype:e=oe(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!ne.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|ce(t,n);e=te(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(ue(t)){var n=0|se(t.length);return 0===(e=te(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?te(e,0):oe(e,t);if("Buffer"===t.type&&Q(t.data))return oe(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function ie(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ae(e,t){if(ie(t),e=te(e,t<0?0:0|se(t)),!ne.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function oe(e,t){var n=t.length<0?0:0|se(t.length);e=te(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function se(e){if(e>=ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ee().toString(16)+" bytes");return 0|e}function ue(e){return!(null==e||!e._isBuffer)}function ce(e,t){if(ue(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Re(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return De(e).length;default:if(r)return Re(e).length;t=(""+t).toLowerCase(),r=!0}}function fe(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ee(this,t,n);case"utf8":case"utf-8":return xe(this,t,n);case"ascii":return Se(this,t,n);case"latin1":case"binary":return Ae(this,t,n);case"base64":return _e(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Me(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function le(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function he(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=ne.from(t,r)),ue(t))return 0===t.length?-1:pe(e,t,n,r,i);if("number"==typeof t)return t&=255,ne.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):pe(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function pe(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(a=n;a<s;a++)if(c(e,a)===c(t,-1===f?0:a-f)){if(-1===f&&(f=a),a-f+1===u)return f*o}else-1!==f&&(a-=a-f),f=-1}else for(n+u>s&&(n=s-u),a=n;a>=0;a--){for(var l=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){l=!1;break}if(l)return a}return-1}function de(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function ge(e,t,n,r){return je(Re(t,e.length-n),e,n,r)}function me(e,t,n,r){return je(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function ye(e,t,n,r){return me(e,t,n,r)}function ve(e,t,n,r){return je(De(t),e,n,r)}function be(e,t,n,r){return je(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function _e(e,t,n){return 0===t&&n===e.length?Y(e):Y(e.slice(t,n))}function xe(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(f=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=l}return function(e){var t=e.length;if(t<=we)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=we));return n}(r)}ne.TYPED_ARRAY_SUPPORT=void 0===B.TYPED_ARRAY_SUPPORT||B.TYPED_ARRAY_SUPPORT,ee(),ne.poolSize=8192,ne._augment=function(e){return e.__proto__=ne.prototype,e},ne.from=function(e,t,n){return re(null,e,t,n)},ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&ne[Symbol.species]),ne.alloc=function(e,t,n){return function(e,t,n,r){return ie(t),t<=0?te(e,t):void 0!==n?"string"==typeof r?te(e,t).fill(n,r):te(e,t).fill(n):te(e,t)}(null,e,t,n)},ne.allocUnsafe=function(e){return ae(null,e)},ne.allocUnsafeSlow=function(e){return ae(null,e)},ne.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Fe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Fe(e.slice(0,0))}(e))},ne.compare=function(e,t){if(!ue(e)||!ue(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},ne.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ne.concat=function(e,t){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return ne.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=ne.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!ue(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},ne.byteLength=ce,ne.prototype._isBuffer=!0,ne.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)le(this,t,t+1);return this},ne.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)le(this,t,t+3),le(this,t+1,t+2);return this},ne.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)le(this,t,t+7),le(this,t+1,t+6),le(this,t+2,t+5),le(this,t+3,t+4);return this},ne.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?xe(this,0,e):fe.apply(this,arguments)},ne.prototype.equals=function(e){if(!ue(e))throw new TypeError("Argument must be a Buffer");return this===e||0===ne.compare(this,e)},ne.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},ne.prototype.compare=function(e,t,n,r,i){if(!ue(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(r,i),c=e.slice(t,n),f=0;f<s;++f)if(u[f]!==c[f]){a=u[f],o=c[f];break}return a<o?-1:o<a?1:0},ne.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},ne.prototype.indexOf=function(e,t,n){return he(this,e,t,n,!0)},ne.prototype.lastIndexOf=function(e,t,n){return he(this,e,t,n,!1)},ne.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return de(this,e,t,n);case"utf8":case"utf-8":return ge(this,e,t,n);case"ascii":return me(this,e,t,n);case"latin1":case"binary":return ye(this,e,t,n);case"base64":return ve(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var we=4096;function Se(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function Ae(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Ee(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=ze(e[a]);return i}function Me(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function Ie(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function ke(e,t,n,r,i,a){if(!ue(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Ce(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Pe(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Oe(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ne(e,t,n,r,i){return i||Oe(e,0,n,4),X(e,t,n,r,23,4),n+4}function Te(e,t,n,r,i){return i||Oe(e,0,n,8),X(e,t,n,r,52,8),n+8}ne.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),ne.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=ne.prototype;else{var i=t-e;n=new ne(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},ne.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},ne.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},ne.prototype.readUInt8=function(e,t){return t||Ie(e,1,this.length),this[e]},ne.prototype.readUInt16LE=function(e,t){return t||Ie(e,2,this.length),this[e]|this[e+1]<<8},ne.prototype.readUInt16BE=function(e,t){return t||Ie(e,2,this.length),this[e]<<8|this[e+1]},ne.prototype.readUInt32LE=function(e,t){return t||Ie(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},ne.prototype.readUInt32BE=function(e,t){return t||Ie(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},ne.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},ne.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Ie(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},ne.prototype.readInt8=function(e,t){return t||Ie(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},ne.prototype.readInt16LE=function(e,t){t||Ie(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},ne.prototype.readInt16BE=function(e,t){t||Ie(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},ne.prototype.readInt32LE=function(e,t){return t||Ie(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},ne.prototype.readInt32BE=function(e,t){return t||Ie(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},ne.prototype.readFloatLE=function(e,t){return t||Ie(e,4,this.length),H(this,e,!0,23,4)},ne.prototype.readFloatBE=function(e,t){return t||Ie(e,4,this.length),H(this,e,!1,23,4)},ne.prototype.readDoubleLE=function(e,t){return t||Ie(e,8,this.length),H(this,e,!0,52,8)},ne.prototype.readDoubleBE=function(e,t){return t||Ie(e,8,this.length),H(this,e,!1,52,8)},ne.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||ke(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},ne.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||ke(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},ne.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,1,255,0),ne.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},ne.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,65535,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ce(this,e,t,!0),t+2},ne.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,65535,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ce(this,e,t,!1),t+2},ne.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,4294967295,0),ne.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Pe(this,e,t,!0),t+4},ne.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,4294967295,0),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Pe(this,e,t,!1),t+4},ne.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ke(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},ne.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ke(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},ne.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,1,127,-128),ne.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},ne.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,32767,-32768),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ce(this,e,t,!0),t+2},ne.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,2,32767,-32768),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ce(this,e,t,!1),t+2},ne.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,2147483647,-2147483648),ne.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Pe(this,e,t,!0),t+4},ne.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ke(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),ne.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Pe(this,e,t,!1),t+4},ne.prototype.writeFloatLE=function(e,t,n){return Ne(this,e,t,!0,n)},ne.prototype.writeFloatBE=function(e,t,n){return Ne(this,e,t,!1,n)},ne.prototype.writeDoubleLE=function(e,t,n){return Te(this,e,t,!0,n)},ne.prototype.writeDoubleBE=function(e,t,n){return Te(this,e,t,!1,n)},ne.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!ne.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},ne.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!ne.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=ue(e)?e:Re(new ne(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Le=/[^+\/0-9A-Za-z-_]/g;function ze(e){return e<16?"0"+e.toString(16):e.toString(16)}function Re(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function De(e){return function(e){var t,n,r,i,a,o;$||J();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new V(3*s/4-a),r=a>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=q[e.charCodeAt(t)]<<18|q[e.charCodeAt(t+1)]<<12|q[e.charCodeAt(t+2)]<<6|q[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=q[e.charCodeAt(t)]<<2|q[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=q[e.charCodeAt(t)]<<10|q[e.charCodeAt(t+1)]<<4|q[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Le,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function je(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Fe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Ue(){throw new Error("setTimeout has not been defined")}function Be(){throw new Error("clearTimeout has not been defined")}var Ge=Ue,qe=Be;function Ve(e){if(Ge===setTimeout)return setTimeout(e,0);if((Ge===Ue||!Ge)&&setTimeout)return Ge=setTimeout,setTimeout(e,0);try{return Ge(e,0)}catch(t){try{return Ge.call(null,e,0)}catch(t){return Ge.call(this,e,0)}}}"function"==typeof B.setTimeout&&(Ge=setTimeout),"function"==typeof B.clearTimeout&&(qe=clearTimeout);var $e,Je=[],We=!1,Ze=-1;function Ye(){We&&$e&&(We=!1,$e.length?Je=$e.concat(Je):Ze=-1,Je.length&&He())}function He(){if(!We){var e=Ve(Ye);We=!0;for(var t=Je.length;t;){for($e=Je,Je=[];++Ze<t;)$e&&$e[Ze].run();Ze=-1,t=Je.length}$e=null,We=!1,function(e){if(qe===clearTimeout)return clearTimeout(e);if((qe===Be||!qe)&&clearTimeout)return qe=clearTimeout,clearTimeout(e);try{return qe(e)}catch(t){try{return qe.call(null,e)}catch(t){return qe.call(this,e)}}}(e)}}function Xe(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Je.push(new Ke(e,t)),1!==Je.length||We||Ve(He)}function Ke(e,t){this.fun=e,this.array=t}Ke.prototype.run=function(){this.fun.apply(null,this.array)};function Qe(){}var et=Qe,tt=Qe,nt=Qe,rt=Qe,it=Qe,at=Qe,ot=Qe;var st=B.performance||{},ut=st.now||st.mozNow||st.msNow||st.oNow||st.webkitNow||function(){return(new Date).getTime()};var ct=new Date;var ft,lt,ht={nextTick:Xe,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:et,addListener:tt,once:nt,off:rt,removeListener:it,removeAllListeners:at,emit:ot,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ut.call(st),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ct)/1e3}},pt={exports:{}};function dt(){}function gt(){gt.init.call(this)}function mt(e){return void 0===e._maxListeners?gt.defaultMaxListeners:e._maxListeners}function yt(e,t,n,r){var i,a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new dt,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=mt(e))&&i>0&&o.length>i){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else o=a[t]=n,++e._eventsCount;return e}function vt(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function bt(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function _t(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}dt.prototype=Object.create(null),gt.EventEmitter=gt,gt.usingDomains=!1,gt.prototype.domain=void 0,gt.prototype._events=void 0,gt.prototype._maxListeners=void 0,gt.defaultMaxListeners=10,gt.init=function(){this.domain=null,gt.usingDomains&&(!ft.active||this instanceof ft.Domain||(this.domain=ft.active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new dt,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},gt.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},gt.prototype.getMaxListeners=function(){return mt(this)},gt.prototype.emit=function(e){var t,n,r,i,a,o,s,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=o[e]))return!1;var f="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=_t(e,r),a=0;a<r;++a)i[a].call(n)}(n,f,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=_t(e,i),o=0;o<i;++o)a[o].call(n,r)}(n,f,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=_t(e,a),s=0;s<a;++s)o[s].call(n,r,i)}(n,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=_t(e,o),u=0;u<o;++u)s[u].call(n,r,i,a)}(n,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=_t(e,i),o=0;o<i;++o)a[o].apply(n,r)}(n,f,this,i)}return!0},gt.prototype.addListener=function(e,t){return yt(this,e,t,!1)},gt.prototype.on=gt.prototype.addListener,gt.prototype.prependListener=function(e,t){return yt(this,e,t,!0)},gt.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,vt(this,e,t)),this},gt.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,vt(this,e,t)),this},gt.prototype.removeListener=function(e,t){var n,r,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0===--this._eventsCount?this._events=new dt:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0===--this._eventsCount)return this._events=new dt,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},gt.prototype.off=function(e,t){return this.removeListener(e,t)},gt.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new dt,this._eventsCount=0):n[e]&&(0===--this._eventsCount?this._events=new dt:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),a=0;a<i.length;++a)"removeListener"!==(r=i[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new dt,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},gt.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},gt.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):bt.call(e,t)},gt.prototype.listenerCount=bt,gt.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},lt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var xt=/%[sdj%]/g;function wt(e){if(!Lt(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Mt(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,a=String(e).replace(xt,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),o=r[n];n<i;o=r[++n])Tt(o)||!Dt(o)?a+=" "+o:a+=" "+Mt(o);return a}function St(e,t){if(zt(B.process))return function(){return St(e,t).apply(this,arguments)};if(!0===ht.noDeprecation)return e;var n=!1;return function(){if(!n){if(ht.throwDeprecation)throw new Error(t);ht.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var At,Et={};function Mt(e,t){var n={seen:[],stylize:kt};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Nt(t)?n.showHidden=t:t&&function(e,t){if(!t||!Dt(t))return e;var n=Object.keys(t),r=n.length;for(;r--;)e[n[r]]=t[n[r]]}(n,t),zt(n.showHidden)&&(n.showHidden=!1),zt(n.depth)&&(n.depth=2),zt(n.colors)&&(n.colors=!1),zt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=It),Ct(n,e,n.depth)}function It(e,t){var n=Mt.styles[t];return n?"["+Mt.colors[n][0]+"m"+e+"["+Mt.colors[n][1]+"m":e}function kt(e,t){return e}function Ct(e,t,n){if(e.customInspect&&t&&Ut(t.inspect)&&t.inspect!==Mt&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Lt(r)||(r=Ct(e,r,n)),r}var i=function(e,t){if(zt(t))return e.stylize("undefined","undefined");if(Lt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(Nt(t))return e.stylize(""+t,"boolean");if(Tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var a=Object.keys(t),o=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),Ft(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Pt(t);if(0===a.length){if(Ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Rt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(jt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ft(t))return Pt(t)}var u,c,f="",l=!1,h=["{","}"];(u=t,Array.isArray(u)&&(l=!0,h=["[","]"]),Ut(t))&&(f=" [Function"+(t.name?": "+t.name:"")+"]");return Rt(t)&&(f=" "+RegExp.prototype.toString.call(t)),jt(t)&&(f=" "+Date.prototype.toUTCString.call(t)),Ft(t)&&(f=" "+Pt(t)),0!==a.length||l&&0!=t.length?n<0?Rt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=l?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)Gt(t,String(o))?a.push(Ot(e,t,n,r,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(Ot(e,t,n,r,i,!0))}),a}(e,t,n,o,a):a.map(function(r){return Ot(e,t,n,o,r,l)}),e.seen.pop(),function(e,t,n){var r=e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(r>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,f,h)):h[0]+f+h[1]}function Pt(e){return"["+Error.prototype.toString.call(e)+"]"}function Ot(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Gt(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=Tt(n)?Ct(e,u.value,null):Ct(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),zt(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function Nt(e){return"boolean"==typeof e}function Tt(e){return null===e}function Lt(e){return"string"==typeof e}function zt(e){return void 0===e}function Rt(e){return Dt(e)&&"[object RegExp]"===Bt(e)}function Dt(e){return"object"==typeof e&&null!==e}function jt(e){return Dt(e)&&"[object Date]"===Bt(e)}function Ft(e){return Dt(e)&&("[object Error]"===Bt(e)||e instanceof Error)}function Ut(e){return"function"==typeof e}function Bt(e){return Object.prototype.toString.call(e)}function Gt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qt(){this.head=null,this.tail=null,this.length=0}Mt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Mt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},qt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},qt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},qt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},qt.prototype.clear=function(){this.head=this.tail=null,this.length=0},qt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},qt.prototype.concat=function(e){if(0===this.length)return ne.alloc(0);if(1===this.length)return this.head.data;for(var t=ne.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Vt=ne.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $t(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Vt(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Wt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Zt;break;default:return void(this.write=Jt)}this.charBuffer=new ne(6),this.charReceived=0,this.charLength=0}function Jt(e){return e.toString(this.encoding)}function Wt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Zt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}$t.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},$t.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},$t.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},Xt.ReadableState=Ht;var Yt=function(e){if(zt(At)&&(At=ht.env.NODE_DEBUG||""),e=e.toUpperCase(),!Et[e])if(new RegExp("\\b"+e+"\\b","i").test(At)){Et[e]=function(){var t=wt.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Et[e]=function(){};return Et[e]}("stream");function Ht(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Mn&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new qt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new $t(e.encoding),this.encoding=e.encoding)}function Xt(e){if(!(this instanceof Xt))return new Xt(e);this._readableState=new Ht(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),gt.call(this)}function Kt(e,t,n,r,i){var a=function(e,t){var n=null;ne.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(a)e.emit("error",a);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,tn(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&tn(e))),function(e,t){t.readingMore||(t.readingMore=!0,Xe(rn,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}lt(Xt,gt),Xt.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=ne.from(e,t),t=""),Kt(this,n,e,t,!1)},Xt.prototype.unshift=function(e){return Kt(this,this._readableState,e,"",!0)},Xt.prototype.isPaused=function(){return!1===this._readableState.flowing},Xt.prototype.setEncoding=function(e){return this._readableState.decoder=new $t(e),this._readableState.encoding=e,this};var Qt=8388608;function en(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=Qt?e=Qt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function tn(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Yt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Xe(nn,e):nn(e))}function nn(e){Yt("emit readable"),e.emit("readable"),sn(e)}function rn(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Yt("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function an(e){Yt("readable nexttick read 0"),e.read(0)}function on(e,t){t.reading||(Yt("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),sn(e),t.flowing&&!t.reading&&e.read(0)}function sn(e){var t=e._readableState;for(Yt("flow",t.flowing);t.flowing&&null!==e.read(););}function un(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;e-=i.length;for(;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=ne.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function cn(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Xe(fn,t,e))}function fn(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function ln(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function hn(){}function pn(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function dn(e,t){Object.defineProperty(this,"buffer",{get:St(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Mn&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?Xe(i,r):i(r);e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var a=bn(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||vn(e,n),r?Xe(yn,e,n,a,i):yn(e,n,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new wn(this)}function gn(e){if(!(this instanceof gn||this instanceof Mn))return new gn(e);this._writableState=new dn(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),gt.call(this)}function mn(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function yn(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),xn(e,t)}function vn(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var o=0;n;)i[o]=n,n=n.next,o+=1;mn(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new wn(t)}else{for(;n;){var s=n.chunk,u=n.encoding,c=n.callback;if(mn(e,t,!1,t.objectMode?1:s.length,s,u,c),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function bn(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _n(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function xn(e,t){var n=bn(t);return n&&(0===t.pendingcb?(_n(e,t),t.finished=!0,e.emit("finish")):_n(e,t)),n}function wn(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}Xt.prototype.read=function(e){Yt("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Yt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?cn(this):tn(this),null;if(0===(e=en(e,t))&&t.ended)return 0===t.length&&cn(this),null;var r,i=t.needReadable;return Yt("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&Yt("length less than watermark",i=!0),t.ended||t.reading?Yt("reading or ended",i=!1):i&&(Yt("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=en(n,t))),null===(r=e>0?un(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&cn(this)),null!==r&&this.emit("data",r),r},Xt.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Xt.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Yt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?o:c;function a(e){Yt("onunpipe"),e===n&&c()}function o(){Yt("onend"),e.end()}r.endEmitted?Xe(i):n.once("end",i),e.on("unpipe",a);var s=function(e){return function(){var t=e._readableState;Yt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,sn(e))}}(n);e.on("drain",s);var u=!1;function c(){Yt("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",o),n.removeListener("end",c),n.removeListener("data",l),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function l(t){Yt("ondata"),f=!1,!1!==e.write(t)||f||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==ln(r.pipes,e))&&!u&&(Yt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,f=!0),n.pause())}function h(t){Yt("onerror",t),g(),e.removeListener("error",h),0===function(e,t){return e.listeners(t).length}(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){Yt("onfinish"),e.removeListener("close",p),g()}function g(){Yt("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",n),r.flowing||(Yt("pipe resume"),n.resume()),e},Xt.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var a=ln(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},Xt.prototype.on=function(e,t){var n=gt.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&tn(this):Xe(an,this))}return n},Xt.prototype.addListener=Xt.prototype.on,Xt.prototype.resume=function(){var e=this._readableState;return e.flowing||(Yt("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Xe(on,e,t))}(this,e)),this},Xt.prototype.pause=function(){return Yt("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Yt("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Xt.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",function(){if(Yt("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){(Yt("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i)||(t.objectMode||i&&i.length)&&(r.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}(["error","close","destroy","pause","resume"],function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){Yt("wrapped _read",t),n&&(n=!1,e.resume())},r},Xt._fromList=un,gn.WritableState=dn,lt(gn,gt),dn.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},gn.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},gn.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),ne.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=hn),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),Xe(t,n)}(this,n):function(e,t,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):ne.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Xe(r,a),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=ne.from(t,n));return t}(t,n,r),ne.isBuffer(n)&&(r="buffer");var a=t.objectMode?1:n.length;t.length+=a;var o=t.length<t.highWaterMark;o||(t.needDrain=!0);if(t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new pn(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else mn(e,t,!1,a,n,r,i);return o}(this,r,e,t,n)),i},gn.prototype.cork=function(){this._writableState.corked++},gn.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||vn(this,e))},gn.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},gn.prototype._write=function(e,t,n){n(new Error("not implemented"))},gn.prototype._writev=null,gn.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,xn(e,t),n&&(t.finished?Xe(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},lt(Mn,Xt);for(var Sn=Object.keys(gn.prototype),An=0;An<Sn.length;An++){var En=Sn[An];Mn.prototype[En]||(Mn.prototype[En]=gn.prototype[En])}function Mn(e){if(!(this instanceof Mn))return new Mn(e);Xt.call(this,e),gn.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",In)}function In(){this.allowHalfOpen||this._writableState.ended||Xe(kn,this)}function kn(e){e.end()}function Cn(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n);i(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Pn(e){if(!(this instanceof Pn))return new Pn(e);Mn.call(this,e),this._transformState=new Cn(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e){On(t,e)}):On(t)})}function On(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Nn(e){if(!(this instanceof Nn))return new Nn(e);Pn.call(this,e)}function Tn(){gt.call(this)}lt(Pn,Mn),Pn.prototype.push=function(e,t){return this._transformState.needTransform=!1,Mn.prototype.push.call(this,e,t)},Pn.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Pn.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Pn.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},lt(Nn,Pn),Nn.prototype._transform=function(e,t,n){n(null,e)},lt(Tn,gt),Tn.Readable=Xt,Tn.Writable=gn,Tn.Duplex=Mn,Tn.Transform=Pn,Tn.PassThrough=Nn,Tn.Stream=Tn,Tn.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",o),n.on("close",s));var a=!1;function o(){a||(a=!0,e.end())}function s(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===gt.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",o),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",u),e.on("error",u),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e};var Ln={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function zn(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Rn(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]}var Dn=Uint8Array,jn=Uint16Array,Fn=Int32Array;function Un(e){for(var t=e.length;--t>=0;)e[t]=0}var Bn=256,Gn=286,qn=30,Vn=15,$n=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Jn=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Wn=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Zn=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Yn=new Array(576);Un(Yn);var Hn=new Array(60);Un(Hn);var Xn=new Array(512);Un(Xn);var Kn=new Array(256);Un(Kn);var Qn=new Array(29);Un(Qn);var er,tr,nr,rr=new Array(qn);function ir(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function ar(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function or(e){return e<256?Xn[e]:Xn[256+(e>>>7)]}function sr(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ur(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,sr(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function cr(e,t,n){ur(e,n[2*t],n[2*t+1])}function fr(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function lr(e,t,n){var r,i,a=new Array(16),o=0;for(r=1;r<=Vn;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=fr(a[s]++,s))}}function hr(e){var t;for(t=0;t<Gn;t++)e.dyn_ltree[2*t]=0;for(t=0;t<qn;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function pr(e){e.bi_valid>8?sr(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function dr(e,t,n,r){var i=2*t,a=2*n;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function gr(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&dr(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!dr(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function mr(e,t,n){var r,i,a,o,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===r?cr(e,i,t):(cr(e,(a=Kn[i])+Bn+1,t),0!==(o=$n[a])&&ur(e,i-=Qn[a],o),cr(e,a=or(--r),n),0!==(o=Jn[a])&&ur(e,r-=rr[a],o))}while(s<e.last_lit);cr(e,256,t)}function yr(e,t){var n,r,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==a[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):a[2*n+1]=0;for(;e.heap_len<2;)a[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;n>=1;n--)gr(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],gr(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,gr(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,c=t.max_code,f=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=Vn;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(a=u[2*u[2*(r=e.heap[n])+1]+1]+1)>d&&(a=d,g++),u[2*r+1]=a,r>c||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),l&&(e.static_len+=s*(f[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>c||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),lr(a,c,e.bl_count)}function vr(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s<u&&i===o||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=i,0===o?(u=138,c=3):i===o?(u=6,c=3):(u=7,c=4))}function br(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++s<u&&i===o)){if(s<c)do{cr(e,i,e.bl_tree)}while(0!==--s);else 0!==i?(i!==a&&(cr(e,i,e.bl_tree),s--),cr(e,16,e.bl_tree),ur(e,s-3,2)):s<=10?(cr(e,17,e.bl_tree),ur(e,s-3,3)):(cr(e,18,e.bl_tree),ur(e,s-11,7));s=0,a=i,0===o?(u=138,c=3):i===o?(u=6,c=3):(u=7,c=4)}}Un(rr);var _r=!1;function xr(e){_r||(!function(){var e,t,n,r,i,a=new Array(16);for(n=0,r=0;r<28;r++)for(Qn[r]=n,e=0;e<1<<$n[r];e++)Kn[n++]=r;for(Kn[n-1]=r,i=0,r=0;r<16;r++)for(rr[r]=i,e=0;e<1<<Jn[r];e++)Xn[i++]=r;for(i>>=7;r<qn;r++)for(rr[r]=i<<7,e=0;e<1<<Jn[r]-7;e++)Xn[256+i++]=r;for(t=0;t<=Vn;t++)a[t]=0;for(e=0;e<=143;)Yn[2*e+1]=8,e++,a[8]++;for(;e<=255;)Yn[2*e+1]=9,e++,a[9]++;for(;e<=279;)Yn[2*e+1]=7,e++,a[7]++;for(;e<=287;)Yn[2*e+1]=8,e++,a[8]++;for(lr(Yn,287,a),e=0;e<qn;e++)Hn[2*e+1]=5,Hn[2*e]=fr(e,5);er=new ir(Yn,$n,257,Gn,Vn),tr=new ir(Hn,Jn,0,qn,Vn),nr=new ir(new Array(0),Wn,0,19,7)}(),_r=!0),e.l_desc=new ar(e.dyn_ltree,er),e.d_desc=new ar(e.dyn_dtree,tr),e.bl_desc=new ar(e.bl_tree,nr),e.bi_buf=0,e.bi_valid=0,hr(e)}function wr(e,t,n,r){ur(e,0+(r?1:0),3),function(e,t,n){pr(e),sr(e,n),sr(e,~n),Rn(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}function Sr(e){ur(e,2,3),cr(e,256,Yn),function(e){16===e.bi_valid?(sr(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}function Ar(e,t,n,r){var i,a,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Bn;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),yr(e,e.l_desc),yr(e,e.d_desc),o=function(e){var t;for(vr(e,e.dyn_ltree,e.l_desc.max_code),vr(e,e.dyn_dtree,e.d_desc.max_code),yr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Zn[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=i&&(i=a)):i=a=n+5,n+4<=i&&-1!==t?wr(e,t,n,r):4===e.strategy||a===i?(ur(e,2+(r?1:0),3),mr(e,Yn,Hn)):(ur(e,4+(r?1:0),3),function(e,t,n,r){var i;for(ur(e,t-257,5),ur(e,n-1,5),ur(e,r-4,4),i=0;i<r;i++)ur(e,e.bl_tree[2*Zn[i]+1],3);br(e,e.dyn_ltree,t-1),br(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),mr(e,e.dyn_ltree,e.dyn_dtree)),hr(e),r&&pr(e)}function Er(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Kn[n]+Bn+1)]++,e.dyn_dtree[2*or(t)]++),e.last_lit===e.lit_bufsize-1}function Mr(e,t,n,r){for(var i=65535&e,a=e>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16}var Ir=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();function kr(e,t,n,r){var i=Ir,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}var Cr,Pr=-2,Or=258,Nr=262,Tr=103,Lr=113,zr=666;function Rr(e,t){return e.msg=Ln[t],t}function Dr(e){return(e<<1)-(e>4?9:0)}function jr(e){for(var t=e.length;--t>=0;)e[t]=0}function Fr(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(Rn(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function Ur(e,t){Ar(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fr(e.strm)}function Br(e,t){e.pending_buf[e.pending++]=t}function Gr(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function qr(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,Rn(t,e.input,e.next_in,i,n),1===e.state.wrap?e.adler=Mr(e.adler,t,i,n):2===e.state.wrap&&(e.adler=kr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function Vr(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-Nr?e.strstart-(e.w_size-Nr):0,c=e.window,f=e.w_mask,l=e.prev,h=e.strstart+Or,p=c[a+o-1],d=c[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(n=t)+o]===d&&c[n+o-1]===p&&c[n]===c[a]&&c[++n]===c[a+1]){a+=2,n++;do{}while(c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&a<h);if(r=Or-(h-a),a=h-Or,r>o){if(e.match_start=t,o=r,r>=s)break;p=c[a+o-1],d=c[a+o]}}}while((t=l[t&f])>u&&0!==--i);return o<=e.lookahead?o:e.lookahead}function $r(e){var t,n,r,i,a,o=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-Nr)){Rn(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=o?r-o:0}while(--n);t=n=o;do{r=e.prev[--t],e.prev[t]=r>=o?r-o:0}while(--n);i+=o}if(0===e.strm.avail_in)break;if(n=qr(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+3-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Nr&&0!==e.strm.avail_in)}function Jr(e,t){for(var n,r;;){if(e.lookahead<Nr){if($r(e),e.lookahead<Nr&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Nr&&(e.match_length=Vr(e,n)),e.match_length>=3)if(r=Er(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}function Wr(e,t){for(var n,r,i;;){if(e.lookahead<Nr){if($r(e),e.lookahead<Nr&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Nr&&(e.match_length=Vr(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Er(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Ur(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=Er(e,0,e.window[e.strstart-1]))&&Ur(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Er(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}function Zr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function Yr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new jn(1146),this.dyn_dtree=new jn(122),this.bl_tree=new jn(78),jr(this.dyn_ltree),jr(this.dyn_dtree),jr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new jn(16),this.heap=new jn(573),jr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new jn(573),jr(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Hr(e){var t,n=function(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:Lr,e.adler=2===t.wrap?0:1,t.last_flush=0,xr(t),0):Rr(e,Pr)}(e);return 0===n&&((t=e.state).window_size=2*t.w_size,jr(t.head),t.max_lazy_match=Cr[t.level].max_lazy,t.good_match=Cr[t.level].good_length,t.nice_match=Cr[t.level].nice_length,t.max_chain_length=Cr[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function Xr(e,t){var n,r,i,a;if(!e||!e.state||t>5||t<0)return e?Rr(e,Pr):Pr;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===zr&&4!==t)return Rr(e,0===e.avail_out?-5:Pr);if(r.strm=e,n=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Br(r,31),Br(r,139),Br(r,8),r.gzhead?(Br(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Br(r,255&r.gzhead.time),Br(r,r.gzhead.time>>8&255),Br(r,r.gzhead.time>>16&255),Br(r,r.gzhead.time>>24&255),Br(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Br(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Br(r,255&r.gzhead.extra.length),Br(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=kr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Br(r,0),Br(r,0),Br(r,0),Br(r,0),Br(r,0),Br(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Br(r,3),r.status=Lr);else{var o=8+(r.w_bits-8<<4)<<8;o|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=Lr,Gr(r,o),0!==r.strstart&&(Gr(r,e.adler>>>16),Gr(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending!==r.pending_buf_size));)Br(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Br(r,a)}while(0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),Fr(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Br(r,a)}while(0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=kr(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.status=Tr)}else r.status=Tr;if(r.status===Tr&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Fr(e),r.pending+2<=r.pending_buf_size&&(Br(r,255&e.adler),Br(r,e.adler>>8&255),e.adler=0,r.status=Lr)):r.status=Lr),0!==r.pending){if(Fr(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&Dr(t)<=Dr(n)&&4!==t)return Rr(e,-5);if(r.status===zr&&0!==e.avail_in)return Rr(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==zr){var s=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&($r(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var n,r,i,a,o=e.window;;){if(e.lookahead<=Or){if($r(e),e.lookahead<=Or&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=o[i=e.strstart-1])===o[++i]&&r===o[++i]&&r===o[++i]){a=e.strstart+Or;do{}while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Or-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Er(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Ur(e,!1),0===e.strm.avail_out)?1:2}(r,t):Cr[r.level].func(r,t);if(3!==s&&4!==s||(r.status=zr),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?Sr(r):5!==t&&(wr(r,0,0,!1),3===t&&(jr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Fr(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Br(r,255&e.adler),Br(r,e.adler>>8&255),Br(r,e.adler>>16&255),Br(r,e.adler>>24&255),Br(r,255&e.total_in),Br(r,e.total_in>>8&255),Br(r,e.total_in>>16&255),Br(r,e.total_in>>24&255)):(Gr(r,e.adler>>>16),Gr(r,65535&e.adler)),Fr(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)}Cr=[new Zr(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if($r(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Ur(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-Nr&&(Ur(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Ur(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Ur(e,!1),e.strm.avail_out),1)}),new Zr(4,4,8,4,Jr),new Zr(4,5,16,8,Jr),new Zr(4,6,32,32,Jr),new Zr(4,4,16,16,Wr),new Zr(8,16,32,32,Wr),new Zr(8,16,128,128,Wr),new Zr(8,32,128,256,Wr),new Zr(32,128,258,1024,Wr),new Zr(32,258,258,4096,Wr)];function Kr(e,t){var n,r,i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M;n=e.state,r=e.next_in,E=e.input,i=r+(e.avail_in-5),a=e.next_out,M=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,l=n.wnext,h=n.window,p=n.hold,d=n.bits,g=n.lencode,m=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;e:do{d<15&&(p+=E[r++]<<d,d+=8,p+=E[r++]<<d,d+=8),b=g[p&y];t:for(;;){if(p>>>=_=b>>>24,d-=_,0===(_=b>>>16&255))M[a++]=65535&b;else{if(!(16&_)){if(64&_){if(32&_){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}b=g[(65535&b)+(p&(1<<_)-1)];continue t}for(x=65535&b,(_&=15)&&(d<_&&(p+=E[r++]<<d,d+=8),x+=p&(1<<_)-1,p>>>=_,d-=_),d<15&&(p+=E[r++]<<d,d+=8,p+=E[r++]<<d,d+=8),b=m[p&v];;){if(p>>>=_=b>>>24,d-=_,16&(_=b>>>16&255)){if(w=65535&b,d<(_&=15)&&(p+=E[r++]<<d,(d+=8)<_&&(p+=E[r++]<<d,d+=8)),(w+=p&(1<<_)-1)>u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=_,d-=_,w>(_=a-o)){if((_=w-_)>f&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(S=0,A=h,0===l){if(S+=c-_,_<x){x-=_;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}}else if(l<_){if(S+=c+l-_,(_-=l)<x){x-=_;do{M[a++]=h[S++]}while(--_);if(S=0,l<x){x-=_=l;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}}}else if(S+=l-_,_<x){x-=_;do{M[a++]=h[S++]}while(--_);S=a-w,A=M}for(;x>2;)M[a++]=A[S++],M[a++]=A[S++],M[a++]=A[S++],x-=3;x&&(M[a++]=A[S++],x>1&&(M[a++]=A[S++]))}else{S=a-w;do{M[a++]=M[S++],M[a++]=M[S++],M[a++]=M[S++],x-=3}while(x>2);x&&(M[a++]=M[S++],x>1&&(M[a++]=M[S++]))}break}if(64&_){e.msg="invalid distance code",n.mode=30;break e}b=m[(65535&b)+(p&(1<<_)-1)]}}break}}while(r<i&&a<s);r-=x=d>>3,p&=(1<<(d-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=a<s?s-a+257:257-(a-s),n.hold=p,n.bits=d}var Qr=15,ei=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ti=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],ni=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],ri=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function ii(e,t,n,r,i,a,o,s){var u,c,f,l,h,p,d,g,m,y=s.bits,v=0,b=0,_=0,x=0,w=0,S=0,A=0,E=0,M=0,I=0,k=null,C=0,P=new jn(16),O=new jn(16),N=null,T=0;for(v=0;v<=Qr;v++)P[v]=0;for(b=0;b<r;b++)P[t[n+b]]++;for(w=y,x=Qr;x>=1&&0===P[x];x--);if(w>x&&(w=x),0===x)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(_=1;_<x&&0===P[_];_++);for(w<_&&(w=_),E=1,v=1;v<=Qr;v++)if(E<<=1,(E-=P[v])<0)return-1;if(E>0&&(0===e||1!==x))return-1;for(O[1]=0,v=1;v<Qr;v++)O[v+1]=O[v]+P[v];for(b=0;b<r;b++)0!==t[n+b]&&(o[O[t[n+b]]++]=b);if(0===e?(k=N=o,p=19):1===e?(k=ei,C-=257,N=ti,T-=257,p=256):(k=ni,N=ri,p=-1),I=0,b=0,v=_,h=a,S=w,A=0,f=-1,l=(M=1<<w)-1,1===e&&M>852||2===e&&M>592)return 1;for(;;){d=v-A,o[b]<p?(g=0,m=o[b]):o[b]>p?(g=N[T+o[b]],m=k[C+o[b]]):(g=96,m=0),u=1<<v-A,_=c=1<<S;do{i[h+(I>>A)+(c-=u)]=d<<24|g<<16|m}while(0!==c);for(u=1<<v-1;I&u;)u>>=1;if(0!==u?(I&=u-1,I+=u):I=0,b++,0===--P[v]){if(v===x)break;v=t[n+o[b]]}if(v>w&&(I&l)!==f){for(0===A&&(A=w),h+=_,E=1<<(S=v-A);S+A<x&&!((E-=P[S+A])<=0);)S++,E<<=1;if(M+=1<<S,1===e&&M>852||2===e&&M>592)return 1;i[f=I&l]=w<<24|S<<16|h-a}}return 0!==I&&(i[h+I]=v-A<<24|64<<16),s.bits=w,0}var ai=-2,oi=12,si=30;function ui(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ci(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new jn(320),this.work=new jn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function fi(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Fn(852),t.distcode=t.distdyn=new Fn(592),t.sane=1,t.back=-1,0):ai}(e)):ai}function li(e,t){var n,r;return e?(r=new ci,e.state=r,r.window=null,n=function(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ai:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,fi(e))):ai}(e,t),0!==n&&(e.state=null),n):ai}var hi,pi,di=!0;function gi(e){if(di){var t;for(hi=new Fn(512),pi=new Fn(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ii(1,e.lens,0,288,hi,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ii(2,e.lens,0,32,pi,0,e.work,{bits:5}),di=!1}e.lencode=hi,e.lenbits=9,e.distcode=pi,e.distbits=5}function mi(e,t){var n,r,i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A,E,M=0,I=new Dn(4),k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return ai;(n=e.state).mode===oi&&(n.mode=13),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,f=n.bits,l=s,h=u,S=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(2&n.wrap&&35615===c){n.check=0,I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0),c=0,f=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=si;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=si;break}if(f-=4,w=8+(15&(c>>>=4)),0===n.wbits)n.wbits=w;else if(w>n.wbits){e.msg="invalid window size",n.mode=si;break}n.dmax=1<<w,e.adler=n.check=1,n.mode=512&c?10:oi,c=0,f=0;break;case 2:for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(n.flags=c,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=si;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=si;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0,n.mode=3;case 3:for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.head&&(n.head.time=c),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,I[2]=c>>>16&255,I[3]=c>>>24&255,n.check=kr(n.check,I,4,0)),c=0,f=0,n.mode=4;case 4:for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0,n.mode=5;case 5:if(1024&n.flags){for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(I[0]=255&c,I[1]=c>>>8&255,n.check=kr(n.check,I,2,0)),c=0,f=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((p=n.length)>s&&(p=s),p&&(n.head&&(w=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Rn(n.head.extra,r,a,p,w)),512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;p=0;do{w=r[a+p++],n.head&&w&&n.length<65536&&(n.head.name+=String.fromCharCode(w))}while(w&&p<s);if(512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,w)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;p=0;do{w=r[a+p++],n.head&&w&&n.length<65536&&(n.head.comment+=String.fromCharCode(w))}while(w&&p<s);if(512&n.flags&&(n.check=kr(n.check,r,p,a)),s-=p,a+=p,w)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;f<16;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=si;break}c=0,f=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=oi;break;case 10:for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}e.adler=n.check=ui(c),c=0,f=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,2;e.adler=n.check=1,n.mode=oi;case oi:if(5===t||6===t)break e;case 13:if(n.last){c>>>=7&f,f-=7&f,n.mode=27;break}for(;f<3;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}switch(n.last=1&c,f-=1,3&(c>>>=1)){case 0:n.mode=14;break;case 1:if(gi(n),n.mode=20,6===t){c>>>=2,f-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=si}c>>>=2,f-=2;break;case 14:for(c>>>=7&f,f-=7&f;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=si;break}if(n.length=65535&c,c=0,f=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(p=n.length){if(p>s&&(p=s),p>u&&(p=u),0===p)break e;Rn(i,r,a,p,o),s-=p,a+=p,u-=p,o+=p,n.length-=p;break}n.mode=oi;break;case 17:for(;f<14;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(n.nlen=257+(31&c),c>>>=5,f-=5,n.ndist=1+(31&c),c>>>=5,f-=5,n.ncode=4+(15&c),c>>>=4,f-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=si;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;f<3;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.lens[k[n.have++]]=7&c,c>>>=3,f-=3}for(;n.have<19;)n.lens[k[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},S=ii(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,S){e.msg="invalid code lengths set",n.mode=si;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;y=(M=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(v<16)c>>>=m,f-=m,n.lens[n.have++]=v;else{if(16===v){for(E=m+2;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c>>>=m,f-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=si;break}w=n.lens[n.have-1],p=3+(3&c),c>>>=2,f-=2}else if(17===v){for(E=m+3;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}f-=m,w=0,p=3+(7&(c>>>=m)),c>>>=3,f-=3}else{for(E=m+7;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}f-=m,w=0,p=11+(127&(c>>>=m)),c>>>=7,f-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=si;break}for(;p--;)n.lens[n.have++]=w}}if(n.mode===si)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=si;break}if(n.lenbits=9,A={bits:n.lenbits},S=ii(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,S){e.msg="invalid literal/lengths set",n.mode=si;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},S=ii(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,S){e.msg="invalid distances set",n.mode=si;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,Kr(e,h),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,f=n.bits,n.mode===oi&&(n.back=-1);break}for(n.back=0;y=(M=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(y&&!(240&y)){for(b=m,_=y,x=v;y=(M=n.lencode[x+((c&(1<<b+_)-1)>>b)])>>>16&255,v=65535&M,!(b+(m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}c>>>=b,f-=b,n.back+=b}if(c>>>=m,f-=m,n.back+=m,n.length=v,0===y){n.mode=26;break}if(32&y){n.back=-1,n.mode=oi;break}if(64&y){e.msg="invalid literal/length code",n.mode=si;break}n.extra=15&y,n.mode=22;case 22:if(n.extra){for(E=n.extra;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,f-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;y=(M=n.distcode[c&(1<<n.distbits)-1])>>>16&255,v=65535&M,!((m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(!(240&y)){for(b=m,_=y,x=v;y=(M=n.distcode[x+((c&(1<<b+_)-1)>>b)])>>>16&255,v=65535&M,!(b+(m=M>>>24)<=f);){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}c>>>=b,f-=b,n.back+=b}if(c>>>=m,f-=m,n.back+=m,64&y){e.msg="invalid distance code",n.mode=si;break}n.offset=v,n.extra=15&y,n.mode=24;case 24:if(n.extra){for(E=n.extra;f<E;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,f-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=si;break}n.mode=25;case 25:if(0===u)break e;if(p=h-u,n.offset>p){if((p=n.offset-p)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=si;break}p>n.wnext?(p-=n.wnext,d=n.wsize-p):d=n.wnext-p,p>n.length&&(p=n.length),g=n.window}else g=i,d=o-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do{i[o++]=g[d++]}while(--p);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;i[o++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;f<32;){if(0===s)break e;s--,c|=r[a++]<<f,f+=8}if(h-=u,e.total_out+=h,n.total+=h,h&&(e.adler=n.check=n.flags?kr(n.check,i,h,o-h):Mr(n.check,i,h,o-h)),h=u,(n.flags?c:ui(c))!==n.check){e.msg="incorrect data check",n.mode=si;break}c=0,f=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;f<32;){if(0===s)break e;s--,c+=r[a++]<<f,f+=8}if(c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=si;break}c=0,f=0}n.mode=29;case 29:S=1;break e;case si:S=-3;break e;case 31:return-4;default:return ai}return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=f,(n.wsize||h!==e.avail_out&&n.mode<si&&(n.mode<27||4!==t))&&function(e,t,n,r){var i,a=e.state;null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Dn(a.wsize)),r>=a.wsize?(Rn(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>r&&(i=r),Rn(a.window,t,n-r,i,a.wnext),(r-=i)?(Rn(a.window,t,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i)))}(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,n.total+=h,n.wrap&&h&&(e.adler=n.check=n.flags?kr(n.check,i,h,e.next_out-h):Mr(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===oi?128:0)+(20===n.mode||15===n.mode?256:0),(0===l&&0===h||4===t)&&0===S&&(S=-5),S}var yi;function vi(e){if(e<1||e>7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function bi(e,t){for(var n=0;n<e.length;n++)this[t+n]=e[n]}vi.prototype.init=function(e,t,n,r,i){var a;switch(this.windowBits=e,this.level=t,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),7===this.mode&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new zn,this.mode){case 1:case 3:case 5:a=function(e,t,n,r,i,a){if(!e)return Pr;var o=1;if(-1===t&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||8!==n||r<8||r>15||t<0||t>9||a<0||a>4)return Rr(e,Pr);8===r&&(r=9);var s=new Yr;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Dn(2*s.w_size),s.head=new jn(s.hash_size),s.prev=new jn(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Dn(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,Hr(e)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:a=li(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===a?(this.write_in_progress=!1,this.init_done=!0):this._error(a)},vi.prototype.params=function(){throw new Error("deflateParams Not supported")},vi.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},vi.prototype.write=function(e,t,n,r,i,a,o){this._writeCheck(),this.write_in_progress=!0;var s=this;return ht.nextTick(function(){s.write_in_progress=!1;var u=s._write(e,t,n,r,i,a,o);s.callback(u[0],u[1]),s.pending_close&&s.close()}),this},vi.prototype.writeSync=function(e,t,n,r,i,a,o){return this._writeCheck(),this._write(e,t,n,r,i,a,o)},vi.prototype._write=function(e,t,n,r,i,a,o){if(this.write_in_progress=!0,0!==e&&1!==e&&2!==e&&3!==e&&4!==e&&5!==e)throw new Error("Invalid flush value");null==t&&(t=new ne(0),r=0,n=0),i._set?i.set=i._set:i.set=bi;var s,u=this.strm;switch(u.avail_in=r,u.input=t,u.next_in=n,u.avail_out=o,u.output=i,u.next_out=a,this.mode){case 1:case 3:case 5:s=Xr(u,e);break;case 7:case 2:case 4:case 6:s=mi(u,e);break;default:throw new Error("Unknown mode "+this.mode)}return this._checkError(s,u,e)||this._error(s),this.write_in_progress=!1,[u.avail_in,u.avail_out]},vi.prototype._checkError=function(e,t,n){switch(e){case 0:case-5:if(0!==t.avail_out&&4===n)return!1;break;case 1:break;default:return!1}return!0},vi.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,1===this.mode||3===this.mode||5===this.mode?function(e){var t;e&&e.state&&(42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==Tr&&t!==Lr&&t!==zr?Rr(e,Pr):(e.state=null,t===Lr&&Rr(e,-3)))}(this.strm):function(e){if(!e||!e.state)return ai;var t=e.state;t.window&&(t.window=null),e.state=null}(this.strm),this.mode=0)},vi.prototype.reset=function(){switch(this.mode){case 1:case 5:yi=Hr(this.strm);break;case 2:case 6:yi=fi(this.strm)}0!==yi&&this._error(yi)},vi.prototype._error=function(e){this.onerror(Ln[e]+": "+this.strm.msg,e),this.write_in_progress=!1,this.pending_close&&this.close()};var _i=Object.freeze({__proto__:null,DEFLATE:1,DEFLATERAW:5,GUNZIP:4,GZIP:3,INFLATE:2,INFLATERAW:6,NONE:0,UNZIP:7,Z_BEST_COMPRESSION:9,Z_BEST_SPEED:1,Z_BINARY:0,Z_BLOCK:5,Z_BUF_ERROR:-5,Z_DATA_ERROR:-3,Z_DEFAULT_COMPRESSION:-1,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8,Z_ERRNO:-1,Z_FILTERED:1,Z_FINISH:4,Z_FIXED:4,Z_FULL_FLUSH:3,Z_HUFFMAN_ONLY:2,Z_NEED_DICT:2,Z_NO_COMPRESSION:0,Z_NO_FLUSH:0,Z_OK:0,Z_PARTIAL_FLUSH:1,Z_RLE:3,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_SYNC_FLUSH:2,Z_TEXT:1,Z_TREES:6,Z_UNKNOWN:2,Zlib:vi});var xi={};Object.keys(_i).forEach(function(e){xi[e]=_i[e]}),xi.Z_MIN_WINDOWBITS=8,xi.Z_MAX_WINDOWBITS=15,xi.Z_DEFAULT_WINDOWBITS=15,xi.Z_MIN_CHUNK=64,xi.Z_MAX_CHUNK=1/0,xi.Z_DEFAULT_CHUNK=16384,xi.Z_MIN_MEMLEVEL=1,xi.Z_MAX_MEMLEVEL=9,xi.Z_DEFAULT_MEMLEVEL=8,xi.Z_MIN_LEVEL=-1,xi.Z_MAX_LEVEL=9,xi.Z_DEFAULT_LEVEL=xi.Z_DEFAULT_COMPRESSION;var wi={Z_OK:xi.Z_OK,Z_STREAM_END:xi.Z_STREAM_END,Z_NEED_DICT:xi.Z_NEED_DICT,Z_ERRNO:xi.Z_ERRNO,Z_STREAM_ERROR:xi.Z_STREAM_ERROR,Z_DATA_ERROR:xi.Z_DATA_ERROR,Z_MEM_ERROR:xi.Z_MEM_ERROR,Z_BUF_ERROR:xi.Z_BUF_ERROR,Z_VERSION_ERROR:xi.Z_VERSION_ERROR};function Si(e){return new Ji(e)}function Ai(e){return new Wi(e)}function Ei(e){return new Hi(e)}function Mi(e){return new Xi(e)}function Ii(e){return new Zi(e)}function ki(e){return new Yi(e)}function Ci(e){return new Ki(e)}function Pi(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Ji(t),e,n)}function Oi(e,t){return $i(new Ji(t),e)}function Ni(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Zi(t),e,n)}function Ti(e,t){return $i(new Zi(t),e)}function Li(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Hi(t),e,n)}function zi(e,t){return $i(new Hi(t),e)}function Ri(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Ki(t),e,n)}function Di(e,t){return $i(new Ki(t),e)}function ji(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Wi(t),e,n)}function Fi(e,t){return $i(new Wi(t),e)}function Ui(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Yi(t),e,n)}function Bi(e,t){return $i(new Yi(t),e)}function Gi(e,t,n){return"function"==typeof t&&(n=t,t={}),Vi(new Xi(t),e,n)}function qi(e,t){return $i(new Xi(t),e)}function Vi(e,t,n){var r=[],i=0;function a(){for(var t;null!==(t=e.read());)r.push(t),i+=t.length;e.once("readable",a)}function o(){var t=ne.concat(r,i);r=[],n(null,t),e.close()}e.on("error",function(t){e.removeListener("end",o),e.removeListener("readable",a),n(t)}),e.on("end",o),e.end(t),a()}function $i(e,t){if("string"==typeof t&&(t=new ne(t)),!ne.isBuffer(t))throw new TypeError("Not a string or buffer");var n=xi.Z_FINISH;return e._processChunk(t,n)}function Ji(e){if(!(this instanceof Ji))return new Ji(e);Qi.call(this,e,xi.DEFLATE)}function Wi(e){if(!(this instanceof Wi))return new Wi(e);Qi.call(this,e,xi.INFLATE)}function Zi(e){if(!(this instanceof Zi))return new Zi(e);Qi.call(this,e,xi.GZIP)}function Yi(e){if(!(this instanceof Yi))return new Yi(e);Qi.call(this,e,xi.GUNZIP)}function Hi(e){if(!(this instanceof Hi))return new Hi(e);Qi.call(this,e,xi.DEFLATERAW)}function Xi(e){if(!(this instanceof Xi))return new Xi(e);Qi.call(this,e,xi.INFLATERAW)}function Ki(e){if(!(this instanceof Ki))return new Ki(e);Qi.call(this,e,xi.UNZIP)}function Qi(e,t){if(this._opts=e=e||{},this._chunkSize=e.chunkSize||xi.Z_DEFAULT_CHUNK,Pn.call(this,e),e.flush&&e.flush!==xi.Z_NO_FLUSH&&e.flush!==xi.Z_PARTIAL_FLUSH&&e.flush!==xi.Z_SYNC_FLUSH&&e.flush!==xi.Z_FULL_FLUSH&&e.flush!==xi.Z_FINISH&&e.flush!==xi.Z_BLOCK)throw new Error("Invalid flush flag: "+e.flush);if(this._flushFlag=e.flush||xi.Z_NO_FLUSH,e.chunkSize&&(e.chunkSize<xi.Z_MIN_CHUNK||e.chunkSize>xi.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<xi.Z_MIN_WINDOWBITS||e.windowBits>xi.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<xi.Z_MIN_LEVEL||e.level>xi.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<xi.Z_MIN_MEMLEVEL||e.memLevel>xi.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=xi.Z_FILTERED&&e.strategy!=xi.Z_HUFFMAN_ONLY&&e.strategy!=xi.Z_RLE&&e.strategy!=xi.Z_FIXED&&e.strategy!=xi.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!ne.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new xi.Zlib(t);var n=this;this._hadError=!1,this._binding.onerror=function(e,t){n._binding=null,n._hadError=!0;var r=new Error(e);r.errno=t,r.code=wi[t],n.emit("error",r)};var r=xi.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(r=e.level);var i=xi.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(i=e.strategy),this._binding.init(e.windowBits||xi.Z_DEFAULT_WINDOWBITS,r,e.memLevel||xi.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new ne(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(wi).forEach(function(e){wi[wi[e]]=e}),lt(Qi,Pn),Qi.prototype.params=function(e,t,n){if(e<xi.Z_MIN_LEVEL||e>xi.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=xi.Z_FILTERED&&t!=xi.Z_HUFFMAN_ONLY&&t!=xi.Z_RLE&&t!=xi.Z_FIXED&&t!=xi.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var r=this;this.flush(xi.Z_SYNC_FLUSH,function(){r._binding.params(e,t),r._hadError||(r._level=e,r._strategy=t,n&&n())})}else ht.nextTick(n)},Qi.prototype.reset=function(){return this._binding.reset()},Qi.prototype._flush=function(e){this._transform(new ne(0),"",e)},Qi.prototype.flush=function(e,t){var n=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=xi.Z_FULL_FLUSH),n.ended)t&&ht.nextTick(t);else if(n.ending)t&&this.once("end",t);else if(n.needDrain){var r=this;this.once("drain",function(){r.flush(t)})}else this._flushFlag=e,this.write(new ne(0),"",t)},Qi.prototype.close=function(e){if(e&&ht.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;ht.nextTick(function(){t.emit("close")})}},Qi.prototype._transform=function(e,t,n){var r,i=this._writableState,a=(i.ending||i.ended)&&(!e||i.length===e.length);if(null===!e&&!ne.isBuffer(e))return n(new Error("invalid input"));a?r=xi.Z_FINISH:(r=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||xi.Z_NO_FLUSH)),this._processChunk(e,r,n)},Qi.prototype._processChunk=function(e,t,n){var r=e&&e.length,i=this._chunkSize-this._offset,a=0,o=this,s="function"==typeof n;if(!s){var u,c=[],f=0;this.on("error",function(e){u=e});do{var l=this._binding.writeSync(t,e,a,r,this._buffer,this._offset,i)}while(!this._hadError&&d(l[0],l[1]));if(this._hadError)throw u;var h=ne.concat(c,f);return this.close(),h}var p=this._binding.write(t,e,a,r,this._buffer,this._offset,i);function d(u,l){if(!o._hadError){var h=i-l;if(function(e,t){if(!e)throw new Error(t)}(h>=0,"have should not go down"),h>0){var p=o._buffer.slice(o._offset,o._offset+h);o._offset+=h,s?o.push(p):(c.push(p),f+=p.length)}if((0===l||o._offset>=o._chunkSize)&&(i=o._chunkSize,o._offset=0,o._buffer=new ne(o._chunkSize)),0===l){if(a+=r-u,r=u,!s)return!0;var g=o._binding.write(t,e,a,r,o._buffer,o._offset,o._chunkSize);return g.callback=d,void(g.buffer=e)}if(!s)return!1;n()}}p.buffer=e,p.callback=d},lt(Ji,Qi),lt(Wi,Qi),lt(Zi,Qi),lt(Yi,Qi),lt(Hi,Qi),lt(Xi,Qi),lt(Ki,Qi);var ea,ta={codes:wi,createDeflate:Si,createInflate:Ai,createDeflateRaw:Ei,createInflateRaw:Mi,createGzip:Ii,createGunzip:ki,createUnzip:Ci,deflate:Pi,deflateSync:Oi,gzip:Ni,gzipSync:Ti,deflateRaw:Li,deflateRawSync:zi,unzip:Ri,unzipSync:Di,inflate:ji,inflateSync:Fi,gunzip:Ui,gunzipSync:Bi,inflateRaw:Gi,inflateRawSync:qi,Deflate:Ji,Inflate:Wi,Gzip:Zi,Gunzip:Yi,DeflateRaw:Hi,InflateRaw:Xi,Unzip:Ki,Zlib:Qi},na=n(Object.freeze({__proto__:null,Deflate:Ji,DeflateRaw:Hi,Gunzip:Yi,Gzip:Zi,Inflate:Wi,InflateRaw:Xi,Unzip:Ki,Zlib:Qi,codes:wi,createDeflate:Si,createDeflateRaw:Ei,createGunzip:ki,createGzip:Ii,createInflate:Ai,createInflateRaw:Mi,createUnzip:Ci,default:ta,deflate:Pi,deflateRaw:Li,deflateRawSync:zi,deflateSync:Oi,gunzip:Ui,gunzipSync:Bi,gzip:Ni,gzipSync:Ti,inflate:ji,inflateRaw:Gi,inflateRawSync:qi,inflateSync:Fi,unzip:Ri,unzipSync:Di}));function ra(){if(void 0===ea){var e=new ArrayBuffer(2),t=new Uint8Array(e),n=new Uint16Array(e);if(t[0]=1,t[1]=2,258===n[0])ea="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");ea="LE"}}return ea}function ia(){return void 0!==B.location?B.location.hostname:""}function aa(){return[]}function oa(){return 0}function sa(){return Number.MAX_VALUE}function ua(){return Number.MAX_VALUE}function ca(){return[]}function fa(){return"Browser"}function la(){return void 0!==B.navigator?B.navigator.appVersion:""}function ha(){return{}}function pa(){return{}}function da(){return"javascript"}function ga(){return"browser"}function ma(){return"/tmp"}var ya=ma;function va(){return"$HOME"}var ba={homedir:va,EOL:"\n",arch:da,platform:ga,tmpdir:ya,tmpDir:ma,networkInterfaces:ha,getNetworkInterfaces:pa,release:la,type:fa,cpus:ca,totalmem:ua,freemem:sa,uptime:oa,loadavg:aa,hostname:ia,endianness:ra},_a=n(Object.freeze({__proto__:null,EOL:"\n",arch:da,cpus:ca,default:ba,endianness:ra,freemem:sa,getNetworkInterfaces:pa,homedir:va,hostname:ia,loadavg:aa,networkInterfaces:ha,platform:ga,release:la,tmpDir:ma,tmpdir:ya,totalmem:ua,type:fa,uptime:oa}));class xa{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(e,t){let n=this.length++;for(this.ids[n]=e,this.values[n]=t;n>0;){const e=n-1>>1,r=this.values[e];if(t>=r)break;this.ids[n]=this.ids[e],this.values[n]=r,n=e}this.ids[n]=e,this.values[n]=t}pop(){if(0===this.length)return;const e=this.ids[0];if(this.length--,this.length>0){const e=this.ids[0]=this.ids[this.length],t=this.values[0]=this.values[this.length],n=this.length>>1;let r=0;for(;r<n;){let e=1+(r<<1);const n=e+1;let i=this.ids[e],a=this.values[e];const o=this.values[n];if(n<this.length&&o<a&&(e=n,i=this.ids[n],a=o),a>=t)break;this.ids[r]=i,this.values[r]=a,r=e}this.ids[r]=e,this.values[r]=t}return e}peek(){if(0!==this.length)return this.ids[0]}peekValue(){if(0!==this.length)return this.values[0]}}const wa=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Sa{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(251!==t)throw new Error("Data does not appear to be in a Flatbush format.");if(n>>4!=3)throw new Error(`Got v${n>>4} data when expected v3.`);const[r]=new Uint16Array(e,2,1),[i]=new Uint32Array(e,4,1);return new Sa(i,r,wa[15&n],e)}constructor(e,t=16,n=Float64Array,r){if(void 0===e)throw new Error("Missing required argument: numItems.");if(isNaN(e)||e<=0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535);let i=e,a=i;this._levelBounds=[4*i];do{i=Math.ceil(i/this.nodeSize),a+=i,this._levelBounds.push(4*a)}while(1!==i);this.ArrayType=n||Float64Array,this.IndexArrayType=a<16384?Uint16Array:Uint32Array;const o=wa.indexOf(this.ArrayType),s=4*a*this.ArrayType.BYTES_PER_ELEMENT;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this._boxes=new this.ArrayType(this.data,8,4*a),this._indices=new this.IndexArrayType(this.data,8+s,a),this._pos=4*a,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1]):(this.data=new ArrayBuffer(8+s+a*this.IndexArrayType.BYTES_PER_ELEMENT),this._boxes=new this.ArrayType(this.data,8,4*a),this._indices=new this.IndexArrayType(this.data,8+s,a),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(this.data,0,2).set([251,48+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e),this._queue=new xa}add(e,t,n,r){const i=this._pos>>2;return this._indices[i]=i,this._boxes[this._pos++]=e,this._boxes[this._pos++]=t,this._boxes[this._pos++]=n,this._boxes[this._pos++]=r,e<this.minX&&(this.minX=e),t<this.minY&&(this.minY=t),n>this.maxX&&(this.maxX=n),r>this.maxY&&(this.maxY=r),i}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);if(this.numItems<=this.nodeSize)return this._boxes[this._pos++]=this.minX,this._boxes[this._pos++]=this.minY,this._boxes[this._pos++]=this.maxX,void(this._boxes[this._pos++]=this.maxY);const e=this.maxX-this.minX||1,t=this.maxY-this.minY||1,n=new Uint32Array(this.numItems);for(let r=0;r<this.numItems;r++){let i=4*r;const a=this._boxes[i++],o=this._boxes[i++],s=this._boxes[i++],u=this._boxes[i++],c=Math.floor(65535*((a+s)/2-this.minX)/e),f=Math.floor(65535*((o+u)/2-this.minY)/t);n[r]=ka(c,f)}Ma(n,this._boxes,this._indices,0,this.numItems-1,this.nodeSize);for(let e=0,t=0;e<this._levelBounds.length-1;e++){const n=this._levelBounds[e];for(;t<n;){const e=t;let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e=0;e<this.nodeSize&&t<n;e++)r=Math.min(r,this._boxes[t++]),i=Math.min(i,this._boxes[t++]),a=Math.max(a,this._boxes[t++]),o=Math.max(o,this._boxes[t++]);this._indices[this._pos>>2]=e,this._boxes[this._pos++]=r,this._boxes[this._pos++]=i,this._boxes[this._pos++]=a,this._boxes[this._pos++]=o}}}search(e,t,n,r,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=[],s=[];for(;void 0!==a;){const u=Math.min(a+4*this.nodeSize,Ea(a,this._levelBounds));for(let c=a;c<u;c+=4){const u=0|this._indices[c>>2];n<this._boxes[c]||(r<this._boxes[c+1]||e>this._boxes[c+2]||t>this._boxes[c+3]||(a<4*this.numItems?(void 0===i||i(u))&&s.push(u):o.push(u)))}a=o.pop()}return s}neighbors(e,t,n=1/0,r=1/0,i){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const o=this._queue,s=[],u=r*r;for(;void 0!==a;){const r=Math.min(a+4*this.nodeSize,Ea(a,this._levelBounds));for(let n=a;n<r;n+=4){const r=0|this._indices[n>>2],s=Aa(e,this._boxes[n],this._boxes[n+2]),u=Aa(t,this._boxes[n+1],this._boxes[n+3]),c=s*s+u*u;a<4*this.numItems?(void 0===i||i(r))&&o.push(1+(r<<1),c):o.push(r<<1,c)}for(;o.length&&1&o.peek();){if(o.peekValue()>u)return o.clear(),s;if(s.push(o.pop()>>1),s.length===n)return o.clear(),s}a=o.pop()>>1}return o.clear(),s}}function Aa(e,t,n){return e<t?t-e:e<=n?0:e-n}function Ea(e,t){let n=0,r=t.length-1;for(;n<r;){const i=n+r>>1;t[i]>e?r=i:n=i+1}return t[n]}function Ma(e,t,n,r,i,a){if(Math.floor(r/a)>=Math.floor(i/a))return;const o=e[r+i>>1];let s=r-1,u=i+1;for(;;){do{s++}while(e[s]<o);do{u--}while(e[u]>o);if(s>=u)break;Ia(e,t,n,s,u)}Ma(e,t,n,r,u,a),Ma(e,t,n,u+1,i,a)}function Ia(e,t,n,r,i){const a=e[r];e[r]=e[i],e[i]=a;const o=4*r,s=4*i,u=t[o],c=t[o+1],f=t[o+2],l=t[o+3];t[o]=t[s],t[o+1]=t[s+1],t[o+2]=t[s+2],t[o+3]=t[s+3],t[s]=u,t[s+1]=c,t[s+2]=f,t[s+3]=l;const h=n[r];n[r]=n[i],n[i]=h}function ka(e,t){let n=e^t,r=65535^n,i=65535^(e|t),a=e&(65535^t),o=n|r>>1,s=n>>1^n,u=i>>1^r&a>>1^i,c=n&i>>1^a>>1^a;n=o,r=s,i=u,a=c,o=n&n>>2^r&r>>2,s=n&r>>2^r&(n^r)>>2,u^=n&i>>2^r&a>>2,c^=r&i>>2^(n^r)&a>>2,n=o,r=s,i=u,a=c,o=n&n>>4^r&r>>4,s=n&r>>4^r&(n^r)>>4,u^=n&i>>4^r&a>>4,c^=r&i>>4^(n^r)&a>>4,n=o,r=s,i=u,a=c,u^=n&i>>8^r&a>>8,c^=r&i>>8^(n^r)&a>>8,n=u^u>>1,r=c^c>>1;let f=e^t,l=r|65535^(f|n);return f=16711935&(f|f<<8),f=252645135&(f|f<<4),f=858993459&(f|f<<2),f=1431655765&(f|f<<1),l=16711935&(l|l<<8),l=252645135&(l|l<<4),l=858993459&(l|l<<2),l=1431655765&(l|l<<1),(l<<1|f)>>>0}var Ca=n(Object.freeze({__proto__:null,default:Sa}));!function(e){!function(){var t=Object.freeze({__proto__:null,get addThousandsSep(){return ve},get addslashes(){return C},get arrayToIndex(){return te},get clamp(){return d},get cleanNumericString(){return it},get contains(){return G},get copyElements(){return We},get countValues(){return K},get createBuffer(){return Ve},get default(){return t},get defaults(){return T},get difference(){return F},get endsWith(){return fe},get every(){return V},get expandoBuffer(){return Je},get extend(){return L},get extendBuffer(){return Ze},get find(){return $},get findMedian(){return De},get findQuantile(){return je},get findRankByValue(){return Le},get findStringPrefix(){return He},get findValueByPct(){return ze},get findValueByRank(){return Re},get forEach(){return re},get forEachProperty(){return ie},get format(){return Ue},get formatDateISO(){return M},get formatIntlNumber(){return xe},get formatNumber(){return _e},get formatNumberForDisplay(){return we},get formatVersionedName(){return Ke},get formatter(){return Ge},get genericSort(){return Me},get getArrayBounds(){return Y},get getGenericComparator(){return Oe},get getKeyComparator(){return Pe},get getSortedIds(){return Ie},get getUniqueName(){return f},get groupBy(){return ee},get htmlEscape(){return N},get indexOf(){return B},get indexOn(){return Q},get inherit(){return z},get initializeArray(){return ae},get intersection(){return U},get isArray(){return g},get isArrayLike(){return k},get isBoolean(){return E},get isDate(){return A},get isEven(){return x},get isFiniteNumber(){return v},get isFunction(){return l},get isInteger(){return _},get isNonNegNumber(){return b},get isNumber(){return m},get isObject(){return p},get isOdd(){return w},get isPromise(){return h},get isString(){return S},get isValidNumber(){return y},get lpad(){return le},get ltrim(){return ge},get mean(){return Fe},get merge(){return j},get mergeNames(){return Ye},get numToStr(){return be},get parseIntlNumber(){return nt},get parseNumber(){return tt},get parsePercent(){return Xe},get parseString(){return et},get pickOne(){return Ae},get pluck(){return X},get pluralSuffix(){return ce},get promisify(){return R},get quicksort(){return Ne},get quicksortPartition(){return Te},get range(){return J},get reduceAsync(){return D},get regexEscape(){return P},get reorderArray(){return Ce},get repeat(){return W},get repeatString(){return se},get replaceArray(){return oe},get rpad(){return he},get rtrim(){return ye},get shuffle(){return Se},get some(){return q},get sortArrayIndex(){return ke},get sortOn(){return Ee},get splitLines(){return ue},get sum(){return Z},get toArray(){return I},get toBuffer(){return $e},get trim(){return pe},get trimQuotes(){return ot},get uniq(){return H},get uniqifyNames(){return Qe},get wildcardToRegExp(){return qe}}),n={};function r(e,t){e in n&&vt("Tried to replace a stashed variable:",e),n[e]=t}function i(e){if(e in n!=!1)return n[e]}function a(){n={}}var o=Object.freeze({__proto__:null,clearStash:a,getStashedVar:i,stashVar:r}),s="object"==typeof window&&window.modules?function(e){return window.modules[e]}:"function"==typeof require?require:function(){},u=void 0!==ne?ne:s("buffer").Buffer,c=0;function f(e){return(e||"__id_")+ ++c}function l(e){return"function"==typeof e}function h(e){return!!e&&l(e.then)}function p(e){return e===Object(e)}function d(e,t,n){return e<t?t:e>n?n:e}function g(e){return Array.isArray(e)}function m(e){return null!=e&&e.constructor==Number}function y(e){return m(e)&&!isNaN(e)}function v(e){return y(e)&&e!==1/0&&e!==-1/0}function b(e){return m(e)&&e>=0}function _(e){return m(e)&&(0|e)===e}function x(e){return e%2==0}function w(e){return e%2==1}function S(e){return null!=e&&e.toString===String.prototype.toString}function A(e){return!!e&&e.getTime===Date.prototype.getTime}function E(e){return!0===e||!1===e}function M(e){return A(e)?e.toISOString().replace(":00.000Z","Z"):""}function I(e){var t;k(e)||vt("toArray() requires an array-like object");try{t=Array.prototype.slice.call(e,0)}catch(i){t=[];for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}return t}function k(e){return!!e&&(!!g(e)||!S(e)&&(0===e.length||e.length>0))}function C(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")}function P(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var O={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function N(e){return String(e).replace(/[&<>"'/]/g,function(e){return O[e]})}function T(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t]||{};for(var i in r)i in e==!1&&r.hasOwnProperty(i)&&(e[i]=r[i])}return e}function L(e){var t,n,r,i=e||{},a=arguments.length;for(n=1;n<a;n++)for(t in r=arguments[n]||{})r.hasOwnProperty(t)&&(i[t]=r[t]);return i}function z(e,t){var n=function(){this.__super__==n&&(this.__super__=t.prototype.__super__,t.apply(this,arguments),delete this.__super__)};n.prototype=t.prototype||t,e.prototype=L(new n,e.prototype),e.prototype.constructor=e,e.prototype.__super__=n}function R(e){return function(){var t=I(arguments);return new Promise((n,r)=>{t.push(function(e,t){e?r(e):n(t)}),e.apply(this,t)})}}function D(e,t,n,r){var i="undefined"==typeof setImmediate?setTimeout:setImmediate,a=0;!function t(o,s){if(o)return r(o,null);i(function(){a<e.length==!1?r(null,s):n(s,e[a++],t)},0)}(null,t)}function j(e,t){g(e)&&g(t)||vt("Usage: merge(destArray, srcArray);");for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e}function F(e,t){var n=te(t);return e.filter(function(e){return!Object.prototype.hasOwnProperty.call(n,e)})}function U(e,t){return e.filter(function(e){return t.includes(e)})}function B(e,t){for(var n=t!=t,r=0,i=e.length||0;r<i;r++){if(e[r]===t)return r;if(n&&e[r]!=e[r])return r}return-1}function G(e,t){return S(e)?-1!=e.indexOf(t):k(e)?-1!=B(e,t):void vt("Expected Array or String argument")}function q(e,t){return e.reduce(function(e,n){return e||t(n)},!1)}function V(e,t){return e.reduce(function(e,n){return e&&t(n)},!0)}function $(e,t,n){var r=e.filter(t,n);return 0===r.length?null:r[0]}function J(e,t,n){for(var r=[],i=void 0===t?0:t,a=void 0===n?1:n;e--;)r.push(i),i+=a;return r}function W(e,t){for(var n,r=[],i=0;i<e;i++)void 0!==(n=t(i))&&(r[i]=n);return r.length>0?r:void 0}function Z(e,t){k(e)||vt("sum() expects an array, received:",e);for(var n,r=0,i=0,a=0,o=e.length;a<o;a++)(n=e[a])?r+=n:isNaN(n)&&i++;return t&&(t.nan=i),r}function Y(e){for(var t,n=1/0,r=-1/0,i=0,a=0,o=e.length;a<o;a++)(t=e[a])!=t&&i++,t<n&&(n=t),t>r&&(r=t);return{min:n,max:r,nan:i}}function H(e){for(var t,n=new Set,r=[],i=0,a=e.length;i<a;i++)t=e[i],n.has(t)||(r.push(t),n.add(t));return r}function X(e,t){return e.map(function(e){return e[t]})}function K(e){return e.reduce(function(e,t){return e[t]=t in e?e[t]+1:1,e},{})}function Q(e,t){return e.reduce(function(e,n){return e[n[t]]=n,e},{})}function ee(e,t){return e.reduce(function(e,n){var r=n[t];return r in e?e[r].push(n):e[r]=[n],e},{})}function te(e,t){var n=arguments.length>1;return e.reduce(function(e,r){return e[r]=!n||t,e},{})}function re(e,t,n){if(!k(e))throw new Error("#forEach() takes an array-like argument. "+e);for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r)}function ie(e,t,n){Object.keys(e).forEach(function(r){t.call(n,e[r],r)})}function ae(e,t){for(var n=0,r=e.length;n<r;n++)e[n]=t;return e}function oe(e,t){e.splice(0,e.length);for(var n=0,r=t.length;n<r;n++)e.push(t[n])}function se(e,t){for(var n="",r=0;r<t;r++)n+=e;return n}function ue(e){return e.split(/\r?\n/)}function ce(e){return 1!=e?"s":""}function fe(e,t){return-1!==e.indexOf(t,e.length-t.length)}function le(e,t,n){return se(n=n||" ",t-(e=String(e)).length)+e}function he(e,t,n){return n=n||" ",(e=String(e))+se(n,t-e.length)}function pe(e){return ge(ye(e))}var de=/^\s+/;function ge(e){return e.replace(de,"")}var me=/\s+$/;function ye(e){return e.replace(me,"")}function ve(e){for(var t="",n="-"==e[0]?1:0,r=e.indexOf("."),i=e.length,a=(-1==r?i:r)-3;a>n;)t=","+e.substring(a,i)+t,i=a,a-=3;return e.substring(0,i)+t}function be(e,t){return t>=0?e.toFixed(t):String(e)}function _e(e){return e+""}function xe(e){return'"'+_e(e).replace(".",",")+'"'}function we(e,t,n,r){var i;return isNaN(e)?i=n||"-":(i=ve(i=be(e,t)),r&&parseFloat(i)>0&&(i="+"+i)),i}function Se(e){var t,n,r;for(n=e.length-1;n>0;n--)r=Math.floor(Math.random()*(n+1)),t=e[n],e[n]=e[r],e[r]=t}function Ae(e){return e[Math.floor(Math.random()*e.length)]}function Ee(e){for(var t=[],n=1;n<arguments.length;n+=2)t.push(Pe(arguments[n],arguments[n+1]));return e.sort(function(e,n){for(var r=0,i=0,a=t.length;i<a&&0===r;)r=t[i](e,n),i++;return r}),e}function Me(e,t){var n=Oe(t);return Array.prototype.sort.call(e,n),e}function Ie(e,t){var n=J(e.length);return ke(n,e,t),n}function ke(e,t,n){var r=Oe(n);e.sort(function(e,n){var i=r(t[e],t[n]);return i>0||0===i&&e>n?1:-1})}function Ce(e,t){for(var n=t.length,r=[],i=0;i<n;i++){var a=t[i];(a<0||a>=n)&&vt("Out-of-bounds array idx"),r[i]=e[a]}oe(e,r)}function Pe(e,t){var n=Oe(t);return function(t,r){return n(t[e],r[e])}}function Oe(e){return e=!1!==e&&"descending"!=e,function(t,n){var r=0;return null==n?r=null==t?0:-1:null==t?r=1:t<n?r=e?-1:1:t>n?r=e?1:-1:t!=t?r=1:n!=n&&(r=-1),r}}function Ne(e,t){return Te(e,0,e.length-1),!1===t&&Array.prototype.reverse.call(e),e}function Te(e,t,n){for(var r,i,a=t,o=n;a<n;){for(r=e[t+n>>1];a<=o;){for(;e[a]<r;)a++;for(;e[o]>r;)o--;a<=o&&(i=e[a],e[a]=e[o],e[o]=i,a++,o--)}t<o&&Te(e,t,o),t=a,o=n}}function Le(e,t){if(isNaN(t))return e.length;for(var n=1,r=0,i=e.length;r<i;r++)t>e[r]&&n++;return n}function ze(e,t){return Re(e,Math.ceil((1-t)*e.length))}function Re(e,t){(!e.length||t<1||t>e.length)&&vt("[findValueByRank()] invalid input");for(var n,r,i,a,o=(t=d(0|t,1,e.length))-1,s=0,u=e.length-1;s<u;){i=e[o],n=s,r=u;do{for(;e[n]<i;)n++;for(;i<e[r];)r--;n<=r&&(a=e[n],e[n]=e[r],e[r]=a,n++,r--)}while(n<=r);r<o&&(s=n),o<n&&(u=r)}return e[o]}function De(e){return je(e,.5)}function je(e,t){var n=e.length,r=Math.floor((n-1)*t),i=Math.ceil((n-1)*t);if(r<0||i>=n)return NaN;var a=Re(e,r+1);return r==i?a:(a*(i/(n-1)-t)+Re(e,i+1)*(t-r/(n-1)))*(n-1)}function Fe(e){for(var t,n=0,r=NaN,i=0,a=e.length;i<a;i++)t=e[i],isNaN(t)||(r=1==++n?t:t/n+(n-1)/n*r);return r}function Ue(e){return Ge(e).apply(null,Array.prototype.slice.call(arguments,1))}function Be(e,t){var n,r,i,a=t[1],o=t[2],s=t[3]?parseInt(t[3].substr(1)):void 0,u=t[4],c="s"==u,f="x"==u||"X"==u,l=!c,h="",p=0,d=!1,g=!1;if(c?n=String(e):f?(n=e.toString(16),"X"==u&&(n=n.toUpperCase())):l&&("-"==(n=be(e,s))[0]&&(g=!0,n=n.substr(1)),d=0==parseFloat(n),-1==a.indexOf("'")&&-1==a.indexOf(",")||(n=ve(n)),d||(g?h="−":-1!=a.indexOf("+")&&(h="+"))),o){var m=n.length+h.length,y=parseInt(o,10);m<y&&(p=y-m,i=se(r=-1==a.indexOf("0")?" ":"0",p))}return n=0==p?h+n:"0"==r?h+i+n:i+h+n}function Ge(e){for(var t,n=/%([',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g,r=[],i=[],a=0,o="",s=n.exec(e);s;)t=e.substring(a,n.lastIndex-s[0].length),"%%"==s[0]?o+=t+"%":(r.push(o+t),o="",i.push(s)),a=n.lastIndex,s=n.exec(e);return r.push(o+e.substr(a)),function(){var t=r[0],n=arguments.length;n!=i.length&&vt("[format()] Data does not match format string; format:",e,"data:",arguments);for(var a=0;a<n;a++)t+=Be(arguments[a],i[a])+r[a+1];return t}}function qe(e){var t=e.split("*").map(function(e){return P(e)}).join(".*");return new RegExp("^"+t+"$")}function Ve(e,t){return _(e)?u.allocUnsafe?u.allocUnsafe(e):new u(e):u.from&&u.allocUnsafe?u.from(e,t):new u(e,t)}function $e(e){return e instanceof u?e:e instanceof ArrayBuffer?u.from(e):e instanceof Uint8Array?u.from(e.buffer,e.byteOffset,e.byteLength):void vt("Unexpected argument type")}function Je(e,t){var n,r=0,i=t>=1?t:1.2;return function(t){return t>r&&(r=Math.ceil(t*i),n=e?new e(r):Ve(r)),n}}function We(e,t,n,r,i,a){var o,s=e==n||e.buffer&&e.buffer==n.buffer,u=1,c=0;if(a&&(s&&vt("copy error"),u=-1,c=i-1),s&&r>t)for(o=i-1;o>=0;o--)n[r+o]=e[t+o];else for(o=0;o<i;o++,c+=u)n[o+r]=e[t+c]}function Ze(e,t,n){var r=Math.max(e.length,t),i=n||e.length,a=new e.constructor(r);return We(e,0,a,0,i),a}function Ye(e,t){var n;return e&&t&&(n=He(e,t).replace(/[-_]$/,"")),n||""}function He(e,t){for(var n=0,r=e.length;n<r&&e[n]===t[n];n++);return e.substr(0,n)}function Xe(e){var t,n=String(e);return(t=n.indexOf("%")>0?Number(n.replace("%",""))/100:Number(n))>=0&&t<=1||bt(Ue("Invalid percentage: %s",n)),t}function Ke(e,t){var n=String(t);return/[0-9]$/.test(e)&&(n="-"+n),e+n}function Qe(e,t){var n=K(e),r=t||Ke,i=[];return e.forEach(function(e){for(var t,a=0,o=e;i.indexOf(o)>-1||o==e&&n[o]>1||o!=e&&n[o]>0;){if(a++,!(t=r(e,a))||t==o)throw new Error("Naming error");o=t}i.push(o)}),i}function et(e){return e||""}function tt(e){return rt(e,it)}function nt(e){return rt(e,at)}function rt(e,t){var n=String(e).trim(),r=n?Number(t(n)):NaN;return isNaN(r)?null:r}function it(e){return e.indexOf(",")>0?e.replace(/,([0-9]{3})/g,"$1"):e}function at(e){return(e=e.replace(/[ .]([0-9]{3})/g,"$1")).replace(",",".")}function ot(e){var t,n,r=e.length;return r>=2&&(t=e.charAt(0),n=e.charAt(r-1),('"'==t&&'"'==n&&!/[^\\]"./.test(e)||"'"==t&&"'"==n&&!/[^\\]'./.test(e))&&(e=(e=e.substr(1,r-2)).replace('"'==t?/\\(?=")/g:/\\(?=')/g,""))),e}var st,ut,ct,ft,lt=!1,pt=!1,dt=function(){throw new Lt(Dt(arguments))};function gt(){function e(){Ft(arguments)}St(e,function(){var e=t.toArray(arguments).join(" ");throw new Error(e)},function(){throw new Tt(Dt(arguments))},e)}function mt(){lt=!0}function yt(){return!!lt}function vt(){st.apply(null,t.toArray(arguments))}function bt(){ut.apply(null,jt(arguments))}function _t(){dt.apply(null,t.toArray(arguments))}function xt(){ct.apply(null,jt(arguments))}function wt(){ft.apply(null,jt(arguments))}function St(e,t,n,r){ct=e,st=t,ut=n,ft=r}function At(e){var t="string"==typeof e.stack?e.stack.split(/\n\s*\n/):[];return t.length,"\nError details:\n"+t[0]}function Et(){pt=!0,ct(t.toArray(arguments)),pt=!1}function Mt(){It()&&xt.apply(null,arguments)}function It(){return i("VERBOSE")}function kt(){return i("DEBUG")}function Ct(){kt()&&Ft(arguments)}function Pt(e){kt()&&console.time(e)}function Ot(e){kt()&&console.timeEnd(e)}function Nt(e){var n;lt&&(t.isString(e)&&(e=new Tt(e)),"NonFatalError"==e.name?console.error(jt([e.message]).join(" ")):"UserError"==e.name?(n=e.message,/Error/.test(n)||(n="Error: "+n),console.error(jt([n]).join(" ")),console.error("Run mapshaper -h to view help")):console.error(e))}function Tt(e){var t=new Error(e);return t.name="UserError",t}function Lt(e){var t=new Error(e);return t.name="NonFatalError",t}function zt(e,t){var n=e.reduce(function(e,t){return t.map(function(t,n){return e?Math.max(e[n],t.length):t.length})},null);return e.map(function(e){return e=e.map(function(e,r){return(t&&"right"==t[r]?e.padStart:e.padEnd).bind(e)(n[r]," ")})," "+e.join(" ")}).join("\n")}function Rt(e,n){var r=e.reduce(function(e,t){return Math.max(e,t.length)},0)+2,i=Math.floor((n||80)/r)||1;return e.reduce(function(e,n,a){var o=a%i;return a>0&&0===o&&(e+="\n"),o<i-1&&(n=t.rpad(n,r-2," ")),e+" "+n},"")}function Dt(e){return t.toArray(e).join(" ")}function jt(e){var n=t.toArray(e),r=i("current_command");return r&&"help"!=r&&n.unshift("["+r+"]"),n}function Ft(e){if(lt&&!i("QUIET")&&t.isArrayLike(e)){var n=Dt(e);pt?console.log(n):console.error(n)}}function Ut(e,t){return t=t||80,e.length>t&&(e=e.substring(0,t-3).trimEnd()+"..."),e}gt();var Bt=Object.freeze({__proto__:null,NonFatalError:Lt,UserError:Tt,debug:Ct,enableLogging:mt,error:vt,formatColumns:zt,formatLogArgs:Dt,formatStringsAsGrid:Rt,getErrorDetail:At,getLoggingSetter:function(){var e=st,t=ut,n=ct,r=ft;return function(){St(n,e,t,r)}},interrupt:_t,logArgs:Ft,loggingEnabled:yt,message:xt,print:Et,printError:Nt,setLoggingForCLI:gt,setLoggingFunctions:St,stop:bt,time:Pt,timeEnd:Ot,truncateString:Ut,useDebug:kt,useVerbose:It,verbose:Mt,warn:wt});function Gt(){this.mx=this.my=1,this.bx=this.by=0}function qt(){arguments.length>0&&this.setBounds.apply(this,arguments)}function Vt(e){new qt;for(var t,n,r,i=1/0,a=1/0,o=-1/0,s=-1/0,u=0,c=e.length;u<c;u++)for(var f=0,l=(t=e[u])?t.length:0;f<l;f++)(n=t[f][0])>o&&(o=n),n<i&&(i=n),(r=t[f][1])>s&&(s=r),r<a&&(a=r);return t?new qt(i,a,o,s):new qt}function $t(e,t){var n,r=e?e.length:0;t||(t=new qt);for(var i=0;i<r;i++)n=e[i],t.mergePoint(n[0],n[1]);return t}function Jt(e){var t=[];return Wt(e.shapes,function(e){t.push(e)}),t}function Wt(e,t){var n,r,i,a,o;for(n=0,r=e.length;n<r;n++)for(i=0,a=(o=e[n])?o.length:0;i<a;i++)t(o[i],n)}Gt.prototype.isNull=function(){return!this.mx||!this.my||isNaN(this.bx)||isNaN(this.by)},Gt.prototype.invert=function(){var e=new Gt;return e.mx=1/this.mx,e.my=1/this.my,e.bx=-this.bx/this.mx,e.by=-this.by/this.my,e},Gt.prototype.transform=function(e,t,n){return(n=n||[])[0]=e*this.mx+this.bx,n[1]=t*this.my+this.by,n},Gt.prototype.toString=function(){return JSON.stringify(Object.assign({},this))},qt.from=function(){var e=new qt;return e.setBounds.apply(e,arguments)},qt.prototype.toString=function(){return JSON.stringify({xmin:this.xmin,xmax:this.xmax,ymin:this.ymin,ymax:this.ymax})},qt.prototype.toArray=function(){return this.hasBounds()?[this.xmin,this.ymin,this.xmax,this.ymax]:[]},qt.prototype.hasBounds=function(){return this.xmin<=this.xmax&&this.ymin<=this.ymax},qt.prototype.sameBounds=qt.prototype.equals=function(e){return e&&this.xmin===e.xmin&&this.xmax===e.xmax&&this.ymin===e.ymin&&this.ymax===e.ymax},qt.prototype.width=function(){return this.xmax-this.xmin||0},qt.prototype.height=function(){return this.ymax-this.ymin||0},qt.prototype.area=function(){return this.width()*this.height()||0},qt.prototype.empty=function(){return this.xmin=this.ymin=this.xmax=this.ymax=void 0,this},qt.prototype.setBounds=function(e,n,r,i){return 1==arguments.length&&(t.isArrayLike(e)?(n=e[1],r=e[2],i=e[3],e=e[0]):(n=e.ymin,r=e.xmax,i=e.ymax,e=e.xmin)),this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i,(e>r||n>i)&&this.update(),this},qt.prototype.centerX=function(){return.5*(this.xmin+this.xmax)},qt.prototype.centerY=function(){return.5*(this.ymax+this.ymin)},qt.prototype.containsPoint=function(e,t){return e>=this.xmin&&e<=this.xmax&&t<=this.ymax&&t>=this.ymin},qt.prototype.containsBufferedPoint=qt.prototype.containsCircle=function(e,t,n){return e+n>this.xmin&&e-n<this.xmax&&t-n<this.ymax&&t+n>this.ymin},qt.prototype.intersects=function(e){return e.xmin<=this.xmax&&e.xmax>=this.xmin&&e.ymax>=this.ymin&&e.ymin<=this.ymax},qt.prototype.contains=function(e){return e.xmin>=this.xmin&&e.ymax<=this.ymax&&e.xmax<=this.xmax&&e.ymin>=this.ymin},qt.prototype.shift=function(e,t){this.setBounds(this.xmin+e,this.ymin+t,this.xmax+e,this.ymax+t)},qt.prototype.padBounds=function(e,t,n,r){this.xmin-=e,this.ymin-=t,this.xmax+=n,this.ymax+=r},qt.prototype.scale=function(e,t){var n=.5*(this.xmax-this.xmin),r=.5*(this.ymax-this.ymin),i=e-1,a=void 0===t?i:t-1;return this.xmin-=n*i,this.ymin-=r*a,this.xmax+=n*i,this.ymax+=r*a,this},qt.prototype.cloneBounds=qt.prototype.clone=function(){return new qt(this.xmin,this.ymin,this.xmax,this.ymax)},qt.prototype.clearBounds=function(){this.setBounds(new qt)},qt.prototype.mergePoint=function(e,t){void 0===this.xmin?this.setBounds(e,t,e,t):(e<this.xmin?this.xmin=e:e>this.xmax&&(this.xmax=e),t<this.ymin?this.ymin=t:t>this.ymax&&(this.ymax=t))},qt.prototype.fillOut=function(e,t,n){arguments.length<3&&(t=.5,n=.5);var r,i=this.width(),a=this.height(),o=i/a;return isNaN(e)||e<=0||(o<e?(r=a*e-i,this.xmin-=(1-t)*r,this.xmax+=t*r):(r=i/e-a,this.ymin-=(1-n)*r,this.ymax+=n*r)),this},qt.prototype.update=function(){var e;this.xmin>this.xmax&&(e=this.xmin,this.xmin=this.xmax,this.xmax=e),this.ymin>this.ymax&&(e=this.ymin,this.ymin=this.ymax,this.ymax=e)},qt.prototype.transform=function(e){return this.xmin=this.xmin*e.mx+e.bx,this.xmax=this.xmax*e.mx+e.bx,this.ymin=this.ymin*e.my+e.by,this.ymax=this.ymax*e.my+e.by,this.update(),this},qt.prototype.getTransform=function(e,t){var n=new Gt;return n.mx=e.width()/this.width()||1,n.bx=e.xmin-n.mx*this.xmin,t?(n.my=-e.height()/this.height()||1,n.by=e.ymax-n.my*this.ymin):(n.my=e.height()/this.height()||1,n.by=e.ymin-n.my*this.ymin),n},qt.prototype.mergeCircle=function(e,t,n){n<0&&(n=-n),this.mergeBounds([e-n,t-n,e+n,t+n])},qt.prototype.mergeBounds=function(e){var t,n,r,i;return e instanceof qt?(t=e.xmin,n=e.ymin,r=e.xmax,i=e.ymax):4==arguments.length?(t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3]):4==e.length?(t=e[0],n=e[1],r=e[2],i=e[3]):vt("Bounds#mergeBounds() invalid argument:",e),void 0===this.xmin?this.setBounds(t,n,r,i):(t<this.xmin&&(this.xmin=t),n<this.ymin&&(this.ymin=n),r>this.xmax&&(this.xmax=r),i>this.ymax&&(this.ymax=i)),this};var Zt=Object.freeze({__proto__:null,countPointsInLayer:function(e){var t=0;return Si(e)&&Wt(e.shapes,function(){t++}),t},forEachPoint:Wt,getPointBounds:Vt,getPointFeatureBounds:$t,getPointsInLayer:Jt});function Yt(e){return e>=0?e:~e}function Ht(e,t,n,r){var i,a,o,s,u,c,f=0|n,l=isNaN(r)?e.length-f:r+f;for(l>0&&(o=u=e[f],s=c=t[f]),f++;f<l;f++)(i=e[f])<o&&(o=i),i>u&&(u=i),(a=t[f])<s&&(s=a),a>c&&(c=a);return[o,s,u,c]}function Xt(e,t){for(var n,r=0,i=t.length-1;r<i;)e<t[n=Math.ceil((r+i)/2)]?i=n-1:r=n;return r}function Kt(e,n,r){var i,a,o,s=e.getVertexData(),u=s.nn,c=s.xx.length,f=0;if(s.xx.buffer.byteLength>=8*s.xx.length+8?(i=new Float64Array(s.xx.buffer,0,c+1),a=new Float64Array(s.yy.buffer,0,c+1)):(i=new Float64Array(new ArrayBuffer(8*(c+50)),0,c+1),a=new Float64Array(new ArrayBuffer(8*(c+50)),0,c+1)),e.isFlat()||(o=new Float64Array(new ArrayBuffer(8*(c+1)),0,c+1)),n<0||n>c)vt("Out-of-range vertex insertion index:",n);else if(n==c)u[u.length-1]++;else for(var l=0;l<u.length;l++)if((f+=u[l])>=n){u[l]=u[l]+1;break}t.copyElements(s.xx,0,i,0,n),t.copyElements(s.yy,0,a,0,n),t.copyElements(s.xx,n,i,n+1,c-n),t.copyElements(s.yy,n,a,n+1,c-n),i[n]=r[0],a[n]=r[1],o&&(o[n]=1/0,t.copyElements(s.zz,0,o,0,n),t.copyElements(s.zz,n,o,n+1,c-n)),e.updateVertexData(u,i,a,o)}function Qt(e,t){for(var n=0,r=0,i=e.length;r<i;r++)e[r]>=t&&n++;return n}function en(e,t){e.zz||vt("Expected simplification data");for(var n,r=e.xx,i=e.yy,a=e.zz,o=Qt(a,t),s=e.nn.length,u=new Float64Array(o),c=new Float64Array(o),f=new Float64Array(o),l=new Int32Array(s),h=0,p=0,d=0;d<s;d++){n=0;for(var g=h+e.nn[d];h<g;h++)a[h]>=t&&(u[p]=r[h],c[p]=i[h],f[p]=a[h],p++,n++);1==n&&vt("Collapsed arc"),l[d]=n}return{xx:u,yy:c,zz:f,nn:l}}var tn=Object.freeze({__proto__:null,absArcId:Yt,appendEmptyArc:function(e){var n=e.getVertexData(),r=t.extendBuffer(n.nn,n.nn.length+1,n.nn.length);e.updateVertexData(r,n.xx,n.yy,n.zz)},appendVertex:function(e,t){var n=e.getPointCount();Kt(e,n,t)},calcArcBounds:Ht,countFilteredVertices:Qt,deleteLastArc:function(e){var t=e.getVertexData(),n=e.size()-1,r=t.nn[n],i=t.xx.length,a=e.getRetainedInterval(),o=new Float64Array(t.xx.buffer,0,i-r),s=new Float64Array(t.yy.buffer,0,i-r),u=new Int32Array(t.nn.buffer,0,e.size()-1),c=e.isFlat()?null:new Float64Array(t.zz.buffer,0,i-r);e.updateVertexData(u,o,s,c),e.setRetainedInterval(a)},deleteVertex:function(e,n){for(var r=e.getVertexData(),i=r.nn,a=r.xx.length,o=new Float64Array(r.xx.buffer,0,a-1),s=new Float64Array(r.yy.buffer,0,a-1),u=e.isFlat()?null:new Float64Array(r.zz.buffer,0,a-1),c=e.getRetainedInterval(),f=0,l=!1,h=0;h<i.length;h++)(f+=i[h])>=n&&!l&&(i[h]=i[h]-1,l=!0);t.copyElements(r.xx,0,o,0,n),t.copyElements(r.yy,0,s,0,n),t.copyElements(r.xx,n+1,o,n,a-n-1),t.copyElements(r.yy,n+1,s,n,a-n-1),u&&(t.copyElements(r.zz,0,u,0,n),t.copyElements(r.zz,n+1,u,n,a-n-1)),e.updateVertexData(i,o,s,u),e.setRetainedInterval(c)},filterVertexData:en,findArcIdFromVertexId:Xt,getUnfilteredArcCoords:function(e,t){for(var n=t.getVertexData(),r=[],i=n.ii[e],a=n.nn[e],o=0;o<a;o++)r.push([n.xx[i+o],n.yy[i+o]]);return r},getUnfilteredArcLength:function(e,t){return t.getVertexData().nn[e]},insertVertex:Kt}),nn=6378137,rn=nn,an=Math.PI/180,on=180/Math.PI;function sn(e,t,n,r,i,a){var o=e-r,s=t-i,u=n-a;return Math.sqrt(o*o+s*s+u*u)}function un(e,t,n,r){var i=e-n,a=t-r;return i*i+a*a}function cn(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}function fn(e,t,n,r,i,a){var o=e-r,s=t-i,u=n-a;return o*o+s*s+u*u}function ln(e){for(var t=2*Math.PI;e<0;)e+=t;for(;e>=t;)e-=t;return e}function hn(e,t,n,r){var i=Math.PI/180;e*=i,n*=i,t*=i,r*=i;var a=Math.sin(n-e)*Math.cos(r),o=Math.cos(t)*Math.sin(r)-Math.sin(t)*Math.cos(r)*Math.cos(n-e);return Math.atan2(a,o)}function pn(e,t,n){var r;e*=an,t*=an,r=Math.cos(t),n[0]=Math.cos(e)*r*rn,n[1]=Math.sin(e)*r*rn,n[2]=Math.sin(t)*rn}function dn(e,t,n,r){var i=n-e,a=r-t,o=Math.sin(a/2)*Math.sin(a/2)+Math.cos(t)*Math.cos(r)*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))}function gn(e,t,n,r){var i=Math.PI/180;return dn(e*i,t*i,n*i,r*i)*rn}function mn(e,t,n,r,i,a){var o=e*r-e*a+n*a-n*t+i*t-i*r;return o*o}function yn(e,t,n){var r;if(0===n)r=e;else if(e>=t+n)r=t;else if(t>=e+n)r=e;else{var i=e+n-t;r=e-i*i/n*.25}return r<0&&(r=0),r}function vn(e,t,n,r,i,a){var o=un(n,r,i,a),s=((e-n)*(i-n)+(t-r)*(a-r))/o;return 0===o?un(e,t,n,r):(s<0&&(s=0),s>1&&(s=1),un(e,t,n+s*(i-n),r+s*(a-r)))}var bn,_n=Object.freeze({__proto__:null,D2R:an,R:rn,R2D:on,bearing:hn,bearing2D:function(e,t,n,r){var i=Math.PI/2-Math.atan2(r-t,n-e);return i>Math.PI?i-2*Math.PI:i},containsBounds:function(e,t){return e[0]<=t[0]&&e[2]>=t[2]&&e[1]<=t[1]&&e[3]>=t[3]},convLngLatToSph:function(e,t,n,r,i){for(var a=[],o=0,s=e.length;o<s;o++)pn(e[o],t[o],a),n[o]=a[0],r[o]=a[1],i[o]=a[2]},cosine:function(e,t,n,r,i,a){var o=cn(e,t,n,r)*cn(n,r,i,a),s=0;return o>0&&((s=((e-n)*(i-n)+(t-r)*(a-r))/o)>1?s=1:s<-1&&(s=-1)),s},cosine3D:function(e,t,n,r,i,a,o,s,u){var c=sn(e,t,n,r,i,a)*sn(r,i,a,o,s,u),f=0;return c>0&&((f=((e-r)*(o-r)+(t-i)*(s-i)+(n-a)*(u-a))/c)>1?f=1:f<-1&&(f=-1)),f},degreesToMeters:function(e){return e*an*rn},distance2D:cn,distance3D:sn,distanceSq:un,distanceSq3D:fn,greatCircleDistance:gn,innerAngle2:function(e,t,n,r,i,a){var o=Math.atan2(t-r,e-n),s=Math.atan2(a-r,i-n),u=Math.abs(o-s);return u>Math.PI&&(u=2*Math.PI-u),u},lngLatToXYZ:pn,pointSegDistSq:function(e,t,n,r,i,a){return yn(un(e,t,n,r),un(e,t,i,a),un(n,r,i,a))},pointSegDistSq2:vn,pointSegDistSq3D:function(e,t,n,r,i,a,o,s,u){return yn(fn(e,t,n,r,i,a),fn(e,t,n,o,s,u),fn(r,i,a,o,s,u))},signedAngle:function(e,t,n,r,i,a){if(e==n&&t==r||n==i&&r==a)return NaN;var o=e-n,s=t-r,u=i-n,c=a-r,f=o*u+s*c,l=o*c-s*u;return ln(Math.atan2(l,f))},signedAngleSph:function(e,t,n,r,i,a){if(e==n&&t==r||n==i&&r==a)return NaN;var o=hn(n,r,e,t),s=hn(n,r,i,a);return ln(2*Math.PI+o-s)},sphericalDistance:dn,standardAngle:ln,triangleArea:function(e,t,n,r,i,a){return Math.abs(((t-a)*(n-i)+(r-a)*(i-e))/2)},triangleArea3D:function(e,t,n,r,i,a,o,s,u){return.5*Math.sqrt(mn(e,t,r,i,o,s)+mn(e,n,r,a,o,u)+mn(t,n,i,a,s,u))},xyzToLngLat:function(e,t,n,r){var i=sn(0,0,0,e,t,n),a=Math.asin(n/i)/an,o=Math.atan2(t/i,e/i)/an;r[0]=o,r[1]=a}});function xn(e,t,n,r){var i,a,o,s,u,c,f,l,h,p,d=r.getShapeIter(n),g=1/0;for(d.hasNext()&&(a=c=l=d.x,o=f=h=d.y);d.hasNext();)(p=vn(e,t,a,o,s=d.x,u=d.y))<g&&(g=p,i=d._ids[d._i],c=a,f=o,l=s,h=u),a=s,o=u;return g==1/0?{distance:1/0}:{segment:[[c,f],[l,h]],distance:Math.sqrt(g),arcId:i}}function wn(e,t,n,r){return(n||[]).reduce(function(n,i){var a=xn(e,t,i,r);return!n||a.distance<n.distance?a:n},null)||{distance:1/0,arcId:-1,segment:null}}function Sn(e,t){var n=t.getShapeIter(e);if(!n.hasNext())return null;for(var r=n.x,i=n.y,a=0,o=0,s=0;n.hasNext();)a++,o+=n.x,s+=n.y;return 0!==a&&n.x===r&&n.y===i||(o+=r,s+=i,a++),{x:o/a,y:s/a}}function An(e,t){var n=0;return(e||[]).reduce(function(e,r){var i=t.getSimpleShapeBounds(r).area();return i>n&&(n=i,e=r),e},null)}bn=function(){var e,t;function n(n,r,i,a){e+=t(i[n],a[n],i[r],a[r])}return function(r,i,a){a&&i.isPlanar()&&vt("Expected lat-long coordinates"),t=a?gn:cn,e=0;for(var o=0,s=r.length;o<s;o++)i.forEachArcSegment(r[o],n);return e}}();var En=Object.freeze({__proto__:null,get calcPathLen(){return bn},countVerticesInPath:function(e,t){for(var n=t.getShapeIter(e),r=0;n.hasNext();)r++;return r},getAvgPathXY:Sn,getMaxPath:An,getPathBounds:function(e){for(var t=new qt,n=0,r=e.length;n<r;n++)t.mergePoint(e[n][0],e[n][1]);return t},getPointToPathDistance:function(e,t,n,r){return xn(e,t,n,r).distance},getPointToPathInfo:xn,getPointToShapeDistance:function(e,t,n,r){var i=wn(e,t,n,r);return i?i.distance:1/0},getPointToShapeInfo:wn,pathIsClosed:function(e,t){var n=e[0],r=e[e.length-1],i=t.getVertex(n,0),a=t.getVertex(r,-1);return i.x===a.x&&i.y===a.y}});function Mn(e,t){var n,r,i,a,o,s,u,c,f=t.getShapeIter(e),l=0,h=0,p=0;if(!f.hasNext())return null;for(i=0,a=0,n=-f.x,r=-f.y;f.hasNext();)o=i,s=a,i=f.x+n,l+=u=o*(a=f.y+r)-s*i,h+=u*(o+i),p+=u*(s+a);return 0===(c=l/2)?Sn(e,t):{x:h/(6*c)-n,y:p/(6*c)-r}}var In=Object.freeze({__proto__:null,getPathCentroid:Mn,getShapeCentroid:function(e,t){var n=An(e,t);return n?Mn(n,t):null}});function kn(e,t,n){if(!t||!Cn(e.xmin,e.ymin,t,n))return!1;var r=!0;return t.forEach(function(t){xr(t,n,function(t,n,i,a){r=r&&!function(e,t,n){return!!n.containsPoint(e[0],e[1])||!!(fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmin,n.ymin,n.xmin,n.ymax)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmin,n.ymax,n.xmax,n.ymax)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmax,n.ymax,n.xmax,n.ymin)||fr.segmentIntersection(e[0],e[1],t[0],t[1],n.xmax,n.ymin,n.xmin,n.ymin))}([i[t],a[t]],[i[n],a[n]],e)})}),r}function Cn(e,t,n,r){var i=!1,a=!1;return!!n&&(n.forEach(function(n){var o=Pn(e,t,n,r);1==o?i=!i:-1==o&&(a=!0)}),a||i)}function Pn(e,t,n,r){var i=!1,a=!1;return xr(n,r,function(n,r,o,s){var u=On(e,t,o[n],s[n],o[r],s[r]);1==u?i=!i:isNaN(u)&&(a=!0)}),a?-1:i?1:0}function On(e,t,n,r,i,a){var o=Nn(e,t,n,r,i,a);return o!=o?NaN:o==-1/0?0:1}function Nn(e,t,n,r,i,a){var o,s=-1/0;return e<n&&e<i||e>n&&e>i||t>r&&t>a||(e===n||e===i?e===n&&e===i?t!=r&&t!=a&&t>r==t>a||(s=NaN):e===n?t===r?s=NaN:i<n&&t<r&&(s=r):t===a?s=NaN:n<i&&t<a&&(s=a):(o=function(e,t,n,r,i){return n+(e-t)*(i-n)/(r-t)}(e,n,r,i,a),o>t?s=o:o==t&&(s=NaN))),s}function Tn(e,t){return(t.isPlanar()?Rn:Ln)(e,t)}function Ln(e,t,n){return zn(t.getShapeIter(e),n)}function zn(e,t){var n,r,i,a,o=0,s=!1,u=Math.PI/180;for(t=t||nn;e.hasNext();)n=e.x*u,r=Math.sin(e.y*u),s?o+=(n-i)*(2+r+a):s=!0,i=n,a=r;return o/2*t*t}function Rn(e,t){var n,r,i,a,o,s,u=t.getShapeIter(e),c=0;if(u.hasNext())for(n=0,r=0,o=-u.x,s=-u.y;u.hasNext();)i=n,a=r,c+=(n=u.x+o)*a-i*(r=u.y+s);return c/2}function Dn(e,t){return(t.isPlanar()?jn:Fn)(e,t)}function jn(e,t){return bn(e,t,!1)}function Fn(e,t){return bn(e,t,!0)}var Un=Object.freeze({__proto__:null,calcPolsbyPopperCompactness:function(e,t){return t<=0?0:Math.abs(e)*Math.PI*4/(t*t)},calcSchwartzbergCompactness:function(e,t){return t<=0?0:2*Math.PI*Math.sqrt(Math.abs(e)/Math.PI)/t},getPathArea:Tn,getPathPerimeter:Dn,getPathWinding:function(e,t){var n=Tn(e,t);return(n>0?1:n<0&&-1)||0},getPlanarPathArea:Rn,getPlanarPathArea2:function(e){for(var t,n,r,i,a,o,s,u=0,c=0,f=e.length;c<f;c++)s=e[c],0===c?(t=0,n=0,a=-s[0],o=-s[1]):u+=(t=s[0]+a)*i-r*(n=s[1]+o),r=t,i=n;return u/2},getPlanarPathPerimeter:jn,getPlanarShapeArea:function(e,t){return(e||[]).reduce(function(e,n){return e+Rn(n,t)},0)},getRayIntersection:Nn,getShapeArea:function(e,t){return(e||[]).reduce(function(e,n){return e+Tn(n,t)},0)},getShapePerimeter:function(e,t){return(e||[]).reduce(function(e,n){return e+Dn(n,t)},0)},getSphericalPathArea:Ln,getSphericalPathArea2:zn,getSphericalPathPerimeter:Fn,getSphericalShapeArea:function(e,t,n){return t.isPlanar()&&vt("[getSphericalShapeArea()] Function requires decimal degree coordinates"),(e||[]).reduce(function(e,r){return e+Ln(r,t,n)},0)},getSphericalShapePerimeter:function(e,t){return t.isPlanar()&&vt("[getSphericalShapePerimeter()] Function requires decimal degree coordinates"),(e||[]).reduce(function(e,n){return e+Fn(n,t)},0)},testBoundsInPolygon:kn,testPointInPolygon:Cn,testPointInRing:Pn,testRayIntersection:On});function Bn(e){var t=Math.max.apply(null,e.map(Math.abs));return(t<=1?1:2**Math.ceil(Math.log2(t)))/2**51}function Gn(e,n){var r=lr(e),i=.0025*r;n>0&&(i=n,xt(t.format("Applying snapping threshold of %s -- %.6f times avg. segment length",n,n/r)));var a=qn(e,i);a>0&&e.dedupCoords(),xt(t.format("Snapped %s point%s",a,t.pluralSuffix(a)))}function qn(e,t){return t>0==!1?0:$n(Jn(e),e,t)}function Vn(e,t){return t>0==!1?0:$n(Wn(e),e,t)}function $n(e,t,n){var r=0,i=e.length,a=t.getVertexData();Zn(a.xx,e,0,i-1);for(var o=0;o<i;o++)r+=s(o,n,e,a.xx,a.yy);return r;function s(e,t,n,r,i){for(var a,o,s,u=e,c=n.length,f=r[n[e]],l=i[n[e]],h=0;++u<c&&!((o=r[a=n[u]]-f)>t);)s=i[a]-l,0===o&&0===s||o*o+s*s>t*t||(r[a]=f,i[a]=l,h++);return h}}function Jn(e){for(var t=e.getVertexData().xx.length,n=new Uint32Array(t),r=0;r<t;r++)n[r]=r;return n}function Wn(e){var t=0,n=[];return e.getVertexData().nn.forEach(function(e){e>0!=!1&&(n.push(t,t+e-1),t+=e)}),n}function Zn(e,t,n,r){if(r-n>24){for(var i,a=e[t[n+r>>1]],o=n,s=r;o<=s;){for(;e[t[o]]<a;)o++;for(;e[t[s]]>a;)s--;o<=s&&(i=t[o],t[o]=t[s],t[s]=i,o++,s--)}s>n&&Zn(e,t,n,s),o<r&&Zn(e,t,o,r)}else!function(e,t,n,r){var i,a,o;for(o=n+1;o<=r;o++){for(i=t[o],a=o-1;a>=n&&e[i]<e[t[a]];a--)t[a+1]=t[a];t[a+1]=i}}(e,t,n,r)}var Yn=Object.freeze({__proto__:null,getCoordinateIds:Jn,getEndpointIds:Wn,getHighPrecisionSnapInterval:Bn,getHighPrecisionSnapInterval_old:function(e){return 1e-14*Math.max.apply(null,e.map(Math.abs))},snapCoords:Gn,snapCoordsByInterval:qn,snapEndpointsByInterval:Vn});function Hn(e,t){var n=Math.abs(e),r=e!=n,i=(n<1e-6?n.toFixed(t):String(n)).split("."),a="0"==i[0]?"":i[0],o=2==i.length?i[1]:"";o.length<t?o=o.padEnd(t,"0"):o.length>t&&(o=o.slice(0,t));for(var s=a+o;0==s[0]&&s.length>1;)s=s.slice(1);return r&&(s="-"+s),s}function Xn(e,t){var n,r,i="-"==e[0],a=i?e.slice(1):e;return n=(r=a.length)>t?a.slice(0,r-t)+"."+a.slice(-t):r==t?"0."+a:"0."+a.padStart(t,"0"),i&&(n="-"+n),Number(n)}function Kn(){for(var e,t=1/0,n=0,r=0,i=arguments.length;r<i;r++)t=Math.min(t,Math.abs(arguments[r]));if(t>=1)n=(e=t.toFixed(1)).indexOf(".");else if(0!==t)for(e=t.toFixed(10).slice(2);"0"===e[0];)n--,e=e.slice(1);return 17-n}function Qn(e,t,n,r,i,a,o,s,u){var c,f,l=u>0?u:Bn([e,t,n,r,i,a,o,s]),h=l*l;return c=function(e,t,n,r,i,a,o,s,u){var c=[];if(tr(c,e,t,n,a,o,s,u),tr(c,e,r,i,a,o,s,u),tr(c,e,a,o,t,n,r,i),tr(c,e,s,u,t,n,r,i),0===c.length)return null;c.length>4&&Ct("Intersection detection error");return c}(h,e,t,n,r,i,a,o,s),!c&&function(e,t,n,r,i,a,o,s,u){return un(t,n,a,o)<=e||un(t,n,s,u)<=e||un(r,i,a,o)<=e||un(r,i,s,u)<=e}(h,e,t,n,r,i,a,o,s)?null:(c||(f=function(e,t,n,r,i,a,o,s,u){var c;if(u>0&&!ur(e,t,n,r,i,a,o,s))return null;if(0===u&&!function(e,t,n,r,i,a,o,s){var u=Kn(e,t,n,r,i,a,o,s),c=BigInt(Hn(e,u)),f=BigInt(Hn(t,u)),l=BigInt(Hn(n,u)),h=BigInt(Hn(r,u)),p=BigInt(Hn(i,u)),d=BigInt(Hn(a,u)),g=BigInt(Hn(o,u)),m=BigInt(Hn(s,u));return ur(c,f,l,h,p,d,g,m)}(e,t,n,r,i,a,o,s))return null;c=function(e,t,n,r,i,a,o,s){if(function(e,t,n,r,i,a,o,s){var u=n-e,c=r-t,f=o-i,l=s-a,h=u*f+c*l,p=u*u+c*c,d=f*f+l*l;if(0===p||0===d)return 0;var g,m=h/Math.sqrt(p*d);g=m>1-1e-14?0:m<1e-14-1?Math.PI:Math.acos(m);g>=Math.PI/2&&(g=Math.PI-g);return g}(e,t,n,r,i,a,o,s)<.1)return!0;var u=cn(e,t,n,r),c=cn(i,a,o,s);return(u<c?u/c:c/u||0)<.001}(e,t,n,r,i,a,o,s)?er(e,t,n,r,i,a,o,s):function(e,t,n,r,i,a,o,s){var u=ar(n-e,r-t,o-i,s-a),c=or(i,a,o,s,e,t)/u,f=[e+c*(n-e),t+c*(r-t)];if(Math.abs(u)<1e-25)return null;return f}(e,t,n,r,i,a,o,s);if(!c)return null;u>0&&function(e,t,n,r,i,a,o,s,u,c){var f=e[0],l=e[1],h=c;h=nr(e,h,f,l,t,n),h=nr(e,h,f,l,r,i),h=nr(e,h,f,l,a,o),h=nr(e,h,f,l,s,u)}(c,e,t,n,r,i,a,o,s,u);return function(e,t,n,r,i,a,o,s,u){var c=e[0],f=e[1],l=!1,h=!1;rr(c,t,r)&&(c=ir(c,t,r),l=!0);rr(c,a,s)&&(c=ir(c,a,s),h=!0);rr(f,n,i)&&(f=ir(f,n,i),l=!0);rr(f,o,u)&&(f=ir(f,o,u),h=!0);(l||h)&&Ct("Clamping a segment intersection point");e[0]=c,e[1]=f}(c,e,t,n,r,i,a,o,s),c}(e,t,n,r,i,a,o,s,l)),c||f||null)}function er(e,t,n,r,i,a,o,s){var u=Kn(e,t,n,r,i,a,o,s),c=10000000000000000n,f=BigInt(Hn(e,u)),l=BigInt(Hn(t,u)),h=BigInt(Hn(n,u)),p=BigInt(Hn(r,u)),d=BigInt(Hn(i,u)),g=BigInt(Hn(a,u)),m=BigInt(Hn(o,u)),y=BigInt(Hn(s,u)),v=ar(h-f,p-l,m-d,y-g);if(0n===v)return Ct('DIV0 error - should have been identified as collinear "touch" intersection.'),null;var b=or(d,g,m,y,f,l)*c/v,_=l*c+b*(p-l);return[Xn((f*c+b*(h-f)).toString(),u+16),Xn(_.toString(),u+16)]}function tr(e,t,n,r,i,a,o,s){if(!(vn(n,r,i,a,o,s)>t)){var u=un(i,a,n,r),c=un(o,s,n,r);u<=t||c<=t||e.push(n,r)}}function nr(e,t,n,r,i,a){var o=cn(n,r,i,a);return o<t&&(t=o,e[0]=i,e[1]=a),t}function rr(e,t,n){return t<n?e<t||e>n:t>n?e>t||e<n:e!=t}function ir(e,t,n){var r=Math.abs(e-t)<Math.abs(e-n)?t:n,i=Math.abs(e-r);return i>1e-15&&Ct("[clampToClosestEndpoint()] large clamping interval:",i),r}function ar(e,t,n,r){return e*r-t*n}function or(e,t,n,r,i,a){return ar(e-i,t-a,n-i,r-a)}function sr(e,t,n,r,i,a){var o=Kn(e,t,n,r,i,a);return Xn(or(BigInt(Hn(e,o)),BigInt(Hn(t,o)),BigInt(Hn(n,o)),BigInt(Hn(r,o)),BigInt(Hn(i,o)),BigInt(Hn(a,o))).toString(),o)}function ur(e,t,n,r,i,a,o,s){return or(e,t,n,r,i,a)*or(e,t,n,r,o,s)<=0&&or(i,a,o,s,e,t)*or(i,a,o,s,n,r)<=0}var cr=Object.freeze({__proto__:null,findClosestPointOnSeg:function(e,t,n,r,i,a,o){var s=i-n,u=a-r,c=s*s+u*u,f=0===c?-1:((e-n)*s+(t-r)*u)/c,l=o>=0?o:.1;return f<=l?[n,r]:f>=1-l?[i,a]:[n+f*s,r+f*u]},findCrossIntersection_robust:er,orient2D:or,orient2D_robust:sr,segmentHit_fast:ur,segmentIntersection:Qn,segmentTurn:function(e,t,n,r){var i=e[0],a=e[1],o=t[0],s=t[1],u=o-n[0],c=s-n[1],f=or(i,a,o,s,r[0]+u,r[1]+c);return f?f<0?1:-1:0}}),fr=Object.assign({},_n,Un,En,cr,In);function lr(e){var t=0,n=e.forEachSegment(function(e,n,r,i){var a=r[e]-r[n],o=i[e]-i[n];t+=Math.sqrt(a*a+o*o)});return t/n||0}function hr(e){var t=0,n=0,r=e.forEachSegment(function(e,r,i,a){t+=Math.abs(i[e]-i[r]),n+=Math.abs(a[e]-a[r])});return[t/r||0,n/r||0]}function pr(e,t){var n=new Uint8Array(t.size());return dr(e,n),function(e){return e<0&&(e=~e),n[e]>0}}function dr(e,t){wr(e,null,function(e){for(var n,r=e.arcs,i=0;i<r.length;i++)(n=r[i])<0&&(n=~n),t[n]++})}function gr(e,t){var n=new qt;return br(e,function(e){t.mergeArcBounds(e,n)}),n}function mr(e){e.reverse();for(var t=0,n=e.length;t<n;t++)e[t]=~e[t];return e}function yr(e,t){return t<=0?e=1/0:t>=1&&(e=0),e}function vr(e,t,n,r){var i,a,o=0,s=-1;n>r&&(i=n,n=r,r=i);for(var u=n+1;u<r;u++)(a=e[u])<t&&a>o&&(s=u,o=a);return s}function br(e,n){for(var r,i=0;i<e.length;i++)if(r=e[i],Array.isArray(r))br(r,n);else if(t.isInteger(r)){var a=n(r);void 0!==a&&(e[i]=a)}else r&&vt("Non-integer arc id in:",e)}function _r(e,t,n){for(var r=0,i=e?e.length:0;r<i;r++)xr(e[r],t,n)}function xr(e,t,n){for(var r=0,i=e.length;r<i;r++)t.forEachArcSegment(e[r],n)}function wr(e,t,n,r){var i=0;e.forEach(function(e,a){if(e&&0!==e.length){var o,s;r&&r(a);for(var u=0,c=e.length;u<c;u++)if(o=e[u],n&&n({i:u,shapeId:a,shape:e,arcs:o}),t)for(var f=0,l=o.length;f<l;f++,i++)s=o[f],t({i:f,shapeId:a,partId:u,arcId:s,segId:i})}})}function Sr(e,t){var n,r,i=t.getArcIter(e);if(i.hasNext())for(n=i.x,r=i.y;i.hasNext();)if(i.x!=n||i.y!=r)return!0;return!1}function Ar(e,t){if(!e)return null;var n=[];return e.forEach(function(e){for(var r=[],i=0;i<e.length;i++)Sr(e[i],t)&&r.push(e[i]);r.length>0&&n.push(r)}),n.length>0?n:null}function Er(e,t,n){for(var r,i=[],a=0,o=e&&e.length;a<o;a++)r=e[a],i.push({ids:r,area:"polygon"==n?fr.getPlanarPathArea(r,t):0,bounds:t.getSimpleShapeBounds(r)});return i}var Mr=Object.freeze({__proto__:null,clampIntervalByPct:yr,countArcsInShapes:dr,filterEmptyArcs:Ar,findNextRemovableVertex:vr,findShapesByArcId:function(e,t,n){var r=n?new Uint8Array(n):[],i=[];return t.forEach(function(e){r[Yt(e)]=1}),e.forEach(function(e,t){var n=!1;br(e||[],function(e){n=n||1==r[Yt(e)]}),n&&i.push(t)}),i},forEachArcId:br,forEachSegmentInPath:xr,forEachSegmentInShape:_r,getArcPresenceTest:pr,getAvgSegment:lr,getAvgSegment2:hr,getDirectedArcPresenceTest:function(e,t){var n=new Uint8Array(t);return br(e,function(e){var r=Yt(e);r<t==!1&&vt("index error"),n[r]|=e<0?2:1}),function(e){var t=Yt(e);return e<0?!(2&~n[t]):!(1&~n[t])}},getPathBounds:gr,getPathMetadata:Er,quantizeArcs:function(e,t){var n=e.getBounds(),r=new qt(0,0,t-1,t-1),i=n.getTransform(r),a=i.invert();e.transformPoints(function(e,t){var n=i.transform(e,t);return a.transform(Math.round(n[0]),Math.round(n[1]))})},reversePath:mr,traversePaths:wr});function Ir(e){return e?e.map(function(e){return e.concat()}):null}function kr(e){return t.isArray(e)?e.map(Ir):null}function Cr(e,t){Or(e,t)}function Pr(e,t){for(var n=0,r=e.length;n<r;n++)e[n]=Or(e[n],t,n)}function Or(e,n,r){if(!e)return null;t.isArray(e)||vt("Expected an array, received:",e);for(var i,a=0,o=e.length,s=0;s<o;s++)null===(i=n(e[s],s,e,r))?e[s]=null:t.isArray(i)&&(e[s]=i.length>0?i:null),null===e[s]&&a++;return a==o?null:a>0?e.filter(function(e){return!!e}):e}function Nr(e){for(var t,n=0,r=0,i=e.length;r<i;r++)(t=e[r])&&t.length>n&&(n=t.length);return n}var Tr=Object.freeze({__proto__:null,cloneShape:Ir,cloneShapes:kr,editShapeParts:Or,editShapes:Pr,findMaxPartCount:Nr,forEachShapePart:Cr}),Lr=s("iconv-lite"),zr=function(e){var n=null;if("utf8"!=(e=Gr(e)))return null;"undefined"!=typeof TextEncoder&&(n=new TextEncoder(e));return function(r){return n?u.from(n.encode(r).buffer):t.createBuffer(r,e)}}("utf8"),Rr=function(e){var t=null;if("utf8"!=(e=Gr(e)))return null;"undefined"!=typeof TextDecoder&&(t=new TextDecoder(e));return function(n){return t?t.decode(n):n.toString(e)}}("utf8");function Dr(){return Lr.encodingExists("ascii"),Object.keys(Lr.encodings)}function jr(e){return Jr(e)||bt("Unknown encoding:",e,"\nRun the -encodings command see a list of supported encodings"),e}function Fr(e){for(var t=0,n=e.length;t<n;t++)if(e.charCodeAt(t)>=128)return!1;return!0}function Ur(e){return!e||/^utf-?8$/i.test(String(e))}function Br(e){return!(e=Gr(e))||/^(win|latin|utf8|ascii|iso88|gb)/.test(e)}function Gr(e){return(e||"").toLowerCase().replace(/[_-]/g,"")}function qr(e,t,n,r){return n>=0&&(e=e.slice(n,r)),$r(e,t)}function Vr(e,t){return Ur(t)?zr(e):Lr.encode(e,t)}function $r(e,t){return Ur(t)?Rr(e):Lr.decode(e,t)}function Jr(e){var t=Gr(e);return Dr().includes(t)}function Wr(e){return 65279==e.charCodeAt(0)&&(e=e.substr(1)),e}function Zr(){var e=Dr().filter(function(e){return!/^(_|cs|internal|ibm|isoir|singlebyte|table|[0-9]|l[0-9]|windows)/.test(e)});e.sort(),Et("Supported encodings:\n"+Rt(e))}var Yr=Object.freeze({__proto__:null,bufferToString:qr,decodeString:$r,encodeString:Vr,encodingIsAsciiCompat:Br,encodingIsSupported:Jr,encodingIsUtf8:Ur,getEncodings:Dr,printEncodings:Zr,standardizeEncodingName:Gr,stringIsAscii:Fr,stringsAreAscii:function(e){return Fr(e.join(""))},trimBOM:Wr,validateEncoding:jr});function Hr(e){var n,r,i={};if(!e)return null;for(n in e)e.hasOwnProperty(n)&&((r=e[n])==e&&delete(r=t.extend({},r))[n],i[n]=r&&r.constructor===Object?Hr(r):r);return i}function Xr(e){var n=null;return null==e?n=null:t.isString(e)?n="string":t.isNumber(e)?n="number":t.isBoolean(e)?n="boolean":t.isDate(e)?n="date":t.isObject(e)&&(n="object"),n}function Kr(e){var t=function(e){var t,n,r,i={};for(t=0;t<e.length;t++)for(r=Object.keys(e[t]||{}),n=0;n<r.length;n++)i[r[n]]=1+(0|i[r[n]]);return Object.keys(i).filter(function(t){return i[t]<e.length})}(e);!function(e,t){var n,r,i,a;for(r=0;r<e.length;r++)for(n=e[r]||(e[r]={}),i=0;i<t.length;i++)(a=t[i])in n==!1&&(n[a]=void 0)}(e,t)}function Qr(e,n){return e.indexOf("*")>-1||0===t.difference(n,e).length}function ei(e,t){for(var n,r=null,i=0,a=t.length;i<a&&!(r=(n=t[i])?Xr(n[e]):null);i++);return r}function ti(e,t){e.getFields().forEach(function(n){t(n)&&e.deleteField(n)})}function ni(e){return/^\s*$/.test(e)}function ri(e,n,r){var i={};return e.map(function(a){var o,s=0;do{o=r&&"ascii"!=r?si(a,n,s,r):oi(a,n,s),s++}while(o in i||a!=o&&t.contains(e,o));return i[o]=!0,o})}function ii(e,t){return e.map(function(e){return e?e[t]:void 0})}function ai(e,t){var n={},r=[];return e.forEach(function(e){var i=e[t];i in n==!1&&(n[i]=!0,r.push(i))}),r}function oi(e,t,n){var r,i;return t=t||256,n?(1==(i=String(n)).length&&(i="_"+i),r=e.substr(0,t-i.length)+i):r=e.substr(0,t),r}function si(e,t,n,r){var i=e+(n?String(n):"");return Vr(i,r).length>(t||256)?si(e=e.substr(0,e.length-1),t,n,r):i}function ui(e,t){return"ascending"==t&&e.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1}),e}function ci(e){for(var t=0,n=e?e.length:0;t<n;t++)if(e[t])return e[t];return null}function fi(e,t){var n=ci(e);return ui(n?Object.keys(n):[],t)}function li(e){return hi[e||"multiple"]}var hi={date:function(e){var t=new Date(e);return isNaN(+t)?null:t},string:function(e){return e},number:function(e){var t=Number(e);return"NaN"==e?t=NaN:isNaN(t)&&(t=null),t},object:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t},boolean:function(e){var t=null;return"true"==e?t=!0:"false"==e&&(t=!1),t},multiple:function(e){var t=Number(e);return isNaN(t)?e:t}},pi=Object.freeze({__proto__:null,applyFieldOrder:ui,copyRecord:Hr,deleteFields:ti,fieldListContainsAll:Qr,findFieldNames:fi,fixInconsistentFields:Kr,getColumnType:ei,getFieldValues:ii,getFirstNonEmptyRecord:ci,getInputParser:li,getUniqFieldNames:ri,getUniqFieldValues:ai,getValueType:Xr,isInvalidFieldName:ni,parseUnknownType:function(e){var t=li("number")(e);return null!==t||null!==(t=li("object")(e))?t:e}});function di(e){var n;if(t.isArray(e))n=e;else if(n=[],t.isInteger(e))for(var r=0;r<e;r++)n.push({});else e&&vt("Invalid DataTable constructor argument:",e);this.getRecords=function(){return n},this.getReadOnlyRecordAt=function(e){return Hr(n[e])}}function gi(e,t){for(var n=t.getSimpleShapeBounds(e).toArray(),r=t.getShapeIter(e),i=0;r.hasNext();){if(r.x!=n[0]&&r.x!=n[2]||r.y!=n[1]&&r.y!=n[3])return!1;i++}return!(i<5)&&(n[2]>n[0]!=!1&&n[3]>n[1]!=!1)}function mi(e){return[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]]}di.prototype={fieldExists:function(e){return t.contains(this.getFields(),e)},toString:function(){return JSON.stringify(this)},toJSON:function(){return this.getRecords()},addField:function(e,n){var r=t.isFunction(n);t.isNumber(n)||t.isString(n)||r||vt("DataTable#addField() requires a string, number or function for initialization"),this.fieldExists(e)&&vt("DataTable#addField() tried to add a field that already exists:",e),this.getRecords().forEach(function(t,i){t[e]=r?n(t,i):n})},getRecordAt:function(e){return this.getRecords()[e]},addIdField:function(){this.addField("FID",function(e,t){return t})},deleteField:function(e){this.getRecords().forEach(function(t){delete t[e]})},getFields:function(){return fi(this.getRecords())},isEmpty:function(){return 0===this.getFields().length||0===this.size()},update:function(e){for(var t=this.getRecords(),n=0,r=t.length;n<r;n++)t[n]=e(t[n],n)},clone:function(){return new di(this.getRecords().map(Hr))},size:function(){return this.getRecords().length}};var yi=Object.freeze({__proto__:null,bboxToCoords:mi,pathIsRectangle:gi});function vi(e,t,n){for(var r,i,a=ki(e)||n.length,o=(e.data=e.data||new di(a)).getRecords(),s=0,u=o.length;s<u;s++)r=o[s],i=n[s],r||(r=o[s]={}),r[t]=void 0===i?null:i}function bi(e){var t=e.data;return t||(t=e.data=new di(e.shapes?e.shapes.length:0)),t}function _i(e){return!(!e.data||!ci(e.data.getRecords()))}function xi(e){return wi(e)||Si(e)}function wi(e){return("polygon"==e.geometry_type||"polyline"==e.geometry_type)&&Mi(e)}function Si(e){return"point"==e.geometry_type&&Mi(e)}function Ai(e,t){return Ei(e,t)&&1==e.shapes.length}function Ei(e,t){return!!wi(e)&&(!(qi(e)>0)&&e.shapes.every(function(e){return!e||gi(e[0],t)}))}function Mi(e){return t.some(e.shapes||[],function(e){return!!e})}function Ii(e,t){Si(e)&&Wt(e.shapes,function(e){var n=t(e[0],e[1]);e[0]=n[0],e[1]=n[1]})}function ki(e){var t=0;return e.data?t=e.data.size():e.shapes&&(t=e.shapes.length),t}function Ci(e){return 0==ki(e)}function Pi(e,t,n){var r=e.fieldExists?e:e.data;t||bt("Missing a field parameter"),r&&r.fieldExists(t)||bt(n||"Missing a field named:",t)}function Oi(e,n){if(n&&n.length){e||bt("Missing attribute data");var r=e.getFields(),i=t.difference(n,r);i.length>0&&bt("Table is missing one or more fields:\n",i,"\nExisting fields:","\n"+Rt(r))}}function Ni(e,n,r){var i;return r&&t.isString(r)?i=r:(i=n+", ",e&&e.geometry_type?i+="received a "+e.geometry_type+" layer":i+="received a layer with no geometry"),i}function Ti(e,t){e&&"point"===e.geometry_type||bt(Ni(e,"Expected a point layer",t))}function Li(e,t){Ti(e),qi(e)>0&&bt(t||"This command requires single points; layer contains multi-point features.")}function zi(e,t){e&&"polyline"===e.geometry_type||bt(Ni(e,"Expected a polyline layer",t))}function Ri(e,t){e&&"polygon"===e.geometry_type||bt(Ni(e,"Expected a polygon layer",t))}function Di(e,t){var n=t.info&&t.info.input_files;return n&&n[0]||""}function ji(e,n,r){var i=t.uniq(r).map(function(t){for(var i,a=[],o=[],s=0,u=0,c=e.length;u<c;u++)r[u]==t&&(t&&o.push(e[u]),i=n[u],a.push(i),i||s++);return{geometry_type:t,shapes:o,data:s<a.length?new di(a):null}});return i}function Fi(e,t){return t&&t.no_replace?{geometry_type:e.geometry_type}:e}function Ui(e,t,n,r){(r=r||{}).name?e.name=r.name:r.no_replace?e.name=n||void 0:e.name=t&&t.name||n||void 0}function Bi(e){var t=Gi(e);return t.data&&(t.data=t.data.clone()),t}function Gi(e){var n=t.extend({},e);return e.shapes&&(n.shapes=kr(e.shapes)),n}function qi(e){for(var t=0,n=0,r=e.length;n<r;n++)e[n]&&e[n].length>1&&t++;return t}function Vi(e,t){var n=$i(e,t);return function(e){return n[Yt(e)]>0}}function $i(e,t){var n=new Uint32Array(t.size());return e.filter(wi).forEach(function(e){dr(e.shapes,n)}),n}function Ji(e,t){var n=null;return"point"==e.geometry_type?n=Vt(e.shapes):"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type||(n=gr(e.shapes,t)),n}function Wi(e){e.data=new di(ki(e))}var Zi=Object.freeze({__proto__:null,copyLayer:Bi,copyLayerShapes:Gi,countArcsInLayers:$i,countMultiPartFeatures:qi,deleteFeatureById:function(e,t){e.shapes&&e.shapes.splice(t,1),e.data&&e.data.getRecords().splice(t,1)},divideFeaturesByType:ji,filterPathLayerByArcIds:function(e,n){var r=n.reduce(function(e,t){return e[t]=!0,e},{}),i=kr(e.shapes);return Pr(i,function(e){for(var t=0;t<e.length;t++)if(Yt(e[t])in r)return null;return e}),t.defaults({shapes:i},e)},getArcPresenceTest2:Vi,getFeatureCount:ki,getLayerBounds:Ji,getLayerDataTable:bi,getLayerSourceFile:Di,getOutputLayer:Fi,initDataTable:Wi,insertFieldValues:vi,isolateLayer:function(e,n){return t.defaults({layers:n.layers.filter(function(t){return t==e})},n)},layerHasAttributeData:function(e){return e.data&&e.data.getFields().length>0},layerHasGeometry:xi,layerHasNonNullData:_i,layerHasNonNullShapes:Mi,layerHasPaths:wi,layerHasPoints:Si,layerIsEmpty:Ci,layerIsGeometric:function(e){return!!e.geometry_type},layerIsRectangle:Ai,layerOnlyHasRectangles:Ei,layerTypeMessage:Ni,requireDataField:Pi,requireDataFields:Oi,requirePathLayer:function(e,t){e&&wi(e)||bt(Ni(e,"Expected a polygon or polyline layer",t))},requirePointLayer:Ti,requirePolygonLayer:Ri,requirePolylineLayer:zi,requireSinglePointLayer:Li,setOutputLayerName:Ui,transformPointsInLayer:Ii});function Yi(){this.a=1,this.c=0,this.tx=0,this.b=0,this.d=1,this.ty=0}Yi.prototype.transformXY=function(e,t,n){return(n=n||{}).x=e*this.a+t*this.c+this.tx,n.y=e*this.b+t*this.d+this.ty,n},Yi.prototype.translate=function(e,t){this.tx+=e,this.ty+=t},Yi.prototype.rotate=function(e,t,n){var r=Math.cos(e),i=Math.sin(e);t=t||0,n=n||0,this.a=r,this.c=-i,this.b=i,this.d=r,this.tx+=t-t*r+n*i,this.ty+=n-t*i-n*r},Yi.prototype.scale=function(e,t,n,r){n=n||0,r=r||0,this.a*=e,this.c*=e,this.b*=t,this.d*=t,this.tx-=n*(e-1),this.ty-=r*(t-1)};var Hi=s("mproj");function Xi(e,n){var r=s(e),i=r.crs,a=[r],o=function(e){e.internal.pj_list.mixed||e.pj_add(function(e){e.a=1},"mixed","Mapshaper Mixed Projection");return e.pj_init("+proj=mixed")}(Hi);function s(e){return{bounds:new qt(u(e.bbox)),crs:Hi.pj_init(e.proj)}}function u(e){var t=Math.PI/180;return e.map(function(e){return e*t})}return i.__mixed_crs=o,i.addFrame=function(e){var r,i,o,u=function(e,n){var r=n[e.name];return t.defaults(e,{scale:1,dx:0,dy:0,rotation:0}),r?(Object.keys(r).forEach(function(t){var n=r[t];t in e?e[t]=r[t]:e.proj=function(e,t,n){var r="+"+t+"=";return e.split(" ").map(function(e){return 0===e.indexOf(r)&&(e=e.substr(0,r.length)+n),e}).join(" ")}(e.proj,t,n)}),e):e}(e,n),c=s(u),f=new Yi,l=u.origin?(r=u.origin,i=c.crs,[(o=Hi.pj_fwd_deg({lam:r[0],phi:r[1]},i)).x,o.y]):[0,0],h=u.placement||[0,0],p=h[0]-l[0]+(+u.dx||0),d=h[1]-l[1]+(+u.dy||0);return u.rotation&&f.rotate(u.rotation*Math.PI/180,l[0],l[1]),u.scale&&f.scale(u.scale,u.scale,l[0],l[1]),f.translate(p,d),c.matrix=f,a.push(c),this},o.fwd=function(e,t){for(var n,r,i=0,o=a.length;i<o;i++)if((n=a[i]).bounds.containsPoint(e.lam,e.phi)){r=Hi.pj_fwd(e,n.crs),n.matrix&&n.matrix.transformXY(r.x,r.y,r);break}t.x=r?r.x:1/0,t.y=r?r.y:1/0},i}function Ki(e){var t=e.trim().split(/ +/),n=[],r=t.filter(function(e){return!/^\+/.test(e)||(n.push(e.substr(1)),!1)}),i=r[0],a=ea(n);return 1!=r.length?null:function(e,t){if("albersusa"==e)return new Qi(t);return null}(i,a)}function Qi(e){var t=e||{},n=new Xi({proj:"+proj=aea +lon_0=-96 +lat_0=37.5 +lat_1=29.5 +lat_2=45.5",bbox:[-129,23,-62,52]},t).addFrame({name:"AK",proj:"+proj=aea +lat_1=55 +lat_2=70 +lat_0=65 +lon_0=-148 +x_0=0 +y_0=0",bbox:[-172.26,50.89,-127,73.21],origin:[-152,63],placement:[-1882782,-969242],scale:.37}).addFrame({name:"HI",proj:"+proj=aea +lat_1=19 +lat_2=24 +lat_0=20.9 +lon_0=-156.5 +x_0=0 +y_0=0",bbox:[-160.5,18.72,-154.57,22.58],origin:[-157,21],placement:[-1050326,-1055362]});return t.PR&&n.addFrame({name:"PR",proj:"+proj=aea +lat_1=18 +lat_2=18.43 +lat_0=17.83 +lon_0=-66.43 +x_0=0 +y_0=0",bbox:[-68.092,17.824,-65.151,18.787],origin:[-66.431,18.228],placement:[1993101,-1254517]}),t.VI&&n.addFrame({name:"VI",proj:"+proj=aea +lat_1=18 +lat_2=18.43 +lat_0=17.83 +lon_0=-66.43 +x_0=0 +y_0=0",bbox:[-65.104,17.665,-64.454,18.505],origin:[-66.431,18.228],placement:[1993101,-1254517]}),n}function ea(e){var n={};return e.forEach(function(e){!function(e,n){var r=e.split("="),i=r[0].split("."),a=i.pop(),o=i.reduce(function(e,n){if(n in e==!1)e[n]={};else if(!t.isObject(e[n]))return{};return e[n]},n);r.length>1?o[a]=function(e){var n;if(e.indexOf(",")>0)return n=e.split(",").map(parseFloat);n=t.parseNumber(e),null===n&&(n=e);return n}(r[1]):a in o!=!1||i.length||(o[a]={})}(e,n)}),n}var ta=Object.freeze({__proto__:null,AlbersUSA:Qi,parseCustomParams:ea,parseCustomProjection:Ki});function ra(e){return[-180+(e=t.isFiniteNumber(e)?e:1e-10),-90+e,180-e,90-e]}function ia(e){var t=ra(-1),n=e instanceof qt?e.toArray():e;return fr.containsBounds(t,n)}function aa(e){var t=e instanceof qt?e.toArray():e;return(new qt).setBounds(Math.max(t[0],-180),Math.max(t[1],-90),Math.min(t[2],180),Math.min(t[3],90))}function oa(e){for(var t=e-180;t<=-180;)t+=360;return t}var sa=Object.freeze({__proto__:null,clampToWorldBounds:aa,getAntimeridian:oa,getWorldBounds:ra,probablyDecimalDegreeBounds:ia}),ua=s("mproj"),ca=null,fa={robinson:"+proj=robin +datum=WGS84",webmercator:"+proj=merc +a=6378137 +b=6378137",wgs84:"+proj=longlat +datum=WGS84",albersusa:Qi};async function la(e){ca&&await ca(e)}function ha(e,t){var n=[0],r=[0],i=e.is_latlong?ua.internal.DEG_TO_RAD:1,a=t.is_latlong?ua.internal.RAD_TO_DEG:1,o=Na(e);return function(s,u){var c;o&&(s<-180?s=-180:s>180&&(s=180)),n[0]=s*i,r[0]=u*i;try{t=t.__mixed_crs||t,ua.pj_transform(e,t,n,r),c=n[0]==1/0}catch(e){c=!0}return c?null:[n[0]*a,r[0]*a]}}function pa(e,t,n){return ya(t,n)?e.concat():ha(t,n)(e[0],e[1])}function da(e){var t,n;try{(t=Ia(e))&&(n=ga(t))}catch(e){}return n||"[unknown]"}function ga(e){return ua.internal.get_proj_defn(e)}function ma(e){var t;try{t=ua.internal.wkt_from_proj4(e)}catch(e){}return t}function ya(e,t){var n=ga(e);return!!n&&n==ga(t)}function va(e){return e in fa}function ba(e){var n;return e=e.replace(/(^| )([\w]+)($| )/,function(e,t,n,r){return n in ua.internal.pj_list?t+"+proj="+n+r:e}),xa(e)?n=e:va(e)?(n=fa[e],t.isFunction(n)&&(n=n())):n=function(e){return/^(esri|epsg|nad83|nad27):[0-9]+$/i.test(String(e))}(e)?"+init="+e.toLowerCase():e in(i("defs")||{})?i("defs")[e]:Ki(e),n||bt("Unknown projection definition:",e),n}function xa(e){return/^(\+[^ ]+ *)+$/.test(e)}function wa(e){return{crs_string:e,crs:Sa(e)}}function Sa(e){var n,r=ba(e);if(t.isString(r))try{n=ua.pj_init(r)}catch(e){bt("Unable to use projection",r,"("+e.message+")")}else n=r;return n||null}function Aa(e){Na(Ia(e))&&bt("Command requires a target with projected coordinates (not lat-long)")}function Ea(e,t){return t=t||{},e.info=e.info||{},e.info.crs=t.crs,e.info.prj=t.prj,e.info.crs_string=t.crs_string,e}function Ma(e){var t=e.info||{},n=t.crs,r=t.crs_string;return!n&&t.prj&&(n=Sa(za(t.prj))),n||ia(wo(e))&&(n=Sa(r="wgs84")),{crs:n||null,crs_string:r,prj:t.prj}}function Ia(e){return Ma(e).crs}function ka(e,t){e.reduce(function(e,n){var r=Ia(n);return e&&r&&Na(e)!=Na(r)&&bt(t||"Unable to combine projected and unprojected datasets"),r||e},null)}function Pa(e,t,n){var r=1/n.to_meter,i=ua.pj_inv_deg({x:e,y:t},n),a=ua.pj_inv_deg({x:e+r,y:t},n);return 1/fr.greatCircleDistance(i.lam,i.phi,a.lam,a.phi)}function Oa(e){return!Na(e)}function Na(e){return e&&e.is_latlong||!1}function Ta(e){return Na(Ia(e))}function La(){var e=ua.internal.pj_list,n="Proj4 projections\n";Object.keys(e).sort().forEach(function(r){n+=" "+t.rpad(r,7," ")+" "+e[r].name+"\n"}),n+="\nAliases",Object.keys(fa).sort().forEach(function(e){n+="\n "+e}),Et(n)}function za(e){var t;try{t=ua.internal.wkt_to_proj4(e)}catch(e){bt("Unusable .prj file ("+e.message+")")}return t}function Ra(e){return Sa(za(e))}var Da=Object.freeze({__proto__:null,crsAreEqual:ya,crsToPrj:ma,crsToProj4:ga,findProjLibs:function(e){var n=e.match(/\b(esri|epsg|nad83|nad27)(?=:[0-9]+\b)/gi)||[];return t.uniq(n.map(function(e){return e.toLowerCase()}))},getCrsInfo:wa,getDatasetCRS:Ia,getDatasetCrsInfo:Ma,getProjDefn:ba,getProjInfo:da,getProjTransform:function(e,t){var n=Na(e);return t=t.__mixed_crs||t,function(r,i){var a;return n&&(r<-180?r=-180:r>180&&(r=180)),a=[r,i],ua.pj_transform_point(e,t,a),a}},getProjTransform2:ha,getScaleFactorAtXY:Pa,initProjLibrary:la,isInvertibleCRS:function(e){return!(!e||!e.inv)},isLatLngCRS:Na,isLatLngDataset:Ta,isProjAlias:va,isProjectedCRS:Oa,isWGS84:function(e){return!!Na(e)&&ga(e).toLowerCase().includes("84")},isWebMercator:function(e){if(!e)return!1;var t=ga(e);return t.includes("+proj=merc")&&t.includes("+a=6378137")&&t.includes("+b=6378137")},looksLikeProj4String:xa,parseCrsString:Sa,parsePrj:Ra,printProjections:La,projectPoint:pa,requireDatasetsHaveCompatibleCRS:ka,requireProjectedDataset:Aa,setDatasetCrsInfo:Ea,setProjectionLoader:function(e){ca=e},toLngLat:function(e,t){return pa(e,t,Sa("wgs84"))},translatePrj:za});function ja(e){var t=e.length,n=0,r={x:0,y:0,hasNext:function(){return!(n>=t)&&(r.x=e[n][0],r.y=e[n][1],n++,!0)}};return r}function Fa(e,t){this._i=0,this._n=0,this._inc=1,this._xx=e,this._yy=t,this.i=0,this.x=0,this.y=0}function Ua(e,t,n){var r=0,i=0,a=1,o=0;this.init=function(e,t,n,s){return r=s||0,n?(i=e,a=1,o=e+t):(i=e+t-1,a=-1,o=e-1),this},this.hasNext=function(){var s=n,u=i,c=u,f=r,l=o,h=a;if(u==l)return!1;do{c+=h}while(c!=l&&s[c]<f);return i=c,this.x=e[u],this.y=t[u],this.i=u,!0}}function Ba(e){this._arcs=e,this._i=0,this._n=0,this.x=0,this.y=0}Fa.prototype.init=function(e,t,n){return n?(this._i=e,this._inc=1):(this._i=e+t-1,this._inc=-1),this._n=t,this},Fa.prototype.hasNext=function(){var e=this._i;return this._n>0&&(this._i=e+this._inc,this.x=this._xx[e],this.y=this._yy[e],this.i=e,this._n--,!0)},Ba.prototype.hasNext=function(){var e=this._arc;return this._i<this._n!=!1&&(e.hasNext()?(this.x=e.x,this.y=e.y,!0):(this.nextArc(),this.hasNext()))},Ba.prototype.init=function(e){return this._ids=e,this._n=e.length,this.reset(),this},Ba.prototype.nextArc=function(){var e=this._i+1;e<this._n&&(this._arc=this._arcs.getArcIter(this._ids[e]),e>0&&this._arc.hasNext()),this._i=e},Ba.prototype.reset=function(){this._i=-1,this.nextArc()};var Ga=Object.freeze({__proto__:null,ArcIter:Fa,FilteredArcIter:Ua,MultiShapeIter:function(e){},PointIter:ja,ShapeIter:Ba});function qa(e){var n=e.getPointCount(),r=Math.ceil(n/5e5),i=e.getRemovableThresholds(r);return t.quicksort(i,!0),function(e){var t=i.length,n=Va(e,i.length);return n<1?0:n>t?1/0:i[n-1]}}function Va(e,t){return 0===t||e>=1?0:e<=0?t+1:Math.floor((1-e)*(t+2))}function $a(e,n,r){var i=n.getRemovableThresholds(r),a=Va(e,i.length);return a<1?0:a>i.length?1/0:t.findValueByRank(i,a)}var Ja=Object.freeze({__proto__:null,getThresholdByPct:$a,getThresholdFunction:qa});function Wa(){var e,n,r,i,a,o,s,u,c,f=0;function l(e){var t=[],n=[],r=e.map(function(e){for(var r=e?e.length:0,i=0;i<r;i++)t.push(e[i][0]),n.push(e[i][1]);return r});h(r,t,n)}function h(t,o,s){var l=t.length;t instanceof Array&&(t=new Uint32Array(t)),o instanceof Array&&(o=new Float64Array(o)),s instanceof Array&&(s=new Float64Array(s)),e=o,n=s,i=t,a=null,f=0,c=null,r=new Uint32Array(l);for(var h=0,p=0;p<l;p++)r[p]=h,h+=t[p];return h==e.length&&e.length==n.length||vt("ArcCollection#initXYData() Counting error"),d(),u=new Fa(e,n),this}function p(t){t?(t.length!=e.length&&vt("ArcCollection#initZData() mismatched arrays"),t instanceof Array&&(t=new Float64Array(t)),c=new Ua(e,n,a=t)):(a=null,f=0,c=null)}function d(){var e=i.length;o=new Float64Array(4*e),s=new qt;for(var t=0;t<e;t++)g(t)}function g(t){var a=i[t],u=r[t],c=4*t,f=Ht(e,n,u,a);o[c++]=f[0],o[c++]=f[1],o[c++]=f[2],o[c]=f[3],s.mergeBounds(f)}function m(){return{xx:e,yy:n,zz:a,bb:o,nn:i,ii:r}}function y(){return en(m(),f)}1==arguments.length?l(arguments[0]):3==arguments.length?h.apply(this,arguments):0===arguments.length?l([]):vt("ArcCollection() Invalid arguments"),this.updateArcBounds=function(e){g(e)},this.updateVertexData=function(e,t,n,r){h(e,t,n),p(r||null)},this.getCopy=function(){var t=new Wa(new Int32Array(i),new Float64Array(e),new Float64Array(n));return a&&(t.setThresholds(new Float64Array(a)),t.setRetainedInterval(f)),t},this.getVertexData=m,this.getFilteredCopy=function(){if(!a||0===f)return this.getCopy();var e=y(),t=new Wa(e.nn,e.xx,e.yy);return t.setThresholds(e.zz),t},this.toArray=function(){var e=[];return this.forEach(function(t){for(var n=[];t.hasNext();)n.push([t.x,t.y]);e.push(n)}),e},this.toJSON=function(){return this.toArray()},this.forEachArcSegment=function(t,o){for(var s=t>=0,u=s?t:~t,c=this.getRetainedInterval(),f=i[u],l=s?1:-1,h=s?r[u]:r[u]+f-1,p=h,d=e,g=n,m=a,y=0,v=1;v<f;v++)p+=l,(0===c||m[p]>=c)&&(o(h,p,d,g),h=p,y++);return y},this.forEachSegment=function(e){for(var t=0,n=0,r=this.size();n<r;n++)t+=this.forEachArcSegment(n,e);return t},this.transformPoints=function(t){for(var r,a=e,o=n,s=-1,u=0,c=0,f=a.length;c<f;c++,u--){for(;0===u;)u=i[++s];(r=t(a[c],o[c],s))&&(a[c]=r[0],o[c]=r[1])}d()},this.forEach=function(e){for(var t=0,n=this.size();t<n;t++)e(this.getArcIter(t),t)},this.forEach2=function(t){for(var o=0,s=this.size();o<s;o++)t(o,r[o],i[o],e,n,a)},this.forEach3=function(t){for(var o,s,u,c,f,l=0,h=this.size();l<h;l++)s=(o=r[l])+i[l],u=e.subarray(o,s),c=n.subarray(o,s),a&&(f=a.subarray(o,s)),t(u,c,f,l)},this.filter=function(e){var t=function(t){return e(this.getArcIter(t),t)}.bind(this);return this.deleteArcs(t)},this.deleteArcs=function(o){for(var s=this.size(),u=new Int32Array(s),c=0,f=0;f<s;f++)o(f)?(u[f]=c++,i[f]):u[f]=-1;return c<s&&function(o){for(var s,u,c=0,f=0,l=t.copyElements,d=0,g=o.length;d<g;d++)s=o[d],u=i[d],s>-1&&(l(e,r[d],e,c,u),l(n,r[d],n,c,u),a&&l(a,r[d],a,c,u),i[s]=u,c+=u,f++);h(i.subarray(0,f),e.subarray(0,c),n.subarray(0,c)),a&&p(a.subarray(0,c))}(u),u},this.dedupCoords=function(){for(var t,r,o=0,s=0,u=0,c=this.size(),f=a;o<c;)r=Za(s,u,t=i[o],e,n,f),i[o]=r,s+=t,u+=r,o++;return s>u&&(h(i,e.subarray(0,u),n.subarray(0,u)),f&&p(f.subarray(0,u))),s-u},this.getVertex=function(t,r){var i=this.indexOfVertex(t,r);return{x:e[i],y:n[i]}},this.getVertex2=function(t){return[e[t],n[t]]},this.indexOfVertex=function(e,t){var n=e<0?~e:e,a=i[n];return t<0&&(t=a+t),n!=e&&(t=a-t-1),(t<0||t>=a)&&vt("[ArcCollection] out-of-range vertex id"),r[n]+t},this.arcIsClosed=function(t){var r=this.indexOfVertex(t,0),i=this.indexOfVertex(t,-1);return r!=i&&e[r]==e[i]&&n[r]==n[i]},this.arcIsLollipop=function(t){var r,i;return!(this.getArcLength(t)<=2||!this.arcIsClosed(t))&&(r=this.indexOfVertex(t,1),i=this.indexOfVertex(t,-2),e[r]==e[i]&&n[r]==n[i])},this.arcIsDegenerate=function(e){return this.arcHasZeroLength(e)||this.arcIsSpike(e)||this.arcIsSpike_v1(e)},this.arcIsSpike_v1=function(e){var t,n,r=this.getArcIter(e);return r.hasNext()&&(t=r.x,n=r.y),r.hasNext(),!(!r.hasNext()||r.x!=t||r.y!=n||r.hasNext())},this.arcIsSpike=function(t){t=Yt(t);for(var a=r[t],o=a+i[t]-1;o>a;){if(e[a]!=e[o]||n[a]!=n[o])return!1;o--,a++}return!0},this.arcHasZeroLength=function(e){for(var t,n,r=this.getArcIter(e),i=0;r.hasNext();){if(i>0&&(t!=r.x||n!=r.y))return!1;t=r.x,n=r.y,i++}return!0},this.getArcLength=function(e){return i[Yt(e)]},this.getArcIter=function(e){var t=e>=0,n=t?e:~e,o=a&&f?c:u;return n>=i.length&&vt("#getArcId() out-of-range arc id:",e),o.init(r[n],i[n],t,f)},this.getShapeIter=function(e){return new Ba(this).init(e)},this.setThresholds=function(e){var t=this.getPointCount(),n=null;return e&&(e.length==t?n=e:e.length==this.size()?n=function(e,t){var n=new Float64Array(t),r=0;e.forEach(function(e){for(var t=0,i=e.length;t<i;r++,t++)n[r]=e[t]}),r!=t&&vt("Mismatched thresholds");return n}(e,t):vt("Invalid threshold data")),p(n),this},this.flatten=function(){if(f>0){var e=y();this.updateVertexData(e.nn,e.xx,e.yy),f=0}else a=null},this.isFlat=function(){return!a},this.getRetainedInterval=function(){return f},this.setRetainedInterval=function(e){return f=e,this},this.getRetainedPct=function(){return this.getPctByThreshold(f)},this.setRetainedPct=function(e){return f=e>=1?0:yr(f=this.getThresholdByPct(e),e),this},this.getRemovableThresholds=function(e){a||vt("[arcs] Missing simplification data.");for(var t,n=1|e,r=new Float64Array(Math.ceil(a.length/n)),i=0,o=0,s=this.getPointCount();i<s;i+=n)(t=a[i])!=1/0&&(r[o++]=t);return r.subarray(0,o)},this.getArcThresholds=function(e){e>=0&&e<this.size()||vt("[arcs] Invalid arc id:",e);var t=r[e],n=t+i[e];return a.subarray(t,n)},this.getPctByThreshold=function(e,n){var r,i,a;return e>0?(r=this.getRemovableThresholds(n),i=t.findRankByValue(r,e),a=r.length>0?1-(i-1)/r.length:1):a=1,a},this.getThresholdByPct=function(e,t){return $a(e,this,t)},this.arcIntersectsBBox=function(e,t){var n=o,r=4*e;return n[r]<=t[2]&&n[r+2]>=t[0]&&n[r+3]>=t[1]&&n[r+1]<=t[3]},this.arcIsContained=function(e,t){var n=o,r=4*e;return n[r]>=t[0]&&n[r+2]<=t[2]&&n[r+1]>=t[1]&&n[r+3]<=t[3]},this.arcIsSmaller=function(e,t){var n=o,r=4*e;return n[r+2]-n[r]<t&&n[r+3]-n[r+1]<t},this.isPlanar=function(){return!ia(this.getBounds())},this.size=function(){return r&&r.length||0},this.getPointCount=function(){return e&&e.length||0},this.getFilteredPointCount=function(){return a&&f?Qt(a,f):this.getPointCount()},this.getBounds=function(){return s.clone()},this.getSimpleShapeBounds=function(e,t){t=t||new qt;for(var n=0,r=e.length;n<r;n++)this.mergeArcBounds(e[n],t);return t},this.getSimpleShapeBbox=function(e,t){var n,r=t||[],i=o;r[0]=r[1]=1/0,r[2]=r[3]=-1/0;for(var a=0,s=e.length;a<s;a++)i[n=4*Yt(e[a])]<r[0]&&(r[0]=i[n]),i[++n]<r[1]&&(r[1]=i[n]),i[++n]>r[2]&&(r[2]=i[n]),i[++n]>r[3]&&(r[3]=i[n]);return r[0]==1/0?[]:r},this.getMultiShapeBounds=function(e,t){if(t=t||new qt,e)for(var n=0,r=e.length;n<r;n++)this.getSimpleShapeBounds(e[n],t);return t},this.mergeArcBounds=function(e,t){e<0&&(e=~e);var n=4*e;i[e]>0&&t.mergeBounds(o[n],o[n+1],o[n+2],o[n+3])}}function Za(e,t,n,r,i,a){for(var o,s,u,c,f,l=0,h=0;l<n;)o=r[c=e+l],s=i[c],(f=o==o&&s==s&&(0===h||o!=r[c-1]||s!=i[c-1]))&&(r[u=t+h]=o,i[u]=s,h++),a&&h>0&&(f||a[c]>a[u])&&(a[u]=a[c]),l++;return h>1?h:0}function Ya(e){var t=new ArrayBuffer(16),n=new Float64Array(t),r=new Uint32Array(t),i=0|e;if(i>0==!1)throw new Error("Invalid size param: "+e);return function(e,t){var a,o=r;return n[0]=e,n[1]=t,(2147483647&(a=(a=o[0]^o[1])<<5^a>>7^o[2]^o[3]))%i}}function Ha(e){var n=Math.floor(.25*e+1),r=Ya(n),i=new Int32Array(n),a=[],o=[],s=0;function u(e,t,n,s,u){for(var c,f,l,h=u(n),p=r(e[n],t[n]),d=i[p];-1!=d;){if(c=o[d][0],f=o[d][1],l=c.length,c[0]===e[s]&&c[l-1]===e[n]&&c[l-2]===e[h]&&f[0]===t[s]&&f[l-1]===t[n]&&f[l-2]===t[h])return d;d=a[d]}return null}t.initializeArray(i,-1),this.addArc=function(e,t){var n=e.length-1,u=r(e[n],t[n]),c=i[u],f=o.length;return i[u]=f,o.push([e,t]),s+=e.length,a.push(c),f},this.findDuplicateArc=function(e,t,n,r,i,a){var o=u(e,t,n,r,i);return o=null===o?u(e,t,r,n,a):~o},this.getVertexData=function(){for(var e,n,r=new Float64Array(s),i=new Float64Array(s),a=new Uint32Array(o.length),u=0,c=0,f=o.length;c<f;c++)n=(e=o[c])[0].length,t.copyElements(e[0],0,r,u,n),t.copyElements(e[1],0,i,u,n),a[c]=n,u+=n;return{xx:r,yy:i,nn:a}}}function Xa(e,t){for(var n,r,i,a,o=function(e,t){var n,r,i,a,o,s=e.length,u=Math.floor(1.3*s)||1,c=Ya(u),f=new Int32Array(u),l=new Int32Array(s);for(i=0;i<s;i++)a=e[i],o=t[i],a!=a||o!=o?r=-1:(r=f[n=c(a,o)]-1,f[n]=i+1),l[i]=r>=0?r:i;return l}(e,t),s=e.length-1;s>=0;s--)if(!((r=o[s])>=s)){i=s,a=-1;do{r=o[n=r],t[n]==t[s]&&e[n]==e[s]?(o[n]=i,i=n):(a>-1&&(o[a]=n),a=n)}while(r<n);a>-1&&(o[a]=a),o[s]=i}return o}function Ka(e){if(e.arcs){var t=e.arcs.getVertexData(),n=Qa(t.nn,t.xx,t.yy);e.arcs.updateVertexData(n.nn,n.xx,n.yy),e.layers.forEach(function(e){"polyline"!=e.geometry_type&&"polygon"!=e.geometry_type||(e.shapes=function(e,t){return e.map(function(e){return n(e,t)});function n(e,t){return e?e.map(function(e){return r(e,t)}):null}function r(e,t){return e.reduce(function(e,n){var r=Yt(n),i=t[r];if(i){n<0&&mr(i=i.concat());for(var a=0,o=i.length;a<o;a++)e.push(i[a])}return e},[])}}(e.shapes,n.paths))})}}function Qa(e,t,n){var r,i,a=t.length,o=Xa(t,n),s=function(e,t){for(var n=new Int32Array(e),r=0,i=0,a=t.length;i<a;i++)for(var o=0,s=t[i];o<s;o++,r++)n[r]=i;return n}(a,e),u=new Ha(a),c=f()?t.subarray:Array.prototype.slice;return r=function(e){for(var t,n=[],r=0,i=0,a=e.length;i<a;i++)t=e[i],n.push(t<2?null:d(r,r+t-1)),r+=t;return n}(e),(i=u.getVertexData()).paths=r,i;function f(){return!(!t.subarray||!n.subarray)}function l(t){var n=s[t],r=t+1;if(r<a&&s[r]===n)return t+1;var i=e[n];return p(t,t-i+1)?t-i+2:-1}function h(t){var n=s[t],r=t-1;if(r>=0&&s[r]===n)return t-1;var i=e[n];return p(t,t+i-1)?t+i-2:-1}function p(e,r){return t[e]==t[r]&&n[e]==n[r]}function d(r,i){for(var a,c=[],f=-1,p=r;p<i;p++)g(p)&&(-1==f?f=p:c.push(v(a,p)),a=p);return-1==f?c.push(function(r,i){var a,c=o[r],f=s[r];for(;c!=r&&!(s[c]<f);)c=o[c];if(c==r)return v(r,i);for(var p=r;p<i;p++)if(null!==(a=u.findDuplicateArc(t,n,p,p,l,h)))return a;vt("Unmatched ring; id:",f,"len:",e[f])}(r,i)):f==r?(g(i)||vt("Topology error"),c.push(v(a,p))):c.push(function(e,r,i,a){var o=u.findDuplicateArc(t,n,e,a,l,h);null===o&&(o=u.addArc(y(t,e,r,i,a),y(n,e,r,i,a)));return o}(a,i,r+1,f)),c}function g(e){var t,n,r=o[e],i=h(e),a=l(e);if(-1==i||-1==a)return!0;for(;e!=r;){if(t=h(r),n=l(r),-1==t||-1==n||m(i,a,t,n))return!0;r=o[r]}return!1}function m(e,r,i,a){var o=t[e],s=t[r],u=t[i],c=t[a],f=n[e],l=n[r],h=n[i],p=n[a];return!(o==c&&s==u&&f==p&&l==h||o==u&&s==c&&f==h&&l==p)}function y(e,t,n,r,i){var a,o=n-t+i-r+2,s=new(f()?Float64Array:Array)(o),u=0;for(a=t;a<=n;a++)s[u++]=e[a];for(a=r;a<=i;a++)s[u++]=e[a];return s}function v(e,r){var i=u.findDuplicateArc(t,n,e,r,l,h);return null===i&&(i=u.addArc(c.call(t,e,r+1),c.call(n,e,r+1))),i}}var eo=Object.freeze({__proto__:null,buildPathTopology:Qa,buildTopology:Ka});function to(e,t){var n=io([e].concat(t)),r=t.reduce(function(e,t){return e.concat(t.layers)},[]);return e.arcs=n.arcs,r}function no(e){return io(e.map(function(e){return t.defaults({layers:e.layers.map(Gi)},e)}))}function ro(e,t){var n,r=[],i=[],a=0;return e.forEach(function(e){r=r.concat(e.layers),i=i.concat(e.dataset),e.dataset.arcs&&e.dataset.arcs.size()>0&&a++}),n=io(i),a>1&&Ka(n),i.forEach(t.removeDataset),t.addDataset(n),t.setDefaultTarget(r,n),[{layers:r,dataset:n}]}function io(e){var t=[],n=0,r={info:{},layers:[]};return ka(e),e.forEach(function(e){var i=e.arcs?e.arcs.size():0;i>0&&t.push(e.arcs),ao(r,e),e.layers.forEach(function(e){"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type||br(e.shapes,function(e){return e<0?e-n:e+n}),r.layers.push(e)}),n+=i}),t.length>0&&(r.arcs=oo(t),r.arcs.size()!=n&&vt("[mergeDatasets()] Arc indexing error")),r}function ao(e,n){var r=n.info||{},i=e.info||(e.info={});i.input_files=t.uniq((i.input_files||[]).concat(r.input_files||[])),i.input_formats=t.uniq((i.input_formats||[]).concat(r.input_formats||[])),t.defaults(i,r)}function oo(e){var n=e.map(function(e){return e.getRetainedInterval()>0&&(Mt("Baking-in simplification setting."),e.flatten()),e.getVertexData()}),r=so(t.pluck(n,"xx"),Float64Array),i=so(t.pluck(n,"yy"),Float64Array);return new Wa(so(t.pluck(n,"nn"),Int32Array),r,i)}function so(e,t){var n=function(e){return e.reduce(function(e,t){return e+(t.length||0)},0)}(e),r=new(t||Array)(n),i=0;return e.forEach(function(e){for(var t=e.length,n=0;n<t;n++)r[n+i]=e[n];i+=t}),r}var uo=Object.freeze({__proto__:null,mergeArcs:oo,mergeCommandTargets:ro,mergeDatasetInfo:ao,mergeDatasets:io,mergeDatasetsForExport:no,mergeDatasetsIntoDataset:to});function co(e,t){var n=new Uint8Array(t.size());function r(e){Cr(e,i)}function i(e){a(~e[0]),a(e[e.length-1])}function a(e){var t=Yt(e),r=t==e;n[t]|=r?1:2}return e.forEach(function(e){wi(e)&&e.shapes.forEach(r)}),function(e){var t=Yt(e),r=t==e,i=n[t];return r?!(1&~i):!(2&~i)}}var fo=Object.freeze({__proto__:null,getPathEndpointTest:co});function lo(e,n){Array.isArray(e)&&(e=new Wa(e));var r,i,a=e.getVertexData(),o=a.nn,s=a.xx,u=a.yy;function c(e){return f(e)?null:[r.xx[e],r.yy[e]]}function f(e){return isNaN(r.xx[e])}function l(e){var t=p(e),n=d(),i=n[t],a=function(e){var t=d(),n=e,r=t[e];for(;r!=e;)n=r,(r=t[r])==n&&vt("Node indexing error");return n}(t);r.xx[t]=NaN,r.yy[t]=NaN,n[t]=t,n[a]=i}function h(e){var t=e>>1;return!0&e?t:~t}function p(e){return e>=0?2*e+1:2*~e}function d(){return r||(r=function(e,t){var n=2*e.size(),r=new Float64Array(n),i=new Float64Array(n),a=new Int32Array(n);e.forEach2(function(e,n,o,s,u,c){var f=n,l=n+o-1,h=2*e,p=h+1,d=s[f],g=u[f],m=s[l],y=u[l];t&&!t(e)&&(d=g=m=y=NaN),r[h]=d,i[h]=g,a[h]=e,r[p]=m,i[p]=y,a[p]=e});var o=Xa(r,i);return{xx:r,yy:i,ids:a,chains:o}}(e,n),2*o.length!=r.chains.length&&vt("[NodeCollection] count error")),r.chains}function g(e,t){var n=t>=0?t:~t,r=o[e>=0?e:~e];return!(r<2)&&(r==o[n]&&!!(m(e,t,-1)&&m(e,t,1)&&m(e,t,-2)))}function m(t,n,r){var i=e.indexOfVertex(t,r),a=e.indexOfVertex(n,r);return s[i]==s[a]&&u[i]==u[a]}function y(e){var t=p(e),n=d(),r=n[t];return r>=0&&r<n.length||vt("out-of-range chain id"),h(r)}Object.defineProperty(this,"arcs",{value:e}),this.setArcFilter=function(e){i=e},this.toArray=function(){var e=d(),n=new Uint8Array(e.length),r=[];return t.forEach(e,function(t,i){var a,o;if(1!=n[i]&&(o=c(i)))for(a={coordinates:o,arcs:[]},r.push(a);1!=n[i];)a.arcs.push(h(i)),n[i]=1,i=e[i]}),r},this.size=function(){return this.toArray().length},this.findDanglingEndpoints=function(){for(var e,t=d(),n=[],r=0,i=t.length;r<i;r++)t[r]==r&&(e=c(r))&&n.push({point:e,arc:h(r)});return n},this.detachAcyclicArcs=function(){for(var e,t,n=d(),r=0,i=0,a=n.length;i<a;i+=2)e=i==n[i],t=i+1==n[i+1],!e&&!t||f(i)||(this.detachArc(h(i)),r++);return r>0&&(r+=this.detachAcyclicArcs()),r},this.detachArc=function(e){l(e),l(~e)},this.forEachConnectedArc=function(e,t){for(var n=y(e),r=0;n!=e;)t(n,r++),n=y(n)},this.getConnectedArcs=function(e,t){var n=[],r=y(e);if(i&&!i(e))return[];for(;r!=e;)t&&!t(r)||i&&!i(r)||n.push(r),r=y(r);return n},this.findDuplicateArc=function(e){for(var t=y(e),n=e;t!=e;)g(e,t)&&Yt(t)<Yt(n)&&(n=t),t=y(t);return n},this.internal={testArcMatch:g,testVertexMatch:m}}function ho(e){var n=e.arcs,r=e.layers.filter(wi);if(n&&r.length){var i=po(r,n),a=[],o=0,s=new Int32Array(n.size()),u=new Uint8Array(n.size());r.forEach(function(e){e.shapes=e.shapes.map(function(e,t){return Or(e&&e.concat(),c)})}),e.arcs=function(e,n,r){var i=new Uint32Array(n.length),a=new Float64Array(r),o=new Float64Array(r),s=e.getVertexData(),u=s.zz?new Float64Array(r):null,c=e.getRetainedInterval(),f=0;return n.forEach(function(e,t){e.forEach(function(e,n){l(e,t)})}),new Wa(i,a,o).setThresholds(u).setRetainedInterval(c);function l(e,n){var r=Yt(e),c=e<0,l=s.nn[r],h=s.ii[r],p=i[n];l>0&&(p>0&&(l--,c||h++),t.copyElements(s.xx,h,a,f,l,c),t.copyElements(s.yy,h,o,f,l,c),u&&t.copyElements(s.zz,h,u,f,l,c),i[n]+=l,f+=l)}}(n,a,o)}else e.arcs=null;function c(e){for(var t,r,c,f,l,h,p=0,d=[],g=0,m=e.length;g<m;g++)l=(r=e[g])===(c=Yt(r)),n.arcIsDegenerate(r)||(0!==u[c]?t=null:(f=n.getArcLength(r),t&&i(e[g-1],r)?(f>0&&f--,t.push(r),u[c]=1):(t=[r],s[c]=a.length,a.push(t),u[c]=l?2:3),p+=f)),u[c]>1&&(h=s[c],(l&&3==u[c]||!l&&2==u[c])&&(h=~h),d.push(h));return o+=p,d}}function po(e,t){var n,r,i=new lo(t,Vi(e,t)),a=co(e.filter(function(e){return"polyline"==e.geometry_type}),t);return function(e,t){return e==t||e==~t?(Mt("Unexpected arc sequence:",e,t),!1):(n=0,i.forEachConnectedArc(e,o),1==n&&r==~t&&!a(e)&&!a(~t))};function o(e,t){n++,r=e}}var go=Object.freeze({__proto__:null,dissolveArcs:ho,getArcDissolveTest:po});function mo(e){return e.layers.map(function(n){var r={arcs:e.arcs,layers:[n],info:t.extend({},e.info)};return ho(r),r})}function yo(e){var t=Object.assign({},e);return Array.isArray(e.input_files)&&(t.input_files=e.input_files.concat()),t}function vo(e,n){var r=[];return e.layers=e.layers.filter(function(i){if(!n.includes(i))return!0;var a={arcs:e.arcs,layers:[i],info:t.extend({},e.info)};return ho(a),r.push(a),!1}),e.layers.length&&(ho(e),r.push(e)),r}function bo(e){var n=t.extend({},e);return n.layers=n.layers.map(Bi),n.arcs&&(n.arcs=n.arcs.getFilteredCopy()),n}function _o(e){var n=t.extend({},e);return n.layers=n.layers.map(Gi),n.arcs&&(n.arcs=n.arcs.getFilteredCopy()),n}function xo(e){return t.defaults({layers:e.layers.map(function(e){return t.extend({},e)})},e)}function wo(e){var t=new qt;return e.layers.forEach(function(n){var r=Ji(n,e.arcs);r&&t.mergeBounds(r)}),t}function So(e){return e.layers.every(function(e){return Ci(e)})}function Ao(e){return t.some(e.layers,function(e){return xi(e)})}function Eo(e){return t.some(e.layers,function(e){return wi(e)})}function Mo(e){if(e.arcs&&!t.some(e.layers,wi))return e.arcs=null,!0}function Io(e){Mo(e),e.arcs&&ho(e)}function ko(e,n,r){var i=e.layers.concat();t.repeat(Math.max(n.length,r.length),function(e){var t=n[e],a=r[e],o=t?i.indexOf(t):i.length;t&&i.splice(o,1),a&&i.splice(o,0,a)}),e.layers=i}function Co(e,t,n){wi(Po(e,t,n,{}))&&Ka(t)}function Po(e,t,n,r){var i=Oo(e,t,n,r);return 1!=i.length&&vt("Expected 1 output layer, received:",i.length),i[0]}function Oo(e,t,n,r){n&&0!==n.layers.length||vt("Invalid source dataset"),!1===t.layers.includes(e)&&vt("Invalid target layer");var i=to(t,[n]),a=i[0];return!a.data&&e.data&&ki(a)==e.data.size()&&(a.data=r.no_replace?e.data.clone():e.data),a.name=r.name||e.name,r.no_replace||(i[0]=Object.assign(e,{data:null,shapes:null},a),wi(e)&&ho(t)),i}function No(e,t){e.arcs&&e.arcs.transformPoints(t),e.layers.forEach(function(e){Si(e)&&Ii(e,t)})}var To=Object.freeze({__proto__:null,cleanupArcs:Mo,copyDataset:bo,copyDatasetForExport:_o,copyDatasetForRenaming:xo,copyDatasetInfo:yo,datasetHasGeometry:Ao,datasetHasPaths:Eo,datasetIsEmpty:So,getDatasetBounds:wo,mergeDatasetInfo:function(e,n){var r=n.info||{},i=e.info||(e.info={});i.input_files=t.uniq((i.input_files||[]).concat(r.input_files||[])),i.input_formats=t.uniq((i.input_formats||[]).concat(r.input_formats||[])),t.defaults(i,r)},mergeOutputLayerIntoDataset:Po,mergeOutputLayersIntoDataset:Oo,pruneArcs:Io,replaceLayerContents:Co,replaceLayers:ko,splitApartLayers:vo,splitDataset:mo,transformPoints:No});function Lo(e){var t={filename:"",directory:"",basename:"",extension:""},n=function(e){return-1==e.indexOf("/")&&-1!=e.indexOf("\\")?"\\":"/"}(e),r=e.split(n),i=r.pop(),a=/\.([a-z][a-z0-9]*)$/i,o=a.test(i)?a.exec(i)[0]:"";return o||i.includes("*")?(t.filename=i,t.extension=o?o.slice(1):"",t.basename=i.slice(0,i.length-o.length),t.directory=r.join(n)):t.directory=i?e:r.join(n),t}function zo(e){return Lo(e).basename}function Ro(e){return Lo(e).extension}function Do(e){var t=Lo(e);return t.extension?e.slice(0,e.length-t.extension.length-1):e}function jo(e,t){var n=Do(e);return t?n+"."+t:n}function Fo(e){var t=Ro(e);return t?Do(e)+"."+t.toLowerCase():e}function Uo(e){return e.reduce(function(e,n,r){return e=0===r?zo(n):t.mergeNames(e,n)},"")}function Bo(e){var t=e.info&&e.info.input_files;return t&&Uo(t)||"output"}var Go,qo,Vo,$o=Object.freeze({__proto__:null,getCommonFileBase:Uo,getFileBase:zo,getFileExtension:Ro,getOutputFileBase:Bo,getPathBase:Do,parseLocalPath:Lo,replaceFileExtension:jo,toLowerCaseExtension:Fo});try{Go=new TextDecoder}catch(vt){}var Jo,Wo,Zo,Yo,Ho,Xo=0,Ko={},Qo=0,es=0,ts=[],ns={useRecords:!1,mapsAsObjects:!0};class rs{}const is=new rs;is.name="MessagePack 0xC1";var as=!1,os=2;try{new Function("")}catch(vt){os=1/0}class ss{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.sequential&&!1!==e.trusted&&(e.trusted=!0,e.structures||0==e.useRecords||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(qo)return Rs(()=>(Ds(),this?this.unpack(e,t):ss.prototype.unpack.call(ns,e,t)));e.buffer||e.constructor!==ArrayBuffer||(e=void 0!==ne?ne.from(e):new Uint8Array(e)),"object"==typeof t?(Vo=t.end||e.length,Xo=t.start||0):(Xo=0,Vo=t>-1?t:e.length),es=0,Wo=null,Zo=null,qo=e;try{Ho=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(qo=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof ss){if(Ko=this,this.structures)return Jo=this.structures,us();(!Jo||Jo.length>0)&&(Jo=[])}else Ko=ns,(!Jo||Jo.length>0)&&(Jo=[]);return us()}unpackMultiple(e,t){let n,r=0;try{as=!0;let i=e.length,a=this?this.unpack(e,i):Fs.unpack(e,i);if(!t){for(n=[a];Xo<i;)r=Xo,n.push(us());return n}if(!1===t(a,r,Xo))return;for(;Xo<i;)if(r=Xo,!1===t(us(),r,Xo))return}catch(e){throw e.lastPosition=r,e.values=n,e}finally{as=!1,Ds()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function us(e){try{if(!Ko.trusted&&!as){let e=Jo.sharedLength||0;e<Jo.length&&(Jo.length=e)}let e;if(Ko.randomAccessStructure&&qo[Xo]<64&&qo[Xo],e=fs(),Zo&&(Xo=Zo.postBundlePosition,Zo=null),as&&(Jo.restoreStructures=null),Xo==Vo)Jo&&Jo.restoreStructures&&cs(),Jo=null,qo=null,Yo&&(Yo=null);else{if(Xo>Vo)throw new Error("Unexpected end of MessagePack data");if(!as){let t;try{t=JSON.stringify(e,(e,t)=>"bigint"==typeof t?`${t}n`:t).slice(0,100)}catch(e){t="(JSON view not available "+e+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw Jo&&Jo.restoreStructures&&cs(),Ds(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||Xo>Vo)&&(e.incomplete=!0),e}}function cs(){for(let e in Jo.restoreStructures)Jo[e]=Jo.restoreStructures[e];Jo.restoreStructures=null}function fs(){let e=qo[Xo++];if(e<160){if(e<128){if(e<64)return e;{let t=Jo[63&e]||Ko.getStructures&&ds()[63&e];return t?(t.read||(t.read=hs(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Ko.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Cs();"__proto__"===e&&(e="__proto_"),t[e]=fs()}return t}{let t=new Map;for(let n=0;n<e;n++)t.set(fs(),fs());return t}}{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=fs();return Ko.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(es>=Xo)return Wo.slice(Xo-Qo,(Xo+=t)-Qo);if(0==es&&Vo<140){let e=t<16?As(t):Ss(t);if(null!=e)return e}return gs(t)}{let t;switch(e){case 192:return null;case 193:return Zo?(t=fs(),t>0?Zo[1].slice(Zo.position1,Zo.position1+=t):Zo[0].slice(Zo.position0,Zo.position0-=t)):is;case 194:return!1;case 195:return!0;case 196:if(t=qo[Xo++],void 0===t)throw new Error("Unexpected end of buffer");return Ms(t);case 197:return t=Ho.getUint16(Xo),Xo+=2,Ms(t);case 198:return t=Ho.getUint32(Xo),Xo+=4,Ms(t);case 199:return Is(qo[Xo++]);case 200:return t=Ho.getUint16(Xo),Xo+=2,Is(t);case 201:return t=Ho.getUint32(Xo),Xo+=4,Is(t);case 202:if(t=Ho.getFloat32(Xo),Ko.useFloat32>2){let e=js[(127&qo[Xo])<<1|qo[Xo+1]>>7];return Xo+=4,(e*t+(t>0?.5:-.5)|0)/e}return Xo+=4,t;case 203:return t=Ho.getFloat64(Xo),Xo+=8,t;case 204:return qo[Xo++];case 205:return t=Ho.getUint16(Xo),Xo+=2,t;case 206:return t=Ho.getUint32(Xo),Xo+=4,t;case 207:return"number"===Ko.int64AsType?(t=4294967296*Ho.getUint32(Xo),t+=Ho.getUint32(Xo+4)):"string"===Ko.int64AsType?t=Ho.getBigUint64(Xo).toString():"auto"===Ko.int64AsType?(t=Ho.getBigUint64(Xo),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ho.getBigUint64(Xo),Xo+=8,t;case 208:return Ho.getInt8(Xo++);case 209:return t=Ho.getInt16(Xo),Xo+=2,t;case 210:return t=Ho.getInt32(Xo),Xo+=4,t;case 211:return"number"===Ko.int64AsType?(t=4294967296*Ho.getInt32(Xo),t+=Ho.getUint32(Xo+4)):"string"===Ko.int64AsType?t=Ho.getBigInt64(Xo).toString():"auto"===Ko.int64AsType?(t=Ho.getBigInt64(Xo),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ho.getBigInt64(Xo),Xo+=8,t;case 212:if(t=qo[Xo++],114==t)return Os(63&qo[Xo++]);{let e=ts[t];if(e)return e.read?(Xo++,e.read(fs())):e.noBuffer?(Xo++,e()):e(qo.subarray(Xo,++Xo));throw new Error("Unknown extension "+t)}case 213:return t=qo[Xo],114==t?(Xo++,Os(63&qo[Xo++],qo[Xo++])):Is(2);case 214:return Is(4);case 215:return Is(8);case 216:return Is(16);case 217:return t=qo[Xo++],es>=Xo?Wo.slice(Xo-Qo,(Xo+=t)-Qo):ms(t);case 218:return t=Ho.getUint16(Xo),es>=(Xo+=2)?Wo.slice(Xo-Qo,(Xo+=t)-Qo):ys(t);case 219:return t=Ho.getUint32(Xo),es>=(Xo+=4)?Wo.slice(Xo-Qo,(Xo+=t)-Qo):vs(t);case 220:return t=Ho.getUint16(Xo),Xo+=2,_s(t);case 221:return t=Ho.getUint32(Xo),Xo+=4,_s(t);case 222:return t=Ho.getUint16(Xo),Xo+=2,xs(t);case 223:return t=Ho.getUint32(Xo),Xo+=4,xs(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}const ls=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function hs(e,t){function n(){if(n.count++>os){let n=e.read=new Function("r","return function(){return "+(Ko.freezeData?"Object.freeze":"")+"({"+e.map(e=>"__proto__"===e?"__proto_:r()":ls.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"})}")(fs);return 0===e.highByte&&(e.read=ps(t,e.read)),n()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];"__proto__"===n&&(n="__proto_"),r[n]=fs()}return Ko.freezeData?Object.freeze(r):r}return n.count=0,0===e.highByte?ps(t,n):n}const ps=(e,t)=>function(){let n=qo[Xo++];if(0===n)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=Jo[r]||ds()[r];if(!i)throw new Error("Record id is not defined for "+r);return i.read||(i.read=hs(i,e)),i.read()};function ds(){let e=Rs(()=>(qo=null,Ko.getStructures()));return Jo=Ko._mergeStructures(e,Jo)}var gs=bs,ms=bs,ys=bs,vs=bs;function bs(e){let t;if(e<16&&(t=As(e)))return t;if(e>64&&Go)return Go.decode(qo.subarray(Xo,Xo+=e));const n=Xo+e,r=[];for(t="";Xo<n;){const e=qo[Xo++];if(128&e)if(192==(224&e)){const t=63&qo[Xo++];r.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&qo[Xo++],n=63&qo[Xo++];r.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&qo[Xo++])<<12|(63&qo[Xo++])<<6|63&qo[Xo++];t>65535&&(t-=65536,r.push(t>>>10&1023|55296),t=56320|1023&t),r.push(t)}else r.push(e);else r.push(e);r.length>=4096&&(t+=ws.apply(String,r),r.length=0)}return r.length>0&&(t+=ws.apply(String,r)),t}function _s(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=fs();return Ko.freezeData?Object.freeze(t):t}function xs(e){if(Ko.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Cs();"__proto__"===e&&(e="__proto_"),t[e]=fs()}return t}{let t=new Map;for(let n=0;n<e;n++)t.set(fs(),fs());return t}}var ws=String.fromCharCode;function Ss(e){let t=Xo,n=new Array(e);for(let r=0;r<e;r++){const e=qo[Xo++];if((128&e)>0)return void(Xo=t);n[r]=e}return ws.apply(String,n)}function As(e){if(e<4){if(e<2){if(0===e)return"";{let e=qo[Xo++];return(128&e)>1?void(Xo-=1):ws(e)}}{let t=qo[Xo++],n=qo[Xo++];if((128&t)>0||(128&n)>0)return void(Xo-=2);if(e<3)return ws(t,n);let r=qo[Xo++];return(128&r)>0?void(Xo-=3):ws(t,n,r)}}{let t=qo[Xo++],n=qo[Xo++],r=qo[Xo++],i=qo[Xo++];if((128&t)>0||(128&n)>0||(128&r)>0||(128&i)>0)return void(Xo-=4);if(e<6){if(4===e)return ws(t,n,r,i);{let e=qo[Xo++];return(128&e)>0?void(Xo-=5):ws(t,n,r,i,e)}}if(e<8){let a=qo[Xo++],o=qo[Xo++];if((128&a)>0||(128&o)>0)return void(Xo-=6);if(e<7)return ws(t,n,r,i,a,o);let s=qo[Xo++];return(128&s)>0?void(Xo-=7):ws(t,n,r,i,a,o,s)}{let a=qo[Xo++],o=qo[Xo++],s=qo[Xo++],u=qo[Xo++];if((128&a)>0||(128&o)>0||(128&s)>0||(128&u)>0)return void(Xo-=8);if(e<10){if(8===e)return ws(t,n,r,i,a,o,s,u);{let e=qo[Xo++];return(128&e)>0?void(Xo-=9):ws(t,n,r,i,a,o,s,u,e)}}if(e<12){let c=qo[Xo++],f=qo[Xo++];if((128&c)>0||(128&f)>0)return void(Xo-=10);if(e<11)return ws(t,n,r,i,a,o,s,u,c,f);let l=qo[Xo++];return(128&l)>0?void(Xo-=11):ws(t,n,r,i,a,o,s,u,c,f,l)}{let c=qo[Xo++],f=qo[Xo++],l=qo[Xo++],h=qo[Xo++];if((128&c)>0||(128&f)>0||(128&l)>0||(128&h)>0)return void(Xo-=12);if(e<14){if(12===e)return ws(t,n,r,i,a,o,s,u,c,f,l,h);{let e=qo[Xo++];return(128&e)>0?void(Xo-=13):ws(t,n,r,i,a,o,s,u,c,f,l,h,e)}}{let p=qo[Xo++],d=qo[Xo++];if((128&p)>0||(128&d)>0)return void(Xo-=14);if(e<15)return ws(t,n,r,i,a,o,s,u,c,f,l,h,p,d);let g=qo[Xo++];return(128&g)>0?void(Xo-=15):ws(t,n,r,i,a,o,s,u,c,f,l,h,p,d,g)}}}}}function Es(){let e,t=qo[Xo++];if(t<192)e=t-160;else switch(t){case 217:e=qo[Xo++];break;case 218:e=Ho.getUint16(Xo),Xo+=2;break;case 219:e=Ho.getUint32(Xo),Xo+=4;break;default:throw new Error("Expected string")}return bs(e)}function Ms(e){return Ko.copyBuffers?Uint8Array.prototype.slice.call(qo,Xo,Xo+=e):qo.subarray(Xo,Xo+=e)}function Is(e){let t=qo[Xo++];if(ts[t]){let n;return ts[t](qo.subarray(Xo,n=Xo+=e),e=>{Xo=e;try{return fs()}finally{Xo=n}})}throw new Error("Unknown extension type "+t)}var ks=new Array(4096);function Cs(){let e=qo[Xo++];if(!(e>=160&&e<192))return Xo--,Ps(fs());if(e-=160,es>=Xo)return Wo.slice(Xo-Qo,(Xo+=e)-Qo);if(!(0==es&&Vo<180))return gs(e);let t,n=4095&(e<<5^(e>1?Ho.getUint16(Xo):e>0?qo[Xo]:0)),r=ks[n],i=Xo,a=Xo+e-3,o=0;if(r&&r.bytes==e){for(;i<a;){if(t=Ho.getUint32(i),t!=r[o++]){i=1879048192;break}i+=4}for(a+=3;i<a;)if(t=qo[i++],t!=r[o++]){i=1879048192;break}if(i===a)return Xo=i,r.string;a-=3,i=Xo}for(r=[],ks[n]=r,r.bytes=e;i<a;)t=Ho.getUint32(i),r.push(t),i+=4;for(a+=3;i<a;)t=qo[i++],r.push(t);let s=e<16?As(e):Ss(e);return r.string=null!=s?s:gs(e)}function Ps(e){if("string"==typeof e)return e;if("number"==typeof e)return e.toString();throw new Error("Invalid property type for record",typeof e)}const Os=(e,t)=>{let n=fs().map(Ps),r=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=Jo[e];return i&&(i.isShared||as)&&((Jo.restoreStructures||(Jo.restoreStructures=[]))[e]=i),Jo[e]=n,n.read=hs(n,r),n.read()};ts[0]=()=>{},ts[0].noBuffer=!0,ts[66]=e=>{let t=e.length,n=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=8n,n+=BigInt(e[r]);return n};let Ns={Error:Error,TypeError:TypeError,ReferenceError:ReferenceError};ts[101]=()=>{let e=fs();return(Ns[e[0]]||Error)(e[1])},ts[105]=e=>{if(!1===Ko.structuredClone)throw new Error("Structured clone extension is disabled");let t=Ho.getUint32(Xo-4);Yo||(Yo=new Map);let n,r=qo[Xo];n=r>=144&&r<160||220==r||221==r?[]:{};let i={target:n};Yo.set(t,i);let a=fs();return i.used?Object.assign(n,a):(i.target=a,a)},ts[112]=e=>{if(!1===Ko.structuredClone)throw new Error("Structured clone extension is disabled");let t=Ho.getUint32(Xo-4),n=Yo.get(t);return n.used=!0,n.target},ts[115]=()=>new Set(fs());const Ts=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");let Ls="object"==typeof globalThis?globalThis:window;ts[116]=e=>{let t=e[0],n=Ts[t];if(!n)throw new Error("Could not find typed array for code "+t);return new Ls[n](Uint8Array.prototype.slice.call(e,1).buffer)},ts[120]=()=>{let e=fs();return new RegExp(e[0],e[1])};const zs=[];function Rs(e){let t=Vo,n=Xo,r=Qo,i=es,a=Wo,o=Yo,s=Zo,u=new Uint8Array(qo.slice(0,Vo)),c=Jo,f=Jo.slice(0,Jo.length),l=Ko,h=as,p=e();return Vo=t,Xo=n,Qo=r,es=i,Wo=a,Yo=o,Zo=s,qo=u,as=h,(Jo=c).splice(0,Jo.length,...f),Ko=l,Ho=new DataView(qo.buffer,qo.byteOffset,qo.byteLength),p}function Ds(){qo=null,Yo=null,Jo=null}ts[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=Xo;return Xo+=t-e.length,Zo=zs,(Zo=[Es(),Es()]).position0=0,Zo.position1=0,Zo.postBundlePosition=Xo,Xo=n,fs()},ts[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");const js=new Array(147);for(let e=0;e<256;e++)js[e]=+("1e"+Math.floor(45.15-.30103*e));var Fs=new ss({useRecords:!1});const Us=Fs.unpack;Fs.unpackMultiple,Fs.unpack;let Bs,Gs,qs,Vs=new Float32Array(1);new Uint8Array(Vs.buffer,0,4);try{Bs=new TextEncoder}catch(vt){}const $s=void 0!==ne,Js=$s?function(e){return ne.allocUnsafeSlow(e)}:Uint8Array,Ws=$s?ne:Uint8Array,Zs=$s?4294967296:2144337920;let Ys,Hs,Xs,Ks,Qs=0,eu=null;const tu=/[\u0080-\uFFFF]/,nu=Symbol("record-id");function ru(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function iu(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=255&n}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function au(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=255&i):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=255&i)}return t[n++]=r,t.set(e,n),n+=i}function ou(e,t,n){if(eu.length>0){Xs.setUint32(eu.position+e,Qs+n-eu.position-e),eu.stringsPosition=Qs-e;let r=eu;eu=null,t(r[0]),t(r[1])}}qs=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,rs],Gs=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,4e6*e.getMilliseconds()+(r/1e3/4294967296|0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,1e6*e.getMilliseconds()),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?ru(e,16,t):iu($s?ne.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==Ws&&this.moreTypes?ru(e,Ts.indexOf(n.name),t):iu(e,t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];let su=new class extends ss{constructor(e){let t,n,r,i;super(e),this.offset=0;let a=Ws.prototype.utf8Write?function(e,t){return Ys.utf8Write(e,t,4294967295)}:!(!Bs||!Bs.encodeInto)&&function(e,t){return Bs.encodeInto(e,Ys.subarray(t)).written},o=this;e||(e={});let s=e&&e.sequential,u=e.structures||e.saveStructures,c=e.maxSharedStructures;if(null==c&&(c=u?32:0),c>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&null==e.moreTypes&&(this.moreTypes=!0);let f=e.maxOwnStructures;null==f&&(f=u?32:64),this.structures||0==e.useRecords||(this.structures=[]);let l=c>32||f+c>64,h=c+64,p=c+f+64;if(p>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let d=[],g=0,m=0;this.pack=this.encode=function(e,a){if(Ys||(Ys=new Js(8192),Xs=Ys.dataView||(Ys.dataView=new DataView(Ys.buffer,0,8192)),Qs=0),Ks=Ys.length-10,Ks-Qs<2048?(Ys=new Js(Ys.length),Xs=Ys.dataView||(Ys.dataView=new DataView(Ys.buffer,0,Ys.length)),Ks=Ys.length-10,Qs=0):Qs=Qs+7&2147483640,t=Qs,a&lu&&(Qs+=255&a),i=o.structuredClone?new Map:null,o.bundleStrings&&"string"!=typeof e?(eu=[],eu.size=1/0):eu=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>c)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||(n=i[r]=Object.create(null)),i=n}i[nu]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}let u;n&&(n=!1);try{o.randomAccessStructure&&e&&e.constructor&&e.constructor===Object?I(e):b(e);let n=eu;if(eu&&ou(t,b,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&-1===a&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(Xs.setUint32(n.position+t,Xs.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&Xs.setUint32(n.position+t,Xs.getUint32(n.position+t)+a),Qs+=6*e.length,Qs>Ks&&A(Qs),o.offset=Qs;let s=function(e,t){let n,r=6*t.length,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=255&a,i=t}return e}(Ys.subarray(t,Qs),e);return i=null,s}return o.offset=Qs,a&cu?(Ys.start=t,Ys.end=Qs,Ys):Ys.subarray(t,Qs)}catch(e){throw u=e,e}finally{if(r&&(y(),n&&o.saveStructures)){let n=r.sharedLength||0,i=Ys.subarray(t,Qs),s=function(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}(r,o);if(!u)return!1===o.saveStructures(s,s.isCompatible)?o.pack(e,a):(o.lastNamedStructuresLength=n,i)}a&fu&&(Qs=t)}};const y=()=>{m<10&&m++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),g>1e4)r.transitions=null,m=0,g=0,d.length>0&&(d=[]);else if(d.length>0&&!s){for(let e=0,t=d.length;e<t;e++)d[e][nu]=0;d=[]}},v=e=>{var t=e.length;t<16?Ys[Qs++]=144|t:t<65536?(Ys[Qs++]=220,Ys[Qs++]=t>>8,Ys[Qs++]=255&t):(Ys[Qs++]=221,Xs.setUint32(Qs,t),Qs+=4);for(let n=0;n<t;n++)b(e[n])},b=e=>{Qs>Ks&&(Ys=A(Qs));var n,r=typeof e;if("string"===r){let r,i=e.length;if(eu&&i>=4&&i<4096){if((eu.size+=i)>21760){let e,n,r=(eu[0]?3*eu[0].length+eu[1].length:0)+10;Qs+r>Ks&&(Ys=A(Qs+r)),eu.position?(n=eu,Ys[Qs]=200,Qs+=3,Ys[Qs++]=98,e=Qs-t,Qs+=4,ou(t,b,0),Xs.setUint16(e+t-3,Qs-t-e)):(Ys[Qs++]=214,Ys[Qs++]=98,e=Qs-t,Qs+=4),eu=["",""],eu.previous=n,eu.size=0,eu.position=e}let n=tu.test(e);return eu[n?0:1]+=e,Ys[Qs++]=193,void b(n?-i:i)}r=i<32?1:i<256?2:i<65536?3:5;let o=3*i;if(Qs+o>Ks&&(Ys=A(Qs+o)),i<64||!a){let t,a,o,s=Qs+r;for(t=0;t<i;t++)a=e.charCodeAt(t),a<128?Ys[s++]=a:a<2048?(Ys[s++]=a>>6|192,Ys[s++]=63&a|128):55296==(64512&a)&&56320==(64512&(o=e.charCodeAt(t+1)))?(a=65536+((1023&a)<<10)+(1023&o),t++,Ys[s++]=a>>18|240,Ys[s++]=a>>12&63|128,Ys[s++]=a>>6&63|128,Ys[s++]=63&a|128):(Ys[s++]=a>>12|224,Ys[s++]=a>>6&63|128,Ys[s++]=63&a|128);n=s-Qs-r}else n=a(e,Qs+r);n<32?Ys[Qs++]=160|n:n<256?(r<2&&Ys.copyWithin(Qs+2,Qs+1,Qs+1+n),Ys[Qs++]=217,Ys[Qs++]=n):n<65536?(r<3&&Ys.copyWithin(Qs+3,Qs+2,Qs+2+n),Ys[Qs++]=218,Ys[Qs++]=n>>8,Ys[Qs++]=255&n):(r<5&&Ys.copyWithin(Qs+5,Qs+3,Qs+3+n),Ys[Qs++]=219,Xs.setUint32(Qs,n),Qs+=4),Qs+=n}else if("number"===r)if(e>>>0===e)e<32||e<128&&!1===this.useRecords||e<64&&!this.randomAccessStructure?Ys[Qs++]=e:e<256?(Ys[Qs++]=204,Ys[Qs++]=e):e<65536?(Ys[Qs++]=205,Ys[Qs++]=e>>8,Ys[Qs++]=255&e):(Ys[Qs++]=206,Xs.setUint32(Qs,e),Qs+=4);else if((e|0)===e)e>=-32?Ys[Qs++]=256+e:e>=-128?(Ys[Qs++]=208,Ys[Qs++]=e+256):e>=-32768?(Ys[Qs++]=209,Xs.setInt16(Qs,e),Qs+=2):(Ys[Qs++]=210,Xs.setInt32(Qs,e),Qs+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let n;if(Ys[Qs++]=202,Xs.setFloat32(Qs,e),t<4||((n=e*js[(127&Ys[Qs])<<1|Ys[Qs+1]>>7])|0)===n)return void(Qs+=4);Qs--}Ys[Qs++]=203,Xs.setFloat64(Qs,e),Qs+=8}else if("object"===r||"function"===r)if(e){if(i){let n=i.get(e);if(n){if(!n.id){let e=i.idsToInsert||(i.idsToInsert=[]);n.id=e.push(n)}return Ys[Qs++]=214,Ys[Qs++]=112,Xs.setUint32(Qs,n.id),void(Qs+=4)}i.set(e,{offset:Qs-t})}let a=e.constructor;if(a===Object)S(e,!0);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)Ys[Qs++]=128;else{(n=e.size)<16?Ys[Qs++]=128|n:n<65536?(Ys[Qs++]=222,Ys[Qs++]=n>>8,Ys[Qs++]=255&n):(Ys[Qs++]=223,Xs.setUint32(Qs,n),Qs+=4);for(let[t,n]of e)b(t),b(n)}else{for(let t=0,n=Gs.length;t<n;t++){if(e instanceof qs[t]){let n=Gs[t];if(n.write){n.type&&(Ys[Qs++]=212,Ys[Qs++]=n.type,Ys[Qs++]=0);let t=n.write.call(this,e);return void(t===e?Array.isArray(e)?v(e):S(e):b(t))}let r,i=Ys,a=Xs,o=Qs;Ys=null;try{r=n.pack.call(this,e,e=>(Ys=i,i=null,Qs+=e,Qs>Ks&&A(Qs),{target:Ys,targetView:Xs,position:Qs-e}),b)}finally{i&&(Ys=i,Xs=a,Qs=o,Ks=Ys.length-10)}return void(r&&(r.length+Qs>Ks&&A(r.length+Qs),Qs=au(r,Ys,Qs,n.type)))}}if(Array.isArray(e))v(e);else{if(e.toJSON){const t=e.toJSON();if(t!==e)return b(t)}if("function"===r)return b(this.writeFunction&&this.writeFunction(e));S(e,!e.hasOwnProperty)}}}else Ys[Qs++]=192;else if("boolean"===r)Ys[Qs++]=e?195:194;else if("bigint"===r){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))Ys[Qs++]=211,Xs.setBigInt64(Qs,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)Ys[Qs++]=207,Xs.setBigUint64(Qs,e);else{if(!this.largeBigIntToFloat){if(this.useBigIntExtension&&e<2n**1023n&&e>-(2n**1023n)){Ys[Qs++]=199,Qs++,Ys[Qs++]=66;let t,n=[];do{let r=0xffn&e;t=(0x80n&r)==(e<0n?0x80n:0n),n.push(r),e>>=8n}while(0n!==e&&-1n!==e||!t);Ys[Qs-2]=n.length;for(let e=n.length;e>0;)Ys[Qs++]=Number(n[--e]);return}throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64")}Ys[Qs++]=203,Xs.setFloat64(Qs,Number(e))}Qs+=8}else{if("undefined"!==r)throw new Error("Unknown type: "+r);this.encodeUndefinedAsNil?Ys[Qs++]=192:(Ys[Qs++]=212,Ys[Qs++]=0,Ys[Qs++]=0)}},_=this.variableMapSize||this.coercibleKeyAsNumber?e=>{let t,n=Object.keys(e),r=n.length;if(r<16?Ys[Qs++]=128|r:r<65536?(Ys[Qs++]=222,Ys[Qs++]=r>>8,Ys[Qs++]=255&r):(Ys[Qs++]=223,Xs.setUint32(Qs,r),Qs+=4),this.coercibleKeyAsNumber)for(let i=0;i<r;i++){t=n[i];let r=Number(t);b(isNaN(r)?t:r),b(e[t])}else for(let i=0;i<r;i++)b(t=n[i]),b(e[t])}:(e,n)=>{Ys[Qs++]=222;let r=Qs-t;Qs+=2;let i=0;for(let t in e)(n||e.hasOwnProperty(t))&&(b(t),b(e[t]),i++);Ys[r+++t]=i>>8,Ys[r+t]=255&i},x=!1===this.useRecords?_:e.progressiveRecords&&!l?(e,n)=>{let i,a,o=r.transitions||(r.transitions=Object.create(null)),s=Qs++-t;for(let u in e)if(n||e.hasOwnProperty(u)){if(i=o[u],i)o=i;else{let n=Object.keys(e),c=o;o=r.transitions;let f=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];i=o[t],i||(i=o[t]=Object.create(null),f++),o=i}s+t+1==Qs?(Qs--,E(o,n,f)):M(o,n,s,f),a=!0,o=c[u]}b(e[u])}if(!a){let n=o[nu];n?Ys[s+t]=n:M(o,Object.keys(e),s,0)}}:(e,t)=>{let n,i=r.transitions||(r.transitions=Object.create(null)),a=0;for(let r in e)(t||e.hasOwnProperty(r))&&(n=i[r],n||(n=i[r]=Object.create(null),a++),i=n);let o=i[nu];o?o>=96&&l?(Ys[Qs++]=96+(31&(o-=96)),Ys[Qs++]=o>>5):Ys[Qs++]=o:E(i,i.__keys__||Object.keys(e),a);for(let n in e)(t||e.hasOwnProperty(n))&&b(e[n])},w="function"==typeof this.useRecords&&this.useRecords,S=w?(e,t)=>{w(e)?x(e,t):_(e,t)}:x,A=e=>{let n;if(e>16777216){if(e-t>Zs)throw new Error("Packed buffer would be larger than maximum buffer size");n=Math.min(Zs,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else n=1+(Math.max(e-t<<2,Ys.length-1)>>12)<<12;let r=new Js(n);return Xs=r.dataView||(r.dataView=new DataView(r.buffer,0,n)),e=Math.min(e,Ys.length),Ys.copy?Ys.copy(r,0,t,e):r.set(Ys.slice(t,e)),Qs-=t,t=0,Ks=r.length-10,Ys=r},E=(e,t,i)=>{let a=r.nextId;a||(a=64),a<h&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=h),r.nextOwnId=a+1):(a>=p&&(a=h),r.nextId=a+1);let o=t.highByte=a>=96&&l?a-96>>5:-1;e[nu]=a,e.__keys__=t,r[a-64]=t,a<h?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(Ys[Qs++]=96+(31&a),Ys[Qs++]=o):Ys[Qs++]=a):(o>=0?(Ys[Qs++]=213,Ys[Qs++]=114,Ys[Qs++]=96+(31&a),Ys[Qs++]=o):(Ys[Qs++]=212,Ys[Qs++]=114,Ys[Qs++]=a),i&&(g+=m*i),d.length>=f&&(d.shift()[nu]=0),d.push(e),b(t))},M=(e,n,r,i)=>{let a=Ys,o=Qs,s=Ks,u=t;Ys=Hs,Qs=0,t=0,Ys||(Hs=Ys=new Js(8192)),Ks=Ys.length-10,E(e,n,i),Hs=Ys;let c=Qs;if(Ys=a,Qs=o,Ks=s,t=u,c>1){let e=Qs+c-1;e>Ks&&A(e);let n=r+t;Ys.copyWithin(n+c,n+1,Qs),Ys.set(Hs.slice(0,c),n),Qs=e}else Ys[r+t]=Hs[0]},I=(e,i)=>{let a=(void 0)(e,Ys,t,Qs,r,A,(e,t,r)=>{if(r)return n=!0;Qs=t;let i=Ys;return b(e),y(),i!==Ys?{position:Qs,targetView:Xs,target:Ys}:Qs},this);if(0===a)return S(e,!0);Qs=a}}useBuffer(e){Ys=e,Xs=new DataView(Ys.buffer,Ys.byteOffset,Ys.byteLength),Qs=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}({useRecords:!1});const uu=su.pack;su.pack;const cu=512,fu=1024,lu=2048;var hu={},pu=Uint8Array,du=Uint16Array,gu=Int32Array,mu=new pu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yu=new pu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vu=new pu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bu=function(e,t){for(var n=new du(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new gu(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},_u=bu(mu,2),xu=_u.b,wu=_u.r;xu[28]=258,wu[258]=28;for(var Su=bu(yu,0),Au=Su.b,Eu=Su.r,Mu=new du(32768),Iu=0;Iu<32768;++Iu){var ku=(43690&Iu)>>1|(21845&Iu)<<1;ku=(61680&(ku=(52428&ku)>>2|(13107&ku)<<2))>>4|(3855&ku)<<4,Mu[Iu]=((65280&ku)>>8|(255&ku)<<8)>>1}var Cu=function(e,t,n){for(var r=e.length,i=0,a=new du(t);i<r;++i)e[i]&&++a[e[i]-1];var o,s=new du(t);for(i=1;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new du(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],l=s[e[i]-1]++<<f,h=l|(1<<f)-1;l<=h;++l)o[Mu[l]>>u]=c}else for(o=new du(r),i=0;i<r;++i)e[i]&&(o[i]=Mu[s[e[i]-1]++]>>15-e[i]);return o},Pu=new pu(288);for(Iu=0;Iu<144;++Iu)Pu[Iu]=8;for(Iu=144;Iu<256;++Iu)Pu[Iu]=9;for(Iu=256;Iu<280;++Iu)Pu[Iu]=7;for(Iu=280;Iu<288;++Iu)Pu[Iu]=8;var Ou=new pu(32);for(Iu=0;Iu<32;++Iu)Ou[Iu]=5;var Nu=Cu(Pu,9,0),Tu=Cu(Pu,9,1),Lu=Cu(Ou,5,0),zu=Cu(Ou,5,1),Ru=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Du=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},ju=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Fu=function(e){return(e+7)/8|0},Uu=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new pu(e.subarray(t,n))},Bu=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Gu=function(e,t,n){var r=new Error(t||Bu[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Gu),!n)throw r;return r},qu=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new pu(0);var o=!n,s=o||2!=t.i,u=t.i;o&&(n=new pu(3*i));var c=function(e){var t=n.length;if(e>t){var r=new pu(Math.max(2*t,e));r.set(n),n=r}},f=t.f||0,l=t.p||0,h=t.b||0,p=t.l,d=t.d,g=t.m,m=t.n,y=8*i;do{if(!p){f=Du(e,l,1);var v=Du(e,l+1,3);if(l+=3,!v){var b=e[(P=Fu(l)+4)-4]|e[P-3]<<8,_=P+b;if(_>i){u&&Gu(0);break}s&&c(h+b),n.set(e.subarray(P,_),h),t.b=h+=b,t.p=l=8*_,t.f=f;continue}if(1==v)p=Tu,d=zu,g=9,m=5;else if(2==v){var x=Du(e,l,31)+257,w=Du(e,l+10,15)+4,S=x+Du(e,l+5,31)+1;l+=14;for(var A=new pu(S),E=new pu(19),M=0;M<w;++M)E[vu[M]]=Du(e,l+3*M,7);l+=3*w;var I=Ru(E),k=(1<<I)-1,C=Cu(E,I,1);for(M=0;M<S;){var P,O=C[Du(e,l,k)];if(l+=15&O,(P=O>>4)<16)A[M++]=P;else{var N=0,T=0;for(16==P?(T=3+Du(e,l,3),l+=2,N=A[M-1]):17==P?(T=3+Du(e,l,7),l+=3):18==P&&(T=11+Du(e,l,127),l+=7);T--;)A[M++]=N}}var L=A.subarray(0,x),z=A.subarray(x);g=Ru(L),m=Ru(z),p=Cu(L,g,1),d=Cu(z,m,1)}else Gu(1);if(l>y){u&&Gu(0);break}}s&&c(h+131072);for(var R=(1<<g)-1,D=(1<<m)-1,j=l;;j=l){var F=(N=p[ju(e,l)&R])>>4;if((l+=15&N)>y){u&&Gu(0);break}if(N||Gu(2),F<256)n[h++]=F;else{if(256==F){j=l,p=null;break}var U=F-254;if(F>264){var B=mu[M=F-257];U=Du(e,l,(1<<B)-1)+xu[M],l+=B}var G=d[ju(e,l)&D],q=G>>4;G||Gu(3),l+=15&G;z=Au[q];if(q>3){B=yu[q];z+=ju(e,l)&(1<<B)-1,l+=B}if(l>y){u&&Gu(0);break}s&&c(h+131072);var V=h+U;if(h<z){var $=a-z,J=Math.min(z,V);for($+h<0&&Gu(3);h<J;++h)n[h]=r[$+h]}for(;h<V;++h)n[h]=n[h-z]}}t.l=p,t.p=j,t.b=h,t.f=f,p&&(f=1,t.m=g,t.d=d,t.n=m)}while(!f);return h!=n.length&&o?Uu(n,0,h):n.subarray(0,h)},Vu=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},$u=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Ju=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Qu,l:0};if(1==i){var o=new pu(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],u=n[1],c=0,f=1,l=2;for(n[0]={s:-1,f:s.f+u.f,l:s,r:u};f!=i-1;)s=n[n[c].f<n[l].f?c++:l++],u=n[c!=f&&n[c].f<n[l].f?c++:l++],n[f++]={s:-1,f:s.f+u.f,l:s,r:u};var h=a[0].s;for(r=1;r<i;++r)a[r].s>h&&(h=a[r].s);var p=new du(h+1),d=Wu(n[f-1],p,0);if(d>t){r=0;var g=0,m=d-t,y=1<<m;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(!(p[v]>t))break;g+=y-(1<<d-p[v]),p[v]=t}for(g>>=m;g>0;){var b=a[r].s;p[b]<t?g-=1<<t-p[b]++-1:++r}for(;r>=0&&g;--r){var _=a[r].s;p[_]==t&&(--p[_],++g)}d=t}return{t:new pu(p),l:d}},Wu=function(e,t,n){return-1==e.s?Math.max(Wu(e.l,t,n+1),Wu(e.r,t,n+1)):t[e.s]=n},Zu=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new du(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Yu=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Hu=function(e,t,n){var r=n.length,i=Fu(t+2);e[i]=255&r,e[i+1]=r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Xu=function(e,t,n,r,i,a,o,s,u,c,f){Vu(t,f++,n),++i[256];for(var l=Ju(i,15),h=l.t,p=l.l,d=Ju(a,15),g=d.t,m=d.l,y=Zu(h),v=y.c,b=y.n,_=Zu(g),x=_.c,w=_.n,S=new du(19),A=0;A<v.length;++A)++S[31&v[A]];for(A=0;A<x.length;++A)++S[31&x[A]];for(var E=Ju(S,7),M=E.t,I=E.l,k=19;k>4&&!M[vu[k-1]];--k);var C,P,O,N,T=c+5<<3,L=Yu(i,Pu)+Yu(a,Ou)+o,z=Yu(i,h)+Yu(a,g)+o+14+3*k+Yu(S,M)+2*S[16]+3*S[17]+7*S[18];if(u>=0&&T<=L&&T<=z)return Hu(t,f,e.subarray(u,u+c));if(Vu(t,f,1+(z<L)),f+=2,z<L){C=Cu(h,p,0),P=h,O=Cu(g,m,0),N=g;var R=Cu(M,I,0);Vu(t,f,b-257),Vu(t,f+5,w-1),Vu(t,f+10,k-4),f+=14;for(A=0;A<k;++A)Vu(t,f+3*A,M[vu[A]]);f+=3*k;for(var D=[v,x],j=0;j<2;++j){var F=D[j];for(A=0;A<F.length;++A){var U=31&F[A];Vu(t,f,R[U]),f+=M[U],U>15&&(Vu(t,f,F[A]>>5&127),f+=F[A]>>12)}}}else C=Nu,P=Pu,O=Lu,N=Ou;for(A=0;A<s;++A){var B=r[A];if(B>255){$u(t,f,C[(U=B>>18&31)+257]),f+=P[U+257],U>7&&(Vu(t,f,B>>23&31),f+=mu[U]);var G=31&B;$u(t,f,O[G]),f+=N[G],G>3&&($u(t,f,B>>5&8191),f+=yu[G])}else $u(t,f,C[B]),f+=P[B]}return $u(t,f,C[256]),f+P[256]},Ku=new gu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qu=new pu(0),ec=function(e,t,n,r,i,a){var o=a.z||e.length,s=new pu(r+o+5*(1+Math.ceil(o/7e3))+i),u=s.subarray(r,s.length-i),c=a.l,f=7&(a.r||0);if(t){f&&(u[0]=a.r>>3);for(var l=Ku[t-1],h=l>>13,p=8191&l,d=(1<<n)-1,g=a.p||new du(32768),m=a.h||new du(d+1),y=Math.ceil(n/3),v=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<v)&d},_=new gu(25e3),x=new du(288),w=new du(32),S=0,A=0,E=a.i||0,M=0,I=a.w||0,k=0;E+2<o;++E){var C=b(E),P=32767&E,O=m[C];if(g[P]=O,m[C]=P,I<=E){var N=o-E;if((S>7e3||M>24576)&&(N>423||!c)){f=Xu(e,u,0,_,x,w,A,M,k,E-k,f),M=S=A=0,k=E;for(var T=0;T<286;++T)x[T]=0;for(T=0;T<30;++T)w[T]=0}var L=2,z=0,R=p,D=P-O&32767;if(N>2&&C==b(E-D))for(var j=Math.min(h,N)-1,F=Math.min(32767,E),U=Math.min(258,N);D<=F&&--R&&P!=O;){if(e[E+L]==e[E+L-D]){for(var B=0;B<U&&e[E+B]==e[E+B-D];++B);if(B>L){if(L=B,z=D,B>j)break;var G=Math.min(D,B-2),q=0;for(T=0;T<G;++T){var V=E-D+T&32767,$=V-g[V]&32767;$>q&&(q=$,O=V)}}}D+=(P=O)-(O=g[P])&32767}if(z){_[M++]=268435456|wu[L]<<18|Eu[z];var J=31&wu[L],W=31&Eu[z];A+=mu[J]+yu[W],++x[257+J],++w[W],I=E+L,++S}else _[M++]=e[E],++x[e[E]]}}for(E=Math.max(E,I);E<o;++E)_[M++]=e[E],++x[e[E]];f=Xu(e,u,c,_,x,w,A,M,k,E-k,f),c||(a.r=7&f|u[f/8|0]<<3,f-=7,a.h=m,a.p=g,a.i=E,a.w=I)}else{for(E=a.w||0;E<o+c;E+=65535){var Z=E+65535;Z>=o&&(u[f/8|0]=c,Z=o),f=Hu(u,f+1,e.subarray(E,Z))}a.i=o}return Uu(s,0,r+Fu(f)+i)},tc=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),nc=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=tc[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},rc=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new pu(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ec(e,null==t.level?6:t.level,null==t.mem?i.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,n,r,i)},ic=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ac=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var s=r[o],u=a[o];if("function"==typeof s){t+=";"+u+"=";var c=s.toString();if(s.prototype)if(-1!=c.indexOf("[native code]")){var f=c.indexOf(" ",8)+1;t+=c.slice(f,c.indexOf("(",f))}else for(var l in t+=c,s.prototype)t+=";"+u+".prototype."+l+"="+s.prototype[l].toString();else t+=c}else n[u]=s}return t},oc=[],sc=function(e,t,n,r){if(!oc[n]){for(var i="",a={},o=e.length-1,s=0;s<o;++s)i=ac(e[s],i,a);oc[n]={c:ac(e[o],i,a),e:a}}var u=ic({},oc[n].e);return function(e,t,n,r,i){var a=new Worker(hu[t]||(hu[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=new Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}(oc[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,u,function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t}(u),r)},uc=function(){return[pu,du,gu,mu,yu,vu,xu,Au,Tu,zu,Mu,Bu,Cu,Ru,Du,ju,Fu,Uu,Gu,qu,Ac,hc,pc]},cc=function(){return[pu,du,gu,mu,yu,vu,wu,Eu,Nu,Pu,Lu,Ou,Mu,Ku,Qu,Cu,Vu,$u,Ju,Wu,Zu,Yu,Hu,Xu,Fu,Uu,ec,rc,Sc,hc]},fc=function(){return[bc,wc,vc,nc,tc]},lc=function(){return[_c,xc]},hc=function(e){return postMessage(e,[e.buffer])},pc=function(e){return e&&{out:e.size&&new pu(e.size),dictionary:e.dictionary}},dc=function(e,t,n,r,i,a){var o=sc(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},gc=function(e,t){return e[t]|e[t+1]<<8},mc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yc=function(e,t){return mc(e,t)+4294967296*mc(e,t+4)},vc=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},bc=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&vc(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},_c=function(e){31==e[0]&&139==e[1]&&8==e[2]||Gu(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)},xc=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},wc=function(e){return 10+(e.filename?e.filename.length+1:0)};function Sc(e,t){return rc(e,t||{},0,0)}function Ac(e,t){return qu(e,{i:2},t&&t.out,t&&t.dictionary)}function Ec(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[cc,fc,function(){return[Mc]}],function(e){return hc(Mc(e.data[0],e.data[1]))},2,n)}function Mc(e,t){t||(t={});var n=nc(),r=e.length;n.p(e);var i=rc(e,t,wc(t),8),a=i.length;return bc(i,t),vc(i,a-8,n.d()),vc(i,a-4,r),i}function Ic(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[uc,lc,function(){return[kc]}],function(e){return hc(kc(e.data[0],e.data[1]))},3,n)}function kc(e,t){var n=_c(e);return n+8>e.length&&Gu(6,"invalid gzip data"),qu(e.subarray(n,-8),{i:2},t&&t.out||new pu(xc(e)),t&&t.dictionary)}var Cc=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=ic(r,a[1]),a=a[0]),a instanceof pu?n[o]=[a,s]:(n[o+="/"]=[new pu(0),s],Cc(a,o,n,r))}},Pc="undefined"!=typeof TextEncoder&&new TextEncoder,Oc="undefined"!=typeof TextDecoder&&new TextDecoder;try{Oc.decode(Qu,{stream:!0})}catch(gx){}function Nc(e,t){if(Pc)return Pc.encode(e);for(var n=e.length,r=new pu(e.length+(e.length>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new pu(i+8+(n-o<<1));s.set(r),r=s}var u=e.charCodeAt(o);u<128||t?a(u):u<2048?(a(192|u>>6),a(128|63&u)):u>55295&&u<57344?(a(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++o))>>18),a(128|u>>12&63),a(128|u>>6&63),a(128|63&u)):(a(224|u>>12),a(128|u>>6&63),a(128|63&u))}return Uu(r,0,i)}function Tc(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Oc)return Oc.decode(e);var i=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Uu(e,n-1)};i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=i.s;return(n=i.r).length&&Gu(8),a}var Lc=function(e,t){return t+30+gc(e,t+26)+gc(e,t+28)},zc=function(e,t,n){var r=gc(e,t+28),i=Tc(e.subarray(t+46,t+46+r),!(2048&gc(e,t+8))),a=t+46+r,o=mc(e,t+20),s=n&&4294967295==o?Rc(e,a):[o,mc(e,t+24),mc(e,t+42)],u=s[0],c=s[1],f=s[2];return[gc(e,t+10),u,c,i,a+gc(e,t+30)+gc(e,t+32),f]},Rc=function(e,t){for(;1!=gc(e,t);t+=4+gc(e,t+2));return[yc(e,t+12),yc(e,t+4),yc(e,t+20)]},Dc=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Gu(9),t+=r+4}return t},jc=function(e,t,n,r,i,a,o,s){var u=r.length,c=n.extra,f=s&&s.length,l=Dc(c);vc(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8;var h=new Date(null==n.mtime?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&Gu(10),vc(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,-1!=a&&(vc(e,t,n.crc),vc(e,t+4,a<0?-a-2:a),vc(e,t+8,n.size)),vc(e,t+12,u),vc(e,t+14,l),t+=16,null!=o&&(vc(e,t,f),vc(e,t+6,n.attrs),vc(e,t+10,o),t+=14),e.set(r,t),t+=u,l)for(var d in c){var g=c[d],m=g.length;vc(e,t,+d),vc(e,t+2,m),e.set(g,t+4),t+=4+m}return f&&(e.set(s,t),t+=f),t},Fc=function(e,t,n,r,i){vc(e,t,101010256),vc(e,t+8,n),vc(e,t+10,n),vc(e,t+12,r),vc(e,t+16,i)};function Uc(e,t,n){n||(n=t,t={}),"function"!=typeof n&&Gu(7);var r={};Cc(e,"",r,t);var i=Object.keys(r),a=i.length,o=0,s=0,u=a,c=new Array(a),f=[],l=function(){for(var e=0;e<f.length;++e)f[e]()},h=function(e,t){Bc(function(){n(e,t)})};Bc(function(){h=n});var p=function(){var e=new pu(s+22),t=o,n=s-o;s=0;for(var r=0;r<u;++r){var i=c[r];try{var a=i.c.length;jc(e,s,i,i.f,i.u,a);var f=30+i.f.length+Dc(i.extra),l=s+f;e.set(i.c,l),jc(e,o,i,i.f,i.u,a,s,i.m),o+=16+f+(i.m?i.m.length:0),s=l+a}catch(e){return h(e,null)}}Fc(e,o,c.length,n,t),h(null,e)};a||p();for(var d=function(e){var t=i[e],n=r[t],u=n[0],d=n[1],g=nc(),m=u.length;g.p(u);var y=Nc(t),v=y.length,b=d.comment,_=b&&Nc(b),x=_&&_.length,w=Dc(d.extra),S=0==d.level?0:8,A=function(n,r){if(n)l(),h(n,null);else{var i=r.length;c[e]=ic(d,{size:m,crc:g.d(),c:r,f:y,m:_,u:v!=t.length||_&&b.length!=x,compression:S}),o+=30+v+w+i,s+=76+2*(v+w)+(x||0)+i,--a||p()}};if(v>65535&&A(Gu(11,0,1),null),S)if(m<16e4)try{A(null,Sc(u,d))}catch(e){A(e,null)}else f.push(function(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[cc],function(e){return hc(Sc(e.data[0],e.data[1]))},0,n)}(u,d,A));else A(null,u)},g=0;g<u;++g)d(g);return l}var Bc="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()};function Gc(e,t,n){n||(n=t,t={}),"function"!=typeof n&&Gu(7);var r=[],i=function(){for(var e=0;e<r.length;++e)r[e]()},a={},o=function(e,t){Bc(function(){n(e,t)})};Bc(function(){o=n});for(var s=e.length-22;101010256!=mc(e,s);--s)if(!s||e.length-s>65558)return o(Gu(13,0,1),null),i;var u=gc(e,s+8);if(u){var c=u,f=mc(e,s+16),l=4294967295==f||65535==c;if(l){var h=mc(e,s-12);(l=101075792==mc(e,h))&&(c=u=mc(e,h+32),f=mc(e,h+48))}for(var p=t&&t.filter,d=function(t){var n=zc(e,f,l),s=n[0],c=n[1],h=n[2],d=n[3],g=n[4],m=n[5],y=Lc(e,m);f=g;var v=function(e,t){e?(i(),o(e,null)):(t&&(a[d]=t),--u||o(null,a))};if(!p||p({name:d,size:c,originalSize:h,compression:s}))if(s)if(8==s){var b=e.subarray(y,y+c);if(h<524288||c>.8*h)try{v(null,Ac(b,{out:new pu(h)}))}catch(e){v(e,null)}else r.push(function(e,t,n){return n||(n=t,t={}),"function"!=typeof n&&Gu(7),dc(e,t,[uc],function(e){return hc(Ac(e.data[0],pc(e.data[1])))},1,n)}(b,{size:h},v))}else v(Gu(14,"unknown compression type "+s,1),null);else v(null,Uu(e,y,y+c));else v(null,null)},g=0;g<c;++g)d()}else o(null,{});return i}function qc(){return"undefined"!=typeof window&&void 0!==window.document}var Vc=Object.freeze({__proto__:null,runningInBrowser:qc});function $c(e){return e.length>2&&e.buffer instanceof ArrayBuffer&&31==e[0]&&139==e[1]}function Jc(e,t){return"string"==typeof e&&(e=Nc(e)),qc()?Mc(e,t):na.gzipSync(e,t)}async function Wc(e,n){return"string"==typeof e&&(e=Nc(e)),(qc()?t.promisify(Ec):t.promisify(na.gzip))(e,n)}async function Zc(e,n){e instanceof ArrayBuffer&&(e=new Uint8Array(e)),n=n||{};var r=qc()?t.promisify(Ic):t.promisify(na.gunzip),i=await r(e,n);return n.filename&&!Af(n.filename)&&(i=Tc(i)),i}function Yc(e,t){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n=kc(e);return t&&!Af(t)&&(n=Tc(n)),n}var Hc=Object.freeze({__proto__:null,gunzipAsync:Zc,gunzipSync:Yc,gzipAsync:Wc,gzipSync:Jc,isGzipped:$c});async function Xc(e){var t=e.getFields(),n=e.getRecords(),r=[],i=await Promise.all(t.map(function(e){var t=ei(e,n);return r.push(t),async function(e,t,n){if("number"==t||"string"==t)return Wc(JSON.stringify(ii(n,e)),{level:2,consume:!0});return ii(n,e)}(e,t,n)}));return{fields:t,types:r,data:i,size:n.length}}function Kc(e){return t=e,Array.isArray(t.fields)&&Array.isArray(t.types)&&Array.isArray(t.data)&&t.fields.length==t.types.length&&t.fields.length==t.data.length&&t.size>=0?function(e){for(var t=e.size,n=[],r=0;r<t;r++)n[r]={};for(var i=0,a=e.fields.length;i<a;i++)Qc(e.fields[i],e.types[i],e.data[i],n),e.data[i]=null;return n}(e):$c(e)?JSON.parse(Tc(Yc(e))):Array.isArray(e)?e:void vt("Unknown packed table format");var t}function Qc(e,t,n,r){var i;$c(n)?i=JSON.parse(Tc(Yc(n))):Array.isArray(n)?i=n:vt("Unexpected packed table format");for(var a=0,o=r.length;a<o;a++)r[a][e]=i[a]}var ef="msx";async function tf(e,t){return[{content:nf(await rf(e,t)),filename:t.file||"mapshaper_snapshot."+ef}]}function nf(e){return uu(e,{})}async function rf(e,t){return{version:1,created:(new Date).toISOString(),datasets:await Promise.all(e.map(e=>af(e,t)))}}async function af(e,t){var n=e.arcs,r=null;n&&((r=n.getVertexData()).zlimit=n.getRetainedInterval(),r=await of(r,t));var i=e.layers.map(e=>async function(e,t){var n=null;e.data&&(n=await Xc(e.data));return{name:e.name||null,geometry_type:e.geometry_type||null,shapes:e.shapes||null,data:n,menu_order:e.menu_order||null,pinned:e.pinned||t.show_all||!1,active:!(!e.active&&e!=t.active_layer)}}(e,t));return{arcs:r,info:e.info?uf(e.info):null,layers:await Promise.all(i)}}async function of(e,t){var n;t.compact&&e.zz&&((n=e).zz&&n.zlimit&&delete(n=en(n,n.zlimit)).zz,e=n);var r={nn:sf(e.nn),xx:sf(e.xx),yy:sf(e.yy),zz:e.zz?sf(e.zz):null,zlimit:e.zlimit||0};return t.compact&&e.zz&&await async function(e,t){var n=Object.assign({level:1,consume:!1},t),r=[Wc(e.nn,n),Wc(e.xx,n),Wc(e.yy,n)];e.zz&&r.push(Wc(e.zz,n));var i=await Promise.all(r);e.nn=i.shift(),e.xx=i.shift(),e.yy=i.shift(),e.zz&&(e.zz=i.shift())}(r),r}function sf(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function uf(e){return!(e=Object.assign({},e)).crs||e.crs_string||e.prj||(e.crs_string=ga(e.crs)),delete e.crs,e}var cf=Object.freeze({__proto__:null,PACKAGE_EXT:ef,compressSnapshotForExport:async function(e){var t=e.datasets.map(e=>{!async function(e){if(!e.arcs)return;var t=function(e){return{nn:new Uint32Array(e.nn.buffer,0,e.nn.length/4),xx:new Float64Array(e.xx.buffer,0,e.xx.length/8),yy:new Float64Array(e.yy.buffer,0,e.yy.length/8),zz:e.zz?new Float64Array(e.zz.buffer,0,e.zz.length/8):null,zlimit:e.zlimit||0}}(e.arcs);e.arcs=await of(t,{compact:!0})}(e)});await Promise.all(t)},exportDataset:af,exportDatasetsToPack:rf,exportInfo:uf,exportPackedDatasets:tf,pack:nf});function ff(e){var t=Ro(e||"").toLowerCase(),n=null;return"dbf"==t||"shp"==t||"kml"==t||lf(t)?n=t:/json$/.test(t)?n="json":"csv"==t||"tsv"==t||"txt"==t||"tab"==t?n="text":t==ef&&(n=ef),n}function lf(e){return"prj"==e||"shx"==e||"cpg"==e}function hf(e){var n=null;return t.isString(e)?n=(df(e)?"json":gf(e)&&"kml")||"text":(t.isObject(e)&&e.type||t.isArray(e))&&(n="json"),n}function pf(e,t){return ff(e)||hf(t)}function df(e){return/^\s*[{[]/.test(String(e))}function gf(e){return(e=String(e)).includes("<kml ")&&e.includes('xmlns="http://www.opengis.net/kml/')}function mf(e){var t=Ro(e).toLowerCase();return/csv|tsv|txt$/.test(t)}function yf(e){var t=ff(e);return!!t&&"gz"!=t&&"zip"!=t}function vf(e){return e.endsWith("."+ef)}function bf(e){return/\.zip$/i.test(e)}function _f(e){return/\.kmz$/i.test(e)}function xf(e){return/\.gz$/i.test(e)}function wf(e){return["geojson","topojson","json","dsv","dbf","shapefile","svg","kml",ef].indexOf(e)>-1}function Sf(e){var t=Ro(e).toLowerCase();return"shp"==t||"shx"==t||"dbf"==t||t==ef}function Af(e){var t=ff(e);return Sf(e)||bf(e)||xf(e)||_f(e)||vf(e)||"json"==t||"text"==t}function Ef(e){return/\.(shx|prj|xls|xlsx|gdb|sbn|sbx|xml)$/i.test(e)}var Mf=Object.freeze({__proto__:null,couldBeDsvFile:mf,filenameIsUnsupportedOutputType:Ef,getFormatName:function(e){return{geojson:"GeoJSON",topojson:"TopoJSON",json:"JSON records",dsv:"CSV",dbf:"DBF",kml:"KML",kmz:"KMZ",[ef]:"Snapshot file",shapefile:"Shapefile",svg:"SVG"}[e]||""},guessInputContentType:hf,guessInputFileType:ff,guessInputType:pf,isAuxiliaryInputFileType:lf,isGzipFile:xf,isImportableAsBinary:Af,isKmzFile:_f,isPackageFile:vf,isSupportedBinaryInputType:Sf,isSupportedOutputFormat:wf,isZipFile:bf,looksLikeContentFile:yf,looksLikeImportableFile:function(e){return!!ff(e)||Af(e)},stringLooksLikeJSON:df,stringLooksLikeKML:gf});function If(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!qc())return function(e){var t=new require("adm-zip")(e),n={};return t.getEntries().forEach(function(e){var t=Fo(e.name);Of(t)&&(n[t]=e.getData())}),n}(e);var t=function(e,t){for(var n={},r=e.length-22;101010256!=mc(e,r);--r)(!r||e.length-r>65558)&&Gu(13);var i=gc(e,r+8);if(!i)return{};var a=mc(e,r+16),o=4294967295==a||65535==i;if(o){var s=mc(e,r-12);(o=101075792==mc(e,s))&&(i=mc(e,s+32),a=mc(e,s+48))}for(var u=t&&t.filter,c=0;c<i;++c){var f=zc(e,a,o),l=f[0],h=f[1],p=f[2],d=f[3],g=f[4],m=f[5],y=Lc(e,m);a=g,u&&!u({name:d,size:h,originalSize:p,compression:l})||(l?8==l?n[d]=Ac(e.subarray(y,y+h),{out:new pu(p)}):Gu(14,"unknown compression type "+l):n[d]=Uu(e,y,y+h))}return n}(e,{filter:Cf});return Pf(t)}function kf(e){return qc()?function(e,t){t||(t={});var n={},r=[];Cc(e,"",n,t);var i=0,a=0;for(var o in n){var s=n[o],u=s[0],c=s[1],f=0==c.level?0:8,l=(S=Nc(o)).length,h=c.comment,p=h&&Nc(h),d=p&&p.length,g=Dc(c.extra);l>65535&&Gu(11);var m=f?Sc(u,c):u,y=m.length,v=nc();v.p(u),r.push(ic(c,{size:u.length,crc:v.d(),c:m,f:S,m:p,u:l!=o.length||p&&h.length!=d,o:i,compression:f})),i+=30+l+g+y,a+=76+2*(l+g)+(d||0)+y}for(var b=new pu(a+22),_=i,x=a-i,w=0;w<r.length;++w){var S=r[w];jc(b,S.o,S,S.f,S.u,S.c.length);var A=30+S.f.length+Dc(S.extra);b.set(S.c,S.o+A),jc(b,i,S,S.f,S.u,S.c.length,S.o,S.m),i+=16+A+(S.m?S.m.length:0)}return Fc(b,i,r.length,x,_),b}(Nf(e)):function(e){var t=new require("adm-zip")();return e.forEach(function(e){var n=e.content;n instanceof ArrayBuffer?n=new Uint8Array(n):n instanceof ne||n instanceof Uint8Array||(n=ne.from(e.content)),t.addFile(e.filename,n)}),t.toBuffer()}(e)}function Cf(e){return Of(e.name)}function Pf(e){return Object.keys(e).reduce(function(t,n){var r=Lo(n).filename,i=e[n];return Af(r)||(i=Tc(i)),t[r]=i,t},{})}function Of(e){var t=Lo(e);return yf(e)&&!/^__MACOSX/.test(e)&&"."!=t.filename[0]}function Nf(e){var t={};return e.forEach(function(e){"string"==typeof e.content?e.content=Nc(e.content):e.content instanceof ArrayBuffer&&(e.content=new Uint8Array(e.content)),t[e.filename]=e.content}),t}var Tf=Object.freeze({__proto__:null,isImportableZipPath:Of,unzipAsync:function(e,t){qc()||vt("Async unzipping only supported in the browser"),e instanceof ArrayBuffer&&(e=new Uint8Array(e)),Gc(e,{filter:Cf},function(e,n){e&&t(e),t(null,Pf(n))})},unzipSync:If,zipAsync:function(e,t){Uc(Nf(e),{},t)},zipSync:kf}),Lf={};async function zf(e,t){return Rf(e,t)}Lf.isFile=function(e,t){if(t&&e in t)return!0;if(qc())return!1;var n=Lf.statSync(e);return n&&n.isFile()||!1},Lf.isDirectory=function(e){if(qc())return!1;var t=Lf.statSync(e);return t&&t.isDirectory()||!1},Lf.readFile=function(e,t,n){var r;return n&&e in n?(r=n[e],delete n[e]):"/dev/stdin"==e?r=s("rw").readFileSync(e):((i("input_files")||[]).push(e),r=s("fs").readFileSync(e)),t&&u.isBuffer(r)&&(r=Wr($r(r,t))),r},Lf.createDirIfNeeded=function(e){var t=Lo(e).directory;if(t&&!Lf.isDirectory(t)&&"/dev/stdout"!=e)try{s("fs").mkdirSync(t,{recursive:!0}),xt("Created output directory:",t)}catch(e){bt("Unable to create output directory:",t)}},Lf.writeFileSync=function(e,n){Lf.createDirIfNeeded(e),t.isString(n)?s("fs").writeFileSync(e,n):Lf.writeFileInChunks(e,n,1e7)},Lf.writeFileInChunks=function(e,t,n){var r,i,a=s("fs"),o=a.openSync(e,"w"),u=0,c=t.length;do{i=Math.min(n,c-u),u+=r=a.writeSync(o,t,u,i)}while(r>0&&u<c);a.closeSync(o)},Lf.convertArrayBuffer=function(e){for(var n=new Uint8Array(e),r=t.createBuffer(n.length),i=0,a=n.length;i<a;i++)r[i]=n[i];return r},Lf.expandDirectoryName=function(e){var n=Lo(e);if(!n.filename.includes("*"))return[e];var r=t.wildcardToRegExp(n.filename),i=[];return s("fs").readdirSync(n.directory||".").forEach(function(e){var t=n.directory?s("path").join(n.directory,e):e;r.test(e)&&Lf.isDirectory(t)&&i.push(t)}),i},Lf.expandFileName=function(e){var n=Lo(e),r=t.wildcardToRegExp(n.filename),i=Lf.expandDirectoryName(n.directory||"."),a=[];try{i.forEach(function(e){s("fs").readdirSync(e).forEach(function(t){var n=s("path").join(e,t);r.test(t)&&Lf.isFile(n)&&a.push(n)})})}catch(e){}return 0===a.length&&bt("No files matched ("+e+")"),a},Lf.expandInputFiles=function(e){return e.reduce(function(e,t){return t.indexOf("*")>-1?e=e.concat(Lf.expandFileName(t)):e.push(t),e},[])},Lf.validateOutputDir=function(e){Lf.isDirectory(e)||qc()||vt("Output directory not found:",e)},Lf.checkFileExists=function(e,t){Lf.isFile(e,t)||"/dev/stdin"==e||bt("File not found ("+e+")")},Lf.statSync=function(e){var t=null;try{t=s("fs").statSync(e)}catch(e){}return t};var Rf=function(e,n){if(e.length>0==!1)xt("No files to save");else if(n.dry_run);else if(n.stdout)s("rw").writeFile("/dev/stdout",e[0].content,function(){});else{n.zip&&(e=[{filename:n.zipfile||"output.zip",content:kf(e)}]);var r=Df(t.pluck(e,"filename"),n),a=i("input_files");e.forEach(function(e,t){var i=r[t];e.content instanceof ArrayBuffer&&(e.content=Lf.convertArrayBuffer(e.content)),n.output?n.output.push({filename:i,content:e.content}):(!n.force&&a.indexOf(i)>-1&&bt('Need to use the "-o force" option to overwrite input files.'),Lf.writeFileSync(i,e.content),xt("Wrote "+i))})}};function Df(e,t){var n=t.directory;return n&&(e=e.map(function(e){return s("path").join(n,e)})),e}var jf=Object.freeze({__proto__:null,getOutputPaths:Df,replaceWriteFiles:function(e){Rf=e},writeFiles:zf});function Ff(e){var t,n;if(!e.length)return function(){return[]};function r(t){return e[t]}return n=s("flatbush"),t=new n(e.length),e.forEach(function(e){var n=e.bounds;t.add(n.xmin,n.ymin,n.xmax,n.ymax)}),t.finish(),function(e,n,i,a){return t.search(e,n,i,a).map(r)}}function Uf(e,t){!function(e,t){function n(e,n){var r=t[e];t[e]=t[n],t[n]=r}for(var r=0,i=t.length;r<i;r+=2)e[t[r]]>e[t[r+1]]&&n(r,r+1)}(e,t),Gf(e,t,0,t.length-2)}function Bf(e,t,n,r){for(var i,a,o=n+2;o<=r;o+=2){i=t[o],a=t[o+1];for(var s=o-2;s>=n&&e[i]<e[t[s]];s-=2)t[s+2]=t[s],t[s+3]=t[s+1];t[s+2]=i,t[s+3]=a}}function Gf(e,t,n,r){for(var i,a,o=n,s=r;o<r;){for(i=e[t[n+r>>2<<1]];o<=s;){for(;e[t[o]]<i;)o+=2;for(;e[t[s]]>i;)s-=2;o<=s&&(a=t[o],t[o]=t[s],t[s]=a,a=t[o+1],t[o+1]=t[s+1],t[s+1]=a,o+=2,s-=2)}if(s-n<40?Bf(e,t,n,s):Gf(e,t,n,s),r-o<40)return void Bf(e,t,o,r);n=o,s=r}}function qf(e,t,n){var r,i,a,o,s,u,c=t.getVertexData(),f=t.getMultiShapeBounds(e);function l(e,t,n){var r,u,f,l=s[n],h=0,p=c.xx,d=c.yy;r=n==o?i.length-l:s[n+1]-l;for(var g=0;g<r;g++)u=i[g+l],f=a[g+l],h+=fr.testRayIntersection(e,t,p[u],d[u],p[f],d[f]);return h}function h(e){var t=Math.floor((e-r)/u);return t<0&&(t=0),t>=o&&(t=o-1),t}!function(){var n,f,l,p,d,g,m,y,v,b,_=c.xx,x=0,w=0,S=-1;_r(e,t,function(){x++}),f=new Uint32Array(2*x),m=0,_r(e,t,function(e,t,n,r){f[m++]=e,f[m++]=t}),Uf(_,f),i=new Uint32Array(x),a=new Uint32Array(x),o=function(e){var t=Math.pow(e,.75)/10;return Math.ceil(t)}(x),s=new Uint32Array(o+1),r=_[f[0]],u=(_[f[f.length-2]]-r)/o,l=0,p=x-1;for(;w<x;){for(d=f[y=2*w],g=f[y+1],v=_[d],b=_[g],n=S,S=h(v);S>n;)n++,s[n]=l;b-v>=0==!1&&vt("Invalid segment"),h(b)-S>1?(i[p]=d,a[p]=g,p--):(i[l]=d,a[l]=g,l++),w++}s[o]=l,l!=p+1&&vt("Segment indexing error")}(),this.pointInPolygon=function(e,t){if(!f.containsPoint(e,t))return!1;var n=h(e),r=l(e,t,n);return n>0&&(r+=l(e,t,n-1)),r+=l(e,t,o),isNaN(r)?-1:r%2==1?1:0}}function Vf(e,n){var r=Ff(function(e,t){var n=[];return e.forEach(function(e,r){for(var i=e?e.length:0,a=0;a<i;a++)n.push({ids:e[a],id:r,bounds:t.getSimpleShapeBounds(e[a])})}),n}(e,n)),i=gr(e,n).area();function a(e,t){return!!t.bounds.containsPoint(e[0],e[1])&&(!t.index&&t.bounds.area()>.01*i&&(t.index=new qf([t.ids],n)),t.index?t.index.pointInPolygon(e[0],e[1]):fr.testPointInRing(e[0],e[1],t.ids,n))}function o(e,t){var n=!1,r=!1;return t.forEach(function(t){var i=a(e,t);-1==i?n=!0:1==i&&(r=!r)}),n||r}function s(e){var t,n,r=[];if(e.length>0){e.sort(function(e,t){return e.id-t.id});for(var i=0;i<e.length;i++)n=e[i],0!==i&&n.id==e[i-1].id||r.push(t=[]),t.push(n)}return r}function u(e,t){var n=t>0?t:0;return e[0],e[1],r(e[0]-n,e[1]-n,e[0]+n,e[1]+n)}function c(e){var t=e[0],r=n.getVertex(t,0),i=n.getVertex(t,1);return[(r.x+i.x)/2,(r.y+i.y)/2]}this.findEnclosingShapes=function(e){var t=[];return s(u(e)).forEach(function(n){o(e,n)&&t.push(n[0].id)}),t},this.findEnclosingShape=function(e){var t=-1;return s(u(e)).forEach(function(n){o(e,n)&&(t=n[0].id)}),t},this.findShapesEnclosingArc=function(e){var t=c([e]);return this.findEnclosingShapes(t)},this.findPointEnclosureCandidates=function(e,n){var r=u(e,n);return t.pluck(r,"id")},this.pointIsEnclosed=function(e){return o(e,u(e))},this.findSmallestEnclosingPolygon=function(e){var t,r=n.getSimpleShapeBounds(e),i=c(e);return u(i).forEach(function(e){!e.bounds.contains(r)||e.bounds.sameBounds(r)||t&&t.bounds.area()<e.bounds.area()||a(i,e)&&(t=e)}),t?t.id:-1},this.arcIsEnclosed=function(e){return this.pointIsEnclosed(c([e]))},this.pathIsEnclosed=function(e){return this.pointIsEnclosed(c(e))},this.findEnclosedPaths=function(e){var t,i=n.getSimpleShapeBounds(e),a=r(i.xmin,i.ymin,i.xmax,i.ymax),o=[];return a.length>6&&(t=new qf([e],n)),a.forEach(function(r){var a=c(r.ids);i.containsPoint(a[0],a[1])&&i.contains(r.bounds)&&(t?t.pointInPolygon(a[0],a[1]):fr.testPointInRing(a[0],a[1],e,n))&&o.push(r.ids)}),o.length>0?o:null},this.findPathsInsideShape=function(e){var t=[];return e.forEach(function(e){var n=this.findEnclosedPaths(e);n&&(t=function(e,t){var n,r=[];for(n=0;n<e.length;n++)-1==t.indexOf(e[n])&&r.push(e[n]);for(n=0;n<t.length;n++)-1==e.indexOf(t[n])&&r.push(t[n]);return r}(t,n))},this),t.length>0?t:null}}function $f(e,t){e.shapes=e.shapes.map(function(e){return e?function(e,t){var n=Er(e,t,"polygon");return n.sort(function(e,t){return Math.abs(t.area)-Math.abs(e.area)}),n.forEach(function(e,r){for(var i,a,o,s=!0,u=r;--u>=0;)if(Jf(e,i=n[u],t)){s=!(i.area>0);break}o=s,(a=e).area>0!=o&&(a.area=-a.area,mr(a.ids))}),n.map(function(e){return e.ids})}(e,t):null})}function Jf(e,t,n){if(!1===t.bounds.contains(e.bounds))return!1;var r=function(e,t){var n=t.getVertex(e,0),r=t.getVertex(e,1);return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}(e.ids[0],n);return 1==fr.testPointInRing(r.x,r.y,t.ids,n)}function Wf(e,t,n){var r,i=[],a=[],o=n?-1:1;return(e||[]).forEach(function(e){e.area*o>0?a.push([e]):e.area*o<0&&i.push(e)}),0===i.length||(r=Ff(a.map(function(e,t){return{bounds:e[0].bounds,idx:t}})),i.forEach(function(e){for(var n,i,s,u,c=-1,f=0,l=e.area*-o,h=e.bounds,p=r(h.xmin,h.ymin,h.xmax,h.ymax),d=0,g=p.length;d<g;d++)i=p[d].idx,s=(n=a[i][0]).area*o,(u=n.bounds.contains(e.bounds)&&s>l)&&p.length>1&&!Jf(e,n,t)||u&&(0===f||s<f)&&(f=s,c=i);-1==c?Ct("[groupPolygonRings()] polygon hole is missing a containing ring, dropping."):a[c].push(e)})),a}function Zf(e){var t;return e&&0!==e.length?{bounds:(t={points:e,pointCount:e.length,bounds:fr.getPathBounds(e)}).bounds,pathData:[t],partCount:1,pointCount:t.pointCount}:{partCount:0,pointCount:0}}function Yf(e,t,n){if("point"==n)return Zf(e);var r=0,i=new qt,a=[];return!e||"polyline"!=n&&"polygon"!=n||e.forEach(function(e,o){var s=function(e){var t,n,r,i,a=[],o=0;for(;e.hasNext();)t=e.x,n=e.y,0!==o&&r==t&&i==n||(a.push([t,n]),o++),r=t,i=n;return{points:a,pointCount:a.length}}(t.getShapeIter(e)),u=!0;s.ids=e,"polygon"==n?(s.area=fr.getPlanarPathArea2(s.points),u=s.pointCount>3&&0!==s.area):"polyline"==n&&(u=s.pointCount>1),u?(r+=s.pointCount,s.bounds=fr.getPathBounds(s.points),i.mergeBounds(s.bounds),a.push(s)):Mt("Skipping a collapsed",n,"path")}),{pointCount:r,pathData:a,pathCount:a.length,bounds:i}}var Hf=Object.freeze({__proto__:null,exportPathData:Yf,exportPointData:Zf});function Xf(e){return JSON.stringify(e).replace(/\n/g,"\n").replace(/\r/g,"\r")}function Kf(e){var n=t.arrayToIndex(e),r="က⿕̐",i=new RegExp('"က⿕̐|က⿕̐"',"g");function a(e,i){if(e in n&&t.isArray(i)){var a=JSON.stringify(i);if(a.indexOf(!1))return r+a.replace(/,/g,", ")+r}return i}return function(e){return JSON.stringify(e,a," ").replace(i,"")}}var Qf=Object.freeze({__proto__:null,getFormattedStringify:Kf,stringifyAsNDJSON:Xf});function el(e,t,n){for(var r=n.getVertexData(),i=r.xx,a=r.yy,o=[],s=0,u=i.length;s<u;s++)i[s]==e&&a[s]==t&&o.push(s);return o}function tl(e,t){var n=t.getVertexData();return[n.xx[e],n.yy[e]]}function nl(e,t){for(var n=t.getVertexData(),r=n.ii,i=n.nn,a=0,o=r.length;a<o;a++)if(e===r[a]+i[a]-1)return!0;return!1}function rl(e,t){return il(e,t)||nl(e,t)}function il(e,t){for(var n=t.getVertexData().ii,r=0,i=n.length;r<i;r++)if(e===n[r])return!0;return!1}function al(e,t){if(e<0)return al(~e,t).reverse();var n=t.getVertexData(),r=n.ii[e],i=n.nn[e];return[[n.xx[r],n.yy[r]],[n.xx[r+i-1],n.yy[r+i-1]]]}function ol(e,t,n,r){var i=r.getVertexData();i.xx[n]=e,i.yy[n]=t}function sl(e,t,n,r,i){for(var a,o,s,u,c=i?fr.greatCircleDistance:fr.distance2D,f=1/0,l=0;l<n.length;l++)for(u=r.getShapeIter(n[l]);u.hasNext();)(s=c(e,t,u.x,u.y))<f&&(f=s,a=u.x,o=u.y);return f<1/0?{x:a,y:o}:null}var ul=Object.freeze({__proto__:null,findNearestVertex:sl,findNearestVertices:function(e,t,n){var r=sl(e[0],e[1],t,n);return el(r.x,r.y,n)},findVertexIds:el,getArcEndCoords:function(e,t){return al(e,t)[1]},getArcEndpointCoords:al,getArcStartCoords:function(e,t){return al(e,t)[0]},getVertexCoords:tl,setVertexCoords:ol,snapPointToArcEndpoint:function(e,t,n){var r,i,a;t.forEach(function(e){il(e,n)?r=tl(e+1,n):nl(e,n)&&(r=tl(e-1,n))}),r&&(i=r[0]-e[0],a=r[1]-e[1],Math.abs(i)>Math.abs(a)?e[1]=r[1]:e[0]=r[0])},snapVerticesToPoint:function(e,t,n){var r=n.getVertexData();e.forEach(function(e){ol(t[0],t[1],e,n),n.updateArcBounds(Xt(e,r.ii))})},vertexIsArcEnd:nl,vertexIsArcEndpoint:rl,vertexIsArcStart:il});function cl(e,t){var n=["orange","blue","green","red","magenta","grey"],r=e.map(function(e,r){return function(e,t,n){return JSON.stringify({type:"Feature",properties:n,geometry:_d.exportLineGeom([[e]],t)})}(e,t,{arcId:e,stroke:n[r]||"black"})});Ct('{"type": "FeatureCollection", "features": ['+r.join(",")+"]}")}function fl(e,t){return t.getArcLength(e)>=2!=!1}function ll(e,t,n){var r=t.arcs,i=r.getVertexData(),a=i.xx,o=i.yy,s=t.getConnectedArcs(e),u=e;if(n&&(s=s.filter(n)),!fl(e,r)||0===s.length)return e;var c,f,l,h,p,d=r.indexOfVertex(e,-1),g=a[d],m=o[d],y=r.indexOfVertex(e,-2),v=a[y],b=o[y];for(p=0;p<s.length;p++)fl(f=s[p],r)?(l=r.indexOfVertex(f,-2),u!=e?(h=hl(v,b,g,m,a[c],o[c],a[l],o[l]),a[c]==a[l]&&o[c]==o[l]&&(Ct("Pathfinder warning: duplicate segments: i:",c,"j:",l,"ids:",[e].concat(s)),kt()&&cl(s,t.arcs)),2==h&&(c=l,u=f)):(c=l,u=f)):Ct("skipping one arc:",f,"out of:",s.length,s);return u==e&&vt("Pathfinder error",u,e),u}function hl(e,t,n,r,i,a,o,s){var u,c=fr.signedAngle(e,t,n,r,i,a),f=fr.signedAngle(e,t,n,r,o,s);return c<=0||f<=0?(Ct("[chooseRighthandPath()] 0 angle(s):",c,f),u=c>0?1:f>0?2:0):c<f-.001?u=1:f<c-.001?u=2:isNaN(c)||isNaN(f)?vt("Invalid node geometry"):u=pl(n,r,i,a,o,s),u}function pl(e,t,n,r,i,a){var o=sr(n,r,e,t,i,a);return o>0?2:o<0?1:0}var dl=Object.freeze({__proto__:null,chooseBetweenClosePaths:pl,getRightmostArc:ll});function gl(e,t,n){return e&~n|t&n}function ml(e,t,n){var r,i=Yt(t);i==t?r=-4:(r=-49,e<<=4),n[i]&=e|r}function yl(e,t){var n=Yt(e),r=t[n];return n!=e&&(r>>=4),7&r}function vl(e,t){br(e,function(e){e<0?t[~e]|=128:t[e]|=8})}function bl(e,t,n,r,i,a,o){br(e,function(e){var s=e<0,u=s?~e:e,c=n[u],f=s?i:r,l=s?r:i,h=c;t.arcIsLollipop(e)?(Ct("lollipop"),h=0):(f&&(h|=3),l&&(h|=48),o>0&&(h|=o),!a||34&~h||(h&=-18)),n[u]=h})}function _l(e,t,n,r,i,a){br(e,function(e){var t=e<0,o=t?~e:e,s=n[o],u=255;(t?i:r)&&(a&&(u&=-2),u^=2),(t?r:i)&&(a&&(u&=-17),u^=32),n[o]=s&u})}function xl(e,t,n){var r=null;function i(t){return~ll(t,e,r)}return n&&(r=function(e){return n(~e)}),function(n){var r,a,o=[],s=n;if(a=n,e.arcs.getArcLength(a)>1==0)return null;do{if(!t(s))return null;if(o.push(s),(s=i(r=s))==~r)return Ct("Pathfinder warning: dead-end path"),null}while(s!=n);return 0===o.length?null:o}}function wl(e,t){var n=e.arcs,r=xl(e,function(e){var n=yl(e,t),r=!1;3==n&&(r=!0,ml(1,e,t));return r},function(e){var n=yl(e,t);return!(1&~n)});return t=t||new Uint8Array(n.size()),function(e,i){var a,o="dissolve"==i,s=!0,u="flatten"==i;return e.length>0?(a=[],bl(e,n,t,s,u,o),Cr(e,function(e){for(var t,n=0,i=e.length;n<i;n++)(t=r(e[n]))&&a.push(t)}),_l(e,0,t,s,u,!0)):a=e,a}}var Sl,Al=Object.freeze({__proto__:null,andBits:function(e,t,n){return e&(~n|t)},closeArcRoutes:_l,getPathFinder:xl,getRingIntersector:wl,getRouteBits:yl,markPathsAsUsed:vl,openArcRoutes:bl,setBits:gl,setRouteBits:ml});function El(e){var t=new Uint8Array(e);this.setId=function(e){t[e]=1},this.hasId=function(e){return 1===t[e]}}function Ml(e){var t=new Uint8Array(e),n=[];this.setId=function(e){this.hasId(e)||n.push(e),e<0?t[~e]|=2:t[e]|=1},this.clear=function(){var e=this;n.forEach(function(t){e.clearId(t)}),n=[]},this.hasId=function(e){return e<0?!(2&~t[~e]):!(1&~t[e])},this.clearId=function(e){e<0?t[~e]&=1:t[e]&=2},this.getIds=function(){return n},this.setIds=function(e){for(var t=0;t<e.length;t++)this.setId(e[t])}}function Il(e,n){var r=t.extend({},n),i=e.getBounds();!e.isPlanar()&&fr.containsBounds(ra(),i.toArray());var a,o,s=i.ymin,u=i.ymax-s,c=r.stripes||Nl(e),f=new Uint32Array(c),l=c>1&&u>0?function(e){return Math.floor((c-1)*(e-s)/u)}:function(e){return 0};r.tolerance>=0==!1&&(r.tolerance=Bn(i.toArray())),e.forEachSegment(function(e,t,n,r){for(var i=l(r[e]),a=l(r[t]);f[i]=f[i]+2,i!=a;)i+=a>i?1:-1});var h,p,d=(h=t.sum(f),p=4*h,(!Sl||Sl.byteLength<p)&&(Sl=new ArrayBuffer(p)),new Uint32Array(Sl,0,h)),g=0,m=[];t.forEach(f,function(e){var t=g;g+=e,m.push(d.subarray(t,g))}),t.initializeArray(f,0),e.forEachSegment(function(e,t,n,r){for(var i,a,o=l(r[e]),s=l(r[t]);i=f[o],f[o]=i+2,(a=m[o])[i]=e,a[i+1]=t,o!=s;)o+=s>o?1:-1});var y,v=e.getVertexData(),b=[];for(a=0;a<c;a++)for(y=Tl(m[a],v.xx,v.yy,r),o=0;o<y.length;o++)b.push(y[o]);return kl(b,r.unique?Pl:null)}function kl(e,t){var n={},r=t||Cl;return e.filter(function(e){var t=r(e);return!(t in n)&&(n[t]=!0,!0)})}function Cl(e){return e.a.join(",")+";"+e.b.join(",")}function Pl(e){return e.x+","+e.y}function Ol(e){var t=e.getFilteredPointCount()-e.size(),n=2*Math.pow(t,.4);return Math.ceil(n)||1}function Nl(e){var t=e.getFilteredPointCount()-e.size(),n=Math.ceil(Math.pow(10*t,.6)/40);return n>0?n:1}function Tl(e,t,n,r){var i,a,o,s,u,c,f,l,h,p,d,g,m,y,v,b,_,x=e.length-2,w=[],S=(r||{}).tolerance;for(Uf(t,e),b=0;b<x;){for(i=e[b],a=e[b+1],u=t[i],c=t[a],h=n[i],p=n[a],_=b;_<x&&!(c<(f=t[o=e[_+=2]]));){if(d=n[o],l=t[s=e[_+1]],g=n[s],h>=d){if(h>g&&p>d&&p>g)continue}else if(h<g&&p<d&&p<g)continue;i!=o&&i!=s&&a!=o&&a!=s&&(m=Qn(u,h,c,p,f,d,l,g,S))&&(y=[i,a],v=[o,s],w.push(Ll(m,y,v,t,n)),4==m.length&&w.push(Ll(m.slice(2),y,v,t,n)))}b+=2}return w}function Ll(e,t,n,r,i){var a,o=e[0],s=e[1];return t=zl(o,s,t[0],t[1],r,i),n=zl(o,s,n[0],n[1],r,i),{x:o,y:s,a:a=t[0]<n[0]?t:n,b:a==t?n:t}}function zl(e,t,n,r,i,a){return i[n]==e&&a[n]==t?[n,n]:i[r]==e&&a[r]==t?[r,r]:n<r?[n,r]:[r,n]}var Rl=Object.freeze({__proto__:null,calcSegmentIntersectionStripeCount:Nl,calcSegmentIntersectionStripeCount2:Ol,dedupIntersections:kl,findSegmentIntersections:Il,formatIntersectingSegment:zl,formatIntersection:Ll,getIntersectionLayer:function(e,t,n){var r=n.getVertexData().ii,i=new El(n.size());br(t.shapes,e=>{i.setId(Yt(e))});var a=[];return e.forEach(e=>{var t=Xt(e.a[0],r),n=Xt(e.b[0],r);i.hasId(t)&&i.hasId(n)&&a.push([e.x,e.y])}),{geometry_type:"point",shapes:[a]}},getIntersectionPoints:function(e){return e.map(function(e){return[e.x,e.y]})},intersectSegments:Tl,sortIntersections:function(e){e.sort(function(e,t){return e.x-t.x||e.y-t.y})}});function Dl(e){var t=e.getCopy();return function(e){!function(e,t){var n=Il(t);if(n.length>0)return void xt("Original layer contains intersections -- unable to repair.");for(var r=Il(e),i=10,a=r.length,o=0;o<i&&r.length>0;o++)jl(r,e,t),r=Il(e);var s=r.length;s>0?xt("Unable to remove",s,"intersection"+(s>1?"s":"")):a>0&&xt("Fix-geometry removed",a,"intersection"+(a>1?"s":""))}(e,t)}}function jl(e,t,n){e.forEach(function(e){Fl(e.a[0],t,n),Fl(e.a[1],t,n),Fl(e.b[0],t,n),Fl(e.b[1],t,n)})}function Fl(e,t,n){var r=t.getVertexData(),i=n.getVertexData(),a=[e];rl(e,t)&&(a=a.concat(function(e,t){for(var n,r,i=t.ii,a=t.nn,o=t.xx,s=t.yy,u=o[e],c=s[e],f=[],l=0;l<i.length;l++)r=(n=i[l])+a[l]-1,n!=e&&o[n]==u&&s[n]==c&&f.push(n),r!=e&&o[r]==u&&s[r]==c&&f.push(r);return f}(e,r))),a.forEach(function(e){r.xx[e]=i.xx[e],r.yy[e]=i.yy[e]})}function Ul(e,t){return+e.toPrecision(t)}function Bl(e,t){return+e.toFixed(t)}function Gl(e,t){var n=1;if(!e&&0!==e)return e;for(t|=0;t-- >0;)n*=10;return Math.round(e*n)/n}function ql(e){return Math.round(10*e)/10}function Vl(e){t.isNumber(e)&&0!==e||vt("Rounding increment must be a non-zero number.");var n=1/e;return n>1&&(n=Math.round(n)),function(e){return Math.round(e*n)/n}}function $l(e){var t=(Math.abs(e[2]-e[0])+Math.abs(e[3]-e[1]))/2+1e-8;return Math.max(0,Math.round(3-Math.log10(t)))}function Jl(e,t){return e.map(function(e){return e.toFixed(t)}).join(",")}const Wl=(Zl=new Float32Array(1),function(e){return Zl[0]=e,Zl[0]});var Zl;const Yl=Math.fround||Wl;function Hl(e,t,n){var r=Vl(t),i=e.arcs&&n?Dl(e.arcs):null;return No(e,function(e,t){return[r(e),r(t)]}),i&&i(e.arcs),e}var Xl=Object.freeze({__proto__:null,fround:Yl,fround2:Wl,getBinaryRoundingFunction:function(e){!1==(e>=1&&e<=32)&&vt("Invalid bits argument:",e);var t="LE"==_a.endianness(),n=new Float64Array(1),r=new Uint32Array(n.buffer,t?0:4,1),i=2**32-2**e;return function(e){return n[0]=e,r[0]=r[0]&i,n[0]}},getBoundsPrecisionForDisplay:$l,getRoundedCoordString:Jl,getRoundedCoords:function(e,t){return Jl(e,t).split(",").map(parseFloat)},getRoundingFunction:Vl,roundPoints:function(e,t){Wt(e.shapes,function(e){e[0]=t(e[0]),e[1]=t(e[1])})},roundToDigits:Bl,roundToDigits2:Gl,roundToSignificantDigits:Ul,roundToTenths:ql,setCoordinatePrecision:Hl}),Kl={m:"meters",meter:"meters",meters:"meters",mi:"miles",mile:"miles",miles:"miles",km:"kilometers",ft:"feet",feet:"feet"},Ql={meters:1,kilometers:1e3,feet:.3048,miles:1609.344};function eh(e){var t=String(e),n=parseFloat(t),r=(/px|pix/.test(t)?"px":/pt|point/.test(t)&&"pt")||/in/.test(t)&&"in"||/cm/.test(t)&&"cm"||!isNaN(+t)&&"px"||null,i="in"==r&&72*n||"cm"==r&&Math.round(28.3465*n)||n;return i>=0!=!1&&r||bt("Invalid size:",t),i}function th(e,t){var n,r=0,i=0;return t&&(t.is_latlong?i=1:t.to_meter>0?i=t.to_meter:vt("Invalid CRS")),e&&((r=Ql[e])||vt("Unknown units:",e)),r&&i?n=r/i:r||i?r&&!i?bt("Unable to convert",e,"to unknown coordinates"):!r&&i&&(n=1/i):n=1,n}function nh(e){var t=rh(e);return isNaN(t.value)&&bt("Invalid parameter:",e),t}function rh(e){var n=t.isString(e)?e:"",r=/(sq|)([a-z]+)(2|)$/i.exec(n),i={};return t.isNumber(e)?i.value=e:""===n?i.value=NaN:r?(i.units=Kl[r[2].toLowerCase()],i.areal=!(!r[1]&&!r[3]),i.value=Number(n.substring(0,n.length-r[0].length)),i.units||isNaN(i.value)||bt("Unknown units: "+r[0])):i.value=Number(n),i}function ih(e,t){var n=nh(e),r=th(n.units,t);return n.value*r*r}function ah(e,t){var n=nh(e),r=th(n.units,t);return n.areal&&bt("Expected a distance, received an area:",e),n.value*r}function oh(e,t){var n=nh(e),r=th(n.units,t);return n.units&&t&&t.is_latlong&&bt("Parameter does not support distance units with latlong datasets"),n.areal&&bt("Expected a distance, received an area:",e),n.value*r}function sh(e,t){var n,r;return Array.isArray(e)&&2==e.length||bt("Expected two distance parameters, received",e),n=nh(e[0]),r=nh(e[1]),(n.units&&!r.units||r.units&&!n.units)&&bt("Both parameters should have units:",e),[oh(e[0],t),oh(e[1],t)]}function uh(e,t,n){var r=e.includes(",")?e.split(","):e.split(" ");return 1==r.length?r=[r[0],r[0],r[0],r[0]]:4!=r.length&&bt("Expected a distance parameter or a list of four params"),r.map(function(e,r){return e.indexOf("%")>0?(parseFloat(e)/100||0)*(1==r||3==r?n.height():n.width()):oh(e,t)})}function ch(e,t){var n=t&&t.to_meter?e*t.to_meter*t.to_meter:e,r=n/1e6;return r<.01?Math.round(n)+" sqm":r+" sqkm"}var fh=Object.freeze({__proto__:null,convertAreaParam:ih,convertDistanceParam:ah,convertFourSides:uh,convertIntervalPair:sh,convertIntervalParam:oh,getAreaLabel:ch,getIntervalConversionFactor:th,parseMeasure:nh,parseMeasure2:rh,parseSizeParam:eh});function lh(e,t,n){var r=n.min_gap_area||n.min_area||n.gap_fill_area;if(0==+r)return{filter:function(){return!1},threshold:0};var i=n.sliver_control>=0?n.sliver_control:0,a=Ia(t),o=r&&"auto"!=r?ih(r,a):dh(e,t.arcs),s=i>0?hh(t.arcs,o,i):function(e,t){var n=t.arcs.isPlanar()?fr.getPlanarPathArea:fr.getSphericalPathArea;return function(r){var i=n(r,t.arcs);return Math.abs(i)<e}}(o,t),u=function(e,t){t&&(e=e.replace(" ","+ ")+" variable");return e+" threshold"}(ch(o,a),i>0);return n.keep_shapes&&(s=function(e){var t;return function(n,r,i){return 0===r&&(t=i.map(t=>e(t))),t.length>0&&t.every(Boolean)&&(t[0]=!1),t[r]}}(s)),{threshold:o,filter:s,label:u}}function hh(e,t,n){n>=0==!1&&(n=1),(n>1||t>=0==!1)&&vt("Invalid parameter");var r=ph(e,n);return function(e){return Math.abs(r(e))<t}}function ph(e,t){var n=Math.sqrt(t);return function(t){var r=fr.getPathArea(t,e),i=fr.getPathPerimeter(t,e),a=fr.calcPolsbyPopperCompactness(r,i);return r*(n*a+1-n)}}function dh(e,t){var n=0,r=t.isPlanar()?fr.distance2D:fr.greatCircleDistance,i=0,a=0,o=function(e,t,n,o){var s=r(n[e],o[e],n[t],o[t]);a++,i+=(s-i)/a};Pr(e.shapes,function(e){n++,xr(e,t,o)});var s=a/n||0,u=Math.pow(s,.75),c=i*i/50*u;return c=Ul(c,2)}var gh=Object.freeze({__proto__:null,calcMaxSliverArea:function(e){var t=e.getBounds().width()/2,n=e.getBounds().height()/2,r=0,i=0;return e.forEachSegment(function(e,a,o,s){var u=Math.abs(o[e]-o[a]),c=Math.abs(s[e]-s[a]);u<t&&c<n&&(i+=(Math.sqrt(u*u+c*c)-i)/++r)}),i*i},getDefaultSliverThreshold:dh,getSliverAreaFunction:ph,getSliverFilter:lh,getSliverTest:hh});var mh={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},yh=/^rgba?\(([^)]+)\)/,vh=/^#([a-f0-9]{3,8})/i;function bh(e){e=e?String(e):"";var t,n,r=vh.test(e)?e:mh[e.toLowerCase().replace(/[ -]+/g,"")],i=null;return r?i=function(e){var t=vh.exec(e)[1];3!=t.length&&4!=t.length||(t=t.split("").map(function(e){return e+e}));return 6!=t.length&&8!=t.length?null:{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8==t.length?parseInt(t.substr(7,2),16)/255:1}}(r):yh.test(e)&&(i=function(e){var t=yh.exec(e)[1],n=t.split(",").map(function(e){return parseFloat(e)});return{r:n[0],g:n[1],b:n[2],a:n[3]>=0?n[3]:1}}(e)),!i||(t=i)&&xh(t.r)&&xh(t.g)&&xh(t.b)&&((n=t.a)>=0&&n<=1)||(i=null),i}function _h(e){return bh(e)||bt("Unsupported color:",e),!0}function xh(e){return e>=0&&e<256}function wh(e){return e.a<1?function(e){var n=Sh(e.r)+","+Sh(e.g)+","+Sh(e.b);return e.a<1?"rgba("+n+","+(r=e.a,r=+r||0,r=Math.round(1e3*r)/1e3,t.clamp(r,0,1)+")"):"rgb("+n+")";var r}(e):function(e){return"#"+Ah(e.r)+Ah(e.g)+Ah(e.b)}(e)}function Sh(e){return Math.round(t.clamp(+e||0,0,255))}function Ah(e){return Sh(e).toString(16).padStart(2,"0")}function Eh(e,n){var r,i,a;if(Array.isArray(e))r=e,i=n;else{r=[],i=[],a=Array.from(arguments);for(var o=0;o<a.length;o+=2)r.push(a[o]),i.push(a[o+1])}if(i=function(e){var n=t.sum(e);if(n>0==!1)return null;return e.map(function(e){return e/n})}(i),!i)return"#eee";var s=r.reduce(function(e,t,n){var r=_h(t)&&bh(t),a=+i[n]||0;return e.r+=r.r*a,e.g+=r.g*a,e.b+=r.b*a,e},{r:0,g:0,b:0});return wh(s)}function Mh(e,t){var n=t?function(e){if(e in Ih)return Ih[e];var t=e;t=t.replace("[-]","(?<prefix>-)?"),t=t.replace(/\[[NSEW, +-]{2,}\]/,"(?<prefix>$&)"),t=t.replace(/D+(\.D+)?/,(e,t)=>{var n="[0-9]+";return t&&(n+="\\.[0-9]+"),`(?<d>${n})`}),t=t.replace(/(MM?)(\.M+)?/,(e,t,n)=>{var r=1==t.length?"[0-9]+":"[0-9][0-9]";return n&&(r+="\\.[0-9]+"),`(?<m>${r})`}),t=t.replace(/(SS?)(\.S+)?/,(e,t,n)=>{var r=1==t.length?"[0-9]+":"[0-9][0-9]";return n&&(r+="\\.[0-9]+"),`(?<s>${r})`}),t="^"+t+"$";try{Ih[e]=new RegExp(t)}catch(t){bt("Invalid DMS format string:",e)}return Ih[e]}(t):/^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)[m'′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i,r=n.exec(e.trim()),i=NaN;return r&&(i=+(r.groups.d||"0")+ +(r.groups.m||"0")/60+ +(r.groups.s||"0")/3600,(/[sw-]/i.test(r.groups.prefix||"")||/[sw]/i.test(r.groups.suffix||""))&&(i=-i)),i}var Ih={};function kh(e,t){t||(t="[-]D°M'S.SSS");var n,r,i,a=t,o=/(D+)[^M]*(M+)?[^S[\]]*(S+)?/.exec(t),s=o&&!!o[3],u=o&&!!o[2];(!o||s&&!u)&&bt("Invalid DMS format string:",t);var c=s&&o[3].length||u&&o[2].length||o[1].length,f=s&&/S\.(S+)/||u&&/M\.(M+)/||/D\.(D+)/,l=f.test(t)?f.exec(t)[1].length:0;if(u){var h=Math.pow(10,l),p=s?3600*h:60*h,d=Math.floor(Math.abs(e)*p+.5),g=function(e,t,n){var r=e.toFixed(n),i=r.split(".");return i.length>0&&(i[0]=i[0].padStart(t,"0"),r=i.join(".")),r}(d/h%60,c,l);s?(d=Math.floor(d/(60*h)),i=g,r=String(d%60).padStart(o[2].length,"0")):(d=Math.floor(d/h),r=g),n=String(Math.floor(d/60)).padStart(o[1].length,"0")}else n=Math.abs(e).toFixed(l);return a=(a=(a=(a=(a=a.replace(/\[-\]/,t=>e<0?"-":"")).replace(/\[[+-]+\]/,t=>e<0?"-":"+")).replace(/\[[NS, ]+\]/,t=>e<0?"S":"N")).replace(/\[[EW, ]+\]/,t=>e<0?"W":"E")).replace(/D+(\.D+)?/,n),u&&(a=a.replace(/M+(\.M+)?/,r)),s&&(a=a.replace(/S+(\.S+)?/,i)),a}function Ch(e,t){!0!==e&&!1!==e&&bt(t||"Filter expression must return true or false")}function Ph(e,n){if(!e||!n||e.length!=n.length-1)return null;for(var r,i,a,o=t.sum(e),s=Math.floor(o/2),u=0,c=1;c<n.length;c++){if(i=n[c-1],a=n[c],s<=(r=u+e[c-1]))return i+(s-u)/(r-u)*(a-i);u=r}return null}function Oh(e,t){Object.keys(t).forEach(function(n){var r=t[n],i="function"==typeof r?{get:r}:{value:r,writable:!1};Object.defineProperty(e,n,i)})}function Nh(e,t,n){if(!e||!n)return null;var r=[],i=[],a=[],o=[];return e.forEach(function(e){for(var s=Th(e,t,n,r,i);s<4&&s>0;)r.pop(),i.pop(),s--;s>0&&(o.push([a.length]),a.push(s))}),{shape:o.length>0?o:null,arcs:new Wa(a,r,i)}}function Th(e,t,n,r,i){for(var a,o,s,u,c=t.getShapeIter(e),f=0;c.hasNext();)s=c.x,u=c.y,(0===f||fr.distance2D(s,u,a,o)>n)&&(r.push(s),i.push(u),a=s,o=u,f++);return s==a&&u==o||(r.push(s),i.push(u),f++),f}var Lh=Object.freeze({__proto__:null,simplifyArcsFast:function(e,t){for(var n,r=[],i=[],a=[],o=0,s=e.size();o<s;o++)1==(n=Th([o],e,t,r,i))&&(n=0,r.pop(),i.pop()),a.push(n);return new Wa(a,r,i)},simplifyPolygonFast:Nh});function zh(e,t){var n,r=e&&fr.getMaxPath(e,t),i=r&&t.getSimpleShapeBounds(r);return i&&i.hasBounds()&&0!==i.area()&&(n=Nh(e,t,.01*Math.sqrt(i.area()))).shape?function(e,t){var n,r,i,a,o,s,u,c=fr.getMaxPath(e,t),f=t.getSimpleShapeBounds(c),l=fr.getPathCentroid(c,t),h=function(e,t){var n=Math.max(t.width(),t.height())/2;return function(t,r){var i=fr.distance2D(e.x,e.y,t,r);return 1-Math.min(.6*i/n,.25)}}(l,f),p=fr.getPlanarPathArea(c,t);1==e.length&&1.2*p>f.area()?(a=5,i=.2):1==e.length&&1.7*p>f.area()?(a=7,i=.4):(a=11,i=.5);n=f.width()*i,r=l.x-n/2,o=n/a,s=Dh(e,t,r,r+n,a,h),s?(u=Dh(e,t,s.x-o/2,s.x+o/2,2,h)).distance>s.distance&&(s=u):(Mt("[points inner] failed, falling back to centroid"),s=l);return s}(n.shape,n.arcs):null}function Rh(e,n,r){var i=n.getBounds().ymin-1;return r.reduce(function(r,a){var o=function(e,n,r,i){var a,o,s,u=function(e,t,n,r){return n?n.reduce(function(n,i){var a=function(e,t,n,r){var i=[];xr(n,r,function(n,r,a,o){var s=fr.getRayIntersection(e,t,a[n],o[n],a[r],o[r]);s>-1/0&&i.push(s)}),i.length%2==1&&(i=[]);return i}(e,t,i,r);return n.concat(a)},[]):[]}(e,n,r,i),c=[];t.genericSort(u);for(var f=0;f<u.length;f+=2)a=u[f],(s=((o=u[f+1])-a)/2)>0&&c.push({y:(a+o)/2,x:e,interval:s});return c}(a,i,e,n);return r.concat(o)},[])}function Dh(e,t,n,r,i,a){var o,s,u,c=function(e,t,n){for(var r=(t-e)/(n+1),i=[],a=1;a<=n;a++)i.push(e+r*a);return i}(n,r,i),f=(r-n)/i,l=Rh(e,t,c);l.forEach(function(e){e.interval*=a(e.x,e.y)}),l.sort(function(e,t){return t.interval-e.interval});for(var h=0;h<l.length&&(u=l[h],!(o&&o.distance>u.interval));h++)s=jh(u.x,u.y,e,t,f,a),(!o||s.distance>o.distance)&&(o=s);return o}function jh(e,t,n,r,i,a){var o={x:e,y:t,distance:fr.getPointToShapeDistance(e,t,n,r)*a(e,t)};return Fh(o,n,r,i,a),Fh(o,n,r,-i,a),o}function Fh(e,t,n,r,i){for(var a,o=e.x,s=e.y,u=e.distance;s+=r,(a=fr.getPointToShapeDistance(o,s,t,n)*i(o,s))>.9*u&&fr.testPointInPolygon(o,s,t,n);)a>u&&(e.distance=u=a,e.y=s)}var Uh=Object.freeze({__proto__:null,findAnchorPoint:zh});function Bh(e,t){var n=new Uint8Array(e.size());br(t,function(e){e<0?n[~e]|=2:n[e]|=1}),this.isInnerArc=function(e){var t=Yt(e);return 3==n[t]}}function Gh(e){return e.reduce(function(e,t){return t.layers.forEach(function(n){e.push({layer:n,dataset:t.dataset})}),e},[])}function qh(e,t,n){var r=$h(e,t,!0);return n&&(r=r.filter(function(e){return e.layer.geometry_type==n})),e.forEach(function(e){e.layer.target_id=-1}),r.forEach(function(e,t){e.layer.target_id=t}),Vh(r)}function Vh(e){var t=[],n=[];return e.forEach(function(e){var r=t.indexOf(e.dataset);-1==r?(t.push(e.dataset),n.push({layers:[e.layer],dataset:e.dataset})):n[r].layers.push(e.layer)}),n}function $h(e,n,r){var i=[],a=[],o={};return n.split(",").forEach(function(t,n){var r=Jh(t),s=!1;e.forEach(function(e,t){t in o?s=!0:r(e.layer,t+1)&&(i.push(e),o[t]=!0,s=!0)}),0==s&&a.push(t)}),r&&a.length&&bt(t.format("Missing layer%s: %s",1==a.length?"":"s",a.join(","))),i}function Jh(e){var n=t.isInteger(Number(e)),r=n?null:t.wildcardToRegExp(e);return function(t,i){return n?String(i)==e:r.test(t.name||"")}}function Wh(e){return e.reduce(function(e,t){return e+t.layers.length},0)}var Zh=Object.freeze({__proto__:null,countTargetLayers:Wh,expandCommandTargets:Gh,findCommandTargets:qh,findMatchingLayers:$h,getLayerMatch:Jh,getLayerTargetId:function(e,t){var n,r=0;return t.name,e.getLayers().forEach(function(e,i){t.name&&e.layer.name==t.name&&r++,t==e.layer&&(n=String(i+1))}),n||vt("Layer not found"),1==r?t.name:n},groupLayersByDataset:Vh});function Yh(e,t){var n={},r=e.data?e.data.getRecords():null;return Oh(n,{name:e.name,data:r,type:e.geometry_type,size:ki(e),empty:0===ki(e),bbox:Xh(n,e,t)}),n.field_exists=function(t){return!(!e.data||!e.data.fieldExists(t))},n.field_type=function(t){return e.data&&ei(t,e.data.getRecords())||null},n.field_includes=function(t,n){return!!e.data&&e.data.getRecords().some(function(e){return e&&e[t]===n})},n}function Hh(e,t,n){var r;return Oh(e,{layer_name:t.name||"",layer:function(){return r||(r=Yh(t,n)),r}}),e}function Xh(e,t,n){var r;return function(){return r||(r=function(e,t){var n=Ji(e,t);if(!n)return null;var r=n.toArray();return Object.assign(r,{cx:n.centerX(),cy:n.centerY(),height:n.height(),width:n.width(),left:n.xmin,bottom:n.ymin,top:n.ymax,right:n.xmax}),r}(t,n)),r}}function Kh(e,n,r){var i,a,o,s,u,c,f,l=r||{},h=Si(e),p=n&&wi(e),d=e.data?e.data.getRecords():null,g=p&&n.isPlanar(),m={};function y(){var t=e.shapes[f];u||(u=t&&t[0]||null)}function v(){return o=o||fr.getShapeCentroid(c,n)}function b(){return s=s||zh(c,n)}function _(){return a||(a=p?n.getMultiShapeBounds(c):h?$t(e.shapes[f]):new qt)}return Oh(m,{id:function(){return f}}),Hh(m,e,n),l.geojson_editor&&(Object.defineProperty(m,"geojson",{set:function(e){l.geojson_editor.set(e,f)},get:function(){return l.geojson_editor.get(f)}}),Object.defineProperty(m,"feature",{set:function(e){l.geojson_editor.set(e,f)},get:function(){return l.geojson_editor.get(f)}}),Object.defineProperty(m,"geometry",{set:function(e){l.geojson_editor.setGeometry(e,f)},get:function(){return l.geojson_editor.getGeometry(f)}})),d&&Object.defineProperty(m,"properties",{set:function(e){t.isObject(e)?d[f]=e:bt("Can't assign non-object to $.properties")},get:function(){var e=d[f];return e||(e=d[f]={}),e}}),(p||h)&&Oh(m,{partCount:function(){var t=e.shapes[f];return t?t.length:0},isNull:function(){return 0===m.partCount},bounds:function(){return _().toArray()},bbox:function(){return _().toArray()},height:function(){return _().height()},width:function(){return _().width()}}),p?(m.bboxContainsPoint=function(e,t){return n.getMultiShapeBounds(c).containsPoint(e,t)},m.bboxIntersectsRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c);return qt.from(e,t,r,i).intersects(a)},m.bboxContainsRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c),o=qt.from(e,t,r,i);return a.contains(o)},m.bboxContainedByRectangle=function(e,t,r,i){var a=n.getMultiShapeBounds(c);return qt.from(e,t,r,i).contains(a)},"polyline"==e.geometry_type&&Oh(m,{length:function(){return fr.getShapePerimeter(c,n)}}),"polygon"==e.geometry_type&&Oh(m,{area:function(){return g?m.planarArea:fr.getSphericalShapeArea(c,n)},perimeter:function(){return fr.getShapePerimeter(c,n)},compactness:function(){return fr.calcPolsbyPopperCompactness(m.area,m.perimeter)},planarArea:function(){return fr.getPlanarShapeArea(c,n)},innerPct:function(){return i||(i=function(e,t){var n,r,i,a=e.isPlanar()?fr.distance2D:fr.greatCircleDistance,o=new Bh(e,t);return function(e){return n=0,r=0,e&&e.forEach(s),r>0?r/(r+n):0};function s(e){e.forEach(u)}function u(t){i=0,e.forEachArcSegment(t,c),o.isInnerArc(t)?r+=i:n+=i}function c(e,t,n,r){i+=a(n[e],r[e],n[t],r[t])}}(n,e.shapes)),i(c)},originalArea:function(){var e,t=n.getRetainedInterval();return n.setRetainedInterval(0),e=m.area,n.setRetainedInterval(t),e},centroidX:function(){var e=v();return e?e.x:null},centroidY:function(){var e=v();return e?e.y:null},innerX:function(){var e=b();return e?e.x:null},innerY:function(){var e=b();return e?e.y:null}})):h&&(Object.defineProperty(m,"coordinates",{set:function(n){!n||t.isArray(n)?e.shapes[f]=n||null:bt("Can't assign non-array to $.coordinates")},get:function(){return e.shapes[f]||null}}),Object.defineProperty(m,"x",{get:function(){return y(),u?u[0]:null},set:function(e){y(),u&&(u[0]=Number(e))}}),Object.defineProperty(m,"y",{get:function(){return y(),u?u[1]:null},set:function(e){y(),u&&(u[1]=Number(e))}})),function(t){return f=t,a=null,p&&(o=null,s=null,c=e.shapes[t]),h&&(u=null),m}}function Qh(e,t,n){var r=n||{},i=t||np(),a=ep(e,r),o=tp(e),s=!r.no_assign&&o.length>0;return r.no_assign&&rp(o,i),i._=i,function(t){var n,r=i.$||null;s&&rp(o,t);try{n=a.call(r,t,i)}catch(t){bt(t.name,"in expression ["+e+"]:",t.message)}return n}}function ep(e,t){var n;e=function(e){return e.replace(/\\\n/g," ")}(e),n="with($$env){with($$record){ "+(n=t.no_return?e:"var $$retn = "+e+"; return $$retn;")+"}}";try{return new Function("$$record,$$env",n)}catch(t){bt(t.name,"in expression ["+e+"]")}}function tp(e,n){var r=e.match(/[a-z_$][.a-z0-9_$]*(?= *=[^>=])/gi)||[],i=t.uniq(r.filter(function(e){var t=e.indexOf(".");return n?t>-1:-1==t}));return i}function np(e){return(e=e||{}).globalThis=void 0,function(){for(var t in this)e[t]=void 0}(),e.console=console,e}function rp(e,t){for(var n=0;n<e.length;n++)e[n]in t==!1&&(t[e[n]]=null)}var ip=Object.freeze({__proto__:null,compileExpressionToFunction:ep,getAssignedVars:tp,getBaseContext:np,getExpressionFunction:Qh,nullifyUnsetProperties:rp});function ap(e,t,n,r){var i=r||{};tp(e).length>0&&!t.data&&Wi(t);var a=t.data?t.data.getRecords():[],o=Kh(t,n,i),s=Hh({},t,n),u=up(t,i.context||{},i),c=Qh(e,u,i);return function(e,t){var n=t||a[e]||(a[e]={});return u.$=e>=0?o(e):s,u.d=n,c(n)}}function op(e,t,n){var r=sp(e,t,n);return function(e,t){var n=r(e,t);return Ch(n,'"where" expression must return true or false'),n}}function sp(e,t,n){var r=up({}),i=s(t,n),a=s(t,n),o=Qh(e,r,{});function s(e,t){var n=e.data?e.data.getRecords():[],r=Kh(e,t);function i(){}return function(e){var t;return-1==e?null:(i.prototype=n[e]||{},(t=new i).$=r(e),t)}}return function(e,t,n){return r.A=i(e),r.B=a(t),o(n||{})}}function up(e,n,r){var a=i("defs"),o=np(),s={},u=e.data?e.data.getFields():[];return r=r||{},function(e){Object.assign(e,{round:Gl,int_median:Ph,sprintf:t.format,blend:Eh,format_dms:kh,parse_dms:Mh})}(o),u.length>0&&rp(u,o),n=t.defaults(n||{},a),o.global=a,Object.keys(n).forEach(function(e){var t=Object.getOwnPropertyDescriptor(n,e);t.get?Object.defineProperty(s,e,{get:t.get}):Object.defineProperty(s,e,{value:n[e]})}),Object.keys(o).reduce(function(e,t){return t in e?r.no_warn||("function"==typeof e[t]&&u.indexOf(t)>-1?xt("Warning: "+t+"() function is hiding a data field with the same name"):xt('Warning: "'+t+'" has multiple definitions')):Object.defineProperty(e,t,{value:o[t]}),e},s)}var cp=Object.freeze({__proto__:null,compileFeatureExpression:ap,compileFeaturePairExpression:sp,compileFeaturePairFilterExpression:op});function fp(e){return lp(e).modes[0]}function lp(e,t){var n=function(e){var t,n,r=[],i={},a=[];for(t=0;t<e.length;t++)(n=e[t])in i==0?(i[n]=r.length,r.push(n),a.push(1)):a[i[n]]++;return{values:r,counts:a}}(e),r=function(e){var t,n,r=e.counts,i=e.values,a=r.length>0?function(e){var t,n=-1/0;for(t=0;t<e.length;t++)e[t]>n&&(n=e[t]);return n}(r):0,o=0,s=[];for(t=0;t<r.length;t++)(n=r[t])===a?s.push(i[t]):n>o&&(o=n);return{modes:s,margin:s.length>1?0:a-o,count:a}}(n);return t&&(r.counts=n.counts,r.values=n.values),r}var hp=Object.freeze({__proto__:null,getMode:fp,getModeData:lp}),pp={};function dp(e,n,r){var i=t.extend({},e),a={expression:r.where,invert:!!r.invert,verbose:!1,no_replace:r.no_replace};return pp.filterFeatures(i,n,a)}function gp(e,t,n){var r,a,o,s=n.expression;return n.where&&(e=dp(e,t,n),s+=" where "+n.where),a=i("defs"),r=yp(e,t,n.expression)(null,a),n.to_layer||xt(s+": "+r),o={expression:n.expression,value:r},n.where&&(o.where=n.where),e.name&&(o.layer_name=e.name),o}function mp(e,t,n){return yp(e,t,n)()}function yp(e,n,r){var i,a,o,s=0,u=0,c=-1,f=[],l={count:v,sum:y,sums:b,average:y,mean:y,median:y,quantile:y,iqr:y,quartile1:y,quartile2:y,quartile3:y,min:y,max:y,mode:b,collect:b,collectIds:function(){b(c)},first:function(e){0===s&&(f[u]=e);return u++,e},every:function(e){e=!!e,f[u]=(0===s||f[u])&&e,u++},some:function(e){e=!!e,f[u]=f[u]||e,u++},last:v},h={count:g(function(){return s},0),sum:g(t.sum,0),sums:g(function(e){var n=e&&e.length?e[0].length:0,r=t.initializeArray(Array(n),0);return e.forEach(function(e){if(e&&e.length)for(var t=0;t<n;t++)r[t]+=+e[t]||0}),r}),median:g(t.findMedian),quantile:(o=t.findQuantile,function(e,t){var n=u++;return s>0?o(f[n],t):null}),iqr:g(function(e){return t.findQuantile(e,.75)-t.findQuantile(e,.25)}),quartile1:g(function(e){return t.findQuantile(e,.25)}),quartile2:g(t.findMedian),quartile3:g(function(e){return t.findQuantile(e,.75)}),min:g(function(e){return t.getArrayBounds(e).min}),max:g(function(e){return t.getArrayBounds(e).max}),average:g(t.mean),mean:g(t.mean),mode:g(fp),collect:g(d),collectIds:g(d),first:g(d),every:g(d,!1),some:g(d,!1),last:g(d)},p=ki(e);return e.geometry_type&&(l.width=l.height=function(){},h.width=function(){return Ji(e,n).width()},h.height=function(){return Ji(e,n).height()}),i=ap(r,e,n,{context:l,no_assign:!0,no_warn:!0,no_return:!0}),a=ap(r,e,n,{context:h,no_warn:!0}),function(e,t){var n;return e?function(e){e.forEach(m)}(e):function(){for(var e=0;e<p;e++)m(e)}(),n=a(void 0,t),c=-1,s=0,u=0,f=[],n};function d(e){return e}function g(e,t){var n=arguments.length>1?t:null;return function(){var t=u++;return s>0?e(f[t]):n}}function m(e){(e<0||e>=p)&&vt("Invalid record index"),c=e,i(e),s++,u=0}function y(e){return isNaN(e)&&e&&bt("Expected a number, received:",e),b(e)}function v(e){return f[u++]=e,e}function b(e){var t;return 0===s&&(f[u]=[]),(t=f[u]).length!=s&&bt("Evaluation failed"),t.push(e),u++,e}}pp.calc=function(e,t,n){var r=e.map(e=>gp(e,t,n));return n.to_layer?{info:{},layers:[{name:n.name||"info",data:new di(r)}]}:null};var vp=Object.freeze({__proto__:null,applyCalcExpression:gp,compileCalcExpression:yp,evalCalcExpression:mp});function bp(e,t){var n=yp({data:e},null,t);return function(e,t){e||(e=[]),n(e,t)}}var _p=Object.freeze({__proto__:null,getJoinCalc:bp});function xp(e,t){if(!e||0===e.length)return function(){return 0};e.forEach(function(e){Pi(t,e)});var n={},r=0,i=t.getRecords(),a=wp(e);return function(e){var t=a(i[e]);return t in n==!1&&(n[t]=r++),n[t]}}function wp(e){return e.reduce(function(e,t){var n=function(e){return String(e[t])};return e?function(t){return e(t)+"~~"+n(t)}:n},null)}function Sp(e,t,n){var r=function(e,t){for(var n,r=[],i=0;i<t;i++)(n=e(i))in r?r[n].push(i):r[n]=[i];return r}(t,e.length);return Ep(e,r,n)}function Ap(e,t,n,r){for(var i=[],a=0;a<n;a++)i.push(t(a));return Ep(e,i,r)}function Ep(e,t,n){var r,i=n.sum_fields||[],a=n.copy_fields||[];function o(t,n){for(var r,i=0,a=0;a<n.length;a++)i+=(r=e[n[a]])&&r[t]||0;return i}return n.fields&&(a=a.concat(n.fields)),n.calc&&(r=bp(new di(e),n.calc)),t.map(function(t){var n,s,u={};for(s=e[(t=t||[])[0]],n=0;n<i.length;n++)u[i[n]]=o(i[n],t);for(n=0;n<a.length;n++)u[a[n]]=s?s[a[n]]:null;return r&&r(t,u),u})}var Mp=Object.freeze({__proto__:null,aggregateDataRecords:Sp,getCategoryClassifier:xp,getMultiFieldKeyFunction:wp,recombineDataRecords:Ap});function Ip(e,t,n,r){var i=function(e,t){var n=[];return wr(e,function(e){var r=t(e.shapeId);r in n==!1&&(n[r]=[]),n[r].push(e.arcId)}),n}(e.shapes,t),a=function(e){var t=new Uint8Array(e.size()),n=function(e){return t[Yt(e)]>0},r=function(e){t[Yt(e)]=0},i=new lo(e);return function(e){e.forEach(function(e){t[Yt(e)]=1});var a=function(e,t,n){var r=[];return e.forEach(function(e){0===t.getConnectedArcs(e,n).length&&r.push(~e),0===t.getConnectedArcs(~e,n).length&&r.push(e)}),r}(e,i,n),o=kp(a,i,n,r),s=kp(e,i,n,r),u=o.concat(s);return e.forEach(function(e){t[Yt(e)]=0}),u}}(n);return i.map(a)}function kp(e,t,n,r){var i=[];return e.forEach(function(e){for(var a,o=[],s=e;n(s)&&(o.push(s),a=n(s)?t.getConnectedArcs(s,n):[],r(s),a.length>0);)s=~a[0];o.length>0&&i.push(o)}),i}function Cp(e,n){var r=function(e,n){var r=[],i=[],a=[],o=e.map(function(e,t){return n(t)});return wr(e,s),i.forEach(g),a;function s(e){var t=e.arcId,n=t<0?~t:t,o=a.length,s=r[n];s||(s=[],r[n]=s),s.push(o),e.group=s,a.push(e),3==s.length&&i.push(s)}function u(e,t){for(var n,r,i=0;i<e.length-1;i++){n=a[e[i]];for(var o=i+1;o<e.length;o++)if(t(n,r=a[e[o]]))return[n.segId,r.segId]}return null}function c(t,n){return Pp(t,a,e).arcId===~Pp(n,a,e).arcId}function f(t,n){return Op(t,a,e).arcId===~Op(n,a,e).arcId}function l(e,t){return p(e,t)&&c(e,t)&&f(e,t)}function h(e,t){return p(e,t)&&(c(e,t)||f(e,t))}function p(e,t){return e.arcId===~t.arcId&&o[e.shapeId]===o[t.shapeId]}function d(e){e.forEach(function(t){a[t].group=e})}function g(e){var n=u(e,l)||u(e,h)||u(e,p);n&&(e=e.filter(function(e){return!t.contains(n,e)}),d(e),d(n),e.length>2&&g(e))}}(e,n);return function(e,n,r){var i=[];return e.forEach(a),i;function a(e){e.used||(c(e)||s(e))}function o(e,t){t in i==!1&&(i[t]=[]),i[t].push(e)}function s(e){var t=[e.arcId],n=u(e);for(e.used=!0;n&&n!=e;)t.push(n.arcId),n.used=!0,(n=u(n))&&n!=e&&n.used&&vt("buildRing() topology error");n||vt("buildRing() traversal error"),e.used=!0,o(t,r(e.shapeId))}function u(t,r){var i,a=Pp(t,e,n);return r=r||0,a!=t&&(i=c(a))&&(r>100&&vt("deep recursion -- unhandled topology problem"),a=1==n[i.shapeId][i.partId].length?u(a,r+1):u(i,r+1)),a}function c(n){var i,a=r(n.shapeId);return i=t.find(n.group,function(t){var i=n,o=e[t];return i!=o&&!o.used&&r(o.shapeId)===a&&i.arcId==~o.arcId}),null===i?null:e[i]}}(r,e,n)}function Pp(e,t,n){return Np(e,t,n,1)}function Op(e,t,n){return Np(e,t,n,-1)}function Np(e,t,n,r){var i,a=n[e.shapeId][e.partId].length,o=(e.i+r)%a;return o<0&&(o+=a),(i=t[e.segId-e.i+o])&&i.shapeId==e.shapeId||vt("index error"),i}var Tp=Object.freeze({__proto__:null,dissolvePolygonGeometry:Cp});function Lp(e,n,r,i){var a,o=null;if(e.data)for(var s=0,u=(o=Sp(e.data.getRecords(),r,i)).length;s<u;s++)n&&!n[s]&&(n[s]=null);return a={name:i.no_replace?null:e.name,shapes:n,data:o?new di(o):null,geometry_type:e.geometry_type},i.silent||function(e,n){var r=ki(e),i=ki(n),a=t.format("Dissolved %,d feature%s into %,d feature%s",r,t.pluralSuffix(r),i,t.pluralSuffix(i));xt(a)}(e,a),a}function zp(e,n){var r=new Int32Array(e.length);t.initializeArray(r,-1);var i=[],a=[];function o(e,t,o){var u=r[t];if(-1!=u&&n.flat){if(!(o&&o(e)>o(u)))return;s(t,u),r[t]=u,u=-1}-1==u?r[t]=e:-2==u?i[t].push(e):(i[t]=[u,e],r[t]=-2),a[e].push(t)}function s(e,t){for(var n=a[t],r=0;r<n.length;r++)if(n[r]===e){n[r]=-1;break}}this.getTileIdsByShapeId=function(e){var t=a[e];return t?t.filter(function(e){return e>=0}):[]},this.getShapeIdByTileId=function(e){var t=r[e];return t>=0?t:-1},this.getShapeIdsByTileId=function(e){var t=r[e];return t>=0?[t]:-1==t?[]:i[e]},this.indexTileIdsByShapeId=function(e,t,n){a[e]=[];for(var r=0;r<t.length;r++)o(e,t[r],n)},this.flatten=function(){i.forEach(function(e,t){!function(e){var t,n=i[e],a=n[0];r[e]=a;for(var o=0;o<n.length;o++)(t=n[o])!=a&&s(e,t)}(t)}),i=[]},this.getUnusedTileIds=function(){for(var e=[],t=0,n=r.length;t<n;t++)-1==r[t]&&e.push(t);return e},this.addTileToShape=function(e,t){e in a!=!1&&-1==r[t]||vt("Internal error"),r[t]=e,a[e].push(t)}}function Rp(e,t,n){for(var r=0,i=e.length;r<i;r++)e[r]=Dp(e[r],t,n)}function Dp(e,t,n){return Or(e,function(e){var r=function(e,t){for(var n=0,r=0,i=e.length;r<i;r++)t.arcIsDegenerate(e[r])&&(n++,e[r]=null);return n>0?e.filter(function(e){return null!==e}):e}(e,t);return"polygon"==n&&r&&(jp(r),0===fr.getPlanarPathArea(r,t)&&(r=null)),r})}function jp(e){var t=e.length;if(t>=2){if(e[0]==~e[t-1])e.pop(),e.shift();else for(var n=1;n<t;n++)if(e[n-1]==~e[n]){e.splice(n-1,2);break}e.length<t&&jp(e)}}function Fp(e){var t=new Ml(e.arcs.size()),n=function(e){return t.hasId(~e)};return function(e){t.setIds(e);var n=r(e);return t.clear(),n};function r(e){for(var t=null,n=0,r=e.length;n<r-1;n++)if(null!==(t=i(e,e[n])))return t;return jp(e),e.length>0?[e]:[]}function i(r,i){var s,u,c,f=e.getConnectedArcs(i,n);if(f.length<2)return null;s=[];for(var l=0;l<f.length;l++)(c=o(r,u=~f[l]))>-1&&(t.clearId(u),s.push(c));return s.length<2?null:Up(r,s).reduce(a,null)}function a(e,t){var n=r(t);return null===e?n:(e.push.apply(e,n),e)}function o(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}}function Up(e,n){var r=[];t.genericSort(n,!0),n[0]>0&&r.push(e.slice(0,n[0]));for(var i=0,a=n.length;i<a;i++)i<a-1?r.push(e.slice(n[i],n[i+1])):r.push(e.slice(n[i]));return r.length>n.length&&t.merge(r[0],r.pop()),r}pp.dissolve=function(e,n,r){var i,a;return(r=t.extend({},r)).where?function(e,n,r,i){i&&i.where||vt('Missing required "where" parameter');var a=e(dp(n,r,i),r,t.defaults({where:null},i)),o=dp(n,r,t.defaults({invert:!0},i));return pp.mergeLayers([o,a],{verbose:!1,force:!0})[0]}(pp.dissolve,e,n,r):(r.field&&(r.fields=[r.field]),a=xp(r.fields,e.data),r.multipart||r.group_points?i=function(e,t){e.shapes&&e.geometry_type||bt("Layer is missing geometry");kr(e.shapes);var n=[];return e.shapes.forEach(function(e,r){var i=t(r);e&&(n[i]?n[i].push.apply(n[i],e):n[i]=e)}),n}(e,a):"polygon"==e.geometry_type?i=Cp(e.shapes,a):"polyline"==e.geometry_type?i=Ip(e,a,n):"point"==e.geometry_type&&(i=function(e,t,n){var r=!n.planar&&ia(Ji(e)),i=n.weight?ap(n.weight,e,null):null,a=[];return 0!==qi(e.shapes)&&bt("Dissolving multi-part points is not supported"),e.shapes.forEach(function(e,n){var o,s=t(n),u=i?i(n):1,c=e&&e[0];c&&(r&&(o=[],fr.lngLatToXYZ(c[0],c[1],o),c=o),a[s]=function(e,t,n){var r,i,a=t[0],o=t[1];return a==a&&o==o&&n>0&&(e?(r=e.sum+n,i=e.sum/r,e.centroid[0]=i*e.centroid[0]+n*a/r,e.centroid[1]=i*e.centroid[1]+n*o/r,3==t.length&&(e.centroid[2]=i*e.centroid[2]+n*t[2]/r),e.sum=r):e={sum:n,centroid:t.concat()}),e}(a[s],c,u))}),a.map(function(e){var t,n;return e?(r?(t=e.centroid,n=[],fr.xyzToLngLat(t[0],t[1],t[2],n)):n=e.centroid,e?[n]:null):null})}(e,a,r)),Lp(e,i,a,r))};var Bp=Object.freeze({__proto__:null,cleanShapes:Rp,getSelfIntersectionSplitter:Fp,removeSpikesInPath:jp,splitPathByIds:Up});function Gp(e){var t,n=new lo(e.arcs),r=function(e){for(var t,n=new Int32Array(e.arcs.size()),r=0,i=0,a=e.arcs.size();i<a;i++)t=e.findDuplicateArc(i),n[i]=t,i!=t&&r++;return r>0?n:null}(n);return r&&qp(e,r),t=function(e){var t=Vi(e.layers,e.arcs),n=e.arcs.size(),r=e.arcs.deleteArcs(t),i=e.arcs.size(),a=n-i;a>0&&qp(e,r);return a}(e),t>0&&(n=new lo(e.arcs)),n}function qp(e,t){var n=function(e){for(var n,r,i,a=0;a<e.length;a++)r=Yt(n=e[a]),i=t[r],e[a]=n==r?i:~i;return e};e.layers.forEach(function(e){wi(e)&&Pr(e.shapes,n)})}function Vp(e,t){var n,r=t||{},i=e.arcs,a=i&&i.getBounds();if(!a||!a.hasBounds())return new lo([]);Ct("addIntersectionCuts() snap dist:",n=r.snap_interval?oh(r.snap_interval,Ia(e)):!r.no_snap&&a.hasBounds()?Bn(a.toArray()):0),i.flatten();var o=function(e,t){var n,r,i,a=e.arcs,o=t>0?{tolerance:t}:{tolerance:0},s=!1,u=4,c=0;do{c++,i=0,n=qn(a,t),r=a.dedupCoords(),(n>0||i>0||1==c)&&(i=$p(e,o)),s|=n+r+i>0,Ct("[snapAndCut] pass:",c,"snaps:",n,"dupes:",r,"cuts:",i)}while(c<u&&i>0);return s}(e,n);return(o||r.rebuild_topology)&&Ka(e),e.layers.forEach(function(e){wi(e)&&Rp(e.shapes,i,e.geometry_type)}),Gp(e)}function $p(e,t){var n=e.arcs.getPointCount(),r=Wp(e.arcs,t),i=e.arcs.getPointCount();return Jp(e,r),i-n}function Jp(e,t){var n=function(e,t){return function(e){for(var t=[],r=0;r<e.length;r++)n(e[r],t);return t};function n(n,r){var i,a=n<0,o=a?~n:n,s=e[o],u=(o>=e.length-1?t:e[o+1])-1;do{a?(i=~u,u--):(i=s,s++),r.push(i)}while(u-s>=0)}}(t,e.arcs.size());e.layers.forEach(function(e){wi(e)&&Pr(e.shapes,n)})}function Wp(e,t){return Yp(Zp(e,t),e)}function Zp(e,t){var n=Il(e,t),r=e.getVertexData();return function(e){for(var t,n,r,i=[],a=0,o=e.length;a<o;a++)n=Hp((t=e[a]).x,t.y,t.a[0],t.a[1]),r=Hp(t.x,t.y,t.b[0],t.b[1]),n&&i.push(n),r&&i.push(r);return i}(n,r.xx,r.yy)}function Yp(e,t){var n,r,i,a,o=t.getVertexData(),s=o.xx,u=o.yy,c=o.nn,f=0,l=0,h=[],p=t.size(),d=new Uint32Array(p),g=Kp(Xp(e,s,u),t),m=t.getPointCount()+2*g.length,y=new Float64Array(m),v=new Float64Array(m);g.reverse(),a=g.pop();for(var b=0,_=0;b<p;b++){for(i=c[b],d[b]=_,n=0,r=0;n<i;){for(y[l]=s[f],v[l]=u[f],l++,r++;a&&a.i==f;)y[l]=a.x,v[l]=a.y,l++,r++,h[_++]=r,r=0,y[l]=a.x,v[l]=a.y,l++,r++,a=g.pop();n++,f++}h[_++]=r}return l!=m&&vt("[insertCutPoints()] Counting error"),t.updateVertexData(h,y,v,null),d}function Hp(e,t,n,r,i,a){return(r<n||r>n+1)&&vt("Out-of-sequence arc ids:",n,r),{x:e,y:t,i:n}}function Xp(e,t,n){return e.sort(function(e,r){return e.i!=r.i?e.i-r.i:fr.distanceSq(t[e.i],n[e.i],e.x,e.y)-fr.distanceSq(t[r.i],n[r.i],r.x,r.y)}),e}function Kp(e,t){var n=[],r=0;return t.forEach2(function(t,i,a,o,s){for(var u,c,f=i+a-1,l=o[i],h=s[i],p=o[f],d=s[f];r<e.length&&e[r].i<=f;)u=e[r],r++,c=n[n.length-1],u.x==l&&u.y==h&&u.i==i||u.x==p&&u.y==d&&u.i>=f-1||c&&c.x==u.x&&c.y==u.y&&c.i==u.i||n.push(u)}),n}var Qp=Object.freeze({__proto__:null,addIntersectionCuts:Vp,cutPathsAtIntersections:$p,divideArcs:Wp,filterSortedCutPoints:Kp,findClippingPoints:Zp,getCutPoint:Hp,insertCutPoints:Yp,remapDividedArcs:Jp,sortCutPoints:Xp}),ed={stack:[],start:function(){ed.stack.push(Date.now())},stop:function(){return Date.now()-ed.stack.pop()+"ms"}};function td(e){ed.start(),e.detachAcyclicArcs();var n=function(e){for(var t=e.arcs,n=[],r=[],i=[],a=[],o=new Uint8Array(t.size()),s=xl(e,l),u=0,c=o.length;u<c;u++)f(u),f(~u);return{cw:n,ccw:r,empty:i,lostArcs:a};function f(e){var o,u;if(h(e)){if(!(o=s(e)))return a.push(e),void Ct("Dead-end arc:",e);(u=fr.getPlanarPathArea(o,t))>0?n.push(o):u<0?r.push(o):i.push(o)}}function l(e){return h(e,!0)}function h(e,t){var n=Yt(e),r=n==e?1:2,i=0===(o[n]&r);return t&&i&&(o[n]|=r),i}}(e),r=n.cw.map(function(e){return[e]});Ct("Find mosaic rings",ed.stop()),ed.start();var i=[],a=new Vf(r,e.arcs);return n.ccw.forEach(function(e){var t=a.findSmallestEnclosingPolygon(e);t>-1?r[t].push(e):(mr(e),i.push([e]))}),Ct(t.format("Detect holes (holes: %d, enclosures: %d)",n.ccw.length-i.length,i.length),ed.stop()),{mosaic:r,enclosures:i,lostArcs:n.lostArcs}}var nd=Object.freeze({__proto__:null,buildPolygonMosaic:td,mosaic:function(e,t){var n,r,i,a,o,s,u,c,f=[];return e.arcs||bt("Dataset is missing path data"),r=td(n=Vp(e,t)),f.push({name:"mosaic",shapes:r.mosaic,geometry_type:"polygon"}),t.debug&&(f.push({geometry_type:"polygon",name:"mosaic-enclosure",shapes:r.enclosures}),r.lostArcs.length>0&&(f=f.concat((i=r.lostArcs,a=n.arcs,o={geometry_type:"polyline",name:"lost-arcs",shapes:[]},s={geometry_type:"point",name:"lost-arc-endpoints",shapes:[]},u=[],c=[],i.forEach(function(e){var t=a.getVertex(e,0),n=a.getVertex(e,-1);u.push({ARCID:e}),o.shapes.push([[e]]),c.push({ARCID:e},{ARCID:e}),s.shapes.push([[t.x,t.y]],[[n.x,n.y]])}),o.data=new di(u),s.data=new di(c),[o,s])))),f}});function rd(e){var n=new Int32Array(e),r=new Int32Array(e);t.initializeArray(n,-1),t.initializeArray(r,-1),this.setId=function(e,t){e<0?r[~e]=t:n[e]=t},this.hasId=function(e){return this.getId(e)>-1},this.getId=function(t){var i=t<0?~t:t;return i>=e?-1:t<0?r[i]:n[i]}}function id(e){var t=[],n=new rd(e),r=n.setId;return n.setId=function(e,i){n.hasId(e)||t.push(e),r(e,i)},n.clear=function(){t.forEach(function(e){r(e,-1)}),t=[]},this.clearId=function(e){n.hasId(e)||vt("Tried to clear an unset id"),r(e,-1)},n}function ad(e,t){Pr(e.shapes,function(e){if(fr.getPathArea(e,t)<=0)return null})}function od(e,t){var n=Fp(e);return function(r,i,a){var o=t?fr.getSphericalPathArea:fr.getPlanarPathArea;Cr(r,function(t){var r=n(t);0===r.length&&Ct("[getRingDivider()] Defective path:",t),r.forEach(function(t,n){var r=o(t,e.arcs);r>0?i.push(t):r<0&&a.push(t)})})}}var sd=Object.freeze({__proto__:null,deleteHoles:ad,getHoleDivider:od});function ud(e,t,n,r){var i,a,o,s=n.arcs,u=new Ml(e.length),c=od(n),f=new Ml(s.size()),l=new Ml(s.size());function h(e){i=i?i.concat(e):e}function p(t){a=s.getSimpleShapeBbox(t),f.setIds(t),function(t){var n,r=t.concat();for(;r.length>0;)(n=m(r.pop()))>=0&&d(r,e[n])}(t),f.clear(),u.clear()}function d(e,t){for(var n,r,i=0,a=t.length;i<a;i++)for(var o=0,s=(r=t[i]).length;o<s;o++)g(n=r[o])&&e.push(~n)}function g(e){var t=~e;return!(f.hasId(e)||f.hasId(t)||l.hasId(e)||l.hasId(t))}function m(e){var n=t.getShapeIdByArcId(e);return-1==n||u.hasId(n)?-1:!1===s.arcIsContained(Yt(e),a)?(Ct("Out-of-bounds ring arc",e),-1):(u.setId(n),o.push(n),n)}this.getTilesInShape=function(e,t){var n,a=[],s=[];return o=[],i=[],r.no_holes?c(e,a,s):(c(e,a,s),s.forEach(h),l.setIds(i)),a.forEach(p),n=o,o=null,l.clear(),i=null,n}}var cd=Object.freeze({__proto__:null,PolygonTiler:ud});function fd(e,t,n){var r=n||{},i=e.shapes,a=td(t).mosaic,o=new ld(a,t.arcs),s=new Ml(a.length),u=new zp(a,r),c=new ud(a,o,t,r),f=null;function l(e,t,n){var r=[],i=n?-1:1;return function(n){var a;return n in r?a=r[n]:(a=i*Math.abs(fr.getShapeArea(e[n],t)),r[n]=a),a}}function h(e,t){return a[e]}function p(e){for(var n,r,i,s,c=a[e][0],f=t.arcs,l=-1,h=0,p=0;p<c.length;p++)n=c[p],(i=o.getShapeIdByArcId(~n))<0||(r=u.getShapeIdByTileId(i))<0||(s=fr.getPathPerimeter([n],f))>h&&(l=r,h=s);l>-1&&u.addTileToShape(l,e)}!r.simple&&r.flat&&(f=function(e,t,n){var r;n&&"max-area"!=n?"min-area"==n?r=l(e,t,!0):"max-id"==n?r=function(e){return e}:"min-id"==n?r=function(e){return-e}:bt("Unknown overlap rule:",n):r=l(e,t,!1);return r}(e.shapes,t.arcs,r.overlap_rule)),this.mosaic=a,this.nodes=t,this.getSourceIdsByTileId=u.getShapeIdsByTileId,this.getTileIdsByShapeId=u.getTileIdsByShapeId,i.forEach(function(e,t){var n=c.getTilesInShape(e,t);u.indexTileIdsByShapeId(t,n,f)}),r.flat&&u.flatten(),this.removeGaps=function(e){r.flat||vt("MosaicIndex#removeGaps() should only be called with a flat mosaic");var t=u.getUnusedTileIds(),n=t.filter(function(t){var n=a[t];return e(n[0])});return n.forEach(p),{removed:n.length,remaining:t.length-n.length}},this.getUnusedTiles=function(){return u.getUnusedTileIds().map(h)},this.getTilesByShapeIds=function(e){return function(e){var t,n,r,i,a=[];for(r=0;r<e.length;r++)for(n=u.getTileIdsByShapeId(e[r]),i=0;i<n.length;i++)t=n[i],s.hasId(t)||(s.setId(t),a.push(t));return s.clear(),a}(e).map(h)}}function ld(e,t){var n,r=new rd(t.size());function i(e){for(var t,i=0,a=e.length;i<a;i++)t=e[i],r.setId(t,n)}e.forEach(function(e,t){n=t,e.forEach(i)}),this.getShapeIdByArcId=function(e){return r.getId(e)}}var hd=Object.freeze({__proto__:null,MosaicIndex:fd,ShapeArcIndex:ld});function pd(e,n,r){(r=t.extend({},r)).field&&(r.fields=[r.field]);var i=xp(r.fields,e.data),a=function(e,t){return e.shapes.reduce(function(e,n,r){var i=t(r);return i in e==!1&&(e[i]=[]),e[i].push(r),e},[])}(e,i);return Lp(e,gd(a,e,n,r),i,r)}function dd(e,n){var r=n.map(function(e,t){return{tile_id:t}});return t.defaults({shapes:n,data:new di(r)},e)}function gd(e,n,r,i){var a,o,s=pr(n.shapes,r.arcs),u=new fd(n,new lo(r.arcs,s),{flat:!i.allow_overlaps,simple:1==e.length,overlap_rule:i.overlap_rule}),c=!i.allow_overlaps&&(i.sliver_control||i.gap_fill_area);c&&(o=lh(n,r,t.extend({sliver_control:1},i)),a=u.removeGaps(o.filter));var f,l,h,p,d=wl(u.nodes),g=e.map(function(e){var t=u.getTilesByShapeIds(e);return i.tiles?t.reduce(function(e,t){return e.concat(t)},[]):function(e,t){for(var n,r,i=[],a=[],o=0,s=e.length;o<s;o++)r=e[o],i.push(r[0]),r.length>1&&(a=a.concat(r.slice(1)));n=t(i.concat(a),"dissolve"),n.length;return n.length>0?n:null}(t,d)});if(g=function(e,t){var n=function(e,n){mr(n);var r=t([n],"flatten");return r.length>1?(r.forEach(mr),e=e.concat(r)):e.push(mr(n)),e};return e.map(function(e){return e?e.reduce(n,[]):null})}(g,d),c&&!i.quiet){var m=(f=a.removed,l=a.remaining,h=o.label,p=f+l,f>0==0?"":t.format("Removed %,d of %,d sliver%s using %s",f,p,t.pluralSuffix(p),h));m&&xt(m)}return g}var md=Object.freeze({__proto__:null,composeMosaicLayer:dd,dissolvePolygonGroups2:gd,dissolvePolygonLayer2:pd});function yd(e,t,n){var r=t.arcs,i=new lo(r,pr(e.shapes,r)),a=new id(r.size());e.shapes=e.shapes.map(function(e,t){return e?(e=function(e,t){var n=[];return Cr(e,r),n;function r(e){for(var r,i=e.length,a=[],o=0;o<i;o++)r=e[o],a.push(r),o<i-1&&t.getConnectedArcs(r).length>1&&(n.push(a),a=[]);a.length>0&&n.push(a)}}(e,i),a.clear(),e=function(e,t){var n=e.reduce(function(e,n){return function(e,t,n){for(var r,i=[],a=0;a<t.length;a++)r=t[a],n.hasId(r)?i.length>0&&(e.push(i),i=[]):i.push(r),n.setId(r,a),n.setId(~r,a);i.length>0&&e.push(i)}(e,n,t),e},[]);return n.length>0?n:null}(e,a),a.clear(),e=function(e,t,n){return!e||e.length<2?e:(e.forEach(function(e,t){var i=~e[0],a=e[e.length-1];(n.hasId(i)||n.hasId(a))&&vt("Indexing error"),n.setId(i,t),n.setId(a,t),r(i,t),r(a,t)}),e.filter(function(e){return!!e}));function r(r,i){var a,o=0,s=-1,u=n.getId(r);if(t.forEachConnectedArc(r,function(e){n.hasId(e)&&(s=n.getId(e),a=e),o++}),1==o&&s>-1&&s<i){!function(e,t,n,r,i){var a,o,s=e[t],u=e[r];~n==s[0]?a=!0:n==s[s.length-1]?a=!1:vt("Index error");~i==u[0]?o=!0:i==u[u.length-1]?o=!1:vt("Index error 2");o||(u=mr(u.concat()));a?function(e,t){t=mr(t.concat());var n=[0,0].concat(t);e.splice.apply(e,n)}(s,u):function(e,t){e.push.apply(e,t)}(s,u)}(e,s,a,u,r),n.setId(r,s);var c=function(e,t){var n=~e[0],r=e[e.length-1];if(t==n)return r;if(t==r)return n;vt("Indexing error")}(e[u],r);n.setId(c,s),u!=s&&(e[u]=null)}}}(e,i,a),e):null})}function vd(e,n,r){var i,a=r||{},o=!a.only_arcs,s=t.some(e,wi);a.debug?Vp(n,a):(e.forEach(function(e){xi(e)&&("polygon"==e.geometry_type&&a.rewind&&$f(e,n.arcs),o&&(i||(i=Vp(n,a)),"polygon"==e.geometry_type?function(e,t,n){n=Object.assign({gap_fill_area:"auto"},n);var r=e.shapes.map(function(e,t){return[t]});e.shapes=gd(r,e,t,n)}(e,n,a):"polyline"==e.geometry_type?yd(e,n):"point"==e.geometry_type&&function(e){var t,n;function r(e){var r=e.join("~");r in t||(t[r]=!0,n.push(e))}e.shapes=e.shapes.map(function(e,i){return e&&e.length>0!=!1?1==e.length?e:(t={},n=[],e.forEach(r),0===n.length?null:n):null})}(e)),a.allow_empty||pp.filterFeatures(e,n.arcs,{remove_empty:!0,verbose:a.verbose}))}),!a.no_arc_dissolve&&s&&n.arcs&&ho(n))}function bd(e){return e.reduce(function(e,n){return null===e?e=n.name||null:e&&n.name&&(e=t.mergeNames(e,n.name)),e},null)||""}pp.cleanLayers=vd,pp.mergeAndFlattenLayers=function(e,t,n){if(!n.flatten)return pp.mergeLayers(e,n);e.forEach(function(e){Ri(e,"the flatten option requires polygon layers")});var r=pp.mergeLayers(e,n);return ko(t,e,r),vd(r,t,{overlap_rule:"max-id"}),ko(t,r,e),r},pp.mergeLayers=function(e,n){var r=e.filter(ki),i={};return n=n||{},r.length?1==r.length?(xt("Use the target= option to specify multiple layers for merging"),r.concat()):(i.data=function(e,n){var r=t.uniq(e.reduce(function(e,t){return e.concat(t.data?t.data.getFields():[])},[]));if(0===r.length)return null;var i=e.reduce(function(e,t){var n=t.data?t.data.getRecords():new di(ki(t)).getRecords();return e.concat(n)},[]),a=function(e,n){var r=t.uniq(n.reduce(function(n,r){return n.concat(t.difference(e,r.data?r.data.getFields():[]))},[]));return r}(r,e);(function(e,t){var n;e.length>0&&(n="["+e.join(", ")+"]",n=(1==e.length?"Field "+n+" is missing":"Fields "+n+" are missing")+" from one or more layers",t.force?!1!==t.verbose&&xt("Warning: "+n):bt(n))})(a,n),function(e,t){e.forEach(function(e){var n=function(e,t){return t.reduce(function(t,n){var r=n.data?ei(e,n.data.getRecords()):null;return r&&-1==t.indexOf(r)&&t.push(r),t},[])}(e,t);n.length>1&&bt('Inconsistent data types in "'+e+'" field:',n.join(", "))})}(r,e),a.length>0&&Kr(i);return new di(i)}(r,n),i.name=bd(r),i.geometry_type=function(e){var n=t.uniq(t.pluck(e,"geometry_type")).filter(function(e){return!!e});n.length>1&&bt("Incompatible geometry types:",n.join(", "));return n[0]||null}(r),i.geometry_type&&(i.shapes=function(e){return e.reduce(function(e,t){for(var n=t.shapes||[],r=ki(t),i=-1;++i<r;)e.push(n[i]||null);return e},[])}(r)),i.shapes&&i.data&&i.shapes.length!=i.data.size()&&vt("Mismatch between geometry and attribute data"),[i]):null};var _d={};function xd(e,n){(n=t.extend({},n)).rfc7946=!n.gj2008;var r=n.extension||"json";return n.rfc7946&&Sd(e),n.file&&(r=Ro(n.file)),(n.combine_layers?[e.layers]:e.layers.map(function(e){return[e]})).map(function(i){var a=bd(i)||"output";return{content:Ed(t.defaults({layers:i},e),n,"buffer"),filename:a+"."+r}})}function wd(e,t,n,r,i){var a,o=Pd(e.data,n),s=e.shapes,u=Nd(e.data,n);return a=n.ndjson?Xf:n.prettify?Kf(["bbox","coordinates"]):JSON.stringify,o&&s&&o.length!==s.length&&vt("Mismatch between number of properties and number of shapes"),(s||o||[]).reduce(function(c,f,l){var h=s?s[l]:null,p=_d.exporters[e.geometry_type],d=h?p(h,t.arcs,n):null,g=null;if(r)g=function(e,t,n){var r=_d.toFeature(e,t);Array.isArray(n.hoist)&&t&&(r.properties=Object.assign({},t),n.hoist.forEach(e=>{t.hasOwnProperty(e)&&(r[e]=t[e],delete r.properties[e])}));return r}(d,o?o[l]:null,n),u&&(g.id=u[l]),n.no_null_props&&!g.properties&&(g.properties={});else{if(!d)return c;g=d}return i&&(g=a(g),"buffer"==i&&(g=Vr(g,"utf8"))),c.push(g),c},[])}function Sd(e){var t=Ia(e);if(!(t&&Na(t)||So(e))){var n="RFC 7946 warning: non-WGS84 GeoJSON output.";t&&(n+=' Tip: use "-proj wgs84" to convert.'),xt(n)}}function Ad(e,t){var n,r,i,a,o=Ia(e),s=t&&o&&Na(o),u=new qt,c=new qt;return e.layers.forEach(function(t){wi(t)?wr(t.shapes,null,function(t){var n=e.arcs.getSimpleShapeBounds(t.arcs);(n.centerX()<0?u:c).mergeBounds(n)}):Si(t)&&Wt(t.shapes,function(e){(e[0]<0?u:c).mergePoint(e[0],e[1])})}),(n=(new qt).mergeBounds(c).mergeBounds(u)).hasBounds()&&(a=n.toArray()),s&&c.hasBounds()&&u.hasBounds()&&(r=c.xmin-u.xmax,i=360+u.xmin-c.xmax,r>0&&r>i&&(a[0]=c.xmin,a[2]=u.xmax)),a||null}function Ed(e,t,n){var r,i,a={},o=e.layers,s=kd(o,t);return a.type=s?"FeatureCollection":"GeometryCollection",t.gj2008&&Id(e,a),t.bbox&&(i=Ad(e,t.rfc7946))&&(a.bbox=i),r=o.reduce(function(r,i,a){var o=wd(i,e,t,s,n);return r.length>0?r.concat(o):o},[]),"Feature"==t.geojson_type&&1==r.length?r[0]:t.ndjson?_d.formatCollectionAsNDJSON(r):n?_d.formatCollection(a,r):(a[Md(a.type)]=r,a)}function Md(e){return"FeatureCollection"==e?"features":"GeometryCollection"==e?"geometries":void vt("Invalid collection type:",e)}function Id(e,t){var n=e.info||{};!n.crs&&"input_geojson_crs"in n&&(t.crs=n.input_geojson_crs)}function kd(e,n){var r=n.geojson_type||"";return"Feature"==r||"FeatureCollection"==r||"GeometryCollection"!=r&&(r&&bt("Unsupported GeoJSON type:",n.geojson_type),t.some(e,function(e){var t=e.data?e.data.getFields():[],r=Cd(t,n),i=!!Od(t,n);return r||i}))}function Cd(e,t){return!(t.drop_table||t.cut_table||0===e.length||1==e.length&&e[0]==_d.ID_FIELD)}function Pd(e,n){var r,i=e?e.getFields():[],a=Od(i,n);return Cd(i,n)?(r=e.getRecords(),a==_d.ID_FIELD?r.map(function(e){return delete(e=t.extend({},e))[a],e}):r):null}function Od(e,n){var r=[],i=n.id_field;return t.isString(i)?r.push(i):t.isArray(i)&&(r=i),r.push(_d.ID_FIELD),t.find(r,function(n){return t.contains(e,n)})}function Nd(e,t){var n=Od(e?e.getFields():[],t);return n?e.getRecords().map(function(e){return n in e?e[n]:null}):null}_d.ID_FIELD="FID",_d.typeLookup={LineString:"polyline",MultiLineString:"polyline",Polygon:"polygon",MultiPolygon:"polygon",Point:"point",MultiPoint:"point"},_d.translateGeoJSONType=function(e){return _d.typeLookup[e]||null},_d.pathIsRing=function(e){var t=e[0],n=e[e.length-1];return e.length>=4&&t[0]==n[0]&&t[1]==n[1]},_d.toFeature=function(e,t){var n=e?e.type:null;return"Feature"==n?e:n in _d.typeLookup?{type:"Feature",geometry:e,properties:t||null}:{type:"Feature",geometry:null,properties:t||null}},_d.formatCollectionAsNDJSON=function(e){var n=t.createBuffer("\n","utf8"),r=e.reduce(function(e,t,r){return r>0&&e.push(n),e.push(t),e},[]);return u.concat(r)},_d.formatCollection=function(e,n){var r=JSON.stringify(e).replace(/\}$/,', "'+Md(e.type)+'": [\n');return t.isString(n[0])?r+n.join(",\n")+"\n]}":_d.joinOutputBuffers(r,"\n]}",n)},_d.joinOutputBuffers=function(e,n,r){var i=t.createBuffer(",\n","utf8"),a=r.reduce(function(e,t,n){return n>0&&e.push(i),e.push(t),e},[t.createBuffer(e,"utf8")]);return a.push(t.createBuffer(n,"utf8")),u.concat(a)},_d.exportPointGeom=function(e,t){var n=null;return 1==e.length?n={type:"Point",coordinates:e[0]}:e.length>1&&(n={type:"MultiPoint",coordinates:e}),n},_d.exportLineGeom=function(e,t){var n=Yf(e,t,"polyline");if(0===n.pointCount)return null;var r=n.pathData.map(function(e){return e.points});return 1==r.length?{type:"LineString",coordinates:r[0]}:{type:"MultiLineString",coordinates:r}},_d.exportPolygonGeom=function(e,t,n){var r=Yf(e,t,"polygon");if(0===r.pointCount)return null;var i=Wf(r.pathData,t,n.invert_y),a=n.rfc7946&&!n.invert_y,o=i.map(function(e){return e.map(function(e){return a&&e.points.reverse(),e.points})});return 1==o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o}},_d.exporters={polygon:_d.exportPolygonGeom,polyline:_d.exportLineGeom,point:_d.exportPointGeom};var Td=Object.freeze({__proto__:null,default:_d,exportDatasetAsGeoJSON:Ed,exportGeoJSON:xd,exportIds:Nd,exportLayerAsGeoJSON:wd,exportProperties:Pd,getDatasetBbox:Ad,getIdField:Od,preserveOriginalCRS:Id,useFeatureCollection:kd,warnIfNotWgs84:Sd});function Ld(e,t){var n,r=Ud(e);return(n=r?Rd(r,e.arcs):Dd(e,t)).invert_y=!!t.invert_y,n.crs=Ia(e),n}function zd(e,t){var n=new qt(t.bbox),r=t.bbox2?new qt(t.bbox2):new qt(0,0,t.width,t.height);n.fillOut(r.width()/r.height());var i=n.getTransform(r,t.invert_y);No(e,function(e,t){return i.transform(e,t)})}function Rd(e,t){var n=Ji(e,t),r=e.data.getReadOnlyRecordAt(0).width||800;return{type:"frame",width:r,height:Math.round(r*n.height()/n.width()),bbox:n.toArray()}}function Dd(e,t){var n,r;return t.svg_bbox?(n=new qt(t.svg_bbox),t=Object.assign({margin:0},t)):n=wo(e),r=qd(n,t),{bbox:n.toArray(),bbox2:r.toArray(),width:Math.round(r.width()),height:Math.round(r.height())||1,type:"frame"}}function jd(e,t){var n,r,i=e.width()/e.height();return n=(r=t.pixels?Math.sqrt(+t.pixels*i):+t.width)/i,[Math.round(r),Math.round(n)]}function Fd(e,t){return"frame"==rm(e)&&Ai(e,t)}function Ud(e){return t.find(e.layers,function(t){return Fd(t,e.arcs)})}function Bd(e){return t.find(e.getLayers(),function(e){return Fd(e.layer,e.dataset.arcs)})}function Gd(e){var t,n,r=new qt(e.bbox);return e.crs?(t=Pa(r.centerX(),r.centerY(),e.crs),n=e.crs.to_meter):(t=1,n=1),r.width()/t*n/e.width}function qd(e,t){var n,r,i,a,o,s=0,u=0,c=0,f=0,l=e.width(),h=e.height(),p=Vd(t.margin),d=p[0]+p[2],g=p[1]+p[3];return t.fit_bbox?(c=t.fit_bbox[0],f=t.fit_bbox[1],n=t.fit_bbox[2]-c,r=t.fit_bbox[3]-f,d=g=0):t.svg_scale>0?(n=l/t.svg_scale+d,r=0):+t.pixels?(n=(i=jd(e,t))[0],r=i[1]):(r=t.height||0,n=t.width||(r>0?0:800)),r>0&&(o=(h||l||1)/(r-g)),n>0&&(a=(l||h||1)/(n-d)),n?r||(o=a,r=h>0?g+h/o:n,t.max_height>0&&r>t.max_height&&(o=a*r/t.max_height,r=t.max_height)):(a=o,n=l>0?d+l/a:r),a>o?u=(o=a)*(r-g)-h:o>a&&(s=(a=o)*(n-d)-l),e.padBounds(p[0]*a+.5*s,p[1]*o+.5*u,p[2]*a+.5*s,p[3]*o+.5*u),n>0&&r>0||vt("Missing valid height and width parameters"),a===o&&a>0||vt("Missing valid margin parameters"),new qt(c,f,n+c,r+f)}function Vd(e){var n=(t.isNumber(e)?String(e):e||"").trim().split(/[, ] */);return 1==n.length&&n.push(n[0]),2==n.length&&n.push(n[0],n[1]),3==n.length&&n.push(n[2]),n.map(function(e){var t=parseFloat(e);return isNaN(t)?0:t})}var $d=Object.freeze({__proto__:null,calcFrameData:Dd,calcOutputBounds:qd,findFrame:Bd,findFrameDataset:function(e){var t=Bd(e);return t&&t.dataset||null},findFrameLayer:function(e){var t=Bd(e);return t&&t.layer||null},findFrameLayerInDataset:Ud,fitDatasetToFrame:zd,getFrameData:Ld,getFrameLayerBounds:function(e){return new qt(im(e).bbox)},getFrameLayerData:Rd,getFrameSize:jd,getMapFrameMetersPerPixel:Gd,isFrameLayer:Fd,parseMarginOption:Vd});function Jd(e){if(!e)return null;var t=function(e){var t=/[, ]+(?![^(]*\))/;return String(e).trim().split(t)}(e),n=t[0]||"",r=null;return n.startsWith("dot")?(t[0]="dots",r=Hd(t)):n.startsWith("square")?(t[0]="squares",r=Hd(t)):n.startsWith("hatch")?(t[0]="hatches",r=Zd(t)):n.startsWith("dash")?r=Wd(t):isNaN(parseFloat(n))||(t.unshift("hatches"),r=Zd(t)),r||xt("Invalid pattern, ignoring:",e),r}function Wd(e){e.shift();for(var n,r=[],i=e.pop(),a=Xd(e.pop());e.length>0;){if(Yd(n=e.pop())){e.push(n);break}r.push(n)}var o=Xd(e.pop()),s=[Xd(e.pop()),Xd(e.pop())].reverse(),u=45;return e.length>0&&(u=Xd(e.pop())),e.length>0||o>0==!1?null:{type:"dashes",tileSize:[r.length*(o+a),t.sum(s)],colors:r,width:o,dashes:s,spacing:a,background:i,rotation:u}}function Zd(e){e.shift();for(var n=e.length%2==1?Xd(e.shift()):45,r=[],i=[],a=0;a<e.length;a+=2)i.push(Xd(e[a])),r.push(e[a+1]);return Math.min.apply(null,i)>0==!1?null:{tileSize:[t.sum(i),10],type:"hatches",colors:r,widths:i,rotation:n}}function Yd(e){return Xd(e)>0}function Hd(e){var t=[],n=e.shift(),r=0;Yd(e[1])&&(r=Xd(e.shift()));for(var i=Xd(e.shift()),a=e.pop(),o=Xd(e.pop());e.length>0;)t.push(e.shift());if(i>0==!1||o>=0==!1)return null;if(0===t.length)return null;var s=t.length*(i+o);return{type:n,tileSize:[s,s],colors:t,size:i,spacing:o,background:a,rotation:r}}function Xd(e){return parseFloat(e)||0}function Kd(e,n){var r=e["fill-pattern"],i=("hash_"+r).replace(/[()# ,_]+/g,"_"),a=t.find(n,function(e){return e.id==i});if(delete e["fill-pattern"],!a){if(a=function(e,t){var n,r=Jd(e);if(!r)return null;"hatches"==r.type?n=function(e){for(var t=e.tileSize[1],n="",r=0,i=0;r<e.widths.length;r++)n+=`<rect x="${i}" y="0" width="${e.widths[r]}" height="${t}" fill="${e.colors[r]}"></rect>`,i+=e.widths[r];return n}(r):"dots"==r.type||"squares"==r.type?n=function(e){for(var t=e.size,n=e.colors.length,r=t+e.spacing,i=n*n,a="squares"==e.type?tg:eg,o="",s=0,u=0,c=0;s<i;s++)o+=a(u,c,t,e.colors[(s+Math.floor(s/n))%n]),0===(u=(s+1)%n*r)&&(c+=r);return o}(r):"dashes"==r.type&&(n=function(e){for(var t="",n=0,r=0;n<e.colors.length;n++)t+=`<rect x="${r}" y="0" width="${e.width}" height="${e.dashes[0]}" fill="${e.colors[n]}"></rect>`,r+=e.width+e.spacing;return t}(r));return{svg:Qd(r,t,n),id:t,href:`url(#${t})`}}(r,i),!a)return;n.push(a)}e.fill=a.href}function Qd(e,t,n){var r=e.tileSize[0],i=e.tileSize[1],a=`<pattern id="${t}" patternUnits="userSpaceOnUse" width="${r}" height="${i}" patternTransform="rotate(${e.rotation})">`;return e.background&&(a+=`<rect x="0" y="0" width="${r}" height="${i}" fill="${e.background}"></rect>`),a+n+"</pattern>"}function eg(e,t,n,r){const i=n/2;return`<circle cx="${e+i}" cy="${t+i}" r="${i}" fill="${r}"></circle>`}function tg(e,t,n,r){return`<rect x="${e}" y="${t}" width="${n}" height="${n}" fill="${r}"></rect>`}var ng=Object.freeze({__proto__:null,convertFillPattern:Kd,parseDashes:Wd,parseDots:Hd,parseHatches:Zd,parsePattern:Jd}),rg={css:"inlinecss",class:"classname",dx:"measure",dy:"measure",fill:"color","fill-pattern":"pattern","fill-effect":null,"font-family":null,"font-size":null,"font-style":null,"font-stretch":null,"font-weight":null,"label-text":null,"letter-spacing":"measure","line-height":"measure",opacity:"number",r:"number",stroke:"color","stroke-dasharray":"dasharray","stroke-width":"number","stroke-opacity":"number","stroke-miterlimit":"number","fill-opacity":"number","vector-effect":null,"text-anchor":null},ig=t.extend({type:null,length:"number",rotation:"number",radius:"number",radii:null,flipped:"boolean",rotated:"boolean",direction:"number",sides:"number",points:"number",anchor:null,"head-angle":"number","head-width":"number","head-length":"number","stem-width":"number","stem-curve":"number","stem-taper":"number","stem-length":"number","min-stem-ratio":"number","arrow-scaling":"number",effect:null},rg),ag="css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity,vector-effect".split(","),og={polygon:t.arrayToIndex(ag.concat("fill","fill-pattern","fill-effect")),polyline:t.arrayToIndex(ag.concat("stroke-linecap","stroke-linejoin","stroke-miterlimit")),point:t.arrayToIndex(ag.concat("fill","r")),label:t.arrayToIndex(ag.concat("fill,font-family,font-size,text-anchor,font-weight,font-style,font-stretch,letter-spacing,dominant-baseline".split(",")))};function sg(e,t,n,r){for(var i=fg(Object.keys(n||{}),t),a=0,o=i.length;a<o;a++)r&&!r(i[a])||ug(e,i[a],n[i[a]]);"polygon"!=t&&"circle"!=t||!n.stroke||n.fill||ug(e,"fill","none")}function ug(e,t,n){e.properties||(e.properties={}),e.properties[t]=n,"stroke-dasharray"==t&&n&&(e.properties["stroke-linecap"]="butt")}function cg(e){return e in rg}function fg(e,t){var n=og[t]||{};return e.filter(function(e){return e in n})}function lg(e,t){var n={},r=[];return!e.data||e.data.getFields(),Object.keys(t).forEach(function(i){var a=i.replace(/_/g,"-");if(a in ig){var o=t[i];n[a]=pg(o,a,e),r.push(a)}}),function(e){for(var t,i={},a=0;a<r.length;a++)i[t=r[a]]=n[t](e);return i}}function hg(e,t){return(t=t||[]).indexOf(e.trim())>-1||/[(){}./*?:&|=[+-]/.test(e)}function pg(e,t,n){var r,i=String(e).trim(),a=ig[t],o=n.data?n.data.getFields():[],s=null;return a&&-1===o.indexOf(i)&&(s=function(e,t){var n=null;"number"==t?n=gg(e)?Number(e):null:"color"==t?n=bg(e)?e:null:"classname"==t?n=dg(e)?e:null:"measure"==t?n=yg(e)?vg(e):null:"dasharray"==t?n=/^[0-9]+( [0-9]+)*$/.test(e)?e:null:"pattern"==t?n=function(e){return!!Jd(e)}(e)?e:null:"boolean"==t?n=mg(e):"inlinecss"==t&&(n=e);return n}(i,a)),null===s&&hg(i,o)&&(r=function(e,t){var n;try{(n=ap(e,t,null,{no_warn:!0}))(0)}catch(e){n=null}return n}(i,n)),r||null!==s||a||(s=i),r||(null!==s?function(e){return s}:void bt("Unexpected value for",t+":",i))}function dg(e){return/^( ?[_a-z][-_a-z0-9]*\b)+$/i.test(e)}function gg(e){return t.isFiniteNumber(e)||t.isString(e)&&/^-?[.0-9]+$/.test(e)}function mg(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&null}function yg(e){return t.isFiniteNumber(e)||t.isString(e)&&/^-?[.0-9]+[a-z]*$/.test(e)}function vg(e){return t.isString(e)&&/[a-z]/.test(e)?e:Number(e)}function bg(e){return/^[a-z]+$/i.test(e)||/^#[0-9a-f]+$/i.test(e)||/^rgba?\([0-9,. ]+\)$/.test(e)}var _g=Object.freeze({__proto__:null,applyStyleAttributes:sg,findStylePropertiesBySymbolGeom:fg,getSymbolDataAccessor:lg,getSymbolPropertyAccessor:pg,isSupportedSvgStyleProperty:cg,isSvgClassName:dg,isSvgColor:bg,isSvgMeasure:yg,isSvgNumber:gg,mightBeExpression:hg,parseBoolean:mg,parseSvgMeasure:vg}),xg={Point:Sg,Polygon:Pg,LineString:Mg,MultiPoint:function(e,t){for(var n,r=[],i=0;i<e.length;i++)(n=Sg(e[i],t))&&("g"==n.tag&&n.children?r=r.concat(n.children):r.push(n));return r.length>0?{tag:"g",children:r}:null},MultiLineString:Ig,MultiPolygon:kg};function wg(e,t){return t=t||{},e.map(function(e){var n="Feature"==e.type?e.geometry:e,r=n&&n.type,i=_d.translateGeoJSONType(r),a=e.properties||{},o=null;return r&&n.coordinates&&(o=xg[r](n.coordinates,a)),o?("polyline"==i||"polygon"==i?sg(o,i,a):"point"==i&&Eg(a)&&sg(o,i,a,Ag),"id"in e&&(o.properties||(o.properties={}),o.properties.id=(t.id_prefix||"")+e.id),o):{tag:"g"}})}function Sg(e,t){if(Eg(t=t||{}))return{tag:"circle",properties:{cx:e[0],cy:e[1],r:t.r}};var n=Fg(t);return n&&(n.properties.transform=Dg(e)),n}function Ag(e){return"r"!=e}function Eg(e){return e&&e.r>0&&!e["svg-symbol"]&&!e["label-text"]}function Mg(e){return{tag:"path",properties:{d:Ng(e)}}}function Ig(e){return{tag:"path",properties:{d:e.map(Ng).join(" ")}}}function kg(e){return Pg(Cg(e))}function Cg(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Pg(e){if(0===e.length)return null;var t={tag:"path",properties:{d:Og(e)}};return e.length>1&&(t.properties["fill-rule"]="evenodd"),t}function Og(e){for(var t=[],n=0;n<e.length;n++)t.push(Ng(e[n])+" Z");return t.length>0?t.join(" "):""}function Ng(e){if(0===e.length)return"";for(var t="M",n=0,r=e.length;n<r;n++)t+=" "+e[n][0]+" "+e[n][1];return t}var Tg=Object.freeze({__proto__:null,flattenMultiPolygonCoords:Cg,importGeoJSONFeatures:wg,importLineString:Mg,importMultiLineString:Ig,importMultiPolygon:kg,importPoint:Sg,importPolygon:Pg});function Lg(e){var t=zg(e);return sg(t,"label",e),t}function zg(e){var t,n,r,i=(t=e["label-text"])||0===t||!1===t?String(t):"",a=/\n|\\n|<br>/i,o=e.dx||0,s={y:e.dy||0,x:o};return a.test(i)&&(n=i.split(a),i=n.shift()),r={tag:"text",value:i,properties:s},n&&(r.children=[],n.forEach(function(t){var n={tag:"tspan",value:t,properties:{x:o,dy:e["line-height"]||"1.1em"}};r.children.push(n)})),r}var Rg=Object.freeze({__proto__:null,renderLabel:zg,renderStyledLabel:Lg});function Dg(e,t){var n="translate("+ql(e[0])+" "+ql(e[1])+")";return t&&1!=t&&(n+=" scale("+t+")"),n}var jg={line:function(e,t,n){var r,i;return r=[[t,n],[t+(e.dx||0),n+(e.dy||0)]],sg(i=Mg(r),"polyline",e),i},polygon:function(e){var t=Pg(e.coordinates||[]);return sg(t,"polygon",e),t},polyline:function(e){var t=Ig(e.coordinates||[]);return sg(t,"polyline",e),t},circle:Bg,square:function(e,t,n){var r=e.r||0,i={tag:"rect",properties:{x:t-r,y:n-r,width:2*r,height:2*r}};return sg(i,"point",e),i},image:function(e,t,n){var r=e.width||20,i=e.height||20,a={tag:"image",properties:{width:r,height:i,x:(t||0)-r/2,y:(n||0)-i/2,href:e.href||""}};e.fill&&(a.properties.fill=e.fill);return a},group:function(e,t,n){var r={tag:"g",children:[]},i=r.children;return(e.parts||[]).forEach(function(e){var r=Ug(e,t,n);i.push(r),"line"==e.type&&(t+=e.dx||0,n+=e.dy||0),"offset"==e.type&&(i=r.children,t=n=0)}),1!=r.children.length||r.properties?r:r.children[0]},label:function(e,t,n){var r=Lg(e);(t||n)&&(r.properties.transform=Dg([t,n]));return r},offset:function(e,t,n){var r=(t||0)+(e.dx||0),i=(n||0)+(e.dy||0);return{tag:"g",properties:{transform:Dg([r,i])},children:[]}}};function Fg(e){var t=[];Mm(e)&&t.push(function(e){if(e["svg-symbol"])return Ug(e["svg-symbol"]);if(e.r>0)return Bg(e);return{tag:"g",properties:{},children:[]}}(e)),Im(e)&&t.push(Lg(e));var n=t.length>1?{tag:"g",children:t}:t[0];return n?(n.properties=n.properties||{},n):null}function Ug(e,n,r){if(t.isString(e)&&(e=JSON.parse(e)),e.tag)return e;var i=jg[e.type];if(!i)return xt(e.type?"Unknown symbol type: "+e.type:"Symbol is missing a type property"),{tag:"g",properties:{},children:[]};var a=i(e,n||0,r||0);return e.opacity&&(a.properties.opacity=e.opacity),a}function Bg(e,t,n){var r={tag:"circle",properties:{cx:t||0,cy:n||0}};return sg(r,"point",e),r}var Gg=Object.freeze({__proto__:null,getTransform:Dg,renderPoint:Fg,symbolRenderers:jg});function qg(e){var n=t.defaults({type:"scalebar"},e);return{name:e.name||"scalebar",data:new di([n])}}function Vg(e,t){if(!t.crs)return xt("Unable to render scalebar: unknown CRS."),[];if(t.width>0==!1)return[];var n,r,i=function(e){var t="b"==e.style||"B"==e.style?"b":"a";return Object.assign({},Jg,$g[t],e,{style:t})}(e),a=Gd(t),o=t.width,s=e.label?e.label.split(","):null,u=s&&s[0]||null,c=Xg(u||function(e,t,n){var r=70*t/1e3;return"1/8 1/5 1/4 1/2 1 2 3 4 5 8 10 15 20 25 30 40 50 75 100 150 200 250 300 350 400 500 750 1,000 1,500 2,000 2,500 3,000 4,000 5,000".split(" ").reduce(function(e,t){if(e)return e;var i=Yg(t,n);return Hg(i)>r?i:void 0},null)||""}(0,a,"mile")),f="b"==i.style&&s&&s[1]||null;if(c.km>0==!1)return xt("Unusable scalebar label:",u),[];var l=Math.round(c.km/a*1e3);l>0==!1&&bt("Null scalebar length"),f&&(n=Xg(f),(r=Math.round(n.km/a*1e3))>l&&bt("First part of a dual-unit scalebar must be longer than the second part."));var h=function(e){var t=e.position||"top-left";return{ypos:t.includes("top")?"top":"bottom",xpos:t.includes("left")?"left":"right"}}(i),p=Zg(i),d="right"==h.xpos?o-l-i.margin:i.margin,g="bottom"==h.ypos?t.height-i.margin:i.margin,m=Math.round(i.label_offset+i.tic_length+.8*i.font_size+i.bar_width/2),y=Math.round(i.bar_width/2),v="top"==p.ypos||f?m:y,b="bottom"==p.ypos||f?m:y;"top"==h.ypos?g+=v:g-=b;var _=function(e,t,n,r,i){var a=Wg(t,e,i),o=Wg("0",e,Object.assign({flipx:!0},i)),s=function(e,t,n){var r;r="b"==n.style?function(e,t,n){var r=[],i=Zg(n),a=n.tic_length+n.bar_width/2;"top"==i.ypos&&(a=-a);r.push([[0,a],[0,0],[e,0],[e,a]]),t>0&&(r.push([[0,0],[0,-a]]),r.push([[t,0],[t,-a]]));return r}(e,t,n):[[[0,0],[e,0]]];var i=Ig(r);return Object.assign(i.properties,{stroke:"black",fill:"none","stroke-width":n.bar_width,"stroke-linecap":"butt","stroke-linejoin":"miter"}),i}(e,n,i),u="b"==i.style?[o,a,s]:[a,s];r&&(u.push(Wg(r,n,Object.assign({flipy:!0},i))),u.push(Wg("0",n,Object.assign({flipx:!0,flipy:!0},i))));return{tag:"g",children:u}}(l,u,r,f,i);return _.properties={transform:"translate("+d+" "+g+")"},[_]}pp.scalebar=function(e,t){var n=qg(t);t.label&&!Kg(t.label)&&bt(`Expected units of km or miles in scalebar label (received ${t.label})`),function(e,t){var n={info:{},layers:[e]};t.getDatasets().push(n)}(n,e)};var $g={a:{bar_width:3,tic_length:0},b:{bar_width:1,tic_length:5}},Jg={position:"top-left",label_position:"top",label_offset:4,font_size:12,margin:12};function Wg(e,t,n){var r=Zg(n),i=t*r.kx+r.dx,a=n.bar_width+n.tic_length+n.label_offset,o=-n.label_offset-n.tic_length,s="top"==r.ypos?o:a,u={"label-text":e,"font-size":n.font_size,"text-anchor":r.anchor,"dominant-baseline":"top"==r.ypos?"auto":"hanging"};return jg.label(u,i,s)}function Zg(e){var t,n=e.label_position,r=n.includes("bottom")?"bottom":"top",i=0;return t="a"==e.style?(n.includes("center")?"center":n.includes("right")&&"right")||"left":"right",e.flipx&&(t=("left"==t?"right":"right"==t&&"left")||t),e.flipy&&(r=("top"==r?"bottom":"bottom"==r&&"top")||r),"b"==e.style&&(i="left"==t&&-e.font_size/4||"right"==t&&e.font_size/4||0),{xpos:t,ypos:r,dx:i,kx:("right"==t?1:"center"==t&&.5)||0,anchor:("center"==t?"middle":"left"==t&&"start")||"end"}}function Yg(e,t){var n=Qg(e);return e+" "+(("km"==t?"KM":n>1&&"MILES")||"MILE")}function Hg(e){var t=Kg(e),n=Qg(e);return t&&n?"mile"==t?1.60934*n:n:NaN}function Xg(e){var t=e?Qg(e):null,n=e?Kg(e):"mile",r=NaN;return n&&t&&(r="mile"==n?1.60934*t:t),{number:t,units:n,km:r}}function Kg(e){var t=/(miles?|mi[.]?|英里)$/.test(e.toLowerCase()),n=/(k\.m\.|km|kilometers?|kilom.tres?|公里)$/.test(e.toLowerCase());return(t?"mile":n&&"km")||""}function Qg(e){var t,n,r=/^([0-9]+) ?\/ ?([0-9]+)/;return e=e.replace(/[\s]/g,"").replace(/,/g,""),(n=r.test(e)?+(t=r.exec(e))[1]/+t[2]:parseFloat(e))>0&&n<1/0?n:NaN}var em=Object.freeze({__proto__:null,formatDistanceLabel:Yg,getScalebarLayer:qg,parseScalebarLabelToKm:Hg,renderScalebar:Vg}),tm={scalebar:Vg};function nm(e){var t=rm(e);return!!t&&t in tm}function rm(e){var t=e.data&&e.data.getReadOnlyRecordAt(0);return t&&t.type||null}function im(e){return e.data&&e.data.getReadOnlyRecordAt(0)}function am(e,t){var n=im(e),r=tm[n.type];return r||bt("Missing renderer for",n.type,"element"),t.crs||bt(`Unable to render ${n.type} (unknown map projection)`),Oa(t.crs)||bt(`Unable to render ${n.type} (map is unprojected)`),r(n,t)||[]}var om=Object.freeze({__proto__:null,getFurnitureLayerData:im,getFurnitureLayerType:rm,isFurnitureLayer:function(e){return nm(e)},layerHasFurniture:nm,renderFurnitureLayer:am});function sm(e){var t,n;return e&&e.tag?(t="<"+e.tag,e.properties&&(t+=lm(e.properties)),e.children||e.value?(t+=">"+(n="text"==e.tag||"tspan"==e.tag?"":"\n"),e.value&&(t+=fm(e.value)),e.children&&(t+=e.children.map(sm).join(n)),t+=n+"</"+e.tag+">"):t+="/>",t):""}var um=/[&<>"']/g,cm={"&":"&","<":"<",">":">",'"':""","'":"'"};function fm(e){return String(e).replace(um,function(t,n){var r=cm[t];return"&"==t&&e.substr(n,r.length)==r?"&":r})}function lm(e){return Object.keys(e).reduce(function(n,r){var i=e[r];return i||0===i?("href"==r&&(r="xlink:href"),"css"==r&&(r="style"),n+" "+r+'="'+fm(t.isString(i)?i:JSON.stringify(i))+'"'):n},"")}var hm=Object.freeze({__proto__:null,stringEscape:fm,stringify:sm,stringifyProperties:lm});function pm(){return{cx:.5,cy:.5,r:.57,fx:.35,fy:.35,stops:[{offset:.3,opacity:0},{offset:.6,opacity:.1},{offset:.78,opacity:.25},{offset:.87,opacity:.45},{offset:.95,opacity:1}]}}function dm(e,n){if("sphere"==e["fill-effect"]){var r="mapshaper_sphere_effect",i=`url(#${r})`,a={cx:.5,cy:.5,r:.57,fx:.35,fy:.35,stops:[{offset:.3,opacity:0},{offset:.6,opacity:.1},{offset:.78,opacity:.25},{offset:.87,opacity:.45},{offset:.95,opacity:1}]},o=a.stops.map(function(e){return`<stop offset="${e.offset}" stop-opacity="${e.opacity}"/>`}),s=`<radialGradient id="${r}" cx="${a.cx}" cy="${a.cy}" r="${a.r}" fx="${a.fx}" fy="${a.fy}">${o.join("")}</radialGradient>`;t.find(n,function(e){return e.id==r})||n.push({svg:s,id:r,href:i}),e.fill=i,"opacity"in e==!1&&"fill-opacity"in e==!1&&(e["fill-opacity"]=.35)}}var gm=Object.freeze({__proto__:null,convertFillEffect:dm,getSphereEffectParams:pm}),mm={};function ym(e,n){!function e(r){"path"==r.tag&&r.properties["fill-pattern"]&&Kd(r.properties,n);"path"==r.tag&&r.properties["fill-effect"]&&dm(r.properties,n);"image"==r.tag?/\.svg/.test(r.properties.href||"")&&function(e,n){var r=e.properties.href,i=t.find(n,function(e){return e.href==r});i||((i={href:r,id:vm(r)}).svg=function(e,t){var n="";try{n=function(e,t){return e=e.replace(/[^]*<svg/,"<svg"),e.replace(/^<svg[^>]*>/,function(e){return e=(e=e.replace(/ id="[^"]*"/,"")).replace(/<svg/,'<svg id="'+t+'"')})}(function(e){var t;0===e.indexOf("http")?t=function(e){if(e in mm)return mm[e];var t=s("sync-request")("GET",e,{timeout:2e3}).getBody().toString();return mm[e]=t,t}(e):s("fs").existsSync(e)?t=s("fs").readFileSync(e,"utf8"):bt("Invalid SVG location:",e);return t}(e),t)+"\n",n="\x3c!-- "+e+"--\x3e\n"+n}catch(e){}return n}(r,i.id),n.push(i));i.svg&&(e.tag="use",e.properties.href="#"+i.id)}(r,n):r.children&&r.children.forEach(e)}(e)}function vm(e){return function(e){for(var t,n,r,i,a,o,s,u=0,c=0,f=[],l=[t=1732584193,n=4023233417,~t,~n,3285377520],h=[],p=unescape(encodeURI(e)),d=p.length;c<=d;)h[c>>2]|=(p.charCodeAt(c)||128)<<8*(3-c++%4);for(h[s=d+8>>2|15]=d<<3;u<=s;u+=16){for(t=l,c=0;c<80;t=[0|[(o=((p=t[0])<<5|p>>>27)+t[4]+(f[c]=c<16?~~h[u+c]:o<<1|o>>>31)+1518500249)+((n=t[1])&(r=t[2])|~n&(i=t[3])),a=o+(n^r^i)+341275144,o+(n&r|n&i|r&i)+882459459,a+1535694389][0|c++/20],p,n<<30|n>>>2,r,i])o=f[c-3]^f[c-8]^f[c-14]^f[c-16];for(c=5;c;)l[--c]=l[c]+t[c]|0}for(e="";c<40;)e+=(l[c>>3]>>4*(7-c++%8)&15).toString(16);return e}(e).substr(0,12)}function bm(e,n){var r,i,a,o='xmlns="http://www.w3.org/2000/svg"',s=[],u="";n.crisp_paths&&(u="\n<style>\n path {shape-rendering: crispEdges;}\n</style>"),n.final?e.arcs&&e.arcs.flatten():e=bo(e),n=Object.assign({invert_y:!0,margin:"1"},n),r=Ld(e,n),zd(e,r),Hl(e,n.precision||.01),n.svg_data&&wm(e.layers,n.svg_data),a=e.layers,n.scalebar&&a.push(qg({})),i=a.map(function(t){var i;return ym(i=nm(t)?_m(t,r,n):xm(t,e,n),s),sm(i)}).join("\n"),s.length>0&&(i="<defs>\n"+t.pluck(s,"svg").join("")+"</defs>\n"+i),i.includes("xlink:")&&(o+=' xmlns:xlink="http://www.w3.org/1999/xlink"');var c=`stroke-linecap="${n.default_linecap||"round"}" stroke-linejoin="round"`;i.includes('stroke-linejoin="miter"')&&(c+=' stroke-miterlimit="2"');var f=`<?xml version="1.0"?>\n<svg ${o} version="1.2" baseProfile="tiny" width="%d" height="%d" viewBox="%s %s %s %s" ${c}>${u}\n${i}\n</svg>`;return[{content:i=t.format(f,r.width,r.height,0,0,r.width,r.height),filename:n.file||Bo(e)+".svg"}]}function _m(e,t,n){var r=Em(e,n);return r.children=am(e,t),r}function xm(e,n,r){var i=Em(e,r);return Ai(e,n.arcs)&&function(e){var t=bi(e).getRecords()[0];t.fill||t.stroke||(t.fill="none")}(e=Bi(e)),i.children=function(e,n,r){var i=t.defaults({layers:[e]},n),a=Ed(i,r),o=wg(a.features||a.geometries||(a.type?[a]:[]),r);r.svg_data&&e.data&&function(e,n,r){var i=n.getFields(),a=r.indexOf("*")>-1?i.concat():r,o=t.difference(a,i);o.length>0&&(a=t.difference(a,o));var s=Sm(n.getRecords(),a);e.length!=s.length&&vt("Mismatch between number of SVG symbols and data attributes");e.forEach(function(e,n){t.extend(e.properties||{},s[n])})}(o,e.data,r.svg_data);return o}(e,n,r),i}function wm(e,n){var r=n.reduce(function(n,r){return function(e,n){return t.some(e,function(e){return e.data&&e.data.fieldExists(n)||!1})}(e,r)||n.push(r),n},[]);r.length&&-1==r.indexOf("*")&&bt("Missing data field(s):",r.join(", "))}function Sm(e,n){var r=/^[a-z_][a-z0-9_-]*$/i,i=/^xml/,a=n.filter(function(e){return r.test(e)&&!i.test(e)}),o=t.difference(n,a);return o.length>0&&(xt("Unable to add data-* attributes for field(s):",o.join(", ")),xt("data-* names should match pattern [a-z_][a-z0-9_-]*")),e.map(function(e){for(var t={},n=0;n<a.length;n++)t["data-"+a[n].toLowerCase()]=Am(e[a[n]]);return t})}function Am(e){return String(e)}function Em(e,n){var r={tag:"g",properties:{id:(n.id_prefix||"")+(e.name||t.getUniqueName("layer"))},children:[]};return("polyline"==e.geometry_type||km(e))&&(r.properties.fill="none"),"polyline"==e.geometry_type&&(r.properties.stroke="black",r.properties["stroke-width"]=1),(Cm(e)||km(e)||nm(e))&&(r.properties["font-family"]="sans-serif",r.properties["font-size"]="12",r.properties["text-anchor"]="middle"),r}function Mm(e){return!(!e||!e["svg-symbol"]&&!e.r)}function Im(e){var t=e&&e["label-text"];return t||0===t}function km(e){return"point"==e.geometry_type&&e.data&&e.data.fieldExists("svg-symbol")}function Cm(e){return"point"==e.geometry_type&&e.data&&e.data.fieldExists("label-text")}var Pm=Object.freeze({__proto__:null,exportDataAttributesForSVG:Sm,exportFurnitureLayerForSVG:_m,exportLayerForSVG:xm,exportSVG:bm,featureHasLabel:Im,featureHasSvgSymbol:Mm,getEmptyLayerForSVG:Em,layerHasLabels:Cm,layerHasSvgSymbols:km,validateSvgDataFields:wm});function Om(e,n){t.isNumber(e)?e=new ArrayBuffer(e):e instanceof ArrayBuffer||("function"==typeof u&&e instanceof u||e instanceof Uint8Array?e=e.buffer&&e.buffer.byteLength==e.length?e.buffer:Om.copyToArrayBuffer(e):vt("BinArray constructor takes an integer, ArrayBuffer or Buffer argument")),this._buffer=e,this._bytes=new Uint8Array(e),this._view=new DataView(e),this._idx=0,this._le=!1!==n}Om.bufferToUintArray=function(e,t){return 4==t?new Uint32Array(e):2==t?new Uint16Array(e):1==t?new Uint8Array(e):void vt("BinArray.bufferToUintArray() invalid word length:",t)},Om.uintSize=function(e){return 1&e||2&e||4},Om.bufferCopy=function(e,t,n,r,i){r=r||0,i=i||n.byteLength-r,e.byteLength-t<i&&vt("Buffer overflow; tried to write:",i);for(var a=Math.min(Om.uintSize(i),Om.uintSize(r),Om.uintSize(e.byteLength),Om.uintSize(t),Om.uintSize(n.byteLength)),o=Om.bufferToUintArray(n,a),s=Om.bufferToUintArray(e,a),u=i/a,c=r/a,f=t/a;u--;)s[f++]=o[c++];return i},Om.copyToArrayBuffer=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e[i];return n},Om.bufferSize=function(e){return e instanceof ArrayBuffer?e.byteLength:0|e.length},Om.prototype={size:function(){return this._buffer.byteLength},littleEndian:function(){return this._le=!0,this},bigEndian:function(){return this._le=!1,this},buffer:function(){return this._buffer},bytesLeft:function(){return this._buffer.byteLength-this._idx},skipBytes:function(e){return this._idx+=e+0,this},readUint8:function(){return this._bytes[this._idx++]},writeUint8:function(e){return this._bytes[this._idx++]=e,this},readInt8:function(){return this._view.getInt8(this._idx++)},writeInt8:function(e){return this._view.setInt8(this._idx++,e),this},readUint16:function(){var e=this._view.getUint16(this._idx,this._le);return this._idx+=2,e},writeUint16:function(e){return this._view.setUint16(this._idx,e,this._le),this._idx+=2,this},readUint32:function(){var e=this._view.getUint32(this._idx,this._le);return this._idx+=4,e},writeUint32:function(e){return this._view.setUint32(this._idx,e,this._le),this._idx+=4,this},readInt32:function(){var e=this._view.getInt32(this._idx,this._le);return this._idx+=4,e},writeInt32:function(e){return this._view.setInt32(this._idx,e,this._le),this._idx+=4,this},readFloat64:function(){var e=this._view.getFloat64(this._idx,this._le);return this._idx+=8,e},writeFloat64:function(e){return this._view.setFloat64(this._idx,e,this._le),this._idx+=8,this},readFloat64Array:function(e){var t,n=8*e,r=this._idx,i=this._buffer;if(r%8==0)t=new Float64Array(i,r,e);else if(i.slice)t=new Float64Array(i.slice(r,r+n));else{var a=new ArrayBuffer(n);Om.bufferCopy(a,0,i,r,n),t=new Float64Array(a)}return this._idx+=n,t},readUint32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.readUint32());return t},peek:function(e){return this._view.getUint8(e>=0?e:this._idx)},position:function(e){return null!=e?(this._idx=e,this):this._idx},readCString:function(e,t){for(var n="",r=e>=0?e:this.bytesLeft();r>0;){var i=this.readUint8();if(r--,0==i)break;if(i>127&&t){n=null;break}n+=String.fromCharCode(i)}return e>0&&r>0&&this.skipBytes(r),n},writeString:function(e,t){var n,r=0,i=e.length;t&&(i=Math.min(i,t));for(var a=0;a<i;a++)(n=e.charCodeAt(a))>127&&(n="?".charCodeAt(0)),this.writeUint8(n),r++;return r},writeCString:function(e,t){var n=t?t-1:null,r=this.writeString(e,n);if(this.writeUint8(0),r++,t)for(;r<t;)this.writeUint8(0),r++;return this},writeBuffer:function(e,t,n){return this._idx+=Om.bufferCopy(this._buffer,this._idx,e,n,t),this}};var Nm=Object.freeze({__proto__:null,BinArray:Om,buffersAreIdentical:function(e,t){var n=Om.bufferSize(e);if(n!=Om.bufferSize(t))return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}}),Tm={},Lm=254;Tm.MAX_STRING_LEN=Lm,Tm.convertValueToString=Rm,Tm.convertFieldNames=jm,Tm.discoverFieldType=Bm,Tm.getDecimalFormatter=Gm,Tm.getNumericFieldInfo=qm,Tm.truncateEncodedString=$m,Tm.getFieldInfo=Um,Tm.exportRecords=function(e,n,r){var i=e.length,a=fi(e,r),o=n||"utf8",s=Fr(a.join(""))?"ascii":o,u=function(e,n){return e.map(function(e){for(var r=Vr(e,n),i=r.length,a=t.createBuffer(11),o=0;o<11;o++)a[o]=o<10&&i>=o-1?r[o]:0;return a})}(jm(a,s),s),c=a.map(function(t,n){var r=Um(e,t,o);return r.warning&&xt("["+t+"] "+r.warning),r}),f=(y=c.length,33+32*y),l=(m=t.pluck(c,"size"),t.sum(m)+1),h=f+i*l+1,p=new ArrayBuffer(h),d=new Om(p).littleEndian(),g=new Date;var m;var y;d.writeUint8(3),d.writeUint8(g.getFullYear()-1900),d.writeUint8(g.getMonth()+1),d.writeUint8(g.getDate()),d.writeUint32(i),d.writeUint16(f),d.writeUint16(l),d.skipBytes(17),d.writeUint8(0),d.skipBytes(2),c.reduce(function(e,t,n){return d.writeBuffer(u[n],11,0),d.writeUint8(t.type.charCodeAt(0)),d.writeUint32(e),d.writeUint8(t.size),d.writeUint8(t.decimals),d.skipBytes(14),e+t.size},1),d.writeUint8(13),d.position()!=f&&vt("Dbf#exportRecords() header size mismatch; expected:",f,"written:",d.position());e.forEach(function(e,t){var n=d.position();d.writeUint8(32);for(var r=0,i=c.length;r<i;r++)c[r].write(t,d);d.position()-n!=l&&vt("#exportRecords() Error exporting record:",e)}),d.writeUint8(26),d.position()!=h&&vt("Dbf#exportRecords() file size mismatch; expected:",h,"written:",d.position());return p};var zm=new function(){var e,t;function n(){e=new Uint8Array(5e3),t=0}return n(),{reserve:function(r){return t+r>5e3&&n(),t+=r,e.subarray(t-r,t)},putBack:function(e){t-=e}}};function Rm(e){return null==e?"":String(e)}function Dm(e,t,n,r){var i="ascii"==r?Vm:function(e){return function(t){var n=Vm(t,!0);return null===n&&(n=Vr(String(t),e)),n}}(r),a=1,o=0,s=t.map(function(e){var t=Rm(e[n]),s=i(t);return s.length>Lm&&(s="ascii"==r?s.subarray(0,Lm):$m(s,r,Lm),o++),a=Math.max(a,s.length),s});e.size=a,e.write=function(e,t){var n,r=s[e],i=Math.min(a,r.length),o=t._bytes,u=t.position();for(n=0;n<i;n++)o[n+u]=r[n];t.position(u+a)},o>0&&(e.warning="Truncated "+o+" string"+(1==o?"":"s")+" to fit the 254-byte limit")}function jm(e,t){var n=ri(e.map(Fm),10,t);return n.forEach(function(t,n){e[n]!=t&&xt('Changed field name from "'+e[n]+'" to "'+t+'"')}),n}function Fm(e){return e.replace(/[-\s]+/g,"_")}function Um(e,n,r){var i=Bm(e,n),a={type:i,decimals:0};return"N"==i?function(e,n,r){var i,a;i=qm(n,r),e.decimals=i.decimals,(a=Math.max(i.max.toFixed(e.decimals).length,i.min.toFixed(e.decimals).length))>18&&(a=18,e.decimals-=a-18,e.decimals<0&&vt("Dbf#getFieldInfo() Out-of-range error.")),e.size=a;var o=Gm(a,e.decimals);e.write=function(e,i){var s=n[e],u=o(s[r]);u.length<a&&(u=t.lpad(u,a," ")),i.writeString(u,a)}}(a,e,n):"C"==i?Dm(a,e,n,r):"L"==i?function(e,t,n){e.size=1,e.write=function(e,r){var i,a=t[e][n];i=!0===a?"T":!1===a?"F":"?",r.writeString(i)}}(a,e,n):"D"==i?function(e,n,r){e.size=8,e.write=function(e,i){var a,o=n[e][r];a=o instanceof Date==0?"00000000":t.lpad(o.getUTCFullYear(),4,"0")+t.lpad(o.getUTCMonth()+1,2,"0")+t.lpad(o.getUTCDate(),2,"0"),i.writeString(a)}}(a,e,n):(a.size=0,a.type="N",i&&(a.warning="Unable to export "+i+"-type data, writing null values"),a.write=function(){}),a}function Bm(e,n){for(var r,i=0,a=e.length;i<a;i++){if(r=e[i][n],t.isString(r))return"C";if(t.isNumber(r))return"N";if(t.isBoolean(r))return"L";if(r instanceof Date)return"D";if(r)return typeof r}return null}function Gm(e,n){return function(r){var i=t.isFiniteNumber(r)?r.toFixed(n):String(" ");return t.lpad(i,e," ")}}function qm(e,n){for(var r,i=0,a=0,o=1,s=1,u=0,c=1e-15,f=0,l=e.length;f<l;f++)if(r=e[f][n],t.isFiniteNumber(r)){if(r<i||r>a)for(r<i&&(i=r),r>a&&(a=r);Math.abs(r)>=s;)s*=10,c*=10;for(;Math.abs(Math.round(r*o)-r*o)>c&&15!=u;)u++,c*=10,o*=10}return{decimals:u,min:i,max:a}}function Vm(e,t){var n,r,i=String(e),a=i.length,o=zm.reserve(a);for(n=0;n<a;n++){if((r=i.charCodeAt(n))>127){if(t){o=null,n=0;break}r="?".charCodeAt(0)}o[n]=r}return zm.putBack(a-n),o?o.subarray(0,n):null}function $m(e,t,n){for(var r,i,a=e.slice(0,n),o=n;o>0&&o>=n-3;){if("�"!=(i=$r(r=o==n?a:e.slice(0,o),t)).charAt(i.length-1)){a=r;break}o--}return a}function Jm(e,n,r){var i,a=e.data;return(!a||r.cut_table||r.drop_table)&&(a=new di(e.shapes?e.shapes.length:0)),a.isEmpty()&&a.addIdField(),i=a.exportAsDbf?a.exportAsDbf(r):Tm.exportRecords(a.getRecords(),r.encoding,r.field_order),t.isInteger(r.ldid)&&(new Uint8Array(i)[29]=r.ldid),[{content:i,filename:e.name+".dbf"}]}function Wm(e,t,n){var r,i,a=[],o=e.length,s=t.length;for(a.push(e),r=0;r<s;r++)i=Zm(t[r][e],n),o=Math.max(o,i.length),a.push(i);for(r=0;r<a.length;r++)a[r]=a[r].padEnd(o," ");return a}function Zm(e,n){return null==e?"":t.isString(e)?e:t.isNumber(e)?n.decimal_comma?t.formatIntlNumber(e):t.formatNumber(e):t.isObject(e)?JSON.stringify(e):e+""}function Ym(e){var n=function(e){var n=t.splitLines(e);n.length>2&&n.pop();for(var r,i,a,o,s=function(e){for(var t=0,n=0;n<e.length;n++)t=Math.max(t,e[n].length);return t}(n),u=n[0],c=[],f=0,l=!1,h=!1,p=0;p<=s;p++){if(i=Km(u,p),r=!Qm(n,p),(a=i&&!h)&&l)return null;(p==s||p>0&&a)&&(o=p==s?void 0:p-1,c.push({name:Hm(u,f,o),end:o,start:f}),f=p),l=r,h=i}return c.length>0?c:null}(e.substring(0,2e3));if(!n)return[];var r=t.splitLines(e);""===r[r.length-1]&&r.pop();for(var i=[],a=1;a<r.length;a++)i.push(Xm(r[a],n));return i}function Hm(e,t,n){return e.substring(t,n).trim()}function Xm(e,t){for(var n,r={},i=0;i<t.length;i++)r[(n=t[i]).name]=Hm(e,n.start,n.end);return r}function Km(e,t){return t<e.length&&" "!==e[t]}function Qm(e,t){for(var n=0;n<e.length;n++)if(Km(e[n],t))return!1;return!0}function ey(e,t){var n=function(e,t){var n=",",r=t.file?Ro(t.file):"";t.delimiter?n=t.delimiter:"tsv"==r?n="\t":"csv"==r?n=",":e.input_delimiter&&(n=e.input_delimiter);return n}(e.info,t),r=function(e,t){var n="txt";t.file?n=Ro(t.file):"\t"==e?n="tsv":","==e&&(n="csv");return n}(n,t);return e.layers.reduce(function(e,i){return i.data&&e.push({content:ty(i,n,t),filename:(i.name||"output")+"."+r}),e},[])}function ty(e,t,n){var r=n||{},i=r.encoding||"utf8",a=e.data.getRecords(),o=fi(a,r.field_order);if(" "==t)return function(e,t,n){for(var r,i=[],a=0;a<e.length;a++)if(r=Wm(e[a],t,n),0===a)i=r;else for(var o=0;o<i.length;o++)i[o]+=" "+r[o];return i.join("\n")}(o,a,r);var s=function(e,t,n){var r=ry(t,n);return function(n){return e.map(function(e){return r(n[e])}).join(t)}}(o,t,r);return Ur(i)&&!r.to_buffer&&(a.length<1e4||r.to_string)?function(e,t,n){var r=ny(e,n);return t.length?r+"\n"+t.map(n).join("\n"):r}(o,a,s):function(e,t,n,r){var i=ny(e,n),a=[Vr(i,r)],o=[],s=t.length,c=0;for(;c<s;)o.push(n(t[c])),++c%1e3!=0&&c!=s||(i="\n"+o.join("\n"),o=[],a.push(Vr(i,r)));return u.concat(a)}(o,a,s,i)}function ny(e,t){var n=e.reduce(function(e,t){return e[t]=t,e},{});return t(n)}function ry(e,n){var r=new RegExp('["\n\r'+e+"]"),i=n&&n.decimal_comma||!1;function a(e){return r.test(e)&&(e='"'+e.replace(/"/g,'""')+'"'),e}return function(e){return null==e?"":t.isString(e)?a(e):t.isNumber(e)?i?t.formatIntlNumber(e):t.formatNumber(e):t.isObject(e)?a(JSON.stringify(e)):e+""}}var iy=Object.freeze({__proto__:null,exportDelim:ey,exportLayerAsDSV:ty,getDelimValueFormatter:ry}),ay={NULL:0,POINT:1,POLYLINE:3,POLYGON:5,MULTIPOINT:8,POINTZ:11,POLYLINEZ:13,POLYGONZ:15,MULTIPOINTZ:18,POINTM:21,POLYLINEM:23,POLYGONM:25,MULIPOINTM:28,MULTIPATCH:31};function oy(e,n){return e.layers.reduce(function(r,i){var a=function(e,t){var n=t.info||{},r=n.prj;if(!r)try{r=ma(Ia(t))}catch(e){}r||xt("Unable to generate .prj file for",e.name+".shp");return r?{content:r,filename:e.name+".prj"}:null}(i,e);return r=r.concat(function(e,n){var r,i=e.shapes||t.initializeArray(new Array(ki(e)),null),a=new qt,o=function(e){var t,n=e.geometry_type;t="point"==n?Nr(e.shapes||[])<=1?ay.POINT:ay.MULTIPOINT:"polygon"==n?ay.POLYGON:"polyline"==n?ay.POLYLINE:ay.NULL;return t}(e),s=100,u=100+8*i.length,c=new Om(u).bigEndian().position(100),f=i.map(function(t,r){var i=function(e,t,n){var r=ay.isMultiPartType(n),i=!r&&!ay.isMultiPointType(n),a=e.pointCount>0==!1,o=a?null:e.bounds,s=null;if(a)s=new Om(12,!1).writeInt32(t).writeInt32(2).littleEndian().writeInt32(0);else if(i)s=new Om(28,!1).writeInt32(t).writeInt32(10).littleEndian().writeInt32(n).writeFloat64(e.pathData[0].points[0][0]).writeFloat64(e.pathData[0].points[0][1]);else{var u=52,c=r?u+4*e.pathCount:48,f=c+16*e.pointCount,l=0;s=new Om(f,!1).writeInt32(t).writeInt32((f-8)/2).littleEndian().writeInt32(n).writeFloat64(o.xmin).writeFloat64(o.ymin).writeFloat64(o.xmax).writeFloat64(o.ymax),r&&s.writeInt32(e.pathCount),s.writeInt32(e.pointCount),e.pathData.forEach(function(e,t){r&&s.position(u+4*t).writeInt32(l),s.position(c+16*l);for(var n=0,i=e.points.length;n<i;n++)s.writeFloat64(e.points[n][0]),s.writeFloat64(e.points[n][1]);l+=n}),e.pointCount!=l&&vt("Shp record point count mismatch; pointCount:",l,"data.pointCount:",e.pointCount)}return{bounds:o,buffer:s.buffer()}}(Yf(t,n.arcs,e.geometry_type),r+1,o),u=i.buffer.byteLength;return c.writeInt32(s/2),c.writeInt32(u/2-4),s+=u,i.bounds&&a.mergeBounds(i.bounds),i.buffer});r=new Om(s,!1).writeInt32(9994).skipBytes(20).writeInt32(s/2).littleEndian().writeInt32(1e3).writeInt32(o),a.hasBounds()?r.writeFloat64(a.xmin||0).writeFloat64(a.ymin||0).writeFloat64(a.xmax||0).writeFloat64(a.ymax||0):r.skipBytes(32);return r.skipBytes(32),f.forEach(function(e){r.writeBuffer(e)}),c.position(0).writeBuffer(r.buffer(),100).position(24).writeInt32(u/2),[{content:r.buffer(),filename:e.name+".shp"},{content:c.buffer(),filename:e.name+".shx"}]}(i,e)),r=r.concat(Jm(i,0,n)),a&&r.push(a),r},[])}ay.isPolygonType=function(e){return 5==e||15==e||25==e},ay.isPolylineType=function(e){return 3==e||13==e||23==e},ay.isMultiPartType=function(e){return ay.isPolygonType(e)||ay.isPolylineType(e)},ay.isMultiPointType=function(e){return 8==e||18==e||28==e},ay.isZType=function(e){return[11,13,15,18].includes(e)},ay.isMType=function(e){return ay.isZType(e)||[21,23,25,28].includes(e)},ay.hasBounds=function(e){return ay.isMultiPartType(e)||ay.isMultiPointType(e)};var sy=Object.freeze({__proto__:null,exportShapefile:oy}),uy={};function cy(e){var t=1e4/e;return function(e){return e===1/0?0:Math.ceil(e*t)}}function fy(e,t,n){return Wf(Er(e,t,"polygon"),t,n).map(function(e){return e.map(function(e){return e.ids})})}function ly(e){return Object.assign({},e)}uy.forEachShapePart=function(e,t){var n={GeometryCollection:function(e){e.geometries.forEach(r)},LineString:function(e){var n=t(e.arcs);n&&(e.arcs=n)},MultiLineString:function(e){i(e.arcs)},Polygon:function(e){i(e.arcs)},MultiPolygon:function(e){e.arcs.forEach(i)}};function r(e){e.type in n&&n[e.type](e)}function i(e){for(var n,r=0;r<e.length;r++)(n=t(e[r]))&&(e[r]=n)}r(e)},uy.forEachArc=function(e,n){uy.forEachShapePart(e,function(e){for(var r,i=0;i<e.length;i++)r=n(e[i]),t.isInteger(r)&&(e[i]=r)})},pp.explodeFeatures=function(e,n,r){var i=e.data?e.data.getRecords():null,a=i?[]:null,o=[],s=t.extend({},e);return e.shapes.forEach(function(s,u){var c;if(s?(c="polygon"==e.geometry_type&&s.length>1?r&&r.naive?function(e,t){var n=Er(e,t,"polygon");return n.map(function(e){return e.area<0&&mr(e.ids),[e.ids]})}(s,n):fy(s,n):function(e){return e.map(function(e){return[e.concat()]})}(s),t.merge(o,c)):o.push(null),null!==a)for(var f=0,l=c?c.length:1;f<l;f++)a.push(ly(i[u]))}),s.shapes=o,null!==a&&(s.data=new di(a)),function(e,n){var r=ki(e),i=ki(n),a=t.format("Exploded %,d feature%s into %,d feature%s",r,t.pluralSuffix(r),i,t.pluralSuffix(i));xt(a)}(e,s),s};var hy=Object.freeze({__proto__:null,explodePolygon:fy});function py(e,n){var r="."+(n.extension||"json"),i=!n.final||Eo(e)&&e.arcs.getRetainedInterval()>0,a=JSON.stringify;return i&&(e=_o(e)),n.prettify&&(a=Kf("coordinates,arcs,bbox,translate,scale".split(","))),n.width>0||n.height>0?zd(e,Ld(e,n=t.defaults({invert_y:!0},n))):n.fit_bbox&&zd(e,Ld(e,{fit_bbox:n.fit_bbox})),n.precision&&n.no_quantization?Hl(e,n.precision,!!n.fix_geometry):n.precision&&xt(`Ignoring precision=${n.precision} -- this option only works with no-quantization.`),n.singles?mo(e).map(function(e){return{content:a(uy.exportTopology(e,n)),filename:(e.layers[0].name||"output")+r}}):[{filename:n.file||Bo(e)+r,content:a(uy.exportTopology(e,n))}]}function dy(e,t){var n=hr(e);return[n[0]*t,n[1]*t]}function gy(e,t,n){var r;return r=n.topojson_precision>0?dy(t,n.topojson_precision):n.quantization>0?[e.width()/(n.quantization-1),e.height()/(n.quantization-1)]:n.precision>0?[n.precision,n.precision]:dy(t,.02),new qt(0,0,Math.ceil(e.width()/r[0])||0,Math.ceil(e.height()/r[1])||0)}uy.getPresimplifyFunction=cy,uy.exportTopology=function(e,t){var n={type:"Topology",arcs:[]},r=Eo(e),i=wo(e);return t.bbox&&i.hasBounds()&&(n.bbox=i.toArray()),r&&t.presimplify&&!e.arcs.getVertexData().zz&&pp.simplify(e,t),t.no_quantization||!t.quantization&&!r||(n.transform=function(e,t,n){var r,i=gy(t,e.arcs,n),a=t.getTransform(i),o=a.invert();function s(e,t){var n=a.transform(e,t);return[Math.round(n[0]),Math.round(n[1])]}function u(e,t){return a.transform(e,t)}e.arcs&&n.fix_geometry?(e.arcs.transformPoints(u),r=Dl(e.arcs),e.arcs.transformPoints(function(e,t){return[Math.round(e),Math.round(t)]}),r(e.arcs)):e.arcs&&e.arcs.transformPoints(s);n.no_point_quantization||e.layers.filter(Si).forEach(function(e){Ii(e,s)});return{scale:[o.mx,o.my],translate:[o.bx,o.by]}}(e,i,t)),r&&(ho(e),n.arcs=function(e,t,n){var r=null,i=[];n.presimplify&&(r=cy(t.width()));return e.forEach2(function(e,t,n,a,o,s){for(var u,c=[],f=t+n;t<f;t++)u=[a[t],o[t]],r&&u.push(r(s[t])),c.push(u);i.push(c.length>1?c:null)}),i}(e.arcs,i,t),n.transform&&n.arcs.forEach(function(e){for(var t,n,r,i,a,o=0,s=e.length;o<s;o++)r=(a=e[o])[0],i=a[1],o>0&&(a[0]=r-t,a[1]=i-n),t=r,n=i})),n.objects=e.layers.reduce(function(n,r,i){return n[r.name||"layer"+(i+1)]=uy.exportLayer(r,e.arcs,t),n},{}),t.metadata&&(n.metadata=function(e){var t=Ia(e),n=null;return t&&(n=ga(t)),{proj4:n}}(e)),n},uy.exportProperties=function(e,t,n){var r=Pd(t,n),i=Nd(t,n);e.forEach(function(e,t){r&&(e.properties=r[t]),i&&(e.id=i[t])})},uy.exportLayer=function(e,t,n){for(var r,i=ki(e),a=[],o=uy.exporters[e.geometry_type]||null,s=0;s<i;s++)r=o&&e.shapes[s],a[s]=r?o(r,t,n):{type:null};return e.data&&uy.exportProperties(a,e.data,n),{type:"GeometryCollection",geometries:a}},uy.exportPolygonGeom=function(e,t,n){var r={};return(e=Ar(e,t))&&0!==e.length?e.length>1?(r.arcs=fy(e,t,n.invert_y),1==r.arcs.length?(r.arcs=r.arcs[0],r.type="Polygon"):r.type="MultiPolygon"):(r.arcs=e,r.type="Polygon"):r.type=null,r},uy.exportLineGeom=function(e,t){var n={};return(e=Ar(e,t))&&0!==e.length?1==e.length?(n.type="LineString",n.arcs=e[0]):(n.type="MultiLineString",n.arcs=e):n.type=null,n},uy.exporters={polygon:uy.exportPolygonGeom,polyline:uy.exportLineGeom,point:_d.exportPointGeom};var my=Object.freeze({__proto__:null,calcExportBounds:gy,exportTopoJSON:py});function yy(e){return Kr(e),{layers:[{data:new di(e)}],info:{}}}function vy(e,t){return e.layers.reduce(function(e,n){return n.data&&e.push({content:by(n,t),filename:(n.name||"output")+".json"}),e},[])}function by(e,t){t=t||{};var n=e.data.getRecords();return t.ndjson?n.map(Xf).join("\n"):t.prettify?Kf([])(n):JSON.stringify(n)}var _y=Object.freeze({__proto__:null,exportJSON:vy,exportJSONTable:by,importJSONTable:yy});function xy(e,t){var n=t.file||null,r=e.info&&e.info.input_formats&&e.info.input_formats[0],i=null;return t.format?t.format:(n?i=wy(n,r):r&&(i=r),"json"==i&&Ao(e)&&(i="geojson"),i||null)}function wy(e,t){var n=Ro(e).toLowerCase(),r=null;return"gz"==n?wy(jo(e,""),t):(n==ef?r=ef:"shp"==n?r="shapefile":"dbf"==n?r="dbf":"svg"==n?r="svg":"kml"==n||"kmz"==n?r="kml":/json$/.test(n)?(r="geojson","topojson"==n||"topojson"==t&&"geojson"!=n?r="topojson":"json"==n&&"json"==t&&(r="json")):mf(e)?r="dsv":t&&(r=t),r)}var Sy=Object.freeze({__proto__:null,getOutputFormat:xy,inferOutputFormat:wy});async function Ay(e,n,r){if(r.fit_extent){var i=e.findSingleLayer(r.fit_extent),a=Ji(i.layer,i.dataset.arcs);r=Object.assign({svg_bbox:a.toArray()},r)}var o=n.map(function(e){return t.defaults({layers:e.layers},e.dataset)});return async function(e,n){var r,i=xy(e[0],n);if(i==ef)return tf(e,n=t.defaults({compact:!0},n));"kml"==i||"svg"==i||"topojson"==i||"geojson"==i&&n.combine_layers?e.length>1&&(e=[no(e)],"topojson"==i&&Ka(e[0]),n=t.defaults({final:!0},n)):function(e){var t=e.reduce(function(e,t){return e.concat(t.layers)},[]);Iy(t)}(e=e.map(xo));r=e.reduce(function(e,r){return qc()?t.sortOn(r.layers,"menu_order",!0):t.sortOn(r.layers,"target_id",!0),e.concat(Ey(r,n))},[]),n.bbox_index&&r.push(function(e){var t=[];return e.forEach(function(e){e.layers.forEach(function(n){var r=Ji(n,e.arcs);t.push({bbox:r.toArray(),name:n.name})})}),{content:JSON.stringify(t),filename:"bbox-index.json"}}(e));ky(r),n.gzip&&r.forEach(function(e){e.filename+=".gz",e.content=Jc(e.content)});return r}(o,r)}function Ey(e,n){var r,i,a=n.format=xy(e,n),o=My[a],s=[];return a?o||vt("Unknown output format:",a):vt("Missing output format"),e=t.defaults({layers:e.layers.map(function(e){return t.extend({},e)})},e),n.file&&"topojson"!=a&&"svg"!=a&&"kml"!=a&&e.layers.forEach(function(e){e.name=zo(n.file)}),Iy(e.layers),n.precision&&"svg"!=a&&"topojson"!=a&&Hl(e=_o(e),n.precision,!!n.fix_geometry),n.cut_table&&(s=(r=e.layers,i=[],r.forEach(function(e){e.data&&i.push({content:JSON.stringify(e.data),filename:(e.name?e.name+"-":"")+"table.json"})}),i).concat(s)),n.extension&&(n.extension=n.extension.replace(/^\.+/,"")),function(e){e.forEach(function(e){e.geometry_type?(t.contains(["polygon","polyline","point"],e.geometry_type)||vt("A layer has an invalid geometry type:",e.geometry_type),e.shapes||vt("A layer is missing shape data")):e.shapes&&t.some(e.shapes,function(e){return!!e})&&vt("A layer contains shape records and a null geometry type")})}(e.layers),function(e){var t={};e.forEach(function(e,n){var r=e.filename;r||vt("Missing a filename for file"+n),r in t&&vt("Duplicate filename",r),t[r]=!0})}(s=o(e,n).concat(s)),s}var My={geojson:xd,topojson:py,shapefile:oy,dsv:ey,dbf:function(e,t){return e.layers.reduce(function(n,r){return r.data&&(n=n.concat(Jm(r,e,t))),n},[])},json:vy,svg:bm,kml:function(e,t){return[{content:(0,s("@placemarkio/tokml").toKML)(Ed(e,Object.assign({combine_layers:!0,geojson_type:"FeatureCollection"},t))),filename:t.file||Bo(e)+".kml"}]}};function Iy(e){var n=e.map(function(e){return e.name||"layer"}),r=t.uniqifyNames(n);e.forEach(function(e,t){e.name=r[t]})}function ky(e){var n=e.map(function(e){return e.filename}),r=t.uniqifyNames(n,Cy);e.forEach(function(e,t){e.filename=r[t]})}function Cy(e,n){var r,i,a=e.split(".");return a.length<2?t.formatVersionedName(e,n):(r=a.pop(),i=a.join("."),t.formatVersionedName(i,n)+"."+r)}var Py=Object.freeze({__proto__:null,assignUniqueFileNames:ky,assignUniqueLayerNames:Iy,exportFileContent:Ey,exportTargetLayers:Ay,formatVersionedFileName:Cy});function Oy(e,t){return qr(e.readSync(0,Math.min(t||1e3,e.size())))}function Ny(e){var t=0;this.position=function(){return t},this.remaining=function(){return Math.max(e.size()-t,0)},this.advance=function(e){t+=e},this.readSync=function(){return e.readSync(t)},this.expandBuffer=function(){e.expandBuffer()}}function Ty(e){var n,r,i=e.byteLength||e.length;function a(){return r||(r=t.toBuffer(e)),r}this.readToBinArray=function(t,r){return i<t+r&&vt("Out-of-range error"),n||(n=new Om(e)),n.position(t),n},this.toString=function(e){return qr(a(),e)},this.readSync=function(e,t){return a().slice(e,t?e+t:i)},this.findString=Ly.prototype.findString,this.expandBuffer=function(){return this},this.size=function(){return i},this.close=function(){}}function Ly(e,n){var r,a,o,u,c=s("fs"),f=c.statSync(e).size,l=n&&n.cacheSize||16777216,h=n&&n.bufferSize||262144;function p(n,i){var s,u,h=f-n;return(h<i||h<0)&&vt("Tried to read past end-of-file"),!(o&&n>=a&&a+o.length>=n+i)&&(h<(u=Math.max(l,i))&&(u=h),o&&u==o.length||(o=t.createBuffer(u)),r||(r=c.openSync(e,"r")),s=c.readSync(r,o,0,u,n),a=n,s!=u&&vt("Error reading file"),!0)}(i("input_files")||[]).push(e),this.expandBuffer=function(){return 2*(h*=2)>l&&(l=2*h),this},this.readToBinArray=function(e,t){return p(e,t)&&(u=new Om(o)),u.position(e-a),u},this.readSync=function(e,n){return n>0==!1&&(n=h),e+n>f&&(n=f-e),0===n?t.createBuffer(0):(p(e,n),o.slice(e-a,e-a+n))},this.size=function(){return f},this.toString=function(t){return Lf.readFile(e,t||"utf8")},this.close=function(){r&&(c.closeSync(r),r=null,o=null)}}Ly.prototype.findString=function(e,t){var n,r=Math.min(this.size(),t||this.size()),i=this.readSync(0,r),a=e.length,o=i.length-a,s=e.charCodeAt(0);for(n=0;n<o;n++)if(i[n]==s&&i.toString("utf8",n,n+a)==e)return{offset:n+a,text:i.toString("utf8",0,n)};return null};var zy=Object.freeze({__proto__:null,BufferReader:Ty,FileReader:Ly,Reader2:Ny,readFirstChars:Oy});function Ry(e,t,n){var r=n||{};if(" "==t)return function(e,t){return Ym(e.toString(t.encoding||"ascii"))}(e,r);var i,a,o=new Ny(e),s=Uy(Gy(o,function(e){var t=e.csv_skip_lines||0;e.csv_field_names||t++;return t}(r),r.encoding),t,r),u=Fy(s.import_fields),c=r.batch_size||1e3,f=[];if(0===s.import_fields.length)return[];for(;i=Gy(o,c,r.encoding);)if(a=qy(i,t,u,s.column_filter||!1,s.row_filter||!1),f.push.apply(f,a),r.csv_lines&&f.length>=r.csv_lines)return f.slice(0,r.csv_lines);return f}function Dy(e,t,n){if(" "==t)return Ym(e);var r=Uy(e,t,n);if(0===r.import_fields.length||!r.remainder)return[];var i=Fy(r.import_fields),a=qy(r.remainder,t,i,r.column_filter,r.row_filter);return n.csv_lines>0&&(a=a.slice(0,n.csv_lines)),a}function jy(e,t){var n=/\r\n|[\r\n]|.$/g,r=1;if(1===t)return 0;if(t>1==!1)return-1;for(;n.exec(e);)if(++r<t==!1)return n.lastIndex;return-1}function Fy(e){return new Function("arr","return {"+e.map(function(e,t){return JSON.stringify(e)+": arr["+t+'] || ""'}).join(",")+"}")}function Uy(e,n,r){var i,a,o,s={headers:[],import_fields:[]},u={};if(e=e||"",r.csv_skip_lines>0){if(-1===(i=jy(e,r.csv_skip_lines+1)))return s;e=e.substr(i)}if(r.csv_field_names)u.headers=r.csv_field_names;else{if(-1===(i=jy(e,2)))return s;u.headers=qy(e.slice(0,i),n)[0],e=e.substr(i)}return r.csv_dedup_fields&&(u.headers=t.uniqifyNames(u.headers)),r.csv_filter&&(u.row_filter=(a=r.csv_filter,o=Qh(a),function(e){var t=o(e);return Ch(t),t})),r.csv_fields?(u.column_filter=By(u.headers,r.csv_fields),u.import_fields=u.headers.filter(function(e,t){return u.column_filter(t)})):u.import_fields=u.headers,u.remainder=e,u}function By(e,n){var r=t.arrayToIndex(n),i=e.map(function(e){return e in r}),a=t.difference(n,e);if(a.length>0){var o=[""].concat(e).join("\n "),s=[""].concat(a).join("\n ");bt("csv-fields option has",1==a.length?"a name":a.length+" names","not found in the file\nFields:",o,"\nMissing:",s)}return function(e){return i[e]}}function Gy(e,t,n){var r,i=e.readSync(),a=function(e,t){var n,r,i=13,a=10,o=34,s=!1,u=0,c=e.length;for(u++,n=0;n<c&&u<=t;n++)(r=e[n])==o?s=!s:r!=i&&r!=a||s||(r==i&&n+1<c&&e[n+1]==a&&n++,u++);return{bytesRead:n,buffer:e.slice(0,n)}}(i,t);return a.bytesRead==i.length&&a.bytesRead<e.remaining()?(e.expandBuffer(),Gy(e,t,n)):(r=a.bytesRead>0?$r(a.buffer,n):"",0===e.position()&&(r=Wr(r)),e.advance(a.bytesRead),r)}function qy(e,t,n,r,i){var a,o,s,u,c,f=t.charCodeAt(0),l=!1,h=!1,p=-1,d=[];function g(){var e=n?n(c):c;i&&!i(e)||d.push(e),p=-1}function m(e){a=e,0===++p&&(c=[]),r&&!r(p)||(h=!0)}function y(t,n){var r;h&&(h=!1,r=t===n?"":34==e.charCodeAt(t)?e.slice(t+1,n-1).replace(/""/g,'"'):e.slice(t,n),c.push(r))}for(n||(n=function(e){return e}),m(0),o=0,u=e.length;o<u;o++)34==(s=e.charCodeAt(o))?l=!l:l||(s==f?(y(a,o),m(o+1)):13!=s&&10!=s||(y(a,o),g(),13==s&&10==e.charCodeAt(o+1)&&o++,o+1<u&&m(o+1)));return p>-1&&(h&&y(a,o),g()),d}var Vy=Object.freeze({__proto__:null,getDelimFieldFilter:By,getRowConverter:Fy,indexOfLine:jy,parseDelimHeaderSection:Uy,parseDelimText:qy,readDelimRecords:Ry,readDelimRecordsFromString:Dy,readLinesAsString:Gy});function $y(e){var t=e.length;return t>=2&&254==e[0]&&255==e[1]?"utf16be":t>=2&&255==e[0]&&254==e[1]?"utf16le":t>=3&&239==e[0]&&187==e[1]&&191==e[2]?"utf8":""}function Jy(e){var n=[{encoding:"latin1",confidence:0},{encoding:"win1252",confidence:Zy(e)},{encoding:"utf8",confidence:Yy(e)},{encoding:"gb18030",confidence:Hy(e)}];return t.sortOn(n,"confidence","descending"),n[0]}function Wy(e,t){return t.map(function(t){return $r(t,e).trim()})}function Zy(e){var t=Wy("win1252",e).join(""),n=Qy(t,"abcdefghijklmnopqrstuvwxyz0123456789.()'\"?+-\n,:;/|_$% "),r=Qy(t,"ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ°–±’‘ ")+n;return Xy(r>.98&&n>=.8,r>.97&&n>=.6)}function Yy(e){var t=Ky(Wy("utf8",e).join(""));return Xy(0==t,t<.03)}function Hy(e){var t=Wy("gb18030",e).join(""),n=t.replace(/[^\u4e00-\u9fa5]/g,""),r=n.length/t.length,i=function(e){return e.replace(/[^a-zA-Z0-9.()'"?+\n,:;/|_$% -]/g,"")}(t),a=i.length/t.length,o=Qy(n,"的一了是不我他在人有这来个说上你们到地大着子那就也时道中出得为里下她要么去可以过和看之然后会自没小好生天而起对能还事想都心只家面样把国多又于头年手发如什开前当所无知老但见长已军从方声儿回意作话两点现很成身情十用些走经同进动己三行种向日明女正问此学太打间分因给本眼定二气力被门真法外听实其高先几笑再主将山战才口文最部第它西与全白者便相住公使东等边信像斯机光次感神却死理名重四做别叫王并水月果何位怎马常觉海张少处亲安特美呢色原直望命由候吧让应尔难关许车平师民夫书新接吗路利世比放活快总立队更花爱清五内金带工风克任至指往入空德吃表连解教思飞物电受今完林干代告兵加认通找远非性脸体轻记目令变似反南场跟必石拉士报李火且满该孩字红象即结言员房件万条提写或坐北早失离步陈乎请转近切黑深城办倒各父传音站官半男击合阿英决怕杀未形及算青黄落刚百论谁突交团度义罗始强紧敌八母钱极片化流管惊每题晚虽政兴答司妈夜越啊奇达谈武友数领朝保服曾拿则哪格尽根急语容喜求衣留双影刻制随冷九苦量备布照周故准客船江系姐争功怪星断句龙竟视界讲取古六静底精七河久绝阳识哈台确息期整伤忙娘终剑送计愿欢微您沉装敢云脚消若复收千木乐毛华集树弟皇响希诉号巴穿线汉攻呀警派刘酒雷停史阵错建足显丽另包势破亮首志观病热跑业治田冲运约暗待共院仍区害元哥围屋胡产室调类细议爷注易务众帝市摇乱密姑斗除式示睛楼造朋社持慢般皮京况块忽脑校甚查土怀福单联赶背统喝疑支血饭灵够章群威举兰游器察嘴痛铁掉宝历改推枪念参术帮党据品须居称旁退梦科岁低严引吉睡爸呼追局露维苏证村挥独节谢香亚波角案读图左掌假跳究楚余鬼钟座礼展玉肯既止守广考恩异料段尼画续米草胜存唐医程弹烟商顾招宗堂野初府激雨尚渐诗顿伯孙际沙雪板闻导致护春态基设耳简婚幸味右买演权卡继依恶庄炮亦虎州刀球需兄闪笔否烈玩啦逃排仅弄具散默景顶郑洋丝卫速侠差贵君习妇助恐救湖莫窗险顺封佛委旧印伙妹副宫洞永罪松责组防艺营班试鲁宋靠索灯介翻喊纪秘妻纸银略充戏担某杨射魔遇鱼陆级坏忘乡鲜哭费抓叶醒族纳床咱桌境列午振抱专毫店街怒托剧置秋藏赵划普岛较承脱革忍伸份免齐抗猛园临犯食架选歌按败良隐养属洛朱狂修坚压寻旅谋温探资端投泪阴换药麻施丈冰雄著绿职负短模荣遗农叹川毒吴蒋卖范禁杂富秀县祖梅谷凡刺登蓝奶缓姓牛价规篇劳质婆仙馆摆舞层狗占墙善熟验肉臣状呆圣懂袋唱值迷替归巨讨毕批镇吸森拍灭握伊杰勒卷偷奔省谓危付伦休厅预迎罢恨博亡欲悲宣标闹岸"),s=Ky(t);return Xy(r>.5&&r+a>.9&&0===s&&o>.25,r>.3&&r+a>.8&&o>.15)}function Xy(e,t){return(e?2:t&&1)||0}function Ky(e){return(e.match(/\ufffd/g)||[]).length/e.length}function Qy(e,t){var n={},r=0;e=e.toLowerCase();for(var i=0,a=t.length;i<a;i++)n[t[i]]=1;for(i=0,a=e.length;i<a;i++)r+=n[e[i]]||0;return r/e.length||0}var ev=Object.freeze({__proto__:null,decodeSamples:Wy,detectEncoding:Jy,detectEncodingFromBOM:$y});function tv(e,n){var r,i,a,o,s,c=!e.content&&""!==e.content,f=e.content;return n=n||{},c?r=new Ly(e.filename):f instanceof ArrayBuffer||f instanceof u||f instanceof Uint8Array?(r=new Ty(f),f=null):t.isString(f)||vt("Unexpected object type"),r&&("utf16be"==(s=$y(r.readSync(0,Math.min(r.size(),3))))||"utf16le"==s?(f=Wr(r.toString(s)),r=null):n.encoding&&!Br(n.encoding)&&(f=r.toString(n.encoding),r=null)),0===(i=r?Ry(r,a=iv(Oy(r,2e3)),n):Dy(f,a=iv(f),n)).length&&xt("Unable to read any data records"),ov(i,n),ti(o=new di(i),ni),{layers:[{data:o}],info:{input_delimiter:a}}}var nv=["|","\t",",",";"," "];function rv(e){return t.contains(nv,e)}function iv(e){return t.find(nv,function(n){var r=function(e){var n="^[^\\n\\r]+"+t.regexEscape(e);return new RegExp(n)}(n);return r.test(e)})||","}function av(e){var t={};return(e=e||{}).string_fields&&e.string_fields.forEach(function(e){t[e]="string"}),e.field_types&&e.field_types.forEach(function(e){var n,r,i;-1!=e.indexOf(":")?(r=(n=e.split(":"))[0],i=function(e){var t=e.toLowerCase(),n=null;"n"==t[0]?n="number":"s"==t[0]&&(n="string");return n}(n[1])):"+"===e[0]&&(r=e.substr(1),i="number"),i?t[r]=i:xt("Invalid type hint (expected :str or :num) ["+e+"]")}),t}function ov(e,n){var r=n||{},i=av(r),a=i["*"],o=Object.keys(e[0]||[]),s=[],u=r.decimal_comma?t.parseIntlNumber:t.parseNumber,c={};o.forEach(function(t){var n=i[t],r=null;"number"==n||"number"==a?r=function(e,t,n){for(var r=[],i=0,a=t.length;i<a;i++)r.push(n(t[i][e]));return r}(t,e,u):"string"==n||"string"==a?r=null:(r=function(e,t,n){for(var r,i,a,o=[],s=0,u=0,c=t.length;u<c;u++){if(null===(a=n(r=t[u][e]))){if((i=r?r.trim():"").length>0&&"NA"!=i&&"NaN"!=i)return null}else s++;o.push(a)}return s>0?o:null}(t,e,u),r&&s.push(t)),r&&(c[t]=r)}),Object.keys(c).length>0&&function(e,t,n){var r="return {"+e.map(function(e){var t=JSON.stringify(e);return t+": "+(n[e]?"replacements["+t+"][i]":"rec["+t+"]")}).join(", ")+"}",i=new Function("rec","replacements","i",r);t.forEach(function(e,r){t[r]=i(e,n,r)})}(o,e,c),s.length>0&&xt(t.format("Auto-detected number field%s: %s",1==s.length?"":"s",s.join(", ")))}var sv=Object.freeze({__proto__:null,adjustRecordTypes:ov,getFieldTypeHints:av,guessDelimiter:iv,importDelim:function(e,t){return tv({content:e},t)},importDelim2:tv,isSupportedDelimiter:rv});function uv(e){var t=e.options;e._,t.files&&(t.files=Lf.expandInputFiles(t.files),"-"!=t.files[0]&&"/dev/stdin"!=t.files[0]||(delete t.files,t.stdin=!0)),"precision"in t&&t.precision>0==!1&&vt("precision= option should be a positive number"),t.encoding&&(t.encoding=jr(t.encoding))}function cv(e){var t=e.options;t.interval||t.percentage||t.resolution||vt("Command requires an interval, percentage or resolution parameter")}function fv(e){e.options.crs||e.options.match||e.options.init||bt("Missing projection data")}function lv(e){var t=e.options;if(1==e._.length){var n=e._[0].split(",");t.cols=parseInt(n[0],10),t.rows=parseInt(n[1],10)||t.cols}}function hv(e){e.options.expression||vt("Command requires a JavaScript expression")}function pv(e){var t=e.options,n=t._||"",r=Lo(n);"-"==n||"/dev/stdout"==n?t.stdout=!0:n&&!r.extension?(Lf.isDirectory(n)||vt("Unknown output option:",n),t.directory=n):n&&(r.directory&&(t.directory=r.directory),/gz/i.test(r.extension)?(Lo(r.basename).extension?t.file=r.basename:t.file=r.filename,t.gzip=!0):/zip/i.test(r.extension)?(t.file=null,t.zipfile=r.filename,t.zip=!0):t.file=r.filename,Ef(t.file)&&vt("Output file looks like an unsupported file type:",t.file)),t.format&&(t.format=t.format.toLowerCase(),"csv"==t.format?(t.format="dsv",t.delimiter=t.delimiter||","):"tsv"==t.format&&(t.format="dsv",t.delimiter=t.delimiter||"\t"),wf(t.format)||vt("Unsupported output format:",t.format)),t.delimiter&&(t.delimiter=t.delimiter.replace(/^["']?\\t["']?$/,"\t"),rv(t.delimiter)||vt("Unsupported delimiter:",t.delimiter)),t.encoding&&(t.encoding=jr(t.encoding)),t.field_order&&"ascending"!=t.field_order&&vt("Unsupported field order:",t.field_order),"quantization"in t&&t.quantization>0==!1&&vt("quantization= option should be a nonnegative integer"),"topojson_precision"in t&&t.topojson_precision>0==!1&&vt("topojson-precision= option should be a positive number")}var dv=/^([a-z0-9_+-]+)=(?!=)(.*)$/i;function gv(e){var n=new RegExp("(([^'\"\\s])+|'((\\\\'|[^'])*?)'|\"((\\\\\"|[^\"])*?)\")*","g");return(e.match(n)||[]).filter(function(e){return!!e&&"\\"!=e}).map(t.trimQuotes)}function mv(e){return e.split(",").map(parseFloat)}function yv(e){var t=_v(e,",");return 1==t.length&&(t=_v(t[0],",")),t}function vv(e){var t=_v(e.replace(/[ ,] *(?=[^(]*\))/g,"~~~"),", ");return 1==t.length&&(t=_v(t[0],", ")),t=t.map(function(e){return e.replace(/~~~/g,",")})}function bv(e){return e=(e=e.map(function(e){return/= $/.test(e)||(e=t.rtrim(e)),e=t.ltrim(e)})).filter(function(e){return""!==e})}function _v(e,n){for(var r,i=new RegExp("^("+("([^"+n+"'\"][^"+n+"]*)")+"|'((\\\\'|[^'])*?)'|\"((\\\\\"|[^\"])*?)\")(["+n+"]+|$)"),a=[];null!==(r=i.exec(e));)a.push(r[1]),e=e.substr(r[0].length);return a.filter(function(e){return!!e&&"\\"!=e}).map(t.trimQuotes)}function xv(e){return dv.test(e)}function wv(e){var n=dv.exec(e);return[n[1],t.trimQuotes(n[2])]}var Sv=Object.freeze({__proto__:null,cleanArgv:bv,formatOptionValue:function(e){return(e=String(e)).indexOf(" ")>-1&&(e=JSON.stringify(e)),e},isAssignment:xv,parseColorList:vv,parseNumberList:mv,parseStringList:yv,splitAssignment:wv,splitShellTokens:gv});function Av(){var e,n=/^--?([a-z][\w-]*)$/i,r=/^--?[a-z][\w-]*[=]/i,i="",a=[],o=[],s=null;if(this instanceof Av==!1)return new Av;function u(){return o.map(function(e){return e.done()})}function c(e){return!!f(e,u())}function f(e,n){return t.find(n,function(t){return t.name===e||t.alias===e||t.old_alias===e})}function l(e,n){return t.find(n.options,function(t){return t.name===e||t.alias===e||t.old_alias===e})}this.usage=function(e){return i=e,this},this.note=function(t){return e=t,this},this.default=function(e){s=e},this.example=function(e){a.push(e)},this.command=function(e){var t=new Ev(e);return t.option("verbose",{type:"flag"}),t.option("debug",{type:"flag"}),o.push(t),t},this.section=function(e){return this.command("").title(e)},this.isCommandName=c,this.parseArgv=function(e){var i,a,o,h=u(),p=[],d=bv(e);for(1==d.length&&c(d[0])?d.unshift("-help"):d.length>0&&!y(d[0])&&s&&d.unshift("-"+s);d.length>0;)(a=_(d))||bt("Invalid command:",d[0]),i=(o=f(a,h)||null)?g(d,o):m(d,a),p.push(i);return p;function g(e,n){for(var r={name:n.name,options:{},_:[]};e.length>0&&!y(e[0]);)v(r,e,n);try{r._.length>0&&function(e,n){var r,i=function(e){return t.find(e.options,function(e){return!!e.DEFAULT})}(n),a=e._;n&&(i||vt("Received one or more unexpected parameters:",a.join(" ")));var o=!0===i.DEFAULT?{}:i.DEFAULT;o.type=o.type||i.type||"string",o.name=i.name,a.length>1&&!o.multi_arg&&vt(o.multi_error_msg||"Command expects a single value.","Received:",a.join(" "));a=a.map(e=>b(e,o)),r=o.multi_arg?t.isString(o.join)?a.join(o.join):a:a[0];e.options[i.name]=r}(r,n),n.validate&&n.validate(r),delete r.options._}catch(e){bt("["+a+"] "+e.message)}return r}function m(e,t){for(var n={name:t,options:{},_:[]};e.length>0&&!y(e[0]);)n._.push(e.shift());return n}function y(e){return r.test(e)&&bt("Invalid command syntax:",e),n.test(e)}function v(e,t,n){var r,i,a,o=t.shift();xv(o)?(i=l((a=wv(o))[0],n))&&("flag"==i.type||i.assign_to?bt("-"+n.name+" "+a[0]+" option doesn't take a value"):t.unshift(a[1])):i=l(o,n),i?(i.alias_to&&(i=l(i.alias_to,n)),r=(r=i.name).replace(/-/g,"_"),i.assign_to?e.options[i.assign_to]=i.name:"flag"==i.type?e.options[r]=!0:e.options[r]=function(e,t){(0===e.length||y(e[0]))&&bt("Missing value for "+t.name+" option");return b(e.shift(),t)}(t,i)):e._.push(o)}function b(e,t){var n,r,i=t.type;return(n="number"==i?Number(e):"integer"==i?Math.round(Number(e)):"colors"==i?vv(e):"strings"==i?yv(e):"bbox"==i||"numbers"==i?mv(e):e)!=n&&(r="Invalid numeric value"),r&&bt(r+" for "+t.name+" option"),n}function _(e){var t=n.exec(e[0]);return t?(e.shift(),t[1]):null}},this.getHelpMessage=function(n){var r,o,s;return n?((o=f(n,u()))||bt(n,"is not a known command"),s=function(e){var t=[],n=[];e.options.forEach(function(e){n=n.concat(function(e){var t,n=[],r=e.describe;r&&(e.label?n.push([e.label,r]):e.DEFAULT?(t=e.name+"=",n.push(["<"+e.name+">","shortcut for "+t]),n.push([t,r])):(t=e.name,e.alias&&(t+=", "+e.alias),"flag"==e.type||e.assign_to||(t+="="),n.push([t,r])));return n}(e))}),t.push("COMMAND",c(e)),n.length>0&&(t.push("","OPTIONS"),t=t.concat(n));e.examples&&(t.push("","EXAMPLE"+(e.examples.length>1?"S":"")),e.examples.forEach(function(e,n){n>0&&t.push(""),e.split("\n").forEach(function(e,n){t.push(" "+e)})}));return t}(o)):(r=u().filter(function(e){return e.name&&e.describe||e.title}),s=function(t){var n=[];i&&n.push(i);t.forEach(function(e){e.title?n.push("",e.title):n.push(c(e))}),a.length>0&&(n.push("","Examples"),a.forEach(function(e){n.push("",e)}));e&&n.push("",e);return n}(r)),function(e){var n=function(e){var t=0;return e.forEach(function(e){Array.isArray(e)&&(t=Math.max(t,e[0].length))}),t}(e),r=qc()?"":" ",i=e.map(function(e){return Array.isArray(e)&&(e=r+t.rpad(e[0],n," ")+" "+e[1]),e}).join("\n");return i}(s);function c(e){var t=e.name?"-"+e.name:"";return e.alias&&(t+=", -"+e.alias),[t,e.describe||"(undocumented command)"]}}}function Ev(e){var n={name:e,options:[]};this.validate=function(e){return n.validate=e,this},this.describe=function(e){return n.describe=e,this},this.example=function(e){return n.examples||(n.examples=[]),n.examples.push(e),this},this.alias=function(e){return n.alias=e,this},this.oldAlias=function(e){return n.old_alias=e,this},this.title=function(e){return n.title=e,this},this.option=function(e,r){return r=t.extend({},r),t.isString(e)&&e||vt("Missing option name"),t.isObject(r)||vt("Invalid option definition:",r),r.name=e,n.options.push(r),this},this.options=function(e){return Object.keys(e).forEach(function(t){this.option(t,e[t])},this),this},this.done=function(){return n}}function Mv(){var e={describe:"layer(s) to target (comma-sep. list)"},t={describe:"rename the edited layer(s)"},n={alias:"+",type:"flag",label:"+, no-replace",describe:"retain both input and output layer(s)"},r={describe:"name the output layer"},i={alias:"+",type:"flag",label:"+",describe:"save output to a new layer"},a={type:"flag"},o={describe:"text encoding (applies to .dbf and delimited text files)"},s={describe:"snapping distance in source units (default is tiny)",type:"distance"},u={describe:"boost gap-fill-area of slivers (0-1, default is 1)",type:"number"},c={describe:"use a JS expression to aggregate data values"},f={describe:"fields to sum when dissolving (comma-sep. list)",type:"strings"},l={describe:"fields to copy when dissolving (comma-sep. list)",type:"strings"},h={DEFAULT:!0,type:"strings",describe:"(optional) field(s) to dissolve on (comma-sep. list)"},p={describe:"type hints for csv source files, e.g. FIPS:str,ZIPCODE:str",type:"strings"},d={describe:"csv field(s) to import as strings, e.g. FIPS,ZIPCODE",type:"strings"},g={type:"bbox",describe:"comma-sep. bounding box: xmin,ymin,xmax,ymax"},m={type:"flag",describe:"retain only features that would have been deleted"},y={describe:"use a JS expression to select a subset of features"},v={describe:"filter polygon boundaries using a JS expression (with A and B)"},b={describe:"aspect ratio as a number or range (e.g. 2 0.8,1.6 ,2)"},_={describe:"offset distance or pct of h/w (single value or l,b,r,t list)",type:"distance"},x=new Av;x.usage("Usage: mapshaper -<command> [options] ..."),x.note("Enter mapshaper -help <command> to view options for a single command"),x.section("I/O commands"),x.default("i"),x.command("i").describe("input one or more files").validate(uv).option("files",{DEFAULT:{multi_arg:!0,type:"string"},type:"strings",describe:"one or more files to import, or - to use stdin"}).option("combine-files",{describe:"import files to separate layers with shared topology",type:"flag"}).option("merge-files",{type:"flag"}).option("no-topology",{describe:"treat each shape as topologically independent",type:"flag"}).option("precision",{describe:"coordinate precision in source units, e.g. 0.001",type:"number"}).option("snap",{type:"flag",describe:"snap nearly identical points to fix minor topology errors"}).option("auto-snap",{alias_to:"snap"}).option("snap-interval",s).option("encoding",o).option("id-field",{describe:"import Topo/GeoJSON id property to this field"}).option("string-fields",d).option("field-types",p).option("name",{describe:"rename the imported layer(s)"}).option("geometry-type",{}).option("json-path",{}).option("csv-skip-lines",{type:"integer",describe:"[CSV] number of lines to skip at the beginning of the file"}).option("csv-lines",{type:"integer",describe:"[CSV] number of data records to read"}).option("csv-field-names",{type:"strings",describe:"[CSV] comma-sep. list of field names to assign each column"}).option("csv-dedup-fields",{type:"flag",describe:"[CSV] rename fields with duplicate names"}).option("csv-filter",{describe:"[CSV] JS expression for filtering records"}).option("csv-fields",{type:"strings",describe:"[CSV] comma-sep. list of fields to import"}).option("decimal-comma",{type:"flag",describe:"[CSV] import numbers formatted like 1.000,01 or 1 000,01"}).option("json-path",{old_alias:"json-subtree",describe:"[JSON] path to JSON input data; separator is /"}).option("single-part",{type:"flag"}),x.command("o").describe("output edited content").validate(pv).option("_",{label:"<file|directory>",describe:"(optional) name of output file or directory, - for stdout",DEFAULT:{multi_error_msg:"Command takes one file or directory argument."}}).option("format",{describe:"options: shapefile,geojson,topojson,json,dbf,csv,tsv,svg"}).option("target",e).option("force",{describe:"allow overwriting input files",type:"flag"}).option("gzip",{describe:"apply gzip compression to output files",type:"flag"}).option("zip",{describe:"save all output files in a single .zip file",type:"flag"}).option("dry-run",{type:"flag"}).option("ldid",{type:"number"}).option("precision",{describe:"coordinate precision in source units, e.g. 0.001",type:"number"}).option("fix-geometry",{describe:"remove intersections introduced by rounding or quantization",type:"flag"}).option("bbox-index",{describe:"export a .json file with bbox of each layer",type:"flag"}).option("cut-table",{describe:"detach data attributes from shapes and save as a JSON file",type:"flag"}).option("drop-table",{describe:"remove data attributes from output",type:"flag"}).option("encoding",{describe:"[Shapefile/CSV] text encoding (default is utf8)"}).option("field-order",{describe:"[Shapefile/CSV] field-order=ascending sorts columns A-Z"}).option("id-field",{describe:"[Topo/GeoJSON/SVG] field to use for id property",type:"strings"}).option("bbox",{type:"flag",describe:"[Topo/GeoJSON] add bbox property"}).option("extension",{describe:'[Topo/GeoJSON] set file extension (default is ".json")'}).option("prettify",{type:"flag",describe:"[Topo/GeoJSON/JSON] format output for readability"}).option("singles",{describe:"[TopoJSON] save each target layer as a separate file",type:"flag"}).option("quantization",{describe:"[TopoJSON] specify quantization (auto-set by default)",type:"integer"}).option("no-quantization",{describe:"[TopoJSON] export coordinates without quantization",type:"flag"}).option("metadata",{type:"flag"}).option("no-point-quantization",{type:"flag"}).option("presimplify",{describe:"[TopoJSON] add per-vertex data for dynamic simplification",type:"flag"}).option("topojson-precision",{type:"number"}).option("gj2008",{describe:"[GeoJSON] use original GeoJSON spec (not RFC 7946)",type:"flag"}).option("rfc7946",{type:"flag"}).option("combine-layers",{describe:"[GeoJSON] output layers as a single file",type:"flag"}).option("geojson-type",{describe:"[GeoJSON] FeatureCollection, GeometryCollection or Feature"}).option("no-null-props",{describe:'[GeoJSON] use "properties":{} when a Feature has no data',type:"flag"}).option("hoist",{describe:"[GeoJSON] move properties to the root level of each Feature",type:"strings"}).option("ndjson",{describe:"[GeoJSON/JSON] output newline-delimited features or records",type:"flag"}).option("width",{describe:"[SVG/TopoJSON] pixel width of output (SVG default is 800)",type:"number"}).option("height",{describe:"[SVG/TopoJSON] pixel height of output (optional)",type:"number"}).option("max-height",{describe:"[SVG/TopoJSON] max pixel height of output (optional)",type:"number"}).option("margin",{describe:"[SVG/TopoJSON] space betw. data and viewport (default is 1)"}).option("pixels",{describe:"[SVG/TopoJSON] output area in pix. (alternative to width=)",type:"number"}).option("fit-bbox",{type:"bbox",describe:"[TopoJSON] scale and shift coordinates to fit a bbox"}).option("svg-scale",{describe:"[SVG] source units per pixel (alternative to width= option)",type:"number"}).option("svg-bbox",{describe:"[SVG] bounding box of SVG map in projected map units",type:"bbox"}).option("fit-extent",{describe:"[SVG] layer to use for the map extent"}).option("point-symbol",{describe:"[SVG] circle or square (default is circle)"}).option("svg-data",{type:"strings",describe:"[SVG] fields to export as data-* attributes"}).option("id-prefix",{describe:"[SVG] prefix for namespacing layer and feature ids"}).option("scalebar",{type:"flag"}).option("delimiter",{describe:"[CSV] field delimiter"}).option("decimal-comma",{type:"flag",describe:"[CSV] export numbers with decimal commas not points"}).option("show-all",{type:"flag",describe:"[Snapshot] show all layers in Web UI"}).option("final",{type:"flag"}).option("metadata",{type:"flag"}),x.section("Editing commands"),x.command("affine").describe("transform coordinates by shifting, scaling and rotating").option("shift",{type:"strings",describe:"x,y offsets in source units (e.g. 5000,-5000)"}).option("scale",{type:"number",describe:"scale (default is 1)"}).option("rotate",{type:"number",describe:"angle of rotation in degrees (default is 0)"}).option("anchor",{type:"numbers",describe:"center of rotation/scaling (default is center of selected shapes)"}).option("fit-bbox",{type:"bbox",describe:"scale and shift coordinates to fit a bbox"}).option("where",y).option("target",e),x.command("buffer").option("radius",{describe:"radius of buffer, as an expression or a constant",DEFAULT:!0}).option("tolerance",{}).option("vertices",{type:"integer"}).option("arc-quality",{type:"integer"}).option("slice-length",{type:"integer"}).option("backtrack",{type:"integer"}).option("cap-style",{describe:"flat or round (default is round)"}).option("type",{}).option("planar",{type:"flag"}).option("v2",{type:"flag"}).option("v3",{type:"flag"}).option("debug-offset",{type:"flag"}).option("debug-winding",{type:"flag"}).option("debug-points",{type:"flag"}).option("debug-mosaic",{type:"flag"}).option("left",{type:"flag"}).option("right",{type:"flag"}).option("no-cleanup",{type:"flag"}).option("units",{describe:"distance units (meters|miles|km|feet) (default is meters)"}).option("name",t).option("target",e).option("no-replace",n),x.command("classify").describe("assign colors or values using one of several methods").option("field",{describe:"name of field to classify",DEFAULT:!0}).option("save-as",{describe:"name of output field (default is fill|stroke|class)"}).option("colors",{describe:"list of CSS colors or color scheme name (see -colors)",type:"colors"}).option("values",{describe:"values to assign to classes (alternative to colors=)",type:"strings"}).option("color-scheme",{}).option("non-adjacent",{describe:"assign non-adjacent colors to a polygon layer",assign_to:"method"}).option("stops",{describe:"a pair of values (0-100) for limiting a color ramp",type:"numbers"}).option("null-value",{describe:"value (or color) to use for invalid or missing data"}).option("method",{describe:"quantile, nice, equal-interval, categorical, etc."}).option("quantile",{assign_to:"method"}).option("equal-interval",{assign_to:"method"}).option("hybrid",{assign_to:"method"}).option("nice",{assign_to:"method"}).option("breaks",{describe:"user-defined sequential class breaks",type:"numbers"}).option("outer-breaks",{describe:"min,max breakpoints, to limit the effect of outliers",old_alias:"range",type:"numbers"}).option("classes",{describe:"number of classes (can be inferred from other options)",type:"integer"}).option("invert",{describe:"reverse the order of colors/values",type:"flag"}).option("continuous",{describe:"output interpolated values, for unclassed colors",type:"flag"}).option("index-field",{describe:"apply pre-calculated classes (0 ... n-1, -1)"}).option("precision",{describe:"round data values before classification (e.g. 0.1)",type:"number"}).option("categories",{describe:"list of data values for categorical color scheme",type:"strings"}).option("other",{describe:"default value for categorical scheme"}).option("key",{type:"flag"}).option("key-style",{describe:"one of: simple, gradient, dataviz"}).option("key-name",{describe:"name of output SVG file"}).option("key-width",{describe:"width of key in pixels",type:"number"}).option("key-font-size",{describe:"label size in pixels",type:"number"}).option("key-tile-height",{describe:"height of color tiles in pixels",type:"number"}).option("key-tic-length",{describe:"length of tic mark in pixels"}).option("key-label-suffix",{describe:"string to append to each label"}).option("key-last-suffix",{describe:"string to append to last label"}).option("target",e),x.command("clean").describe("fixes geometry issues, such as polygon overlaps and gaps").option("gap-fill-area",{old_alias:"min-gap-area",describe:"threshold for filling gaps, e.g. 1.5km2 (default is small)",type:"area"}).option("sliver-control",u).option("snap-interval",s).option("no-snap",a).option("allow-overlaps",{describe:"allow polygons to overlap (disables gap fill)",type:"flag"}).option("overlap-rule",{describe:"how to resolve overlaps: min-id|max-id|min-area|[max-area]"}).option("allow-empty",{describe:"keep null geometries (removed by default)",type:"flag"}).option("rewind",{describe:"fix errors in the CW/CCW winding order of polygon rings",type:"flag"}).option("arcs",{alias_to:"only-arcs"}).option("only-arcs",{describe:"delete unused arcs but don't remove gaps and overlaps",type:"flag"}).option("no-arc-dissolve",{type:"flag"}).option("target",e),x.command("clip").describe("use a polygon layer to clip another layer").example("$ mapshaper states.shp -clip land_area.shp -o clipped.shp").option("source",{DEFAULT:!0,describe:"file or layer containing clip polygons"}).option("remove-slivers",{describe:"remove sliver polygons created by clipping",type:"flag"}).option("bbox",g).option("bbox2",{type:"bbox",describe:"experimental fast bbox clipping"}).option("name",t).option("no-snap",a).option("no-cleanup",{type:"flag"}).option("target",e).option("no-replace",n),x.command("colorizer").describe("define a function to convert data values to color classes").option("colors",{describe:"comma-separated list of CSS colors",type:"colors"}).option("breaks",{describe:"ascending-order list of breaks for sequential color scheme",type:"numbers"}).option("categories",{describe:"comma-sep. list of keys for categorical color scheme",type:"strings"}).option("random",{describe:"randomly assign colors",type:"flag"}).option("other",{describe:"default color for categorical scheme (default is nodata color)"}).option("nodata",{describe:"color to use for invalid or missing data (default is white)"}).option("name",{describe:"function name to use in -each and -svg-style commands"}).option("precision",{describe:"rounding precision to apply before classification (e.g. 0.1)",type:"number"}).example("Define a sequential color scheme and use it to create a new field\n$ mapshaper data.json -colorizer name=getColor nodata=#eee breaks=20,40 \\\n colors=#e0f3db,#a8ddb5,#43a2ca -each 'fill = getColor(RATING)' -o output.json"),x.command("dashlines").describe("split lines into sections, with or without a gap").oldAlias("split-lines").option("dash-length",{type:"distance",describe:"length of split-apart lines (e.g. 200km)"}).option("gap-length",{type:"distance",describe:"length of gaps between dashes (default is 0)"}).option("scaled",{type:"flag",describe:"scale dashes and gaps to prevent partial dashes"}).option("planar",{type:"flag",describe:"use planar geometry"}).option("where",y).option("target",e),x.command("define").option("expression",{DEFAULT:!0,describe:"one or more assignment expressions (comma-sep.)"}),x.command("dissolve").describe("merge features within a layer").example("Dissolve all polygons in a feature layer into a single polygon\n$ mapshaper states.shp -dissolve -o country.shp").example("Generate state-level polygons by dissolving a layer of counties\n(STATE_FIPS, POPULATION and STATE_NAME are attribute field names)\n$ mapshaper counties.shp -dissolve STATE_FIPS copy-fields=STATE_NAME sum-fields=POPULATION -o states.shp").option("field",{}).option("fields",h).option("calc",c).option("sum-fields",f).option("copy-fields",l).option("multipart",{type:"flag",describe:"make multipart features instead of dissolving"}).option("where",y).option("group-points",{type:"flag",describe:"[points] group points instead of converting to centroids"}).option("weight",{describe:"[points] field or expression to use for weighting centroid"}).option("planar",{type:"flag",describe:"[points] use 2D math to find centroids of latlong points"}).option("name",t).option("target",e).option("no-replace",n),x.command("dissolve2").describe("merge adjacent polygons (repairs overlaps and gaps)").option("field",{}).option("fields",h).option("calc",c).option("sum-fields",f).option("copy-fields",l).option("gap-fill-area",{describe:"threshold for filling gaps, e.g. 1.5km2",type:"area"}).option("sliver-control",u).option("allow-overlaps",{describe:"allow dissolved polygons to overlap (disables gap fill)",type:"flag"}).option("name",t).option("no-snap",a).option("target",e).option("no-replace",n),x.command("divide").describe("divide lines by polygons, copy polygon data to lines").option("fields",{describe:"fields to copy (comma-sep.) (default is all but key field)",type:"strings"}).option("calc",{describe:"use a JS expression to assign values (for many-to-one joins)"}).option("force",{describe:"replace values from same-named fields",type:"flag"}).option("source",{DEFAULT:!0,describe:"file or layer containing polygons"}).option("target",e),x.command("dots").describe("fill polygons with dots of one or more colors").option("fields",{DEFAULT:!0,describe:"one or more fields containing numbers of dots",type:"strings"}).option("colors",{describe:"one or more colors",type:"strings"}).option("values",{describe:"values to assign to dot classes (alternative to colors=)",type:"strings"}).option("save-as",{describe:"name of color/value output field (default is fill)"}).option("progressive",{type:"flag"}).option("r",{describe:"radius of each dot in pixels",type:"number"}).option("evenness",{describe:"(0-1) dot spacing, from random to even (default is 1)",type:"number"}).option("per-dot",{describe:"number for scaling data values (e.g. 10 per dot)",type:"number"}).option("copy-fields",{describe:"list of fields to copy from polygons to dots",type:"strings"}).option("multipart",{describe:"combine groups of same-color dots into multi-part features",type:"flag"}).option("target",e).option("name",t).option("no-replace",n),x.command("drop").describe("delete layer(s) or elements within the target layer(s)").option("geometry",{describe:"delete all geometry from the target layer(s)",type:"flag"}).option("holes",{describe:"delete holes from polygons",type:"flag"}).option("fields",{type:"strings",describe:"delete a list of attribute data fields, e.g. 'id,name' '*'"}).option("target",e),x.command("each").describe("create/update/delete data fields using a JS expression").example("Add two calculated data fields to a layer of U.S. counties\n$ mapshaper counties.shp -each 'STATE_FIPS=CNTY_FIPS.substr(0, 2), AREA=$.area'").option("expression",{DEFAULT:!0,describe:"JS expression to apply to each target feature"}).option("ids",{type:"numbers"}).option("where",y).option("target",e),x.command("erase").describe("use a polygon layer to erase another layer").example("$ mapshaper land_areas.shp -erase water_bodies.shp -o erased.shp").option("source",{DEFAULT:!0,describe:"file or layer containing erase polygons"}).option("remove-slivers",{describe:"remove sliver polygons created by erasing",type:"flag"}).option("bbox",g).option("name",t).option("no-snap",a).option("no-cleanup",{type:"flag"}).option("target",e).option("no-replace",n),x.command("explode").describe("divide multi-part features into single-part features").option("naive",{type:"flag"}).option("target",e),x.command("filter").describe("delete features using a JS expression").option("expression",{DEFAULT:!0,describe:"delete features that evaluate to false"}).option("bbox",{describe:"delete features outside bbox (xmin,ymin,xmax,ymax)",type:"bbox"}).option("invert",m).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("keep-shapes",{type:"flag"}).option("ids",{type:"numbers"}).option("cleanup",{type:"flag"}).option("name",t).option("target",e).option("no-replace",n),x.command("filter-fields").describe("retain a subset of data fields").option("fields",{DEFAULT:!0,type:"strings",describe:"fields to retain (comma-sep.), e.g. 'fips,name'"}).option("invert",{type:"flag",describe:"retain only fields that would have been deleted"}).option("target",e),x.command("filter-geom").describe("").option("bbox",{type:"bbox",describe:"remove non-intersecting geometry (xmin,ymin,xmax,ymax)"}).option("target",e),x.command("filter-islands2").option("min-area",{type:"area",describe:"remove small-area islands (e.g. 10km2)"}).option("min-vertices",{type:"integer",describe:"remove low-vertex-count islands"}).option("keep-shapes",{type:"flag",describe:"only filter smaller parts of multipart polygons"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("target",e),x.command("filter-islands").describe("remove small detached polygon rings (islands)").option("min-area",{type:"area",describe:"remove small-area islands (e.g. 10km2)"}).option("min-vertices",{type:"integer",describe:"remove low-vertex-count islands"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("target",e),x.command("filter-slivers").describe("remove small polygon rings").option("min-area",{type:"area",describe:"area threshold (e.g. 2sqkm)"}).option("sliver-control",{describe:"boost area threshold of slivers (0-1, default is 1)",type:"number"}).option("weighted",{type:"flag"}).option("remove-empty",{type:"flag",describe:"delete features with null geometry"}).option("keep-shapes",{type:"flag",describe:"protect sliver polygons from complete removal"}).option("target",e),x.command("graticule").describe("create a graticule layer").option("interval",{describe:"size of grid cells in degrees (default is 10)",type:"number"}).option("polygon",{describe:"create a polygon to match the outline of the graticule",type:"flag"}).option("name",t),x.command("grid2").option("type",{describe:"square, hex or hex2 (default is square)"}).option("interval",{describe:"side length (e.g. 500m, 12km)",type:"distance"}).option("name",t).option("target",e).option("no-replace",n),x.command("grid").describe("create a grid of square or hexagonal polygons").option("type",{describe:"square, hex or hex2 (default is square)"}).option("interval",{describe:"side length (e.g. 500m, 12km)",type:"distance"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("name",t).option("target",e).option("no-replace",n),x.command("include").describe("import JS data and functions for use in JS expressions").option("file",{DEFAULT:!0,describe:"file containing a JS object with key:value pairs to import"}),x.command("inlay").describe("inscribe a polygon layer inside another polygon layer").option("source",{DEFAULT:!0,describe:"file or layer containing polygons to inlay"}).option("target",e),x.command("innerlines").describe("convert polygons to polylines along shared edges").option("where",v).option("name",t).option("target",e).option("no-replace",n),x.command("join").describe("join data records from a file or layer to a layer").example("Join a csv table to a Shapefile (don't auto-convert FIPS column to numbers)\n$ mapshaper states.shp -join data.csv keys=STATE_FIPS,FIPS string-fields=FIPS -o joined.shp").validate(function(e){e.options.source||vt("Command requires the name of a layer or file to join")}).option("source",{DEFAULT:!0,describe:"file or layer containing data records"}).option("keys",{describe:"join by matching target,source key fields, e.g. keys=FID,id",type:"strings"}).option("calc",{describe:"use a JS expression to assign values (for many-to-one joins)"}).option("where",{describe:"use a JS expression to filter source records"}).option("fields",{describe:"fields to copy (comma-sep.) (default is all but key field)",type:"strings"}).option("prefix",{describe:"prefix for renaming fields joined from the source table"}).option("interpolate",{describe:"(polygon-polygon join) list of area-interpolated fields",type:"strings"}).option("point-method",{describe:"(polygon-polygon join) join polygons via inner points",type:"flag"}).option("largest-overlap",{describe:"(polygon-polygon join) use max overlap to join one polygon",type:"flag"}).option("min-overlap-pct",{describe:"(polygon-polygon join) min overlap as pct of target polygon",type:"percent"}).option("min-overlap-area",{describe:"(polygon-polygon join) minimum area of overlap",type:"area"}).option("max-distance",{describe:"(point-point join) join source points within this radius",type:"distance"}).option("planar",{type:"flag"}).option("duplication",{describe:"duplicate target features on many-to-one joins",type:"flag"}).option("string-fields",d).option("field-types",p).option("sum-fields",{describe:"fields to sum in a many-to-one join (or use calc= for this)",type:"strings"}).option("force",{describe:"replace values from same-named fields",type:"flag"}).option("unjoined",{describe:'copy unjoined records from source table to "unjoined" layer',type:"flag"}).option("unmatched",{describe:'copy unmatched records in target table to "unmatched" layer',type:"flag"}).option("encoding",o).option("target",e),x.command("lines").describe("convert a polygon or point layer to a polyline layer").option("fields",{DEFAULT:!0,describe:"field(s) to create a hierarchy of boundary lines",type:"strings"}).option("where",v).option("each",{describe:"apply a JS expression to each polygon boundary (with A and B)"}).option("segments",{describe:"convert paths to segments, for debugging",type:"flag"}).option("callouts",{type:"flag"}).option("arcs",{describe:"convert paths to arcs, for debugging",type:"flag"}).option("groupby",{describe:"field for grouping point input into multiple lines"}).option("name",t).option("target",e).option("no-replace",n),x.command("merge-layers").describe("merge multiple layers into as few layers as possible").option("force",{type:"flag",describe:"merge layers with inconsistent data fields"}).option("flatten",{describe:"remove polygon overlaps; higher-id polygons take priority",type:"flag"}).option("name",t).option("target",e),x.command("mosaic").describe("convert a polygon layer with overlaps into a flat mosaic").option("calc",c).option("name",t).option("target",e).option("snap-interval",s).option("no-snap",a).option("no-replace",n),x.command("point-grid").describe("create a rectangular grid of points").validate(lv).option("_",{label:"<cols,rows>",describe:"size of the grid, e.g. -point-grid 100,100",DEFAULT:!0}).option("interval",{describe:"distance between adjacent points, in source units",type:"distance"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("bbox",{type:"bbox",describe:"xmin,ymin,xmax,ymax (default is bbox of data)"}).option("name",t).option("target",e).option("no-replace",n),x.command("points").describe("create a point layer from a different layer type").option("x",{describe:"field containing x coordinate"}).option("y",{describe:"field containing y coordinate"}).option("inner",{describe:"create an interior point for each polygon's largest ring",type:"flag"}).option("centroid",{describe:"create a centroid point for each polygon's largest ring",type:"flag"}).option("vertices",{describe:"capture unique vertices of polygons and polylines",type:"flag"}).option("vertices2",{describe:"like vertices, but without removal of duplicate coordinates",type:"flag"}).option("endpoints",{describe:"capture unique endpoints of polygons and polylines",type:"flag"}).option("midpoints",{describe:"find the (planar) midpoint of each polyline",type:"flag"}).option("intersections",{type:"flag"}).option("interpolated",{describe:"interpolate points along polylines; requires interval=",type:"flag"}).option("interval",{describe:"distance between interpolated points (meters or projected units)",type:"distance"}).option("name",t).option("target",e).option("no-replace",n),x.command("polygons").describe("convert polylines to polygons").option("gap-tolerance",{describe:"specify gap tolerance in source units",type:"distance"}).option("from-rings",{describe:"do simple conversion from a layer of closed paths",type:"flag"}).option("target",e),x.command("proj").describe("project your data (using Proj.4)").option("crs",{DEFAULT:{multi_arg:!0,join:" "},describe:"set destination CRS using a Proj.4 definition or alias"}).option("projection",{alias_to:"crs"}).option("match",{describe:"set destination CRS using a .prj file or layer id"}).option("source",{alias_to:"match"}).option("from",{alias_to:"init",describe:"(deprecated) alias for init="}).option("init",{describe:"set source CRS (if unset) using a string, .prj or layer id"}).option("densify",{type:"flag",describe:"add points along straight segments to approximate curves"}).option("clip-angle",{describe:"use a custom clipping radius (for azimuthal projections)",type:"number"}).option("clip-bbox",{describe:"clip to a lat-long bounding box before projecting",type:"bbox"}).option("target",e).validate(fv),x.command("rectangle").describe("create a rectangle from a bbox or target layer").option("bbox",{describe:"rectangle coordinates (xmin,ymin,xmax,ymax)",type:"bbox"}).option("offset",_).option("width",{describe:"set width of map in pixels, use rectangle as frame"}).option("aspect-ratio",b).option("source",{describe:"name of layer to enclose"}).option("name",t).option("target",e).option("no-replace",n),x.command("rectangles").describe("create a rectangle for each feature in a layer").option("offset",_).option("bbox",{describe:"Use an expression to generate a rectangle for each feature"}).option("aspect-ratio",b).option("name",t).option("target",e).option("no-replace",n),x.command("rename-fields").describe("rename data fields").option("fields",{DEFAULT:!0,type:"strings",describe:"list of replacements (comma-sep.), e.g. 'fips=STATE_FIPS,st=state'"}).option("target",e),x.command("rename-layers").describe("assign new names to layers").option("names",{DEFAULT:!0,type:"strings",describe:"list of replacements (comma-sep.)"}).option("target",e),x.command("simplify").validate(cv).example("Retain 10% of removable vertices\n$ mapshaper input.shp -simplify 10%").describe("simplify the geometry of polygon and polyline features").option("percentage",{DEFAULT:!0,alias:"p",type:"percent",describe:"percentage of removable points to retain, e.g. 10%"}).option("dp",{alias:"rdp",describe:"use Ramer-Douglas-Peucker simplification",assign_to:"method"}).option("visvalingam",{describe:'use Visvalingam simplification with "effective area" metric',assign_to:"method"}).option("weighted",{describe:"use weighted Visvalingam simplification (default)",assign_to:"method"}).option("method",{}).option("weighting",{type:"number",describe:"weighted Visvalingam coefficient (default is 0.7)"}).option("resolution",{describe:"output resolution as a grid (e.g. 1000x500)"}).option("interval",{describe:"output resolution as a distance (e.g. 100)",type:"distance"}).option("variable",{describe:"JS expr. assigning to one of: interval= percentage= resolution=",type:"flag"}).option("planar",{describe:"simplify decimal degree coords in 2D space (default is 3D)",type:"flag"}).option("cartesian",{alias_to:"planar"}).option("keep-shapes",{describe:"prevent small polygon features from disappearing",type:"flag"}).option("lock-box",{type:"flag"}).option("no-repair",{describe:"don't remove intersections introduced by simplification",type:"flag"}).option("stats",{describe:"display simplification statistics",type:"flag"}).option("target",e),x.command("slice").option("source",{DEFAULT:!0,describe:"file or layer containing clip polygons"}).option("id-field",{describe:"slice id field (from source layer)"}).option("name",t).option("no-snap",a).option("target",e).option("no-replace",n),x.command("snap").describe("snap together nearby vertices").option("interval",{describe:"snap together vertices within a tolerance (default is small)",DEFAULT:!0,type:"distance"}).option("endpoints",{describe:"only snap together the endpoints of lines",type:"flag"}).option("precision",{describe:"round all coordinates to a given decimal precision (e.g. 0.000001)",type:"number"}).option("fix-geometry",{describe:"remove intersections introduced by rounding and snapping",type:"flag"}).option("target",e),x.command("sort").describe("sort features using a JS expression").option("expression",{DEFAULT:!0,describe:"JS expression to generate a sort key for each feature"}).option("ascending",{describe:"sort in ascending order (default)",type:"flag"}).option("descending",{describe:"sort in descending order",type:"flag"}).option("target",e),x.command("split").describe("split a layer into single-feature or multi-feature layers").option("field",{alias_to:"expression"}).option("expression",{DEFAULT:!0,describe:"expression or field for grouping features and naming split layers"}).option("ids",{type:"numbers"}).option("apart",{describe:"save output layers to independent datasets",type:"flag"}).option("target",e).option("no-replace",n),x.command("split-on-grid").describe("split features into separate layers using a grid").validate(lv).option("_",{DEFAULT:!0,label:"<cols,rows>",describe:"size of the grid, e.g. -split-on-grid 12,10"}).option("cols",{type:"integer"}).option("rows",{type:"integer"}).option("id-field",{describe:"assign each feature a cell id instead of splitting layer"}).option("target",e),x.command("style").oldAlias("svg-style").describe("set SVG style properties using JS or literal values").option("clear",{describe:"remove all style properties from a layer",type:"flag"}).option("where",y).option("class",{describe:"name of CSS class or classes (space-separated)"}).option("css",{describe:"inline css style"}).option("fill",{describe:"fill color; examples: #eee pink rgba(0, 0, 0, 0.2)"}).option("fill-pattern",{describe:'pattern fill, ex: "hatches 2px grey 2px blue"'}).option("fill-effect",{describe:'use "sphere" on a circle for a 3d globe effect'}).option("fill-opacity",{describe:"fill opacity"}).option("fill-hatch",{alias_to:"fill-pattern"}).option("stroke",{describe:"stroke color"}).option("stroke-width",{describe:"stroke width"}).option("stroke-dasharray",{describe:'stroke dashes. Examples: "4" "2 4"'}).option("stroke-opacity",{describe:"stroke opacity"}).option("opacity",{describe:"opacity; example: 0.5"}).option("r",{describe:"symbol radius (set this to export points as circles)"}).option("label-text",{describe:"label text (set this to export points as labels)"}).option("text-anchor",{describe:"label alignment; one of: start, end, middle (default)"}).option("dx",{describe:"x offset of labels (default is 0)"}).option("dy",{describe:"y offset of labels (default is 0/baseline-aligned)"}).option("font-size",{describe:"size of label text (default is 12)"}).option("font-family",{describe:"CSS font family of labels (default is sans-serif)"}).option("font-weight",{describe:"CSS font weight property of labels (e.g. bold, 700)"}).option("font-style",{describe:"CSS font style property of labels (e.g. italic)"}).option("font-stretch",{describe:"CSS font stretch property of labels (e.g. condensed)"}).option("letter-spacing",{describe:"CSS letter-spacing property of labels"}).option("line-height",{describe:"line spacing of multi-line labels (default is 1.1em)"}).option("target",e),x.command("symbols").describe("symbolize points as arrows, circles, stars, polygons, etc.").option("type",{describe:"types: arrow, circle, square, star, polygon, ring"}).option("stroke",{}).option("stroke-width",{}).option("fill",{describe:"symbol fill color (filled symbols only)"}).option("stroke",{describe:"symbol line color (linear symbols only)"}).option("stroke-width",{describe:"symbol line width (linear symbols only)"}).option("opacity",{describe:"symbol opacity"}).option("geographic",{old_alias:"polygons",describe:"make geographic shapes instead of SVG objects",type:"flag"}).option("pixel-scale",{describe:"set symbol scale in meters per pixel (geographic option)",type:"number"}).option("rotated",{type:"flag",describe:"symbol is rotated to an alternate orientation"}).option("rotation",{describe:"rotation of symbol in degrees"}).option("scale",{describe:"scale symbols by a multiplier",type:"number"}).option("radius",{describe:"distance from center to farthest point on the symbol",type:"distance"}).option("sides",{describe:"(polygon) number of sides of a (regular) polygon symbol",type:"number"}).option("points",{describe:"(star) number of points"}).option("point-ratio",{old_alias:"star-ratio",describe:"(star) ratio of minor to major radius of star",type:"number"}).option("radii",{describe:"(ring) comma-sep. list of concentric radii, ascending order"}).option("arrow-style",{describe:"(arrow) options: stick, standard (default is standard)"}).option("length",{old_alias:"arrow-length",describe:"(arrow) length of arrow in pixels"}).option("direction",{old_alias:"arrow-direction",describe:"(arrow) angle off of vertical (-90 = left-pointing)"}).option("head-angle",{old_alias:"arrow-head-angle",describe:"(arrow) angle of tip of arrow (default is 40 degrees)"}).option("head-width",{old_alias:"arrow-head-width",describe:"(arrow) width of arrow head from side to side"}).option("head-length",{old_alias:"arrow-head-width",describe:"(arrow) length of head (alternative to head-angle)"}).option("head-shape",{}).option("stem-width",{old_alias:"arrow-stem-width",describe:"(arrow) width of stem at its widest point"}).option("stem-length",{old_alias:"arrow-stem-length",describe:"(arrow) alternative to length"}).option("stem-taper",{old_alias:"arrow-stem-taper",describe:"(arrow) factor for tapering the width of the stem (0-1)"}).option("stem-curve",{old_alias:"arrow-stem-curve",describe:"(arrow) curvature in degrees (default is 0)"}).option("min-stem-ratio",{old_alias:"arrow-min-stem",describe:"(arrow) minimum ratio of stem to total length",type:"number"}).option("anchor",{describe:"(arrow) takes one of: start, middle, end (default is start)"}).option("effect",{}).option("name",t).option("target",e).option("no-replace",n),x.command("target").describe("set active layer (or layers)").option("target",{DEFAULT:!0,describe:"name or index of layer to target"}).option("type",{describe:"type of layer to target (polygon|polyline|point)"}).option("name",{describe:"rename the target layer"}),x.command("union").describe("create a flat mosaic from two or more polygon layers").option("fields",{type:"strings",describe:"fields to retain (comma-sep.) (default is all fields)"}).option("name",t).option("target",{describe:"specify layers to target (comma-sep. list)"}).option("no-replace",n),x.command("uniq").describe("delete features with the same id as a previous feature").option("expression",{DEFAULT:!0,describe:"JS expression to obtain the id of a feature"}).option("max-count",{type:"number",describe:"max features with the same id (default is 1)"}).option("index",{type:"flag"}).option("invert",m).option("verbose",{describe:"print each removed feature",type:"flag"}).option("target",e),x.section("Experimental commands (may give unexpected results)"),x.command("add-shape").describe("").option("geojson",{}).option("coordinates",{}).option("properties",{}).option("name",t).option("target",e).option("no-replace",n),x.command("alpha-shapes").option("interval",{describe:"alpha parameter",type:"number"}).option("keep-points",{type:"flag"}).option("name",t).option("target",e).option("no-replace",n),x.command("check-geometry").option("strict",{describe:"stops the program if any errors are found",type:"flag"}),x.command("cluster").describe("group polygons into compact clusters").option("id-field",{describe:'field name of cluster id (default is "cluster")'}).option("pct",{alias:"p",type:"percent",describe:"percentage of shapes to retain, e.g. 50%"}).option("max-width",{describe:"max width of cluster bounding box",type:"number"}).option("max-height",{describe:"max height of cluster bounding box",type:"number"}).option("max-area",{describe:"max area of a cluster",type:"number"}).option("group-by",{describe:"field name; only same-value shapes will be grouped"}).option("target",e),x.command("data-fill").describe("fill in missing values in a polygon layer").option("field",{describe:"name of field to fill in"}).option("postprocess",{alias_to:"contiguous"}).option("contiguous",{describe:"remove non-contiguous data islands",type:"flag"}).option("weight-field",{describe:"use field values to calculate data island weights"}),x.command("filter-points").option("group-interval",{type:"number"}),x.command("frame").describe("create a rectangular map frame layer at a given display width").option("width",{describe:"width of frame (e.g. 5in, 10cm, 600px; default is 800px)"}).option("height",{describe:"(optional) height of frame; similar to width= option"}).option("aspect-ratio",{describe:"(optional) aspect ratio of frame, if height= or width= is omitted",type:"number"}).option("bbox",{describe:"frame coordinates (xmin,ymin,xmax,ymax)",type:"bbox"}).option("offset",{describe:"padding in display units or pct of width, e.g. 5cm 20px 5%",type:"strings"}).option("offsets",{describe:"separate offsets for each side, in l,b,r,t order",type:"strings"}).option("name",t).option("target",e),x.command("fuzzy-join").describe("join points to polygons, with data fill and fuzzy match").option("source",{DEFAULT:!0,describe:"file or layer containing data records"}).option("field",{describe:"field to join"}).option("dedup-points",{describe:"uniqify points with the same location and field value",type:"flag"}).option("no-dropouts",{describe:"try to retain all values from the point layer",type:"flag"}).option("postprocess",{alias_to:"contiguous"}).option("contiguous",{describe:"remove non-contiguous data islands",type:"flag"}).option("target",e),x.command("point-to-grid").option("interval",{type:"number"}).option("radius",{type:"number"}).option("circles",{type:"flag"}).option("cell-margin",{type:"number"}).option("aligned",{type:"flag"}).option("calc",c).option("target",e).option("name",t).option("no-replace",n),x.command("require").describe("require a Node module or ES module to use in JS expressions").option("module",{DEFAULT:!0,describe:"name of installed module or path to module file"}).option("alias",{describe:"Set the module name to an alias"}),x.command("rotate").option("rotation",{DEFAULT:!0,type:"numbers"}).option("invert",{type:"flag"}),x.command("run").describe("create commands on-the-fly and run them").option("expression",{DEFAULT:!0,describe:"JS expression or template to generate command(s)"}).option("commands",{alias_to:"expression"}).option("target",e),x.command("scalebar").describe("add a simple scale bar to SVG output").option("label",{DEFAULT:!0,describe:'distance label, e.g. "35 miles"'}).option("style",{describe:"two options: a or b"}).option("font-size",{type:"number"}).option("tic-length",{describe:"length of tic marks (style b)",type:"number"}).option("bar-width",{describe:"line width of bar",type:"number"}).option("label-offset",{type:"number"}).option("position",{describe:"e.g. bottom-right (default is top-left)"}).option("label-position",{describe:"top, bottom, top-center (style a), etc"}).option("dual-units",{type:"flag"}).option("margin",{describe:"offset in pixels from edge of map",type:"number"}),x.command("shape").describe("create a polyline or polygon from coordinates").option("coordinates",{describe:"list of vertices as x,y,x,y...",type:"numbers"}).option("offsets",{describe:"list of vertices as offsets from coordinates list",type:"numbers"}).option("closed",{describe:"close an open path to create a polygon",type:"flag"}).option("type",{DEFAULT:!0}).option("center",{type:"numbers"}).option("radius",{type:"number"}).option("radius-angle",{type:"number"}).option("bbox",{type:"numbers"}).option("geometry",{}).option("rotation",{type:"numbers"}).option("name",t),x.command("subdivide").describe("recursively split a layer using a JS expression").validate(hv).option("expression",{DEFAULT:!0,describe:"boolean JS expression"}).option("target",e),x.section("Control flow commands");var w={expression:{DEFAULT:!0,describe:"JS expression"},layer:{describe:"name or id of layer to test (default is current target)"},target:e};return x.command("if").describe("run the following commands if a condition is met").options(w),x.command("elif").describe("test an alternate condition; used after -if").options(w),x.command("else").describe("run commands if all preceding -if/-elif conditions are false"),x.command("endif").describe("mark the end of an -if sequence"),x.command("ignore").option("empty",{describe:"ignore empty files",type:"flag"}).option("target",e),x.command("stop").describe("stop processing (skip remaining commands)"),x.section("Informational commands"),x.command("calc").describe("calculate statistics about the features in a layer").example("Calculate the total area of a polygon layer\n$ mapshaper polygons.shp -calc 'sum($.area)'").example("Count census blocks in NY with zero population\n$ mapshaper ny-census-blocks.shp -calc 'count()' where='POPULATION == 0'").validate(hv).option("expression",{DEFAULT:!0,describe:"functions: sum() average() median() max() min() count()"}).option("where",y).option("target",e).option("to-layer",i).option("name",r),x.command("colors").describe("print list of color scheme names"),x.command("comment").describe("add a comment to the sequence of commands").option("message",{DEFAULT:{multi_arg:!0,join:" "}}),x.command("encodings").describe("print list of supported text encodings (for .dbf import)"),x.command("help").alias("h").describe("print help; takes optional command name").option("command",{DEFAULT:!0,describe:"view detailed information about a command"}),x.command("info").describe("print information about data layers").option("save-to",{describe:"name of file to save info in JSON format"}).option("target",e).option("to-layer",i).option("name",r),x.command("inspect").describe("print information about a feature").option("expression",{DEFAULT:!0,describe:"boolean JS expression for selecting a feature"}).option("target",e).validate(hv),x.command("print").describe("print a message to stdout").option("message",{DEFAULT:{multi_arg:!0,join:" "}}),x.command("projections").describe("print list of supported projections"),x.command("quiet").describe("inhibit console messages"),x.command("verbose").describe("print verbose processing messages"),x.command("version").alias("v").describe("print mapshaper version"),x.command("debug"),x}var Iv=[1,"437",2,"850",3,"1252",8,"865",9,"437",10,"850",11,"437",13,"437",14,"850",15,"437",16,"850",17,"437",18,"850",19,"932",20,"850",21,"437",22,"850",23,"865",24,"437",25,"437",26,"850",27,"437",28,"863",29,"850",31,"852",34,"852",35,"852",36,"860",37,"850",38,"866",55,"850",64,"852",77,"936",78,"949",79,"950",80,"874",87,"1252",88,"1252",89,"1252",100,"852",101,"866",102,"865",103,"861",106,"737",107,"857",108,"863",120,"950",121,"949",122,"936",123,"932",124,"874",134,"737",135,"852",136,"857",200,"1250",201,"1251",202,"1254",203,"1253",204,"1257"],kv={932:"Japanese",936:"Simplified Chinese",950:"Traditional Chinese",1252:"Western European",949:"Korean",874:"Thai",1250:"Eastern European",1251:"Russian",1254:"Turkish",1253:"Greek",1257:"Baltic"},Cv='To set the text encoding, re-import using the "encoding=" option.\nTo list the supported encodings, run the "encodings" command.';function Pv(e,t,n){for(var r,i=e.position(),a=0,o=0;o<t&&0!==(r=e.readUint8());o++)(a>0||32!=r)&&(n[a++]=r);for(;a>0&&32==n[a-1];)a--;return e.position(i+t),a}function Ov(e){var n=e||"ascii",r=Gr(n),i=t.createBuffer(256);return"utf8"==r||"ascii"==r?function(e,t){var n=Pv(e,t,i);return i.toString(r,0,n)}:function(e,t){var r,a,o=Pv(e,t,i),s="";for(r=0;r<o;r++){if((a=i[r])>127)return qr(i,n,0,o);s+=String.fromCharCode(a)}return s}}function Nv(e,t){for(var n=0;n<t;n++)if(e[n]>=128)return!0;return!1}function Tv(e,t){return e.readInt32()}function Lv(e,t){var n=e.readCString(t),r=null;return/[ty]/i.test(n)?r=!0:/[fn]/i.test(n)&&(r=!1),r}function zv(e,t){var n=e.readCString(t),r=n.substr(0,4),i=n.substr(4,2),a=n.substr(6,2);return new Date(Date.UTC(+r,+i-1,+a))}function Rv(e,n){var r,i,a=t.isString(e)?new Ly(e,{cacheSize:33554432,bufferSize:4194304}):new Ty(e),o=function(e){var t=e.readToBinArray(0,Math.min(8193,e.size()));t.position(0).littleEndian();var n,r={version:t.readInt8(),updateYear:t.readUint8(),updateMonth:t.readUint8(),updateDay:t.readUint8(),recordCount:t.readUint32(),dataOffset:t.readUint16(),recordSize:t.readUint16(),incompleteTransaction:t.skipBytes(2).readUint8(),encrypted:t.readUint8(),mdx:t.skipBytes(12).readUint8(),ldid:t.readUint8()},i=1;t.skipBytes(2),r.fields=[];for(;13!=t.peek()&&10!=t.peek()&&t.position()<r.dataOffset-1;)(n=u(t)).columnOffset=i,r.fields.push(n),i+=n.size;i!=r.recordSize&&vt("Record length mismatch; header:",r.recordSize,"detected:",i);13!=t.peek()&&xt("Found a non-standard DBF header terminator ("+t.peek()+"). DBF file may be corrupted.");return r}(a);function s(){if(!r){var e="ascii";l(),g().length>0&&(e=h()),r=o.fields.map(function(n){var r=t.extend({},n);return r.name=$r(n.namebuf,e),r}),ri(t.pluck(r,"name")).forEach(function(e,t){r[t].name=e})}}function u(e){var n=t.createBuffer(11),r=Pv(e,11,n);return{namebuf:t.createBuffer(n.slice(0,r)),type:String.fromCharCode(e.readUint8()),address:e.readUint32(),size:e.readUint8(),decimals:e.readUint8(),id:e.skipBytes(2).readUint8(),position:e.skipBytes(2).readUint8(),indexFlag:e.skipBytes(7).readUint8()}}function c(){return s(),t.pluck(r,"name")}function f(e){return o.dataOffset+o.recordSize*e}function l(){i||(i=n||function(){var e,n=o.ldid,r=function(e){var t=Iv.indexOf(e);return-1==t?null:Iv[t+1]}(n),i=function(){var e,n,r,i,s,u,c=[],l=o.fields.filter(function(e){return"C"==e.type}),h=l.length,p=Math.min(o.recordCount,1e4),d=50,m=t.createBuffer(256),y={};c=g();for(var v=0;v<p;v++){u=(s=a.readToBinArray(f(v),o.recordSize)).position();for(var b=0;b<h&&!(c.length>=d);b++)e=l[b],s.position(u+e.columnOffset),(n=Pv(s,e.size,m))>0&&Nv(m,n)&&(i=(r=t.createBuffer(m.slice(0,n))).toString("hex"))in y==!1&&(y[i]=!0,c.push(r))}return c}(),s=0===i.length;r&&87!=n?e=r:s&&(e="ascii");if(!e){var u,c=Jy(i);e=c.encoding,c.confidence<2&&(u="Warning: Unable to auto-detect the DBF file text encoding"+(1==c.confidence?" with high confidence":"")+".",u+=" Defaulting to "+e+(e in kv?" ("+kv[e]+").":"."),u+="\n\nSample of how non-ascii text was imported:\n",qc()?u+="<pre>"+Rt(Wy(e,i),50)+"</pre>":u+=Rt(Wy(e,i)),xt(u+="\n\n"+Cv+"\n"))}return e}())}function h(){return l(),i}function p(){s();var e,t=r.map(d),n=(e=c().map(function(e,t){return JSON.stringify(e)+": arguments["+t+"]"}),new Function("return {"+e.join(",")+"};")),i=[];return function(e){var s,u,c=a.readToBinArray(f(e),o.recordSize),l=c.position();(c.bytesLeft()<o.recordSize||c.bytesLeft()==o.recordSize&&26==c.peek(c.size()-1))&&bt("Invalid DBF file: encountered end-of-file while reading data");for(var h=0,p=r.length;h<p;h++)s=l+(u=r[h]).columnOffset,c.position(s),i[h]=t[h](c,u.size);return n.apply(null,i)}}function d(e){var t=e.type,n=null;return"I"==t?n=Tv:"F"==t||"N"==t?n=function(){var e=Ov("ascii");return function(t,n){var r,i=e(t,n);return i.indexOf(",")>=0&&(i=i.replace(",",".")),r=parseFloat(i),isNaN(r)?null:r}}():"L"==t?n=Lv:"D"==t?n=zv:"C"==t?n=Ov(h()):(xt('Field "'+e.name+'" has an unsupported type ('+e.type+") -- converting to null values"),n=function(){return null}),n}function g(){var e=[];return o.fields.forEach(function(t){Nv(t.namebuf,t.namebuf.length)&&e.push(t.namebuf)}),e}this.size=function(){return o.recordCount},this.readRow=function(e){return p()(e)},this.getFields=c,this.getBuffer=function(){return a.readSync(0,a.size())},this.deleteField=function(e){s(),r=r.filter(function(t){return t.name!=e})},this.readRows=function(){for(var e=p(),t=[],n=0,r=this.size();n<r;n++)t.push(e(n));return t}}function Dv(e,t){return new jv(e,(t||{}).encoding)}function jv(e,t){var n,r=new Rv(e,t),i=!1;function a(){return n||(n=new di(r.readRows()),r=null,e=null),n}this.exportAsDbf=function(e){if(!(!r||i||e.field_order||e.encoding))try{return r.getBuffer()}catch(e){}return Tm.exportRecords(a().getRecords(),e.encoding,e.field_order)},this.getReadOnlyRecordAt=function(e){return r?r.readRow(e):n.getReadOnlyRecordAt(e)},this.deleteField=function(e){n?n.deleteField(e):(i=!0,r.deleteField(e))},this.getRecords=function(){return a().getRecords()},this.getFields=function(){return r?r.getFields():n.getFields()},this.isEmpty=function(){return r?0===this.size():n.isEmpty()},this.size=function(){return r?r.size():n.size()}}Object.assign(jv.prototype,di.prototype);var Fv=Object.freeze({__proto__:null,ShapefileTable:jv,importDbfTable:Dv});function Uv(e){return[ay.POLYGON,ay.POLYGONM,ay.POLYGONZ].includes(e)?"polygon":[ay.POLYLINE,ay.POLYLINEM,ay.POLYLINEZ].includes(e)?"polyline":[ay.POINT,ay.POINTM,ay.POINTZ,ay.MULTIPOINT,ay.MULTIPOINTM,ay.MULTIPOINTZ].includes(e)?"point":null}function Bv(e){return[0,1,3,5,8,11,13,15,18,21,23,25,28].includes(e)}var Gv=Object.freeze({__proto__:null,isSupportedShapefileType:Bv,translateShapefileType:Uv});function qv(e){var t,n,r=ay.hasBounds(e),i=ay.isMultiPartType(e),a=ay.isZType(e),o=ay.isMType(e),s=!r,u=s?0:16;t=function(t,n){var r=t.position();if(this.id=t.bigEndian().readUint32(),this.type=t.littleEndian().skipBytes(4).readUint32(),0===this.type||0===e)return{id:this.id,isNull:!0,pointCount:0,partCount:0,byteLength:12};(n>0!=!0||this.type!=e&&0!==this.type)&&vt("Unable to read a shape -- .shp file may be corrupted"),this.byteLength=n,s?(this.pointCount=1,this.partCount=1):(t.skipBytes(32),this.partCount=i?t.readUint32():1,this.pointCount=t.readUint32()),this._data=function(){return t.position(r)}};var c={_xypos:function(){var e=12;return s||(e+=4),r&&(e+=32),i&&(e+=4*this.partCount+4),e},readCoords:function(){if(0===this.pointCount)return null;var e=this.readPartSizes(),t=this._data().skipBytes(this._xypos());return e.map(function(e){return t.readFloat64Array(2*e)})},readXY:function(){return 0===this.pointCount?new Float64Array(0):this._data().skipBytes(this._xypos()).readFloat64Array(2*this.pointCount)},readPoints:function(){for(var e,t=this.readXY(),n=a?this.readZ():null,r=o&&this.hasM()?this.readM():null,i=[],s=0,u=t.length/2;s<u;s++)e=[t[2*s],t[2*s+1]],n&&e.push(n[s]),r&&e.push(r[s]),i.push(e);return i},readPartSizes:function(){var e,t,n,r=[];if(0===this.pointCount);else if(1==this.partCount)r.push(this.pointCount);else{t=0,n=this._data().skipBytes(56);for(var i=0,a=this.partCount;i<a;i++)(e=(i<a-1?n.readUint32():this.pointCount)-t)>0&&(r.push(e),t+=e)}return r}},f={read:function(){var e=2;return a&&e++,this.hasM()&&e++,this._data().skipBytes(12).readFloat64Array(e)},stream:function(e){var t=this._data().skipBytes(12);e.addPoint(t.readFloat64(),t.readFloat64()),e.endPath()}},l={readBounds:function(){return this._data().skipBytes(12).readFloat64Array(4)},stream:function(e){for(var t,n=this.readPartSizes(),r=this.readXY(),i=0,a=0;i<n.length;){for(t=n[i];t-- >0;)e.addPoint(r[a++],r[a++]);e.endPath(),i++}r.length!=a&&vt("Counting error")},stream2:function(e){for(var t,n=this.readPartSizes(),r=this._data().skipBytes(this._xypos()),i=0;i<n.length;){for(t=n[i];t-- >0;)e.addPoint(r.readFloat64(),r.readFloat64());e.endPath(),i++}},read:function(){for(var e=[],t=this.readPartSizes(),n=this.readPoints(),r=0,i=t.length-1;r<i;r++)e.push(n.splice(0,t[r]));return e.push(n),e}},h={_mpos:function(){var e=this._xypos()+16*this.pointCount;return a&&(e+=8*this.pointCount+u),e},readMBounds:function(){return this.hasM()?this._data().skipBytes(this._mpos()).readFloat64Array(2):null},readM:function(){return this.hasM()?this._data().skipBytes(this._mpos()+u).readFloat64Array(this.pointCount):null},hasM:function(){var e=this._mpos(),t=e+8*this.pointCount+u;return this.byteLength!=e&&(this.byteLength==t||void vt("#hasM() Counting error"))}},p={_zpos:function(){return this._xypos()+16*this.pointCount},readZBounds:function(){return this._data().skipBytes(this._zpos()).readFloat64Array(2)},readZ:function(){return this._data().skipBytes(this._zpos()+u).readFloat64Array(this.pointCount)}};return n=0===e?{}:s?Object.assign(c,f):Object.assign(c,l),a&&Object.assign(n,p),o&&Object.assign(n,h),t.prototype=n,n.constructor=t,t}function Vv(e,n){if(this instanceof Vv==!1)return new Vv(e,n);var r,i,a=t.isString(e)?new Ly(e):new Ty(e),o=function(e){var t={signature:e.bigEndian().readUint32(),byteLength:2*e.skipBytes(20).readUint32(),version:e.littleEndian().readUint32(),type:e.readUint32(),bounds:e.readFloat64Array(4),zbounds:e.readFloat64Array(2),mbounds:e.readFloat64Array(2)};9994!=t.signature&&vt("Not a valid .shp file");Bv(t.type)||vt("Unsupported .shp type:",t.type);t.byteLength!=a.size()&&vt("File size of .shp doesn't match size in header");return t}(a.readToBinArray(0,100)),s=o.type,u=100,c=0,f=0,l=new qv(s);function h(e,t){var n=e.size();if(t+12>n)return null;var r=e.readToBinArray(t,12);r.bigEndian().readUint32();var i=2*r.readUint32()+8,a=r.littleEndian().readUint32();return t+i<=n&&i>=12&&(0===a||a==s)?(r=e.readToBinArray(t,i),new l(r,i)):null}n&&(i=t.isString(n)?new Ly(n):new Ty(n),r=i.readToBinArray(0,i.size()).bigEndian()),this.header=function(){return o},this.forEachShape=function(e){for(var t=this.nextShape();t;)e(t),t=this.nextShape()},this.nextShape=function(){var e;return a||vt("Tried to read from a used ShpReader"),e=function(e){return r?function(e,t,n){if(t.size()<=100+8*n)return null;t.position(100+8*n);var r=n+1,i=2*t.readUint32();t.readUint32();var a=h(e,i);a||bt("Index of Shapefile record",r,"in the .shx file is invalid.");a.id!=r&&(f++,Mt(`Warning: A feature has a different record number in .shx (${r}) and .shp (${a.id}).`));return a}(a,r,e):function(e,t,n){var r,i,a,o=n+1,c=t,f=e.size(),l=null;for(;c+12<=f;)if(i=(r=e.readToBinArray(c,12)).bigEndian().readUint32(),!((a=r.littleEndian().skipBytes(4).readUint32())==s||0===a)||i!=o&&0===a)c+=4;else{if(!(l=h(e,c)))break;if(u=c+l.byteLength,i==o)break;i<o?(xt("Found a Shapefile record with the same id as a previous record ("+l.id+") -- skipping."),c+=l.byteLength):bt("Shapefile contains an out-of-sequence record. Possible data corruption -- bailing.")}l&&c>t&&Mt("Skipped over "+(c-t)+" non-data bytes in the .shp file.");return l}(a,u,e)}(c),e?(c++,e):(a.close(),a=i=r=null,f>0&&xt(`Warning: ${f}/${c} features have non-standard record numbers in the .shp file.`),null)}}function $v(e,t){var n,r=e.arcs;(t.snap||t.auto_snap||t.snap_interval)&&(t.snap_interval&&(n=oh(t.snap_interval,Ia(e))),r&&Gn(r,n)),e.layers.forEach(function(e){wi(e)&&Rp(e.shapes,r,e.geometry_type)})}function Jv(e){return e[0]>-1e38&&e[1]>-1e38}function Wv(e){var n=1e4,r=new Float64Array(n),i=new Float64Array(n),a=0;this.endPath=function(){e(r,i,a),a=0},this.addPoint=function(e,o){a>=n&&(n=Math.ceil(1.3*n),r=t.extendBuffer(r,n),i=t.extendBuffer(i,n)),r[a]=e,i[a]=o,a++}}function Zv(e){var n=e.reserved_points>0?e.reserved_points:2e4,r=new Float64Array(n),i=new Float64Array(n),a=[],o=[],s=[],u=[],c=e.type||null,f=null,l=-1,h=-1,p=0,d=0,g=0;function m(e){var t=h<u.length?u[h]:null;t?t!=e&&bt("Unable to import mixed-geometry features"):(u[h]=e,c?e!=c&&(c="mixed"):c=e)}function y(e){if(e>r.length){var n=Math.max(e,Math.ceil(1.5*r.length));r=t.extendBuffer(r,n,p),i=t.extendBuffer(i,n,p)}}function v(e){(a[h]||(a[h]=[])).push(e)}e.precision&&(f=Vl(e.precision)),t.extend(this,new Wv(function(e,t,n){var a,o,u,h,m=0;y(p+n);for(var b=0;b<n;b++)a=e[b],o=t[b],f&&(a=f(a),o=f(o)),b>0&&a==u&&o==h?d++:(r[p]=a,i[p]=o,p++,m++),h=o,u=a;"polygon"==c&&m>0&&(e[0]==e[n-1]&&t[0]==t[n-1]||(y(p+1),r[p]=e[0],i[p]=t[0],g++,p++,m++));!function(e){l++,s[l]=e,v([l])}(m)})),this.startShape=function(e){a[++h]=null,e&&(o[h]=e)},this.importLine=function(e){e.length<2?Mt("Skipping a defective line"):(m("polyline"),this.importPath(e))},this.importPoints=function(e){m("point"),e=e.filter(Jv),f&&e.forEach(function(e){e[0]=f(e[0]),e[1]=f(e[1])}),e.forEach(v)},this.importRing=function(e,t){var n=fr.getPlanarPathArea2(e);!n||e.length<4?Mt("Skipping a defective ring"):(m("polygon"),(!0===t&&n>0||!1===t&&n<0)&&e.reverse(),this.importPath(e))},this.importPath=function(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],this.addPoint(t[0],t[1]);this.endPath()},this.done=function(){var e,n,f={name:""};return d>0&&Mt(t.format("Removed %,d duplicate point%s",d,t.pluralSuffix(d))),g>0&&xt(t.format("Closed %,d open polygon ring%s",g,t.pluralSuffix(g))),p>0&&(p<r.length&&(r=r.subarray(0,p),i=i.subarray(0,p)),e=new Wa(s,r,i)),"mixed"==c?n=ji(a,o,u):(f={geometry_type:c},c&&(f.shapes=a),o.length>0&&(f.data=new di(o)),n=[f]),n.forEach(function(e){e.data&&Kr(e.data.getRecords())}),{arcs:e||null,info:{},layers:n}}}Vv.prototype.type=function(){return this.header().type};var Yv=Object.freeze({__proto__:null,PathImporter:Zv,cleanPathsAfterImport:$v,pointHasValidCoords:Jv});function Hv(e,n,r){var i=new Vv(e,n),a=i.type(),o=Uv(a),s=new Zv(t.defaults({type:o,reserved_points:Math.round(i.header().byteLength/16)},r));return Bv(a)||bt("Unsupported Shapefile type:",a),ay.isZType(a)?Mt("Warning: Shapefile Z data will be lost."):ay.isMType(a)&&Mt("Warning: Shapefile M data will be lost."),i.forEachShape(function(e){s.startShape(),e.isNull||("point"==o?s.importPoints(e.readPoints()):e.stream(s))}),s.done()}var Xv=Object.freeze({__proto__:null,importShp:Hv});function Kv(e,n){var r,i,a=n||{},o=Object.keys(_d.pathImporters),s=t.isString(e)?JSON.parse(e):e,u=new Qv(a);return((r="Feature"==s.type?{type:"FeatureCollection",features:[s]}:o.includes(s.type)?{type:"GeometryCollection",geometries:[s]}:s).features||r.geometries||[]).forEach(u.parseObject),tb(i=u.done(),s),i}function Qv(e){var t=e.id_field||_d.ID_FIELD,n=new Zv(e);this.parseObject=function(r){var i,a;r&&r.type?"Feature"==r.type?(i=r.geometry,a=r.properties||{},"id"in r&&(a[t]=r.id)):i=r:i=null,i&&"GeometryCollection"==i.type?_d.importComplexFeature(n,i,a,e):e.single_part&&function(e){return e&&e.type&&0===e.type.indexOf("Multi")}(i)?_d.importMultiAsSingles(n,i,a,e):_d.importSimpleFeature(n,i,a,e)},this.done=function(){return n.done()}}function eb(e,t){return t=t||{},e.forEach(function(e){if(e){var n=_d.translateGeoJSONType(e.type);n?(n in t==!1&&(t[n]=[]),t[n].push(e)):"GeometryCollection"==e.type&&eb(e.geometries||[],t)}}),Object.values(t)}function tb(e,t){"crs"in t&&(e.info.input_geojson_crs=t.crs)}_d.importComplexFeature=function(e,t,n,r){var i=eb(t.geometries||[]);0!==i.length?i.forEach(function(t,i){e.startShape(Hr(n)),t.forEach(function(t){_d.importSimpleGeometry(e,t,r)})}):e.startShape(n)},_d.importSimpleFeature=function(e,t,n,r){e.startShape(n),_d.importSimpleGeometry(e,t,r)},_d.importMultiAsSingles=function(e,t,n,r){t.coordinates.forEach(function(i,a){var o={type:t.type.substr(5),coordinates:i},s=0===a?n:Hr(n);_d.importSimpleFeature(e,o,s,r)})},_d.importSimpleGeometry=function(e,t,n){var r=t?t.type:null;if(null===r);else if(r in _d.pathImporters){if(n.geometry_type&&n.geometry_type!=_d.translateGeoJSONType(r))return;_d.pathImporters[r](t.coordinates,e)}else Mt("Unsupported geometry type:",t.type)},_d.pathImporters={LineString:function(e,t){t.importLine(e)},MultiLineString:function(e,t){for(var n=0;n<e.length;n++)_d.pathImporters.LineString(e[n],t)},Polygon:function(e,t){for(var n=0;n<e.length;n++)t.importRing(e[n],n>0)},MultiPolygon:function(e,t){for(var n=0;n<e.length;n++)_d.pathImporters.Polygon(e[n],t)},Point:function(e,t){t.importPoints([e])},MultiPoint:function(e,t){t.importPoints(e)}};var nb=Object.freeze({__proto__:null,GeoJSONParser:Qv,importCRS:tb,importGeoJSON:Kv});function rb(e,n){var r,i,a;return t.isString(e)&&(e=JSON.parse(e)),e.arcs&&e.arcs.length>0&&(e.transform&&function(e,t){var n=t.scale[0],r=t.scale[1],i=t.translate[0],a=t.translate[1];e.forEach(function(e){for(var t,o,s,u=0,c=0,f=0,l=e.length;f<l;f++)o=(t=e[f])[0]+u,s=t[1]+c,t[0]=o*n+i,t[1]=s*r+a,u=o,c=s})}(e.arcs,e.transform),n&&n.precision&&function(e,t){var n,r=Vl(t);e.forEach(function(e){for(var t=0,i=e.length;t<i;t++)(n=e[t])[0]=r(n[0]),n[1]=r(n[1])})}(e.arcs,n.precision),i=new Wa(e.arcs)),a=Object.keys(e.objects).reduce(function(t,r){for(var a,o=uy.importObject(e.objects[r],i,n),s=0,u=o.length;s<u;s++)(a=o[s]).name=r,t.push(a);return t},[]),a.forEach(function(t){var n,r;wi(t)&&Rp(t.shapes,i,t.geometry_type),"point"==t.geometry_type&&e.transform&&(n=t.shapes,r=e.transform,Wt(n,function(e){e[0]=e[0]*r.scale[0]+r.translate[0],e[1]=e[1]*r.scale[1]+r.translate[1]})),t.data&&Kr(t.data.getRecords())}),tb(r={layers:a,arcs:i,info:{}},e),e.metadata&&function(e,t){t.proj4&&Ea(e,wa(t.proj4))}(r,e.metadata),r}uy.importObject=function(e,t,n){var r=new uy.GeometryImporter(t,n);return("GeometryCollection"==e.type?e.geometries:[e]).forEach(r.addGeometryObject,r),r.done()},uy.GeometryImporter=function(e,t){var n,r=t&&t.id_field||_d.ID_FIELD,i=[],a=[],o=[],s=0,u=null;this.addGeometryObject=function(e){var t=e.properties||null;n=a.length,a[n]=null,"id"in e&&((t=t||{})[r]=e.id),i[n]=t,t||s++,e.type&&this.addShape(e)},this.addShape=function(t){var r,i=a[n],o=_d.translateGeoJSONType(t.type);"GeometryCollection"==t.type?t.geometries.forEach(this.addShape,this):o?(this.setGeometryType(o),(r=uy.shapeImporters[t.type](t,e))&&r.length&&(Array.isArray(r[0])?a[n]=i?i.concat(r):r:bt("Invalid TopoJSON",t.type,"geometry"))):t.type&&bt("Invalid TopoJSON geometry type:",t.type)},this.setGeometryType=function(e){var t=n<o.length?o[n]:null;t?t!=e&&bt("Unable to import mixed-type TopoJSON geometries"):(o[n]=e,this.updateCollectionType(e))},this.updateCollectionType=function(e){u?e&&u!=e&&(u="mixed"):u=e},this.done=function(){return"mixed"==u?ji(a,i,o):[{geometry_type:u,shapes:u?a:null,data:s<a.length?new di(i):null}]}},uy.importPolygonArcs=function(e,t){var n,r=e[0],i=null;if(t||bt("Invalid TopoJSON file: missing arc data."),!(n=r?fr.getPlanarPathArea(r,t):null))return null;n<0&&mr(r),i=[r];for(var a=1;a<e.length;a++)r=e[a],(n=fr.getPlanarPathArea(r,t))&&(n>0&&mr(r),i.push(r));return i},uy.shapeImporters={Point:function(e){return[e.coordinates]},MultiPoint:function(e){return e.coordinates},LineString:function(e){return[e.arcs]},MultiLineString:function(e){return e.arcs},Polygon:function(e,t){return uy.importPolygonArcs(e.arcs,t)},MultiPolygon:function(e,t){return e.arcs.reduce(function(e,n){var r=uy.importPolygonArcs(n,t);return r&&(e=e?e.concat(r):r),e},null)}};var ib,ab=Object.freeze({__proto__:null,importTopoJSON:rb}),ob=123,sb=93,ub=34,cb=44,fb=4096,lb=1e7;function hb(e,t){var n=Lb(e,0),r=function(e){var t=e.getChar(),n=0;for(;t!=ib&&n<fb;){if(n++,t==ob)return e.back(),!0;t=e.getChar()}return!1}(n);r||bt("File is not GeoJSON");var i=Eb(n,t);if("FeatureCollection"==i.type||"GeometryCollection"==i.type)return i;for(i.type||bt("Invalid GeoJSON"),t(i),yb(n);n.peek()==ob;)t(Eb(n,t)),yb(n);return null}function pb(e,t){t>=0&&(e+=" at position "+t),bt(e)}function db(e,t){if(e==ib)return pb("Unexpected end of JSON input");pb(e==ub?"Unexpected string in JSON":e<33||e>126?"Unexpected token in JSON":"Unexpected token "+String.fromCharCode(e)+" in JSON",t)}function gb(e,t){t==ib&&pb("Unterminated string in JSON",e),pb("Too-long string in JSON",e)}function mb(e){return 32==e||10==e||13==e||9==e}function yb(e){for(;mb(e.peek());)e.advance()}function vb(e,t){var n;for(xb(e,91),n=wb(e,sb);n!=sb;)e.refresh(),t(bb(e)),n=Ab(e,cb,sb)}function bb(e){var t,n,r,i,a=e.index();if(91==e.getChar()&&Ob(e.peek())&&(t=Tb(e),r=e.getChar(),yb(e),r==cb&&Ob(e.peek()))){if(n=Tb(e),(i=e.getChar())==sb)return[t,n];if(i==cb)return function(e,t){yb(e);do{e.refresh(),t.push(Sb(e))}while(Ab(e,cb,sb)==cb);return t}(e,[t,n])}return e.index(a),Sb(e)}function _b(e,t){for(var n=0;n<t.length;n++)xb(e,t.charCodeAt(n));return!0}function xb(e,t){var n=e.getChar();n!=t&&db(n,e.index()-1)}function wb(e,t){return yb(e),e.peek()===t?(e.advance(),yb(e),t):null}function Sb(e){var t,n=e.peek();return Ob(n)?t=Tb(e):91==n?t=function(e){var t,n=[];for(xb(e,91),t=wb(e,sb);t!=sb;)e.refresh(),n.push(bb(e)),t=Ab(e,cb,sb);return n}(e):n==ub?t=kb(e):n==ob?t=Eb(e):110==n?t=function(e){return _b(e,"null"),null}(e):116==n?t=function(e){return _b(e,"true"),!0}(e):102==n?t=function(e){return _b(e,"false"),!1}(e):db(n,e.index()),t}function Ab(e,t,n){yb(e);var r=e.getChar();return r!=t&&r!=n&&db(r,e.index()-1),yb(e),r}function Eb(e,t){var n,r,i={};for(xb(e,ob),r=wb(e,125);125!=r;)e.refresh(),n=Ib(e),yb(e),xb(e,58),yb(e),"features"!=n&&"geometries"!=n||91!=e.peek()||!t?"type"==n&&e.peek()==ub?i[n]=Ib(e):i[n]=Sb(e):(vb(e,t),i[n]=null),r=Ab(e,cb,125);return i}function Mb(){return(fb*=2)<=5e6}function Ib(e){var t=e.index(),n=e.cache,r=!1,i=0;xb(e,ub);for(var a=e.getChar();a!=ub||!0===r;)++i>2e3&&gb(t,a),r?r=!1:92==a&&(r=!0),n[a]||(n[a]=[]),n=n[a],a=e.getChar();return n[0]||(e.index(t),n[0]=kb(e)),n[0]}function kb(e){var t=e.index();xb(e,ub);for(var n=0,r="",i=e.getChar();i!=ub;){if(++n>256||92==i||i<32||i>126)return e.index(t),Cb(e);r+=String.fromCharCode(i),i=e.getChar()}return r}function Cb(e){e.refresh();var t=fb-2,n=e.index(),r=0,i=!1;xb(e,ub);for(var a,o=e.getChar();o!=ub||!0===i;){if(++r>t)return o!=ib&&Mb()||gb(n,o),e.index(n),Cb(e);i?i=!1:92==o&&(i=!0),o=e.getChar()}return a=JSON.parse(e.toString(n,r+2)),e.refresh(),a}function Pb(e){return e>=48&&e<=57}function Ob(e){return e>=48&&e<=57||45==e}function Nb(e){return e>=48&&e<=57||45==e||46==e||43==e||69==e||101==e}function Tb(e){var t,n,r=e.index(),i=0,a=1,o=1,s=!1,u=!1,c=e.getChar();for(45===c&&(o=-1,c=e.getChar()),t=c;Pb(c);)i=10*i+(n=c-48),c=e.getChar();if(i>0&&48===t&&(u=!0),46==c){for(;Pb(c=e.getChar());)a*=10,i=10*i+(n=c-48);1!=a&&46!=t||(u=!0)}return 0===i&&48!=t&&(u=!0),u&&pb("Invalid number in JSON",r),a>1e22&&(s=!0),i>=9007199254740992&&(!(i>=0x40000000000000)&&1&~n||(s=!0)),s||69==c||101==c?(e.index(r),function(e){for(var t=e.index(),n=0;Nb(e.getChar());)n++;e.back();var r=e.toString(t,n),i=Number(r);return isNaN(i)&&pb("Invalid number in JSON",t),i}(e)):(e.back(),o*i/a)}function Lb(e,t){var n=e.size(),r=t,i=e.readSync(r,lb),a=0,o={peek:function(){return i[a]},getChar:function(){return i[a++]},advance:function(){a++},back:function(){a--},toString:function(e,t){var n=e-r;return i.toString("utf8",n,n+t)},index:function(e){if(e>=0==!1)return a+r;a=e-r},refresh:s,cache:[]};return s(),o;function s(){i.length-a>=fb||r+i.length>=n||(r+=a,a=0,i=e.readSync(r,lb))}}function zb(e,t){var n=null;return e.length>1e3&&(e=e.substr(0,1e3)),e=e.replace(/\s/g,""),t&&t.json_path||/^\[[{\]]/.test(e)?n="json":/"arcs":\[|"objects":\{|"transform":\{/.test(e)?n="topojson":/^\{"/.test(e)&&(n="geojson"),n}function Rb(e){var n=null;return e&&("Topology"==e.type?n="topojson":e.type?n="geojson":t.isArray(e)&&(n="json")),n}function Db(e,t){var n=new Qv(t);return hb(e,n.parseObject),n.done()}function jb(e,n){var r,i,a=e.content,o=e.filename,s={filename:o};if(a?(a instanceof ArrayBuffer||a instanceof u||a instanceof Uint8Array)&&((a.byteLength||a.length)<1e7?a=qr(t.createBuffer(a)):(r=new Ty(a),a=null)):r=new Ly(o),r&&(e=function(e,t){var n;return n="geojson"==zb(Oy(e,1e3),t)?{dataset:Db(e,t),format:"geojson"}:{content:e.toString("utf8")},e.close(),n}(r,n),e.dataset?(s.dataset=e.dataset,s.format=e.format):a=e.content),a){if(t.isString(a))try{a=JSON.parse(a)}catch(e){bt("JSON parsing error:",e.message)}n.json_path?(i=Rb(a=function(e,t){var n,r,i,a=/(.*)\[([0-9]+)\]$/,o=t.indexOf("/")>0?"/":".",s=t.split(o);for(;s.length>0;)if(n=s.shift(),!(e=(i=a.exec(n))?(r=e[i[1]])&&r[+i[2]]||null:e[n]))return null;return e}(a,n.json_path)))||bt("Unexpected object type at JSON path:",n.json_path):i=Rb(a),"topojson"==i?s.dataset=rb(a,n):"geojson"==i?s.dataset=Kv(a,n):"json"==i?s.dataset=yy(a):bt("Unknown JSON format"),s.format=i}return s}var Fb=Object.freeze({__proto__:null,identifyJSONObject:Rb,identifyJSONString:zb,importGeoJSONFile:Db,importJSON:jb});function Ub(e,n){var r,i,a;return n=n||{},e.json?(i=(a=jb(e.json,n)).format,$v(r=a.dataset,n)):e.text?(i="dsv",r=tv(a=e.text,n)):e.shp?(i="shapefile",a=e.shp,r=function(e,n){var r,i=e.shp.content||e.shp.filename,a=e.shx?e.shx.content||e.shx.filename:null,o=Hv(i,a,n),s=o.layers[0];e.dbf&&(r=Bb(e,n),t.extend(o.info,r.info),s.data=r.layers[0].data,s.shapes&&s.data.size()!=s.shapes.length&&xt("Mismatched .dbf and .shp record count -- possible data loss."));e.prj&&(o.info.prj=e.prj.content);e.cpg&&(o.info.cpg=e.cpg.content,"string"!=typeof o.info.cpg&&vt("Invalid encoding argument, expected a string"));return o}(e,n),$v(r,n)):e.dbf?(i="dbf",a=e.dbf,r=Bb(e,n)):e.prj?(i="prj",r={layers:[],info:{prj:(a=e.prj).content}}):e.kml&&(i="kml",r=function(e,t){var n=s("@tmcw/togeojson"),r="undefined"==typeof DOMParser?s("@xmldom/xmldom").DOMParser:DOMParser;return Kv(n.kml((new r).parseFromString(e,"text/xml")),t||{})}((a=e.kml).content,n)),r||bt("Missing an expected input type"),r.arcs&&!n.no_topology&&"topojson"!=i&&Ka(r),"topojson"!=i&&r.layers.forEach(function(e){e.name||(e.name=function(e){var t="layer1",n=Lo(e);n.basename&&n.extension&&(t=n.basename);return t}(a.filename||""))}),a.filename&&(r.info.input_files=[a.filename]),r.info.input_formats=[i],r}function Bb(e,n){return n=t.extend({},n),e.cpg&&!n.encoding&&(n.encoding=e.cpg.content),{info:{},layers:[{data:Dv(e.dbf.content||e.dbf.filename,n)}]}}var Gb=Object.freeze({__proto__:null,importContent:Ub,importFileContent:function(e,t,n){var r={};return r[pf(t,e)]={filename:t,content:e},Ub(r,n)}});async function qb(e){return Vb(Us(e,{}))}async function Vb(e){(function(e){if(!Array.isArray(e.datasets))return!1;return!0})(e)||bt("Invalid mapshaper session data object");var t=await Promise.all(e.datasets.map($b));return t=t.filter(Boolean),Object.assign(e,{datasets:t})}async function $b(e){var t=null,n=(e.layers||[]).map(Zb);try{e.arcs&&(t=await async function(e){if($c(e.xx)){var t=[];t.push(Zc(e.nn)),t.push(Zc(e.xx)),t.push(Zc(e.yy)),e.zz&&t.push(Zc(e.zz));var n=await Promise.all(t);e.nn=n.shift(),e.xx=n.shift(),e.yy=n.shift(),e.zz&&(e.zz=n.shift())}var r=Jb(e.nn,Uint32Array),i=Jb(e.xx,Float64Array),a=Jb(e.yy,Float64Array),o=new Wa(r,i,a);e.zz&&(o.setThresholds(Jb(e.zz,Float64Array)),o.setRetainedInterval(e.zlimit));return o}(e.arcs))}catch(e){return wt(`Some coordinates are corrupted, skipping ${1==n.length?"a layer":n.length+" layers"}.`),null}return{info:await Wb(e.info||{}),layers:n,arcs:t}}function Jb(e,t){return new t(Om.copyToArrayBuffer(e))}async function Wb(e){return e.crs_string?(await la({crs:e.crs_string}),e.crs=Sa(e.crs_string)):e.prj&&(e.crs=Ra(e.prj)),e}function Zb(e){var t=e.data;return t&&(t=Kc(t)),Object.assign(e,{data:e.data?new di(t):null})}var Yb=Object.freeze({__proto__:null,restoreSessionData:Vb,unpackSessionData:qb});function Hb(e,t){var n;e in t?n=t[e]:(n=e,Lf.checkFileExists(e));var r=If(n);return Object.assign(t,r),function(e){return Object.keys(e).filter(function(t){var n=ff(t);return("dbf"!=n||!(jo(t,"shp")in e))&&(n&&!lf(n))})}(r)}function Xb(e,t){return Kb(e,t)}pp.importFiles=async function(e,n){var r,i=n.files||[];return n.stdin?(r=Xb("/dev/stdin",n),e.addDataset(r),r):(i.length>0==!1&&bt("Missing input file(s)"),Mt("Importing: "+i.join(" ")),(n=Object.assign({},n)).input=Object.assign({},n.input),function(e,n){var r=e.map(e=>df(e)?"layer.json":null).filter(Boolean);if(0===r.length)return;r.length>1&&(r=t.uniqifyNames(r,Cy));e.forEach((t,i)=>{if(df(t)){var a=r.shift();n[a]=t,e[i]=a}})}(i,n.input),i=function(e,t){var n=[];return e.forEach(function(e){var r;r=bf(e)?Hb(e,t):_f(e)?function(e,t){var n=Hb(e,t),r=jo(Lo(e).filename,"kml");"doc.kml"==n[0]&&(n[0]=r,t[r]=t["doc.kml"]);return n}(e,t):[e],n=n.concat(r)}),n}(i,n.input),0===i.length&&bt("Missing importable files"),i.some(vf)?(i.length>1&&bt("Expected a single package file"),r=await async function(e,t,n){var r=Lf.readFile(e,null,n.input),i=await qb(r);return i.datasets.forEach(t.addDataset,t),i.target}(i[0],e,n),r):(r=1==i.length?Xb(i[0],n):Qb(i,n),n.merge_files&&i.length>1&&(r.layers=pp.mergeLayers(r.layers)),e.addDataset(r),r))};var Kb=function(e,n){var r,i=ff(e),a={},o=n&&n.encoding||null,s=n&&n.input||null,u=s&&e in s;if(Lf.checkFileExists(e,s),"shp"!=i&&"json"!=i&&"text"!=i&&"dbf"!=i||u)if(i&&Sf(e))r=Lf.readFile(e,null,s),t.isString(r)&&bt("Expected binary content, received a string");else if(i)r=Lf.readFile(e,o||"utf-8",s);else if("gz"==Ro(e)){var c=e;(i=ff(e=c.replace(/\.gz$/,"")))||bt("Unrecognized file type:",e),r=Yc(Lf.readFile(c,null,s),e)}else"text"==(i=hf(r=Lf.readFile(e,o||"utf-8",s)))&&r.indexOf("�")>-1&&(i=null);else r=null;return i||bt(function(e){var t=Ro(e),n="Unable to import "+e;"zip"==t.toLowerCase()?n+=" (ZIP files must be unpacked before running mapshaper)":n+=" (unknown file type)";return n}(e)),a[i]={filename:e,content:r},r=null,"shp"!=i&&"dbf"!=i||function(e,t,n){var r=jo(e,"dbf"),i=jo(e,"shx"),a=jo(e,"cpg"),o=jo(e,"prj");Lf.isFile(o,n)&&(t.prj={filename:o,content:Lf.readFile(o,"utf-8",n)});Lf.isFile(i,n)&&(t.shx={filename:i,content:Lf.readFile(i,null,n)});!t.dbf&&Lf.isFile(r,n)&&(t.dbf={filename:r,content:n&&r in n?Lf.readFile(r,null,n):null});t.dbf&&Lf.isFile(a,n)&&(t.cpg={filename:a,content:Lf.readFile(a,"utf-8",n).trim()})}(e,a,s),"shp"!=i||a.dbf||xt(t.format("[%s] .dbf file is missing - shapes imported without attribute data.",e)),Ub(a,n)};function Qb(e,n){var r=!1,i=io(e.map(function(e){var i=Xb(e,t.defaults({no_topology:!0,snap:!1,snap_interval:null,files:[e]},n));return i.arcs&&i.arcs.size()>0&&"topojson"!=i.info.input_formats[0]&&(r=!0),i}));return r&&!n.no_topology&&($v(i,n),Ka(i)),i}var e_=Object.freeze({__proto__:null,importFile:Xb,importFilesTogether:Qb,replaceImportFile:function(e){Kb=e}});function t_(e,t){return function(e){return/[$][{]/.test(e)}(e)?((t.length>1||1!=t[0].layers.length)&&bt("Interpolated names are not compatible with multiple targets."),n_(e,t[0].layers[0])):e}function n_(e,t){var n={target:t.name||""},r="with($$ctx) { return `"+e+"`; }";try{e=new Function("$$ctx",r)(n)}catch(t){bt("Unable to interpolate ["+e+"]")}return e}function r_(e,n,r){var i,a=n.findSingleLayer(e);return a||((i=Xb(e,t.defaults({no_topology:!0},r)))?i.layers.length>1&&bt("Multiple-layer sources are not supported"):bt(t.format("Unable to find source [%s]",e)),a={dataset:i,layer:i.layers[0],disposable:!0}),a}var i_=Object.freeze({__proto__:null,convertInterpolatedName:n_,convertSourceName:t_,findCommandSource:r_});function a_(){var e=[],t=[];function n(e,t){return{layer:e,dataset:t}}function r(e,t){var n=-1;return t.forEach(function(t,r){t.layer==e&&(n=r)}),n}this.forEachLayer=function(t){var n=0;e.forEach(function(e){e.layers.forEach(function(r){t(r,e,n++)})})},this.deleteLayer=function(e,n){this.getActiveLayer().layer==e&&(t=[]),n.layers.splice(n.layers.indexOf(e),1),0===n.layers.length&&this.removeDataset(n),t=t.filter(function(t){var n=t.layers.indexOf(e);return-1==n||(t.layers.splice(n,1),t.layers.length>0)})},this.findLayer=function(e){var t="function"==typeof e?e:null,r=null;return this.forEachLayer(function(i,a){(t?t(i,a):i==e)&&(r=n(i,a))}),r},this.findCommandTargets=function(e,t){return e?qh(this.getLayers(),e,t):this.getDefaultTargets()||[]},this.findSingleLayer=function(e){var t=$h(this.getLayers(),e);return t.length>1&&bt("Ambiguous pattern (multiple layers were matched):",e),t[0]||null},this.clear=function(){e=[],t=[]},this.removeDataset=function(n){t=t.filter(function(e){return e.dataset!=n}),e=e.filter(function(e){return e!=n})},this.getDatasets=function(){return e},this.getLayers=function(){var e=[];return this.forEachLayer(function(t,r){e.push(n(t,r))}),e},this.addDataset=function(e){return this.setDefaultTarget(e.layers,e),this},this.addDatasets=function(e){e.forEach(function(e){this.addDataset(e)},this)},this.findNextLayer=function(e){var t=this.getLayers(),n=r(e,t);return n>-1?t[(n+1)%t.length]:null},this.findPrevLayer=function(e){var t=this.getLayers(),n=r(e,t);return n>-1?t[(n-1+t.length)%t.length]:null},this.isEmpty=function(){return 0===e.length},this.getDefaultTargets=function(){return 0!==t.length||this.isEmpty()||(t=[{dataset:e[0],layers:e[0].layers.slice(0,1)}]),t},this.setDefaultTarget=function(e,t){this.setDefaultTargets([{layers:e.concat(),dataset:t}])},this.setDefaultTargets=function(n){n.forEach(function(t){-1==e.indexOf(t.dataset)&&e.push(t.dataset)}),t=n},this.getActiveLayer=function(){var e=(this.getDefaultTargets()||[])[0],t=e?.layers[e.layers.length-1];return e?{layer:t,dataset:e.dataset}:null}}function o_(e){var t=[];return e.forEachLayer(function(e,n,r){t.push(" ["+(r+1)+"] "+(e.name||"[unnamed]"))}),t.length>0?t.join("\n"):"[none]"}var s_=Object.freeze({__proto__:null,Catalog:a_,getFormattedLayerList:o_});function u_(e){var t,n={catalog:e||new a_,defs:{},settings:{},input_files:[],initSettings:function(e){n.settings=e,c_(n,{})},startCommand:function(e){t=e,c_(n,e)},endCommand:function(){t=null,a()},resumeCommand:function(){c_(n,t)}};return n}function c_(e,t){a(),r("current_command",t.name),r("DEBUG",e.settings.DEBUG||t.debug),r("VERBOSE",e.settings.VERBOSE||t.verbose),r("QUIET",e.settings.QUIET||t.quiet),r("defs",e.defs),r("input_files",e.input_files)}function f_(e,n){var r=t.toArray(arguments).slice(2),i=n.reduce(function(n,i){var a=e.apply(null,[i].concat(r));return t.isArray(a)?n=n.concat(a):a&&n.push(a),n},[]);return i.length>0?i:null}function l_(e){return"string"==typeof e?JSON.parse(e):e}function h_(e){return e?l_(e):null}function p_(e){return e.length>=2&&e.every(t.isNumber)}function d_(e){return e.every(g_)}function g_(e){return e&&2==e.length&&p_(e)}function m_(e,t,n,r){var i=e*Math.PI/180,a=t*Math.cos(i),o=-t*Math.sin(i);return function(e,t){return[a*(e-r[0])-o*(t-r[1])+n[0]+r[0],o*(e-r[0])+a*(t-r[1])+n[1]+r[1]]}}pp.addShape=function(e,t,n){e.length>1&&bt("Command expects a single target layer");var r=e[0],i=!n.no_replace&&r&&r.geometry_type||null,a=Kv(function(e,t){if(e.geojson)return l_(e.geojson);var n=e.coordinates&&function(e){"string"==typeof e&&((e=e.trim()).startsWith("[")||e.endsWith("]")||(e="["+e+"]"));var t=l_(e);if(g_(t))return{type:"Point",coordinates:t};p_(t)&&(t=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);d_(t)||bt("Unable to parse x,y,x,y... coordinates");return t}(t));if(function(e){return d_(e)&&e.length>3&&(t=e[0],n=e[e.length-1],t[0]==n[0]&&t[1]==n[1]);var t,n}(t))return{type:"Polygon",coordinates:[t]};if(d_(t))return{type:"LineString",coordinates:t};bt("Unable to import coordinates")}(e.coordinates)||null;n||bt("Missing required shape coordinates");"point"==t&&"Point"!=n.type&&bt("Expected point coordinates, received",n.type);"polygon"==t&&"Polygon"!=n.type&&bt("Expected polygon coordinates, received",n.type);"polyline"==t&&("Polygon"==n.type?(n.coordinates=n.coordinates[0],n.type="LineString"):bt("Expected polyline coordinates, received",n.type));return{type:"Feature",properties:h_(e.properties),geometry:n}}(n,i)),o=to(t,[a])[0];if(n.no_replace||!r)return Ui(o,r&&r.name,null,n),[o];return pp.mergeLayers([r,o],{force:!0})},pp.affine=function(e,n,r){var i,a,o,s=r.rotate||0,u=r.scale||1,c=r.shift?sh(r.shift,Ia(n)):[0,0],f=n.arcs,l=[],h=[],p=[];n.layers.filter(xi).forEach(function(t){var i,a=[],o=[];-1==e.indexOf(t)?o=t.shapes:r.where?(i=ap(r.where,t,n.arcs),t.shapes.forEach(function(e,t){(i(t)?a:o).push(e)})):a=t.shapes,"point"==t.geometry_type?p=p.concat(a):(l=l.concat(a),h=h.concat(o))});var d=function(e,t){var n,r;n=t.anchor?t.anchor:[(r=wo(e)).centerX(),r.centerY()];return n}({arcs:n.arcs,layers:[{geometry_type:"point",shapes:p},{geometry_type:"polyline",shapes:l}]},r);o=m_(s,u,c,d),r.fit_bbox&&(o=function(e,t,n,r){var i={arcs:r,layers:[]};t&&t.length&&i.layers.push({geometry_type:"point",shapes:t});n&&n.length&&i.layers.push({geometry_type:"polyline",shapes:n});var a=Dd(i,{fit_bbox:e}),o=new qt(a.bbox),s=new qt(a.bbox2),u=o.getTransform(s,!1);return function(e,t){return u.transform(e,t)}}(r.fit_bbox,p,l,f)),l.length>0&&(i=new Uint8Array(f.size()),a=new Uint8Array(f.size()),dr(l,i),h.length>0&&(dr(h,a),function(e,t){for(var n=0,r=e.length;n<r;n++)0===t[n]&&(e[n]=0)}(a,i),n.arcs=function(e,n,r){for(var i,a=0,o=0,s=n.getVertexData(),u=[],c=[],f=[],l=[],h=0,p=r.length;h<p;h++)r[h]>0&&(l[h]=n.size()+a,i=s.nn[h],t.copyElements(s.xx,s.ii[h],u,o,i),t.copyElements(s.yy,s.ii[h],c,o,i),f.push(i),o+=i,a++);return br(e,function(e){var t=Yt(e);if(r[t]>0)return e<0?~l[t]:l[t]}),oo([n,new Wa(f,u,c)])}(h,f,a)),n.arcs.transformPoints(function(e,t,n){if(n<i.length&&i[n]>0)return o(e,t)})),Wt(p,function(e){var t=o(e[0],e[1]);e[0]=t[0],e[1]=t[1]})};const y_=11102230246251565e-32,v_=134217729,b_=(3+8*y_)*y_;function __(e,t,n,r,i){let a,o,s,u,c=t[0],f=r[0],l=0,h=0;f>c==f>-c?(a=c,c=t[++l]):(a=f,f=r[++h]);let p=0;if(l<e&&h<n)for(f>c==f>-c?(o=c+a,s=a-(o-c),c=t[++l]):(o=f+a,s=a-(o-f),f=r[++h]),a=o,0!==s&&(i[p++]=s);l<e&&h<n;)f>c==f>-c?(o=a+c,u=o-a,s=a-(o-u)+(c-u),c=t[++l]):(o=a+f,u=o-a,s=a-(o-u)+(f-u),f=r[++h]),a=o,0!==s&&(i[p++]=s);for(;l<e;)o=a+c,u=o-a,s=a-(o-u)+(c-u),c=t[++l],a=o,0!==s&&(i[p++]=s);for(;h<n;)o=a+f,u=o-a,s=a-(o-u)+(f-u),f=r[++h],a=o,0!==s&&(i[p++]=s);return 0===a&&0!==p||(i[p++]=a),p}function x_(e){return new Float64Array(e)}const w_=x_(4),S_=x_(8),A_=x_(12),E_=x_(16),M_=x_(4);function I_(e,t,n,r,i,a){const o=(t-a)*(n-i),s=(e-i)*(r-a),u=o-s,c=Math.abs(o+s);return Math.abs(u)>=33306690738754716e-32*c?u:-function(e,t,n,r,i,a,o){let s,u,c,f,l,h,p,d,g,m,y,v,b,_,x,w,S,A;const E=e-i,M=n-i,I=t-a,k=r-a;_=E*k,h=v_*E,p=h-(h-E),d=E-p,h=v_*k,g=h-(h-k),m=k-g,x=d*m-(_-p*g-d*g-p*m),w=I*M,h=v_*I,p=h-(h-I),d=I-p,h=v_*M,g=h-(h-M),m=M-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,w_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,w_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,w_[2]=v-(A-l)+(y-l),w_[3]=A;let C=function(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}(4,w_),P=22204460492503146e-32*o;if(C>=P||-C>=P)return C;if(l=e-E,s=e-(E+l)+(l-i),l=n-M,c=n-(M+l)+(l-i),l=t-I,u=t-(I+l)+(l-a),l=r-k,f=r-(k+l)+(l-a),0===s&&0===u&&0===c&&0===f)return C;if(P=11093356479670487e-47*o+b_*Math.abs(C),C+=E*f+k*s-(I*c+M*u),C>=P||-C>=P)return C;_=s*k,h=v_*s,p=h-(h-s),d=s-p,h=v_*k,g=h-(h-k),m=k-g,x=d*m-(_-p*g-d*g-p*m),w=u*M,h=v_*u,p=h-(h-u),d=u-p,h=v_*M,g=h-(h-M),m=M-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const O=__(4,w_,4,M_,S_);_=E*f,h=v_*E,p=h-(h-E),d=E-p,h=v_*f,g=h-(h-f),m=f-g,x=d*m-(_-p*g-d*g-p*m),w=I*c,h=v_*I,p=h-(h-I),d=I-p,h=v_*c,g=h-(h-c),m=c-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const N=__(O,S_,4,M_,A_);_=s*f,h=v_*s,p=h-(h-s),d=s-p,h=v_*f,g=h-(h-f),m=f-g,x=d*m-(_-p*g-d*g-p*m),w=u*c,h=v_*u,p=h-(h-u),d=u-p,h=v_*c,g=h-(h-c),m=c-g,S=d*m-(w-p*g-d*g-p*m),y=x-S,l=x-y,M_[0]=x-(y+l)+(l-S),v=_+y,l=v-_,b=_-(v-l)+(y-l),y=b-w,l=b-y,M_[1]=b-(y+l)+(l-w),A=v+y,l=A-v,M_[2]=v-(A-l)+(y-l),M_[3]=A;const T=__(N,A_,4,M_,E_);return E_[T-1]}(e,t,n,r,i,a,c)}const k_=Math.pow(2,-52),C_=new Uint32Array(512);class P_{static from(e,t=R_,n=D_){const r=e.length,i=new Float64Array(2*r);for(let a=0;a<r;a++){const r=e[a];i[2*a]=t(r),i[2*a+1]=n(r)}return new P_(i)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1;let o=1/0,s=1/0,u=-1/0,c=-1/0;for(let t=0;t<a;t++){const n=e[2*t],r=e[2*t+1];n<o&&(o=n),r<s&&(s=r),n>u&&(u=n),r>c&&(c=r),this._ids[t]=t}const f=(o+u)/2,l=(s+c)/2;let h,p,d,g=1/0;for(let t=0;t<a;t++){const n=O_(f,l,e[2*t],e[2*t+1]);n<g&&(h=t,g=n)}const m=e[2*h],y=e[2*h+1];g=1/0;for(let t=0;t<a;t++){if(t===h)continue;const n=O_(m,y,e[2*t],e[2*t+1]);n<g&&n>0&&(p=t,g=n)}let v=e[2*p],b=e[2*p+1],_=1/0;for(let t=0;t<a;t++){if(t===h||t===p)continue;const n=T_(m,y,v,b,e[2*t],e[2*t+1]);n<_&&(d=t,_=n)}let x=e[2*d],w=e[2*d+1];if(_===1/0){for(let t=0;t<a;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];L_(this._ids,this._dists,0,a-1);const t=new Uint32Array(a);let n=0;for(let e=0,r=-1/0;e<a;e++){const i=this._ids[e];this._dists[i]>r&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(I_(m,y,v,b,x,w)<0){const e=p,t=v,n=b;p=d,v=x,b=w,d=e,x=t,w=n}const S=function(e,t,n,r,i,a){const o=n-e,s=r-t,u=i-e,c=a-t,f=o*o+s*s,l=u*u+c*c,h=.5/(o*c-s*u),p=e+(c*f-s*l)*h;return{x:p,y:t+(o*l-u*f)*h}}(m,y,v,b,x,w);this._cx=S.x,this._cy=S.y;for(let t=0;t<a;t++)this._dists[t]=O_(e[2*t],e[2*t+1],S.x,S.y);L_(this._ids,this._dists,0,a-1),this._hullStart=h;let A=3;n[h]=t[d]=p,n[p]=t[h]=d,n[d]=t[p]=h,r[h]=0,r[p]=1,r[d]=2,i.fill(-1),i[this._hashKey(m,y)]=h,i[this._hashKey(v,b)]=p,i[this._hashKey(x,w)]=d,this.trianglesLen=0,this._addTriangle(h,p,d,-1,-1,-1);for(let a,o,s=0;s<this._ids.length;s++){const u=this._ids[s],c=e[2*u],f=e[2*u+1];if(s>0&&Math.abs(c-a)<=k_&&Math.abs(f-o)<=k_)continue;if(a=c,o=f,u===h||u===p||u===d)continue;let l=0;for(let e=0,t=this._hashKey(c,f);e<this._hashSize&&(l=i[(t+e)%this._hashSize],-1===l||l===n[l]);e++);l=t[l];let g,m=l;for(;g=n[m],I_(c,f,e[2*m],e[2*m+1],e[2*g],e[2*g+1])>=0;)if(m=g,m===l){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,u,n[m],-1,-1,r[m]);r[u]=this._legalize(y+2),r[m]=y,A++;let v=n[m];for(;g=n[v],I_(c,f,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(v,u,g,r[u],-1,r[v]),r[u]=this._legalize(y+2),n[v]=v,A--,v=g;if(m===l)for(;g=t[m],I_(c,f,e[2*g],e[2*g+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(g,u,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,A--,m=g;this._hullStart=t[u]=m,n[m]=t[v]=u,n[u]=v,i[this._hashKey(c,f)]=u,i[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(A);for(let e=0,t=this._hullStart;e<A;e++)this.hull[e]=t,t=n[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[e],s=e-e%3;if(a=s+(e+2)%3,-1===o){if(0===i)break;e=C_[--i];continue}const u=o-o%3,c=s+(e+1)%3,f=u+(o+2)%3,l=t[a],h=t[e],p=t[c],d=t[f];if(N_(r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1],r[2*d],r[2*d+1])){t[e]=d,t[o]=l;const r=n[f];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===f){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(o,n[a]),this._link(a,f);const s=u+(o+1)%3;i<C_.length&&(C_[i++]=s)}else{if(0===i)break;e=C_[--i]}}return a}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,i,a){const o=this.trianglesLen;return this._triangles[o]=e,this._triangles[o+1]=t,this._triangles[o+2]=n,this._link(o,r),this._link(o+1,i),this._link(o+2,a),this.trianglesLen+=3,o}}function O_(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}function N_(e,t,n,r,i,a,o,s){const u=e-o,c=t-s,f=n-o,l=r-s,h=i-o,p=a-s,d=f*f+l*l,g=h*h+p*p;return u*(l*g-d*p)-c*(f*g-d*h)+(u*u+c*c)*(f*p-l*h)<0}function T_(e,t,n,r,i,a){const o=n-e,s=r-t,u=i-e,c=a-t,f=o*o+s*s,l=u*u+c*c,h=.5/(o*c-s*u),p=(c*f-s*l)*h,d=(o*l-u*f)*h;return p*p+d*d}function L_(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=e[i],a=t[r];let o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+1,a=r;z_(e,n+r>>1,i),t[e[n]]>t[e[r]]&&z_(e,n,r),t[e[i]]>t[e[r]]&&z_(e,i,r),t[e[n]]>t[e[i]]&&z_(e,n,i);const o=e[i],s=t[o];for(;;){do{i++}while(t[e[i]]<s);do{a--}while(t[e[a]]>s);if(a<i)break;z_(e,i,a)}e[n+1]=e[a],e[a]=o,r-i+1>=a-n?(L_(e,t,i,r),L_(e,t,n,a-1)):(L_(e,t,n,a-1),L_(e,t,i,r))}}function z_(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function R_(e){return e[0]}function D_(e){return e[1]}function j_(e,t){return Ta(e)?function(e){return function(t,n){return gn(t[0],t[1],n[0],n[1])<=e}}(t):function(e){return function(t,n){return cn(t[0],t[1],n[0],n[1])<=e}}(t)}function F_(e){var t=1e-4,n=e[0],r=e[1];return[[[n,r],[n,r+t],[n+t,r+t],[n+t,r],[n,r]]]}function U_(e){var t=Fp(e);return function(n){var r=[];return Cr(n,function(n){for(var i,a=t(n),o=0;o<a.length;o++)i=a[o],fr.getPlanarPathArea(i,e.arcs)<0&&(i=mr(i)),r.push(i)}),r.length>0?r:null}}function B_(e,t){var n=U_(t);e.shapes=e.shapes.map(function(e){return n(e)})}function G_(e,t){var n=Fp(t);e.shapes=e.shapes.map(function(e,r){return function(e){var r=[];return Cr(e,function(e){var i=n(e);if(0===i.length)vt("[cleanPolygon()] Defective path:",e);else if(1==i.length)r.push(i[0]);else{var a,o=fr.getPlanarPathArea(e,t.arcs)>0?1:-1;i.reduce(function(e,n,r){var i=fr.getPlanarPathArea(n,t.arcs)*o;return i>e&&(a=n,e=i),e},0),a&&r.push(a)}}),r.length>0?r:null}(e)})}pp.alphaShapes=function(e,t,n){Ti(e),n.interval>0==!1&&bt("Expected a non-negative interval parameter");var r=function(e,t,n){var r=function(e,t,n){for(var r,i,a,o,s,u,c=Jt(e),f=P_.from(c),l=n.keep_points?new Uint8Array(c.length):null,h=f.triangles,p={type:"MultiPolygon",coordinates:[]},d=0,g=h.length;d<g;d+=3)o=h[d],s=h[d+1],u=h[d+2],r=c[o],i=c[s],a=c[u],t(r,i)&&t(i,a)&&t(r,a)&&(p.coordinates.push([[a,i,r,a]]),l&&(l[o]=1,l[s]=1,l[u]=1));l&&function(e,t,n){for(var r=0,i=n.length;r<i;r++)0===n[r]&&e.coordinates.push(F_(t[r]))}(p,c,l);return Kv(p)}(e,t,n);Ka(r),n.debug||vd(r.layers,r,{quiet:!0});return r}(e,j_(t,n.interval),n),i=io([t,r]),a=i.layers.pop();return t.arcs=i.arcs,Ui(a,e,null,n),a};var q_=Object.freeze({__proto__:null,getPolygonRewinder:U_,repairPolygonGeometry:function(e,t,n){var r=Vp(t);return e.forEach(function(e){G_(e,r)}),e},repairSelfIntersections:G_,rewindPolygonParts:B_});function V_(e,t){return rh(e).value&&ah(e,t)||null}function $_(e,t,n){n.radius||bt("Missing expected radius parameter");var r=n.units||"",i=Ia(t),a=V_(n.radius+r,i);if(a)return function(){return a};var o=ap(n.radius,e,null);return function(e){var t=o(e);return t&&V_(t+r,i)||0}}function J_(e,t,n,r){return i=e[0],a=e[1],o=t[0],s=t[1],u=n[0],c=n[1],f=r[0],l=r[1],i<u&&i<f&&o<u&&o<f||i>u&&i>f&&o>u&&o>f||a<c&&a<l&&s<c&&s<l||a>c&&a>l&&s>c&&s>l?null:Qn(i,a,o,s,u,c,f,l);var i,a,o,s,u,c,f,l}function W_(e,t){var n,r,i,a={},o=[],s=t.backtrack>=0?t.backtrack:100,u=0;function c(){n=[],r=[],i=[],u=0}return c(),a.size=function(){return r.length+n.length},a.getDebugPoints=function(){var e=o;return o=[],e},a.addPathVertex=function(e){r.push(e)},a.addBufferVertices=function(e){for(var t=0;t<e.length;t++)a.addBufferVertex(e[t])},a.addBufferVertex=function(t,r){var a=i.length,o=a-1;if(r)return i.push(!0),void n.push(t);if(-1==o)return n.push(t),void i.push(!1);var c=n[o],f=i[o];if(!function(e,t){return e[0]===t[0]&&e[1]===t[1]}(c,t)){for(var l,h,p,d,g,m=f,y=0,v=a-3;y<s&&v>=u;y++,v--)if(h=n[v],p=n[v+1],(l=e(h,p,c,t))&&(d=i[v],g=i[v+1],!d||!g)){for(;n.length>v+1;)n.pop(),i.pop();n.push(l),i.push(!1),m=!1;break}n.push(t),i.push(m)}},a.done=function(){t.debug_points&&(o=o.concat(n.map((e,t)=>({type:"Feature",geometry:{type:"Point",coordinates:e},properties:{id:t,inside:i[t],fill:i[t]?"magenta":"dodgerblue"}}))));var e=r.reverse().concat(n);return e.length<3&&vt("Defective buffer ring:",e),e.push(e[0]),c(),e},a}var Z_=nn;function Y_(e){Na(e)||vt("Expected an unprojected CRS");var t=e.es/(1+Math.sqrt(e.one_es));return new(s("geographiclib-geodesic").Geodesic.Geodesic)(e.a,t)}function H_(e,t,n,r,i){var a=1-i;return[e*a+n*i,t*a+r*i]}function X_(e){if(!(e&&Na(e)))return H_;var t=Y_(e);return function(e,n,r,i,a){var o=t.Inverse(n,e,i,r),s=o.s12*a,u=t.Direct(n,e,o.azi1,s);return[u.lon2,u.lat2]}}function K_(e,t,n,r){var i=n/180*Math.PI;return[e+Math.sin(i)*r,t+Math.cos(i)*r]}function Q_(e,t,n,r){var i=Math.PI/180,a=Math.cos(t*i),o=2*a*a-1,s=2*a*o-a,u=2*a*s-o,c=1e3*(111.41513*a-.09455*s+12e-5*(2*a*u-s)),f=1e3*(111.13209-.56605*o+.0012*u),l=n*i,h=t+Math.cos(l)*r/f;return[e+Math.sin(l)*r/c,h]}function ex(e,t,n,r){var i=Math.PI/180,a=1/298.257223563,o=a*(2-a),s=Z_*i,u=Math.cos(t*i),c=1/(1-o*(1-u*u)),f=Math.sqrt(c),l=s*f*u,h=s*f*c*(1-o),p=function(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}(n-e)*l,d=(r-t)*h;return Math.atan2(p,d)/i}function tx(e){if(!Na(e))return K_;var t=Y_(e);return function(e,n,r,i){var a=t.Direct(n,e,r,i);return[a.lon2,a.lat2]}}function nx(e){return Na(e)?Q_:K_}function rx(e){return Na(Ia(e))?ex:ix}function ix(e,t,n,r){return 180*fr.bearing2D(e,t,n,r)/Math.PI}var ax=Object.freeze({__proto__:null,bearingDegrees:function(e,t,n,r){return 180*fr.bearing(e,t,n,r)/Math.PI},bearingDegrees2D:ix,getBearingFunction:rx,getFastGeodeticSegmentFunction:nx,getGeodeticSegmentFunction:tx,getInterpolationFunction:X_,getPlanarSegmentEndpoint:K_,interpolatePoint2D:H_});function ox(e,t){var n=nx(Ia(e)),r=J_,i=rx(e),a=t.arc_quality>=2?t.arc_quality:12,o=360/a/4,s=t.cap_style||"round",u=new Ba(e.arcs),c=new W_(r,t);return function(e,n){var r=[];if((e||[]).forEach(function(e,i){var a=function(e,n){var r,i=[];t.right&&!t.left||(i=i.concat(f(e,n)));t.left&&!t.right||(r=mr(e.concat()),i=i.concat(f(r,n)));return i}(e,n);r=r.concat(a)}),0===r.length)return null;var i={type:"Feature",properties:null,geometry:{type:"MultiPolygon",coordinates:r.map(e=>[e])}};return t.debug_points?[i].concat(c.getDebugPoints()):i};function f(e,t){var a,f,p,m,y,v,b,_,x,w,S,A,E,M,I,k,C,P=[],O=0;for(u.init(e),u.hasNext()&&(a=y=u.x,f=v=u.y,c.addPathVertex([a,f]),O++);u.hasNext();)u.x!==y||u.y!==v?(p=y,m=v,y=u.x,v=u.y,c.addPathVertex([y,v]),S=i(p,m,y,v),A=i(y,v,p,m)-180,b=n(p,m,S-90,t),_=n(y,v,A-90,t),1==O?k=S:M=g(E,S),1==O?c.addBufferVertex(b,!1):M>1.5*o?(C=l(p,m,E-90,M,t),c.addBufferVertices(C),b=C.pop()):M>0&&(I=h(x,w,b,_))||M<0&&(I=r(x,w,b,_))?(c.addBufferVertex(I,!1),b=I):0==M?c.addBufferVertex(b,!1):(c.addBufferVertex(w),c.addBufferVertex(b,M<0)),E=A,x=b,w=_,O++):Ct("skipping a duplicate point");return w&&c.addBufferVertex(w),y==a&&v==f?(M=g(A,k))>0&&c.addBufferVertices(function(e,t,r,i,a){var o=d(e,t,r,i,a);return o.push(n(e,t,r+i,a)),o}(y,v,S-90,M,t)):"round"==s&&c.addBufferVertices(function(e,t,r,i){var a=d(e,t,r,180,i);return a.push(n(e,t,r+180,i)),a}(y,v,A-90,t)),P.push(c.done()),P}function l(e,t,i,a,s){for(var u,c,f,l,h,p,d,g=Math.max(1,Math.round(a/o)),m=a/g,y=[],v=0;v<=g;){if(p=n(e,t,d=i+m*v,s),f=n(p[0],p[1],d-90,2*s),l=n(p[0],p[1],d+90,2*s),v>0){if(!(h=r(u,c,f,l)))throw Error(`no intersection on ${v} of ${g}`);y.push(h)}u=f,c=l,v++}return y}function h(e,t,n,i){var a=8192,o=[p(t[0],t[0]-e[0],a),p(t[1],t[1]-e[1],a)],s=[p(n[0],n[0]-i[0],a),p(n[1],n[1]-i[1],a)];return r(e,o,s,i)}function p(e,t,n){return e+t*n}function d(e,t,r,i,o){for(var s=[],u=90/a,c=u;c<i;)s.push(n(e,t,r+c,o)),c+=u;return s}function g(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}}function sx(e,t){var n,r,i,a=nx(Ia(e)),o=rx(e),s=t.slice_length||1/0,u=t.backtrack>=0?t.backtrack:100,c=t.arc_quality>=2?t.arc_quality:12,f=t.cap_style||"round",l=new Ba(e.arcs);return function(e,n){var r=[];return(e||[]).forEach(function(e,i){var a=function(e,n){var r,i=[];t.right&&!t.left||(i=i.concat(h(e,n)));t.left&&!t.right||(r=mr(e.concat()),i=i.concat(h(r,n)));return i}(e,n);r=r.concat(a)}),0===r.length?null:{type:"MultiPolygon",coordinates:r.map(e=>[e])}};function h(e,t){var u,c,h,y,v,b,_,x,w,S,A,E,M,I;n=[],r=[],i=[];var k=0;for(l.init(e),l.hasNext()&&(u=v=l.x,c=b=l.y,k++);l.hasNext();)l.x!==v||l.y!==b?(h=v,y=b,v=l.x,b=l.y,E=A,S=o(h,y,v,b),A=o(v,b,h,y)-180,w=x,_=a(h,y,S-90,t),x=a(v,b,A-90,t),1==k?I=S:M=g(E,S),0==r.length&&r.push([h,y]),r.push([v,b]),k>1&&M>0?(w&&m(w),d(h,y,E-90,M,t).forEach(m),m(_),m(x)):(m(_),m(x)),r.length-1>=s&&p(),k++):Ct("skipping a duplicate point");return r.length>1&&p(),v==u&&b==c?(M=g(A,I))>0&&function(e,t,n,r,i,o){var s=e.pop(),u=d(t,n,r,i,o);e.push.apply(e,u),e.push(a(t,n,r+i,o)),e.push(s)}(i[i.length-1],v,b,S-90,M,t):function(e,t,n,r,i){if("flat"==f||e.length<4)return;var o=e.pop(),s=function(e,t,n,r){var i=d(e,t,n,180,r);return i.push(a(e,t,n+180,r)),i}(t,n,r-90,i);e.push.apply(e,s),e.push(o)}(i[i.length-1],v,b,A,t),i}function p(){if(r.length<2)Ct("defective path, skipping");else{var e=r.reverse().concat(n);e.push(e[0]),n=[],r=[],i.push(e)}}function d(e,t,n,r,i){for(var o=[],s=90/c,u=s;u<r;)o.push(a(e,t,n+u,i)),u+=s;return o}function g(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}function m(e){var t,r,i,a,o=n;i=o[o.length-1];for(var s=0,c=o.length-3;s<u&&c>=0;s++,c--)if(t=o[c],r=o[c+1],a=cx(t[0],t[1],r[0],r[1],i[0],i[1],e[0],e[1])){for(;o.length>c+1;)o.pop();ux(o,a),i=a}ux(o,e)}}function ux(e,t){var n,r,i,a,o,s=e[e.length-1];s&&(n=s[0],r=s[1],i=t[0],a=t[1],o=1e-10,fr.distance2D(n,r,i,a)<o)||e.push(t)}function cx(e,t,n,r,i,a,o,s){return e<i&&e<o&&n<i&&n<o||e>i&&e>o&&n>i&&n>o||t<a&&t<s&&r<a&&r<s||t>a&&t>s&&r>a&&r>s?null:fr.segmentIntersection(e,t,n,r,i,a,o,s)}function fx(e,t){var n=nx(Ia(e)),r=rx(e),i=function(e,t,n,r){var i=r.backtrack>=0?r.backtrack:50,a=new Ba(e),o=r.cap_style||"round";function s(e,n,r,a,o,s){for(var u=10,c=a+o,f=a+u;f<c;)d(e,t(n,r,f,s),i),f+=u}function u(e,t,n,r,i){return fr.distance2D(e,t,n,r)<i}function c(e,t,n){var r=e[e.length-1];return u(r[0],r[1],t,n,1e-6)}function f(e,t){var n=e[e.length-1];u(n[0],n[1],t[0],t[1],1e-10)||e.push(t)}function l(e,t,n,r){return"flat"==o?[[e,t]]:h(e,t,n,r)}function h(e,n,r,i){for(var a=[],o=10,s=r-90,u=o;u<180;)a.push(t(e,n,s+u,i)),u+=o;return a}function p(e,t){var n=t-e;return n>180&&(n-=360),n<-180&&(n+=360),n}function d(e,t,n){for(var r,i,a,o,s=0,u=e.length-3;s<n&&u>=0;s++,u--)if(a=e[e.length-1],r=e[u],i=e[u+1],o=lx(r[0],r[1],i[0],i[1],a[0],a[1],t[0],t[1])){for(;e.length>u+1;)e.pop();f(e,o)}f(e,t)}return function(e,r){var o,u,f,h,g,m,y,v,b,_,x,w,S=[],A=0;for(a.init(e);a.hasNext();)a.x===g&&a.y===m||(f=g,h=m,g=a.x,m=a.y,A>=1&&(_=b,b=n(f,h,g,m),y=t(f,h,b-90,r),v=t(g,m,b-90,r)),1==A&&(x=b,o=f,u=h,S.push(y,v)),A>1&&(w=p(_,b),c(S,y[0],y[1])?d(S,v,i):w>0?(s(S,f,h,_-90,w,r),d(S,y,i),d(S,v,i)):(d(S,y,i),d(S,v,i))),A++);return g==o&&m==u?(w=p(b,x))>0&&s(S,g,m,b-90,w,r):S.push.apply(S,l(g,m,b,r)),S}}(e.arcs,n,r,t),a=t.geometry_type,o="polyline"==t.output_geometry?"polyline":"polygon";function s(e,t){var n,r=i(e,t);return"polyline"==a&&(n=mr(e.concat()),r=r.concat(i(n,t))),r.push(r[0]),"polyline"==o?r:[r]}return function(e,t){for(var n={type:"polyline"==o?"MultiLineString":"MultiPolygon",coordinates:[]},r=0;r<e.length;r++)n.coordinates.push(s(e[r],t));return 0==n.coordinates.length?null:n}}function lx(e,t,n,r,i,a,o,s){return e<i&&e<o&&n<i&&n<o||e>i&&e>o&&n>i&&n>o||t<a&&t<s&&r<a&&r<s||t>a&&t>s&&r>a&&r>s?null:fr.segmentIntersection(e,t,n,r,i,a,o,s)}function hx(e,t,n){Pt("buffer");var r=Kv(px(e,t,n),{});return n.debug_points||function(e,t){var n,r=t||{},i=e.layers[0];if(!r.debug_offset){var a=new fd(i,Vp(e,{rebuild_topology:!0}),{flat:!1,no_holes:!1});if(i.shapes=i.shapes.map(function(e,t){var n=a.getTilesByShapeIds([t]);return n.length?n.reduce(function(e,t){return e.concat(t)},[]):null}),!r.debug_winding){if(r.debug_mosaic)return n=dd(i,a.mosaic),i.shapes=n.shapes,void(i.data=n.data);var o=wl(a.nodes),s=i.shapes.map(function(e,t){for(var n=a.getTilesByShapeIds([t]),r=[],i=0;i<n.length;i++)r.push(n[i][0]);return o(r,"dissolve")});i.shapes=s,r.no_dissolve||ho(e)}}}(r,n),Ot("buffer"),r}function px(e,t,n){var r=$_(e,t,n),i=Object.assign({geometry_type:e.geometry_type},n),a=n.v2&&sx(t,i)||n.v3&&ox(t,i)||fx(t,i),o=e.shapes.reduce(function(e,t,n){var i=r(n);if(!i||!t)return e;var o=a(t,i);return e.concat(o)},[]),s=o?.[0].type;return"Feature"==s?{type:"FeatureCollection",features:o}:{type:"GeometryCollection",geometries:o}}function dx(e,t,n){var r=Kv(px(e,t,n),{});return function(e){var t,n={},r=e.layers[0];if(!n.debug_offset){var i=Vp(e,{rebuild_topology:!0});if(n.debug_winding)B_(r,i);else{B_(r,i);var a=new fd(r,i,{flat:!1,no_holes:!1});if(n.debug_mosaic)return t=dd(r,a.mosaic),r.shapes=t.shapes,void(r.data=t.data);var o=wl(a.nodes),s=r.shapes.map(function(e,t){for(var n=a.getTilesByShapeIds([t]),r=[],i=0;i<n.length;i++)r.push(n[i][0]);return o(r,"dissolve")});r.shapes=s,n.no_dissolve||ho(e)}}}(r),r}var gx=1e-10,mx=90-gx,yx=-180+gx,vx=-90+gx,bx=180-gx;function _x(e){return e[e.length-1]}function xx(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}function wx(e){return xx(e[0],_x(e))}function Sx(e){e[0]<=yx&&(e[0]=-180),e[0]>=bx&&(e[0]=180),e[1]<=vx&&(e[1]=-90),e[1]>=mx&&(e[1]=90)}function Ax(e){return e[1]>=mx||e[1]<=vx}function Ex(e,t){return Ax(e)||Ax(t)||e[0]<=yx&&t[0]<=yx||e[0]>=bx&&t[0]>=bx}function Mx(e){return e[1]<=vx||e[1]>=mx||e[0]<=yx||e[0]>=bx}function Ix(e){if(!function(e){for(var t=0,n=e.length;t<n;t++)if(Mx(e[t]))return!0;return!1}(e))return e;var t,n,r,i=[],a=!1;e.pop(),t=e[e.length-1],n=e[0];for(var o=1,s=e.length;o<=s;o++)(r=o==s?i[0]:e[o])&&((a||Ex(t,n))&&Ex(n,r)?a=!0:(!0===a&&(a=!1),i.push(n),t=n),n=r);return i.length>0&&i.push(i[0].concat()),i}function kx(e){return Tx(e)}function Cx(e){return-180==e[0]||180==e[0]}function Px(e){for(var n,r=[],i=[],a=0;a<e.length;a++)wx(n=e[a])||vt("Received an open path"),0===Nx(n)?r.push(n):i=i.concat(Tx(n));return i.length>0&&(r=r.concat(function(e){var n=function(e){var n=e.map(function(e){return e[0][1]});return t.genericSort(n,!0)}(e),r=[],i=[];return e.forEach(function(e,t){if(!i[t]){(function(e){var t=_x(e)[0],n=e[0][0];return!(180!=t&&-180!=t||180!=n&&-180!=n)})(e)||vt("Geometry error");var n=a(e,[]);n&&(wx(n)||vt("Generated an open ring"),r.push(n))}}),r;function a(t,r){var o=_x(t),s=e.indexOf(t);if(i[s])return Ct("Tried to use a previously used path"),null;i[s]=!0,r=r.concat(t);var u=function(e,t,n){var r,i=t[0],a=t[1],o=n.indexOf(a),s=-180==i?180:-180,u=180==i,c=u?o-1:o+1;if(180!=i&&-180!=i)return Ct("Unexpected error"),null;if(-1==o)return Ct("Point missing from intersection table:",t),null;r=c<0||c>=n.length?[s,a]:[i,n[c]];return r}(0,o,n);if(!u)return null;if(o[0]!=u[0]){var c=180==o[0]?-90:90;r.push([o[0],c],[0,c],[u[0],c])}var f=function(e,t){for(var n=0;n<e.length;n++)if(xx(e[n][0],t))return e[n];return null}(e,u);return f?xx(r[0],f[0])?(r.push(r[0]),r):a(f,r):null}}(i))),r}function Ox(e,t){t.length>1&&e.push(t)}function Nx(e){for(var t,n,r=0,i=0,a=e.length;i<a;i++)n=e[i],i>0&&Math.abs(t[0]-n[0])>180&&r++,t=n;return r}function Tx(e){for(var t,n,r,i=[],a=[],o=e[0],s=xx(o,_x(e)),u=0,c=e.length;u<c;u++)t=e[u],u>0&&Lx(n,t)&&(zx(a,n,r=Rx(n,t)),Ox(i,a),zx(a=[],t,r)),a.push(t),n=t;return Ox(i,a),s&&i.length>1&&!Cx(o)&&((a=i.pop()).pop(),i[0]=a.concat(i[0])),i}function Lx(e,t){return Math.abs(e[0]-t[0])>180}function zx(e,t,n){var r=t[0]<0?-180:180;Cx(t)||e.push([r,n])}function Rx(e,t){var n,r;return t[0]-e[0]>0?(n=e[0]+180,r=180-t[0]):(n=180-e[0],r=t[0]+180),0===n?e[1]:0===r?t[1]:(r*e[1]+n*t[1])/(n+r)}function Dx(e){return zn(new ja(e))}function jx(e,t,n){var r=function(e,t,n){var r=n.vertices||72,i=$_(e,t,n),a=Ia(t),o=Na(a),s=tx(a),u=e.shapes.map(function(e,t){var n=i(t);return n&&e?Ux(e,n,r,s,o):null});return{type:"GeometryCollection",geometries:u}}(e,t,n);return Kv(r,{})}function Fx(e,t,n,r){var i=tx(Sa("wgs84"));return r.inset&&(t-=r.inset),"polyline"==r.geometry_type?function(e,t,n,r){var i,a=[];if(!e||!e.length)return null;for(var o=0;o<e.length;o++)for(i=kx(i=Bx(e[o],t,n,r));i.length>0;)a.push(i.pop());return 1==a.length?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a}}([e],t,360,i):Ux([e],t,360,i,!0)}function Ux(e,t,n,r,i){var a,o,s=[];if(!e||!e.length)return null;for(var u=0;u<e.length;u++)if(a=Bx(e[u],t,n,r),i)if(Nx(a)>0)for(o=Px([a]);o.length>0;)s.push([o.pop()]);else Dx(a)<0?s.push([[[180,90],[180,-90],[0,-90],[-180,-90],[-180,90],[0,90],[180,90]],a]):s.push([a]);else s.push([a]);return{type:"MultiPolygon",coordinates:s}}function Bx(e,t,n,r){for(var i,a=[],o=360/n,s=0;s<n;s++)i=(s+.5)*o%360,a.push(r(e[0],e[1],i,t));return a.push(a[0].concat()),a}pp.buffer=function(e,t,n){var r;"point"==e.geometry_type?r=jx(e,t,n):"polyline"==e.geometry_type?r=hx(e,t,n):"polygon"==e.geometry_type?r=dx(e,t,n):bt("Unsupported geometry type");return Oo(e,t,r,n)},pp.checkGeometry=function(e,t,n){if(t.arcs){var r=Il(t.arcs);r.length>0&&function(e,t){var n=t.strict?bt:xt;n(e)}(`Found ${r.length} intersection${r.length>1?"s":""}.`,n)}};var Gx=[10,12,15,18,20,22,25,30,35,40,45,50,60,70,80,90,100],qx=[10,2,5,2,10,2,5,10,5,10,5,50,10,10,10,10,10];function Vx(e){var t=Gx.indexOf(e);return qx[t]||vt("Unknown error")}function $x(e,t){return(t>=50?1:t>=10&&.9)||t>=5&&.8||.7}function Jx(e,n){var r=NS(e,n),i=function(e,t,n){var r=[],i=Math.max(Math.abs(e),Math.abs(t)),a=n>=2?(t-e)/(n-1):i,o=function(e){var t=1;e>1e-4!=!1&&e<1e9!=!1||bt("Data range error");for(;e>100;)e/=10,t/=10;for(;e<10;)e*=10,t*=10;return t}(a),s=Hx(o*a);return s.forEach(function(t){var i=Vx(t),a=Zx(t,o),s=Zx(i,o),u=function(e,t){var n=Vl(t)(e),r=n+(e>n?t:-t),i=n<r?[n,r]:[r,n];return i}(e,s);u.forEach(function(e){r.push({interval:a,precision:s,roundness:$x(0,i),breaks:Yx(e,a,n)})})}),r}(r[0],r[r.length-1],n);return i.forEach(function(n){var r,i,a,o;TS(n.breaks,e),n.distribution=TS(n.breaks,e),n.quality=n.roundness*(r=n.distribution,i=t.sum(r)/r.length,a=r[0],o=r[r.length-1],(Wx(i,a)+Wx(i,o))/2)}),t.sortOn(i,"quality",!1),i[0].breaks}function Wx(e,t){return t>e?e/t:e/(2*e-t)}function Zx(e,t){return t<1?e*Math.round(1/t):e/t}function Yx(e,t,n){for(var r=[e],i=1;i<n;i++)r.push(e+t*i);return r}function Hx(e){for(var t,n,r=Gx,i=1;i<r.length;i++)if(t=r[i-1],n=r[i],e>=t&&e<=n)return[t,n];vt("Range error")}function Xx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Kx(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Qx(){}var ew=.7,tw=1/ew,nw="\\s*([+-]?\\d+)\\s*",rw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",iw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aw=/^#([0-9a-f]{3,8})$/,ow=new RegExp(`^rgb\\(${nw},${nw},${nw}\\)$`),sw=new RegExp(`^rgb\\(${iw},${iw},${iw}\\)$`),uw=new RegExp(`^rgba\\(${nw},${nw},${nw},${rw}\\)$`),cw=new RegExp(`^rgba\\(${iw},${iw},${iw},${rw}\\)$`),fw=new RegExp(`^hsl\\(${rw},${iw},${iw}\\)$`),lw=new RegExp(`^hsla\\(${rw},${iw},${iw},${rw}\\)$`),hw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pw(){return this.rgb().formatHex()}function dw(){return this.rgb().formatRgb()}function gw(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=aw.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?mw(t):3===n?new _w(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?yw(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?yw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ow.exec(e))?new _w(t[1],t[2],t[3],1):(t=sw.exec(e))?new _w(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=uw.exec(e))?yw(t[1],t[2],t[3],t[4]):(t=cw.exec(e))?yw(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=fw.exec(e))?Mw(t[1],t[2]/100,t[3]/100,1):(t=lw.exec(e))?Mw(t[1],t[2]/100,t[3]/100,t[4]):hw.hasOwnProperty(e)?mw(hw[e]):"transparent"===e?new _w(NaN,NaN,NaN,0):null}function mw(e){return new _w(e>>16&255,e>>8&255,255&e,1)}function yw(e,t,n,r){return r<=0&&(e=t=n=NaN),new _w(e,t,n,r)}function vw(e){return e instanceof Qx||(e=gw(e)),e?new _w((e=e.rgb()).r,e.g,e.b,e.opacity):new _w}function bw(e,t,n,r){return 1===arguments.length?vw(e):new _w(e,t,n,null==r?1:r)}function _w(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function xw(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}`}function ww(){const e=Sw(this.opacity);return`${1===e?"rgb(":"rgba("}${Aw(this.r)}, ${Aw(this.g)}, ${Aw(this.b)}${1===e?")":`, ${e})`}`}function Sw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Aw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ew(e){return((e=Aw(e))<16?"0":"")+e.toString(16)}function Mw(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new kw(e,t,n,r)}function Iw(e){if(e instanceof kw)return new kw(e.h,e.s,e.l,e.opacity);if(e instanceof Qx||(e=gw(e)),!e)return new kw;if(e instanceof kw)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new kw(o,s,u,e.opacity)}function kw(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Cw(e){return(e=(e||0)%360)<0?e+360:e}function Pw(e){return Math.max(0,Math.min(1,e||0))}function Ow(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Xx(Qx,gw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pw,formatHex:pw,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Iw(this).formatHsl()},formatRgb:dw,toString:dw}),Xx(_w,bw,Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new _w(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new _w(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _w(Aw(this.r),Aw(this.g),Aw(this.b),Sw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xw,formatHex:xw,formatHex8:function(){return`#${Ew(this.r)}${Ew(this.g)}${Ew(this.b)}${Ew(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ww,toString:ww})),Xx(kw,function(e,t,n,r){return 1===arguments.length?Iw(e):new kw(e,t,n,null==r?1:r)},Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new kw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new kw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new _w(Ow(e>=240?e-240:e+120,i,r),Ow(e,i,r),Ow(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new kw(Cw(this.h),Pw(this.s),Pw(this.l),Sw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Sw(this.opacity);return`${1===e?"hsl(":"hsla("}${Cw(this.h)}, ${100*Pw(this.s)}%, ${100*Pw(this.l)}%${1===e?")":`, ${e})`}`}}));const Nw=Math.PI/180,Tw=180/Math.PI;var Lw=-.14861,zw=1.78277,Rw=-.29227,Dw=-.90649,jw=1.97294,Fw=jw*Dw,Uw=jw*zw,Bw=zw*Rw-Dw*Lw;function Gw(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof qw)return new qw(e.h,e.s,e.l,e.opacity);e instanceof _w||(e=vw(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Bw*r+Fw*t-Uw*n)/(Bw+Fw-Uw),a=r-i,o=(jw*(n-i)-Rw*a)/Dw,s=Math.sqrt(o*o+a*a)/(jw*i*(1-i)),u=s?Math.atan2(o,a)*Tw-120:NaN;return new qw(u<0?u+360:u,s,i,e.opacity)}(e):new qw(e,t,n,null==r?1:r)}function qw(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xx(qw,Gw,Kx(Qx,{brighter(e){return e=null==e?tw:Math.pow(tw,e),new qw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ew:Math.pow(ew,e),new qw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Nw,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new _w(255*(t+n*(Lw*r+zw*i)),255*(t+n*(Rw*r+Dw*i)),255*(t+n*(jw*r)),this.opacity)}}));var Vw=e=>()=>e;function $w(e,t){return function(n){return e+n*t}}function Jw(e){return 1===(e=+e)?Ww:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Vw(isNaN(t)?n:t)}}function Ww(e,t){var n=t-e;return n?$w(e,n):Vw(isNaN(e)?t:e)}var Zw=function e(t){var n=Jw(t);function r(e,t){var r=n((e=bw(e)).r,(t=bw(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Ww(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);var Yw,Hw=(Yw=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return function(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}((n-r/t)*t,o,i,a,s)}},function(e){var t,n,r=e.length,i=new Array(r),a=new Array(r),o=new Array(r);for(t=0;t<r;++t)n=bw(e[t]),i[t]=n.r||0,a[t]=n.g||0,o[t]=n.b||0;return i=Yw(i),a=Yw(a),o=Yw(o),n.opacity=1,function(e){return n.r=i(e),n.g=a(e),n.b=o(e),n+""}});function Xw(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function Kw(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=aS(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}function Qw(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function eS(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function tS(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=aS(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}var nS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rS=new RegExp(nS.source,"g");function iS(e,t){var n,r,i,a=nS.lastIndex=rS.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(n=nS.exec(e))&&(r=rS.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,u.push({i:o,x:eS(n,r)})),a=rS.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var n,r=0;r<t;++r)s[(n=u[r]).i]=n.x(e);return s.join("")})}function aS(e,t){var n,r=typeof t;return null==t||"boolean"===r?Vw(t):("number"===r?eS:"string"===r?(n=gw(t))?(t=n,Zw):iS:t instanceof gw?Zw:t instanceof Date?Qw:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?Xw:Array.isArray(t)?Kw:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?tS:eS)(e,t)}function oS(e){return function t(n){function r(t,r){var i=e((t=Gw(t)).h,(r=Gw(r)).h),a=Ww(t.s,r.s),o=Ww(t.l,r.l),s=Ww(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,r.gamma=t,r}(1)}oS(function(e,t){var n=t-e;return n?$w(e,n>180||n<-180?n-360*Math.round(n/360):n):Vw(isNaN(e)?t:e)});var sS=oS(Ww);function uS(e,t){for(var n,r=cS(e,null),i=e.length,a=function(e){var t=e[0]/100,n=e[1]/100;return 2!=e.length&&bt("Only two stops are currently supported"),t>=0&&n<=1&&t<n||bt("Invalid gradient stops:",e),function(e){return e*(n-t)+t}}(t),o=[],s=0;s<i;s++)n=r(a(s/(i-1))*(i-1)),o.push(n);return o}function cS(e,t){for(var n=[],r=e.length-1,i=1;i<e.length;i++)n.push(aS(e[i-1],e[i]));return function(e){if(-1==e)return t;!1==(e>=0&&e<=r)&&vt("Range error");var i=e==r?r-1:Math.floor(e),a=e==r?1:e%1;return n[i](a)}}function fS(e,t,n){var r=e.length;return function(i){return i>=0&&i<r?e[i]:-2==i?void 0===n?t:n:t}}function lS(e,t,n){return n.continuous?cS(e,t):fS(e,t,n.other)}function hS(e,t){return{width:t.key_width||"dataviz"==e&&500||300,tileHeight:t.key_tile_height||10,labelSuffix:t.key_label_suffix||"",lastSuffix:t.key_last_suffix||"",chartHeight:90,chartColor:"#ddd",ticColor:"rgba(0,0,0,0.3)",ticLen:t.key_tic_length>=0?+t.key_tic_length:6,fontFamily:"sans-serif",fontSize:t.key_font_size||13,textColor:"#555"}}function pS(e,t,n,r,i){var a,o,s,u=hS("simple",i),c=function(e,t,n){for(var r=[],i=0;i<n.length;i++)r.push(IS(i*e,0,e,t,n[i]));return AS(r)}(u.width/e.length,u.tileHeight,e),f=[c];e.length==t.length+1?(a=wS(t,s=vS(t.length,u.width),0,u.width,u),o=bS(s,0,u.width,u),f.push(o,a)):e.length==t.length+2&&(u.ticLen=2,a=function(e,t){var n,r=[],i=yS(e,t);_S(t);for(var a=0;a<i.length;a++)n=(a+.5)*t.width/i.length,r.push(ES(i[a],n,t));return AS(r)}(xS(t,n,r),u),f.push(a)),SS(i.key_name||"simple-key",f,u.width)}function dS(e,t,n,r){var i=hS("dataviz",r),a=n[0],o=n[n.length-1],s=xS(t,a,o),u=function(e,t){for(var n,r,i=5,a=Math.floor(t.width/i),o=TS(OS(e,a-1),e),s=Math.max.apply(o,o),u=[],c=t.tileHeight,f=0;f<a;f++)(n=o[f])&&(r=n/s*t.chartHeight,u.push(IS(f*i,c,i,r,t.chartColor)));return AS(u)}(n,i),c=function(e,t,n,r,i){for(var a,o,s=xS(t,n,r),u=mS(i.width,n,r),c=[],f=0;f<s.length;f++)a=u(s[f]),o=u(s[f+1])-a,c.push(IS(a,0,o,i.tileHeight,e[f]));return AS(c)}(e,t,a,o,i),f=wS(s,s,a,o,i),l=bS(s,a,o,i);SS(r.key_name||"dataviz-key",[u,c,l,f],i.width)}function gS(e,t,n,r,i){var a=hS("gradient",i),o=function(e,t,n){for(var r=[],i=function(e,t){var n=e.length-1,r=t/n;return function(t){var i=Math.min(Math.floor(t/r),n-1),a=(t-i*r)/r;return e[i]*(1-a)+e[i+1]*a}}(t,n.width),a=2,o=0;o<n.width;o+=a)r.push(IS(o,0,a,n.tileHeight,e(i(o))));return AS(r)}(e,xS(t,n,r),a),s=vS(t.length,a.width),u=wS(t,s,0,a.width,a),c=[o,bS(s,0,a.width,a),u];SS(i.key_name||"gradient-key",c,a.width)}function mS(e,t,n){return function(r){return(r-t)/(n-t)*e}}function yS(e,t){var n=function(e){var t=e[0],n=e[e.length-1],r=(n-t)/e.length,i=0;r<1?i=2:r<10&&(i=1);return i}(e);return e.map(function(r,i){var a=i==e.length-1&&t.lastSuffix||t.labelSuffix||"";return Bl(r,n)+a})}function vS(e,t){for(var n=[],r=0;r<e;r++)n.push((r+1)/(e+1)*t);return n}function bS(e,t,n,r){for(var i=mS(r.width,t,n),a=[],o=0;o<e.length;o++)a.push(MS(i(e[o]),r));return AS(a)}function _S(e){return e.labelSuffix?3:0}function xS(e,t,n){return[t].concat(e,n)}function wS(e,t,n,r,i){for(var a=yS(e,i),o=mS(i.width,n,r),s=[],u=0;u<t.length;u++)s.push(ES(a[u],o(t[u]),i));return AS(s)}function SS(e,t,n){var r={width:n,crisp_paths:!0,default_linecap:"butt"},i=e+(e.endsWith(".svg")?"":".svg"),a=bm(1==t.length?t[0]:io(t),r);a[0].filename=i,zf(a,{})}function AS(e){return Kv({type:"FeatureCollection",features:e})}function ES(e,t,n){var r,i=-(n.ticLen+.7*n.fontSize+4);return t<=0?r="start":t>=n.width?r="end":(r="middle",t+=_S(n)),{type:"Feature",properties:{"label-text":e,"font-family":n.fontFamily,"font-size":n.fontSize,"text-anchor":r,fill:n.textColor},geometry:{type:"Point",coordinates:[t,i]}}}function MS(e,t){var n=t.tileHeight,r=t.tileHeight+t.ticLen;return{type:"Feature",properties:{stroke:t.ticColor},geometry:{type:"LineString",coordinates:[[e,n],[e,n-r]]}}}function IS(e,t,n,r,i){var a=function(e,t,n,r){return[[e,t],[e,t+r],[e+n,t+r],[e+n,t],[e,t]]}(e,t,n,r);return{type:"Feature",properties:{fill:i},geometry:{type:"Polygon",coordinates:[a]}}}function kS(e,n,r,i,a){var o,s,u,c,f=e.length,l=(a.continuous?f-1:f)-1,h=a.precision?Vl(a.precision):null;h&&(r=r.map(h));var p,d=(p=r.filter(t.isFiniteNumber),t.genericSort(p,!0),p);a.outer_breaks&&(d=function(e,t){var n=t[0],r=t[1];r>n==!1&&bt("Invalid data range:",t);var i=e.map(function(e){return e<n&&(e=n),e>r&&(e=r),e});i[0]<n&&i.unshift(n);i[i.length-1]<r&&i.push(r);return i}(d,a.outer_breaks));var g=r.length-d.length,m=d[0],y=d[d.length-1],v=a.outer_breaks?function(e){return e<a.outer_breaks[0]&&(e=a.outer_breaks[0]),e>a.outer_breaks[1]&&(e=a.outer_breaks[1]),e}:null;return a.outer_breaks&&(m=a.outer_breaks[0],y=a.outer_breaks[1]),0===l?o=[]:a.breaks?o=a.breaks:"equal-interval"==i?o=OS(d,l):"quantile"==i?o=NS(d,l):"hybrid"==i?o=function(e,t){var n=NS(e,t);if(t<3)return n;var r=n[0],i=n[n.length-1],a=e.filter(function(e){return e>=r&&e<i}),o=OS(a,t-2),s=[r].concat(o).concat(i);return s}(d,l):"nice"==i?xt("Nice breaks:",o=Jx(d,l)):bt("Unknown classification method:",i),function(e,t,n){var r=TS(t,e),i=function(e,t){for(var n,r,i,a,o=[],s=0,u=0;s<=e.length;s++)(n=CS(t,r=0===s?-1/0:e[s-1],i=s<e.length?e[s]:1/0,u))?(a=[t[n[0]],t[n[1]]],u=n[1]):a=0===s?[i,i]:s<e.length?[r,i]:[r,r],o.push(a);return o}(t,e).map(function(e,t){return[`${e[0]} - ${e[1]}`,`(${r[t]})`]});i.push(["null or non-numeric values",`(${n})`]),xt("Data ranges and (feature counts):\n"+zt(i,["left","right"]))}(d,o,g),u=a.continuous?function(e,n,r){return function(i){var a,o,s=e.length;if(!t.isValidNumber(i)||i<n||i>r)return-1;for(var u=0;u<=s;u++)if(o=u===s?r:e[u],u===s||i<o)return u+(i-(a=0===u?n:e[u-1]))/(o-a);vt("Range error")}}(o,m,y):PS(o,h),c=lS(e,n,a),s=function(e){return v&&(e=v(e)),c(u(e))},a.colors&&(a.key||a.key_style)&&("gradient"==a.key_style&&a.continuous?gS(s,o,m,y,a):"dataviz"==a.key_style?dS(e,o,d,a):(a.key||"simple"==a.key_style)&&pS(e,o,m,y,a)),s}function CS(e,t,n,r){for(var i,a=e.length,o=-1,s=-1;r<a&&!((i=e[r])>=n);)-1==o&&i>=t&&(o=r),s=r,r++;return o>-1&&s>-1?[o,s]:null}function PS(e,n){var r=!1;return function(e){return LS(e,t.genericSort(e.map(parseFloat)))}(e)||(!function(e){return LS(e,t.genericSort(e.map(parseFloat),!1))}(e)?bt("Invalid class breaks:",e.join(",")):(e=e.concat().reverse(),r=!0)),function(t){var i=-1;return Number(t)===t&&(n&&(t=t(n)),i=zS(t,e)),r&&i>-1&&(i=e.length-i),i}}function OS(e,t){var n,r=t+1,i=e[0],a=(e[e.length-1]-i)/r,o=[];for(n=1;n<r;n++)o.push(i+n*a);return o}function NS(e,t){var n,r,i=t+1,a=e.length/i,o=[];for(n=1;n<i;n++)r=Math.floor(n*a),o.push(e[r]);return o}function TS(e,n){var r=t.initializeArray(new Array(e.length+1),0);return n.forEach(function(t){var n=zS(t,e);-1==n?vt("Indexing error"):r[n]++}),r}function LS(e,t){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return e.length==t.length}function zS(e,n){var r=0;if(!t.isValidNumber(e))return-1;for(;r<n.length&&e>=n[r];)r++;return r}function RS(e,t,n){var r=n.categories.reduce((e,t,n)=>(e[t]=n,e),{}),i=fS(e,t,n.other);return function(e){var t;return t=e in r?r[e]:e||0===e?-2:-1,i(t)}}function DS(e,n,r){var i,a=r||{},o=!a.reusable,s=n.size(),u=new Int32Array(s),c=new Int32Array(s);return a.where&&(i=op(a.where,e,n)),t.initializeArray(u,-1),t.initializeArray(c,-1),wr(e.shapes,function(e){var t=Yt(e.arcId),n=e.shapeId,r=u[t];-1==r?u[t]=n:n<r?(c[t]=r,u[t]=n):c[t]=n}),function(e){return function(t){return function(e,t){var n,r=Yt(e),a=u[r],s=c[r];return-1==a||null===(n=t(a,s))||!1===n?null:(o&&(u[r]=-1,c[r]=-1),i&&!i(a,s)?null:n)}(t,e)}}}var jS=Object.freeze({__proto__:null,getArcClassifier:DS});function FS(e,t){var n,r,i,a=DS(e,t,{reusable:!0})(function(e,t){return-1==t?-1:e==n?t:e});function o(e){var t=a(e);-1!=t&&(i?i(t,e):-1==r.indexOf(t)&&r.push(t))}return function(t,a){if(n=t,!a)return r=[],br(e.shapes[t],o),r;i=a,br(e.shapes[t],o),i=null}}function US(e,t){var n=DS(e,t)(function(e,t){return t>-1&&e>-1?[e,t]:null}),r=[],i={};return br(e.shapes,function(e){var t,a=n(e);a&&(t=a.join("~"))in i==!1&&(r.push(a),i[t]=!0)}),r}var BS=Object.freeze({__proto__:null,findPairsOfNeighbors:US,getNeighborLookupFunction:FS});function GS(e,n,r){Ri(e);var i,a,o,s=FS(e,n.arcs),u=0,c=t.range(ki(e)).map(function(e){var t=s(e)||[];return{nabes:t,colorId:-1,nabeColors:[],uncolored:t.length,saturation:0,common:0}}),f=(i=r.length,a=t.range(i),o=new Uint32Array(i),function(e){return e>=0&&e<i?(o[e]++,t.sortArrayIndex(a,o,!0)):void 0!==e&&vt("Unexpected color index:",e),a}),l=f(),h=function(e){var n=e.concat();function r(t){for(var r;n.length>0;)t(r=n.pop()),qS(r,n,e)}return t.sortOn(n,"uncolored",!0),{forEach:r}}(c);return h.forEach(function(e){var t=function(e,t,n){for(var r,i=0;i<n.length;i++)if(JS(e,t,r=n[i]))return r;return-1}(e,c,l);-1==t&&(u++,t=l[0]),e.colorId=t,l=f(t)}),u>0&&xt(`Unable to find non-adjacent colors for ${u} ${1==u?"polygon":"polygons"}`),function(e){return r[c[e].colorId]}}function qS(e,t,n){for(var r,i=e.nabes,a=0;a<i.length;a++)(r=n[i[a]]).colorId>-1||VS(r,e.colorId,t)}function VS(e,t,n){var r,i=function(e,t){var n,r=0,i=t.length;for(;i-r>50;)t[n=Math.floor((r+i)/2)].saturation>=e.saturation?i=n:r=n;return t.indexOf(e,r)}(e,n),a=n.length;for(-1==i&&vt("Indexing error"),e.uncolored--,e.nabeColors.includes(t)?e.common++:(e.saturation++,e.nabeColors.push(t));++i<a&&$S(e,r=n[i]);)n[i-1]=r,n[i]=e}function $S(e,t){return e.saturation>t.saturation||!(e.saturation<t.saturation)&&(e.common>t.common||!(e.common<t.common)&&e.uncolored<t.uncolored)}function JS(e,t,n){for(var r=e.nabes,i=0;i<r.length;i++)if(t[r[i]].colorId===n)return!1;return!0}function WS(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(6*r,6*++r);return n}var ZS=WS("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),YS=WS("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),HS=WS("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),XS=WS("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),KS=WS("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),QS=WS("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),eA=WS("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),tA=WS("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),nA=WS("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),rA=WS("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),iA=e=>Hw(e[e.length-1]),aA=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(WS),oA=iA(aA),sA=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(WS),uA=iA(sA),cA=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(WS),fA=iA(cA),lA=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(WS),hA=iA(lA),pA=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(WS),dA=iA(pA),gA=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(WS),mA=iA(gA),yA=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(WS),vA=iA(yA),bA=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(WS),_A=iA(bA),xA=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(WS),wA=iA(xA),SA=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(WS),AA=iA(SA),EA=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(WS),MA=iA(EA),IA=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(WS),kA=iA(IA),CA=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(WS),PA=iA(CA),OA=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(WS),NA=iA(OA),TA=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(WS),LA=iA(TA),zA=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(WS),RA=iA(zA),DA=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(WS),jA=iA(DA),FA=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(WS),UA=iA(FA),BA=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(WS),GA=iA(BA),qA=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(WS),VA=iA(qA),$A=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(WS),JA=iA($A),WA=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(WS),ZA=iA(WA),YA=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(WS),HA=iA(YA),XA=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(WS),KA=iA(XA),QA=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(WS),eE=iA(QA),tE=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(WS),nE=iA(tE),rE=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(WS),iE=iA(rE);var aE=sS(Gw(300,.5,0),Gw(-240,.5,1)),oE=sS(Gw(-100,.75,.35),Gw(80,1.5,.8)),sE=sS(Gw(260,.75,.35),Gw(80,1.5,.8)),uE=Gw();var cE=bw(),fE=Math.PI/3,lE=2*Math.PI/3;function hE(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var pE,dE=hE(WS("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),gE=hE(WS("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),mE=hE(WS("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),yE=hE(WS("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),vE=Object.freeze({__proto__:null,interpolateBlues:ZA,interpolateBrBG:oA,interpolateBuGn:AA,interpolateBuPu:MA,interpolateCividis:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"},interpolateCool:sE,interpolateCubehelixDefault:aE,interpolateGnBu:kA,interpolateGreens:HA,interpolateGreys:KA,interpolateInferno:mE,interpolateMagma:gE,interpolateOrRd:PA,interpolateOranges:iE,interpolatePRGn:uA,interpolatePiYG:fA,interpolatePlasma:yE,interpolatePuBu:LA,interpolatePuBuGn:NA,interpolatePuOr:hA,interpolatePuRd:RA,interpolatePurples:eE,interpolateRainbow:function(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return uE.h=360*e-100,uE.s=1.5-1.5*t,uE.l=.8-.9*t,uE+""},interpolateRdBu:dA,interpolateRdGy:mA,interpolateRdPu:jA,interpolateRdYlBu:vA,interpolateRdYlGn:_A,interpolateReds:nE,interpolateSinebow:function(e){var t;return e=(.5-e)*Math.PI,cE.r=255*(t=Math.sin(e))*t,cE.g=255*(t=Math.sin(e+fE))*t,cE.b=255*(t=Math.sin(e+lE))*t,cE+""},interpolateSpectral:wA,interpolateTurbo:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"},interpolateViridis:dE,interpolateWarm:oE,interpolateYlGn:GA,interpolateYlGnBu:UA,interpolateYlOrBr:VA,interpolateYlOrRd:JA,schemeAccent:YS,schemeBlues:WA,schemeBrBG:aA,schemeBuGn:SA,schemeBuPu:EA,schemeCategory10:ZS,schemeDark2:HS,schemeGnBu:IA,schemeGreens:YA,schemeGreys:XA,schemeOrRd:CA,schemeOranges:rE,schemePRGn:sA,schemePaired:XS,schemePastel1:KS,schemePastel2:QS,schemePiYG:cA,schemePuBu:TA,schemePuBuGn:OA,schemePuOr:lA,schemePuRd:zA,schemePurples:QA,schemeRdBu:pA,schemeRdGy:gA,schemeRdPu:DA,schemeRdYlBu:yA,schemeRdYlGn:bA,schemeReds:tE,schemeSet1:eA,schemeSet2:tA,schemeSet3:nA,schemeSpectral:xA,schemeTableau10:rA,schemeYlGn:BA,schemeYlGnBu:FA,schemeYlOrBr:qA,schemeYlOrRd:$A}),bE={categorical:[],sequential:[],rainbow:[],diverging:[],all:[]};function _E(){pE||(pE={},wE("categorical","Category10,Accent,Dark2,Paired,Pastel1,Pastel2,Set1,Set2,Set3,Tableau10"),wE("sequential","Blues,Greens,Greys,Purples,Reds,Oranges,BuGn,BuPu,GnBu,OrRd,PuBuGn,PuBu,PuRd,RdPu,YlGnBu,YlGn,YlOrBr,YlOrRd"),wE("rainbow","Cividis,CubehelixDefault,Rainbow,Warm,Cool,Sinebow,Turbo,Viridis,Magma,Inferno,Plasma"),wE("diverging","BrBG,PRGn,PRGn,PiYG,PuOr,RdBu,RdGy,RdYlBu,RdYlGn,Spectral"),function(){function e(e){e.forEach(function(e){vE["scheme"+e]||xt("Warning: missing data for",e)})}function t(e){e.forEach(function(e){vE["interpolate"+e]||xt("Missing interpolator for",e)})}e(bE.categorical),e(bE.sequential),e(bE.diverging),t(bE.sequential),t(bE.rainbow),t(bE.diverging)}(),SE("Category20","1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),SE("Category20b","393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),SE("Category20c","3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),SE("Tableau20","4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),bE.all=[].concat(bE.sequential,bE.rainbow,bE.diverging,bE.categorical))}function xE(e){if(!e)return null;for(var t=e.toLowerCase(),n=0;n<bE.all.length;n++)if(bE.all[n].toLowerCase()==t)return bE.all[n];return null}function wE(e,t){var n=t.split(",");bE[e]=bE[e].concat(n),"categorical"==e&&n.forEach(e=>{pE[e]=vE["scheme"+e]})}function SE(e,t){bE.categorical.push(e),pE[e]=function(e){for(var t=[],n=0,r=e.length;n<r;n+=6)t.push("#"+e.substr(n,6));return t}(t)}function AE(e){return _E(),bE.all.includes(xE(e))}function EE(e){return _E(),bE.categorical.includes(xE(e))}function ME(e,n,r){_E(),e=xE(e);var i,a=vE["scheme"+e],o=vE["interpolate"+e];return a||o||bt("Unknown color scheme name:",e),bE.categorical.includes(e)&&bt(e," is a categorical color scheme (expected a sequential color scheme)"),i=a&&a[n]?a[n]:function(e,n){n>0!=!1&&t.isInteger(n)||vt("Expected a positive integer");for(var r=[],i=0;i<n;i++)r.push(e(i/(n-1)));return r}(o,n),r&&(i=uS(i,r)),i}function IE(e){return"null_value"in e?function(e){t.isString(e)&&!isNaN(+e)&&(e=+e);"null"===e&&(e=null);return e}(e.null_value):e.colors?"#eee":e.values?null:-1}function kE(e,n,r){var i,a="categorical"==e||"non-adjacent"==e,o=r.colors&&1==r.colors.length?r.colors[0]:null;return"blacki"==e?[]:("random"==o?(i=a?function(e){_E();var n=Math.min(e,20),r=bE.categorical.filter(e=>pE[e].length>=n);return t.pickOne(r)||"Tableau20"}(n):function(e){_E();var n=bE[e];return n||vt("Unknown color scheme type:",e),t.pickOne(n)}("sequential"),xt("Randomly selected color scheme:",i)):AE(o)?i=o:o&&!bh(o)?bt("Unrecognized color scheme name:",o):r.colors&&r.colors.forEach(_h),i?a&&EE(i)?function(e,t){var n;return _E(),AE(e=xE(e))?n=EE(e)?pE[e]||vE["scheme"+e]:ME(e,t):bt("Unknown color scheme name:",e),t>n.length?(xt("Color scheme has",n.length,"colors. Using duplication to match",t,"categories."),n=function(e,t){for(;e.length>0&&e.length<t;)e=e.concat(e.slice(0,t-e.length));return e}(n,t)):n=n.slice(0,t),n}(i,n):ME(i,n,r.stops):r.colors||r.values?a?function(e,t){t!=e.length&&bt("Mismatch in number of categories and number of values");return CE(e)}(r.colors||r.values,n):function(e,t,n){var r=CE(e);if(t!=r.length||n.stops)return function(e,t,n){if(e.length==t&&!n)return e;for(var r,i,a,o,s=e.length-1,u=[e[0]],c=1;c<t-1;c++)a=(r=c/(t-1)*s)-(i=Math.floor(r)),o=aS(e[i],e[i+1])(a),u.push(o);return u.push(e[e.length-1]),n&&(u=uS(u,n)),u}(r,t,n.stops);return r}(r.colors||r.values,n,r):function(e){for(var t=[],n=0;n<e;n++)t.push(n);return t}(n))}function CE(e){var n=e;return e.every(t.parseNumber)&&(n=e.map(function(e){return+e})),n}var PE=["quantile","nice","equal-interval","hybrid","breaks"],OE=["non-adjacent","indexed","categorical","blacki"].concat(PE);function NE(e,t,n,r){var i=new Vf(t,n.arcs);return e.map(function(e){return function(e){var t=null;e&&(t=e.reduce(a,[]));return t&&t.length>0?t:null}(e)});function a(e,t){for(var n,a,o=null,s=0;s<t.length;s++)n=t[s],(a=i.arcIsEnclosed(n))&&"clip"==r||!a&&"erase"==r?(o||e.push(o=[]),o.push(n)):o=null;return e}}pp.classify=function(e,n,r){e.data||Wi(e);var i,a,o,s,u,c,f,l,h,p,d=r||{},g=e.data&&e.data.getRecords(),m=!!d.colors;d.color_scheme&&bt("color-scheme is not a valid option, use colors instead"),d.index_field?(i=d.index_field,a=ei(d.field,g)):d.field&&(i=d.field,a=ei(d.field,g)),i&&Pi(e.data,i),p=function(e,t){var n;if(e.method)n=e.method;else if(e.breaks)n="breaks";else if(e.index_field)n="indexed";else if(e.categories||"string"==t)n="categorical";else if("number"==t)n="quantile";else if("date"==t||"object"==t)bt("Data type does not support classification:",t);else{if(null===t)return null;bt(void 0===t?"Expected a data field to classify or the non-adjacent option":"Unable to determine which classification method to use.")}return OE.includes(n)||bt("Not a recognized classification method:",n),PE.includes(n)&&"number"!=t&&null!==t&&bt("The",n,"method requires a numerical data field"),n}(d,a),"non-adjacent"==p?("polygon"!=e.geometry_type&&bt("The non-adjacent option requires a polygon layer"),i&&bt("The non-adjacent option does not accept a data field argument")):i||bt("Missing a data field to classify"),"categorical"==p&&(d.categories&&!d.categories.includes("*")||!i||(d.categories=ai(g,i)),d.categories&&"number"==a&&(d.categories=d.categories.map(e=>+e))),d.classes?(t.isInteger(d.classes)&&d.classes>1!=!1||bt("Invalid number of classes:",d.classes,"(expected a value greater than 1)"),l=d.classes):l="blacki"==p?999:"indexed"==p&&i?function(e,n){var r=[],i=-1;return e.forEach(function(e){var a=(e||{})[n];!t.isInteger(a)||a<-2?r.push(a):i=Math.max(i,a)}),r.length>0&&bt(`Class index field contains invalid value(s): ${r.slice(0,5)}`),i+1}(g,i):d.breaks?d.breaks.length+1:"categorical"==p&&d.categories?d.categories.length:d.colors&&d.colors.length>1?d.colors.length:d.values&&d.values.length>1?d.values.length:"non-adjacent"==p?5:4,(h=d.continuous?l+1:l)>1==!1&&bt("Missing a valid number of values"),s=kE(p,h,d),d.invert&&(s=s.concat().reverse()),m&&xt("Colors:",function(e){if(e.some(e=>t.isString(e)&&0===e.indexOf("rgb(")))return function(e){return e.map(function(e){var t=gw(e);return t||bt("Unable to parse color:",e),t.formatHex()})}(e);return e}(s)),u=IE(d),null===a?f=function(){return u}:"blacki"==p?f=function(e,n){var r=e.data.getRecords(),i={},a=[],o=0;r.forEach(function(e,t){var r,s,u=e[n],c=-1;if(Array.isArray(u))for(var l=0;l<u.length;l++)-1==(r=(s=u[l])in i?i[s]:-1)?(-1==c&&(c=o++),Array.isArray(a[c])?a[c].includes(s)||a[c].push(s):a[c]=[s],i[s]=c):-1==c?c=r:c>r?(f(c,r),c=r):c<r&&f(r,c)});var s,u=(s=-1,a.map(function(e,t){return null!==e&&s++,s})),c=r.map(function(e){var t=e[n];return Array.isArray(t)&&0!==t.length?(t[0]in i==0&&vt("Internal error"),u[i[t[0]]]):-1});return a=null,i=null,function(e){return c[e]};function f(e,n){a[e].forEach(function(e){i[e]=n}),a[n]=t.uniq(a[n].concat(a[e])),a[e]=null}}(e,i):"non-adjacent"==p?f=GS(e,n,s):c="indexed"==p?function(e,n,r){var i=e.length,a=lS(e,n,r);return function(e){var n=t.isInteger(e)&&e>=0&&e<i?e:-1;return a(n)}}(s,u,d):"categorical"==p?RS(s,u,d):kS(s,u,ii(g,i),p,d),c&&(f=function(e){var t=g[e]||{};return c(t[i])}),o=m?"polyline"==e.geometry_type?"stroke":"fill":"class",d.save_as?o=d.save_as:xt(`Output was saved to "${o}" field (use save-as= to change)`),g.forEach(function(e,t){e[o]=f(t)})},pp.filterSlivers=function(e,n,r){return"polygon"!=e.geometry_type?0:function(e,n,r){var i=t.extend({sliver_control:1},r),a=lh(e,n,i),o=a.filter,s=0,u=function(e,t,n){if(o(e,t,n))return s++,null};Pr(e.shapes,u),xt(t.format("Removed %'d sliver%s using %s",s,t.pluralSuffix(s),a.label)),i.remove_empty&&pp.filterFeatures(e,n.arcs,{remove_empty:!0,verbose:!1});return s}(e,n,r)};var TE=Object.freeze({__proto__:null,clipPolylines:NE});function LE(e,t){t=t&&!e.arcs.isPlanar();var n=new Uint8Array(e.arcs.size()),r=od(e,t),i=wl(e,n);return function(t){if(!t)return null;var n=[],a=[];r(t,n,a),n=i(n,"flatten"),a.forEach(mr),(a=i(a,"flatten")).forEach(mr);var o=function(e,t){for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e}(n,a),s=i(o,"dissolve");return s.length>1&&(s=function(e,t){if(e.length<=1)return e;var n=Er(e,t,"polygon"),r=new Vf(e.map(function(e){return[e]}),t);return e.filter(function(e,t){var i,a=r.findSmallestEnclosingPolygon(e),o=!0;return a>-1&&(i=n[t].area>0,n[a].area>0==i&&(o=!1)),o})}(s,e.arcs)),s.length>0?s:null}}function zE(e,t,n,r,i){var a=n.arcs,o=i||{},s=new Uint8Array(a.size()),u=new Uint8Array(a.size()),c=0,f=0,l=[],h=xl(n,function(e){var t,n,i=e>=0,a=i?e:~e,o=u[a],c=s[a];i?(t=o,n=c):(t=o>>4,n=c>>4);n&=3;var h=!1;3==(t&=3)?1==n||2==n&&"erase"==r||(h=!0):0===t&&3==n&&(l.push(e),h=!0);h&&(3==n&&f++,o=i?gl(o,1,3):gl(o,16,48));return o|=i?4:64,u[a]=o,h},function(e){var t=e>=0,n=t?e:~e,r=t?1:16,i=u[n],a=s[n];a>0&&c++;return(i&r)>0||(a&r)>0}),p=LE(n);o.bbox2||(e=e.map(p)),bl(t,a,s,"clip"==r,"erase"==r,!0,17);var d=new Vf(t,a),g=e.map(function(e,t){return e?function(e,t,n){var r=[],i="clip"==t,o="erase"==t;bl(e,a,u,!0,!1,!1),Cr(e,function(e){for(var t,a=0,s=e.length;a<s;a++)if(c=0,f=0,t=h(e[a]))if(0===c||0===f){var u=n.pathIsEnclosed(t);(i&&u||o&&!u)&&r.push(t)}else r.push(t)}),_l(e,0,u,!0,!0,!0),l.length>0&&(_l(l,0,u,!0,!0,!0),l=[]);return 0===r.length?null:r}(e,r,d):null});vl(g,u);var m=function(e){return e.map(function(e){var t=[];return Cr(e,function(e){for(var n=!0,r=!1,i=0;i<e.length;i++){if(!y(e[i],u)){n=!1;break}!r&&v(e[i],s)&&(r=!0)}n&&r&&t.push(e)}),t.length>0?t:null})}(t);return _l(t,0,u,!0,!0),d=new Vf(m,a),e.forEach(function(e,t){var n=e?function(e,t,n){var r=n.findPathsInsideShape(e),i=[];if(!r)return null;"erase"==t&&r.forEach(mr);r.length<=1?i=r:(bl(r,a,u,!0,!1,!0),r.forEach(function(e){for(var t,n=0;n<e.length;n++)(t=h(e[n]))&&i.push(t)}));return i.length>0?i:null}(e,r,d):null;n&&(g[t]=(g[t]||[]).concat(n))}),g;function y(e,t){return!(136&t[Yt(e)])}function v(e,t){return(17&t[Yt(e)])>0}}function RE(e,t,n,r){var i=new Vf(t,n),a=e.reduce(function(e,t){for(var n,a=t?t.length:0,o=[],s=0;s<a;s++)n=i.findEnclosingShape(t[s])>-1,("clip"==r&&n||"erase"==r&&!n)&&o.push(t[s].concat());return e.push(o.length>0?o:null),e},[]);return a}var DE=Object.freeze({__proto__:null,clipPoints:RE});function jE(e,n,r,i){t.some(e,wi);var a,o,s,u=i.bbox||i.bbox2;return r&&r.geometry_type&&(r={dataset:n,layer:r,disposable:!0}),u?(o=function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=[[t,n],[t,i],[r,i],[r,n],[t,n]];i>n&&r>t||bt("Invalid bbox (should be [xmin, ymin, xmax, ymax]):",e);return{arcs:new Wa([a]),layers:[{shapes:[[[0]]],geometry_type:"polygon"}]}}(u),s=o.layers[0]):r?r.layer&&r.dataset?(s=r.layer,o=t.defaults({layers:[s]},r.dataset)):r.layers&&1==r.layers.length&&(s=r.layers[0],o=r):bt("Command requires a source file, layer id or bbox"),n.arcs!=o.arcs?(r&&!r.disposable&&(o.layers[0]=Gi(o.layers[0])),Ka(a=io([n,o]))):((a=t.extend({},n)).layers=n.layers.filter(function(e){return e!=s}),a.layers.push(s)),a}var FE=Object.freeze({__proto__:null,mergeLayersForOverlay:jE});function UE(e,t){var n=e.arcs,r=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=[],s=[],u=[],c=[];return e.forEachSegment(function(e,t,l,h){var p,d=l[e],g=h[e],m=l[t],y=h[t];BE(d,g,m,y,n,r,i,a)||GE(d,g,m,y,n,r,i,a)||((p=fr.segmentIntersection(n,a,i,a,d,g,m,y))&&f(o,p,e,t,l,h),(p=fr.segmentIntersection(n,r,i,r,d,g,m,y))&&f(u,p,e,t,l,h),(p=fr.segmentIntersection(n,r,n,a,d,g,m,y))&&f(c,p,e,t,l,h),(p=fr.segmentIntersection(i,r,i,a,d,g,m,y))&&f(s,p,e,t,l,h))}),{cutPoints:c.concat(u,s,o),bboxPoints:qE(t,c,o,s,u)};function f(e,t,n,r,i,a){t&&(e.push(l(t[0],t[1],n,r,i,a)),4==t.length&&e.push(l(t[2],t[3],n,r,i,a)))}function l(e,t,n,r,i,a){var o=zl(e,t,n,r,i,a);return Hp(e,t,o[0],o[1])}}(n,t),i=Yp(r.cutPoints,n);n.dedupCoords(),Jp(e,i);var a=function(e){for(var t,n,r=[],i=[],a={geometry_type:"polygon",shapes:[[i]]},o=0,s=e.length-1;o<s;o++)t=e[o],n=e[o+1],r.push([[t.x,t.y],[n.x,n.y]]),i.push(o);return{arcs:new Wa(r),layers:[a]}}(r.bboxPoints),o=io([e,a]),s=o.layers.pop();return e.arcs=o.arcs,e.layers=o.layers,s}function BE(e,t,n,r,i,a,o,s){return e<i&&n<i||e>o&&n>o||t<a&&r<a||t>s&&r>s}function GE(e,t,n,r,i,a,o,s){return e>i&&n>i&&e<o&&n<o&&t>a&&r>a&&t<s&&r<s}function qE(e,n,r,i,a){var o={x:e[0],y:e[1]},s={x:e[0],y:e[3]},u={x:e[2],y:e[3]},c={x:e[2],y:e[1]};return n=t.sortOn(n.concat([o,s]),"y",!0),r=t.sortOn(r.concat([s,u]),"x",!0),i=t.sortOn(i.concat([u,c]),"y",!1),a=t.sortOn(a.concat([c,o]),"x",!1),n.concat(r,i,a).reduce(function(e,t){var n=e.length>0?e[e.length-1]:null;return null!==n&&n.x==t.x&&n.y==t.y||e.push(t),e},[])}var VE=Object.freeze({__proto__:null,divideDatasetByBBox:UE,segmentInsideBBox:GE,segmentOutsideBBox:BE});function $E(e,t,n,r,i){var a=JE(e,t,n,r,i);e.forEach(function(e,t){var n=a[t];e.shapes=n.shapes,e.data=n.data}),ho(n)}function JE(e,n,r,i,a){var o,s,u,c=t.some(e,wi);return(a=a||{no_cleanup:!0}).bbox2&&c?WE(e,r,a):(s=(o=jE(e,r,n,a)).layers[o.layers.length-1],c?(u=Vp(o,a),r.arcs=o.arcs,s=pd(s=t.defaults({data:null},s),o,{quiet:!0,silent:!0})):u=new lo(o.arcs),ZE(e,s,u,i,a))}function WE(e,t,n){return ZE(e,UE(t,n.bbox2),new lo(t.arcs),"clip",n)}function ZE(e,t,n,r,i){return Ri(t,"Requires a polygon clipping layer"),e.reduce(function(e,a){return"slice"==r?e=e.concat(function(e,t,n,r){var i=pp.splitLayer(t,r.id_field,{no_replace:!0});return i.map(function(t,i){var a=YE(e,t,n,"clip",r);return a.name=function(e,t,n){var r=t?e.data.getRecords()[0][t]:n+1;return"slice-"+r}(t,r.id_field,i),a})}(a,t,n,i)):e.push(YE(a,t,n,r,i)),e},[])}function YE(e,t,n,r,i){var a,o,s,u=n.arcs,c=e.shapes?e.shapes.length:0,f=0;return 0===c?e:(e===t&&bt("Can't clip a layer with itself"),"point"==e.geometry_type?o=RE(e.shapes,t.shapes,u,r):"polygon"==e.geometry_type?o=zE(e.shapes,t.shapes,n,r,i):"polyline"==e.geometry_type?o=NE(e.shapes,t.shapes,n,r):bt("Invalid target layer:",e.name),s={name:e.name,geometry_type:e.geometry_type,shapes:o,data:e.data},i.remove_slivers&&"polygon"==s.geometry_type&&(f=function(e,t,n){var r=hh(n,dh(e,n),1),i=new Uint8Array(n.size()),a=0;return dr(t.shapes,i),Pr(e.shapes,function(e){for(var t=0,n=0,o=0,s=e&&e.length||0;o<s;o++)i[Yt(e[o])]>0?n++:t++;if(n>0&&t>0&&r(e))return a++,null}),a}(s,t,u)),pp.filterFeatures(s,u,{remove_empty:!0,verbose:!1}),s.data&&(s.data=s.data.clone()),(a=c-s.shapes.length)&&f&&xt(HE(a,f)),s)}function HE(e,n){var r=e?t.format("%,d null feature%s",e,t.pluralSuffix(e)):"",i=n?t.format("%,d sliver%s",n,t.pluralSuffix(n)):"";return r||i?t.format("Removed %s%s%s",r,r&&i?" and ":"",i):""}pp.clipLayers=function(e,t,n,r){return JE(e,t,n,"clip",r)},pp.eraseLayers=function(e,t,n,r){return JE(e,t,n,"erase",r)},pp.clipLayer=function(e,t,n,r){return pp.clipLayers([e],t,n,r)[0]},pp.eraseLayer=function(e,t,n,r){return pp.eraseLayers([e],t,n,r)[0]},pp.sliceLayers=function(e,t,n,r){return JE(e,t,n,"slice",r)},pp.sliceLayer=function(e,t,n,r){return pp.sliceLayers([e],t,n,r)};var XE=Object.freeze({__proto__:null,clipLayers:JE,clipLayersByBBox:WE,clipLayersByLayer:ZE,clipLayersInPlace:$E,getClipMessage:HE});function KE(e){var t,n=e.nodata||"white",r=e.precision?Vl(e.precision):null;return e.random||e.colors&&e.colors.length||bt("Missing colors= parameter"),e.random?t=function(e){e&&e.length||(e="#ccc,#888,#444".split(","));return function(t){var n=e.length,r=void 0===t?Math.floor(Math.random()*n):function(e){var t=String(e),n=5381,r=t.length;for(;r>0;)n=33*n^t.charCodeAt(--r);return Math.abs(n)}(t)%n;return e[r]}}(e.colors):e.breaks?(e.colors.length!=e.breaks.length+1&&bt("Number of colors should be one more than number of class breaks"),t=function(e,t,n,r){var i=PS(e,r),a=fS(t,n);return function(e){return a(i(e))}}(e.breaks,e.colors,n,r)):e.categories?(e.colors.length!=e.categories.length&&bt("Number of colors should be equal to the number of categories"),t=RS(e.colors,n,e)):bt("Missing categories= or breaks= parameter"),t}pp.cluster=function(e,n,r){Ri(e);var i=function(e,n,r){var i,a=function(e){var t=e.max_width||1/0,n=e.max_height||1/0,r=e.max_area||1/0;return function(e,i){var a=e.area+i.area,o=fr.distance2D(e.centroid.x,e.centroid.y,i.centroid.x,i.centroid.y),s=e.bounds.clone().mergeBounds(i.bounds);return(a>r||s.width()>t||s.height()>n)&&(o=-1),o}}(r),o=e.shapes.length,s=r.pct?t.parsePercent(r.pct):1,u=Math.round(o*s),c=r.group_by||null,f=e.shapes.map(function(t,r){var i=c&&e.data.getRecordAt(r)[c]||null;return{ids:[r],area:fr.getShapeArea(t,n),bounds:n.getMultiShapeBounds(t),centroid:fr.getShapeCentroid(t,n),group:i,friends:[]}}),l=[],h={};c&&!e.data&&bt("Missing attribute data table");US(e,n).forEach(function(e,t){var n,r,i=f[e[0]],a=f[e[1]];i.group===a.group&&((n={ids:e}).score=g(n),n.score<0||(r=l.length,i.friends.push(r),a.friends.push(r),l.push(n)))});for(;u-- >0&&(i=d());)p(i);return f.filter(Boolean).reduce(function(e,t,n){for(var r=t.ids,i=0;i<r.length;i++)e[r[i]]=n;return e},[]);function p(e){var t=y(e.ids),n=f.length;f[n]=t,b(t.friends,e.ids,n)}function d(){var e,t,n,r=-1,i=1/0;for(t=0,n=l.length;t<n;t++)null!==(e=l[t])&&e.score<i&&(i=e.score,r=t);return-1==r?null:(e=l[r],l[r]=null,e)}function g(e){return a(f[e.ids[0]],f[e.ids[1]])}function m(e,t){var n=e.area/(e.area+t.area),r=e.centroid,i=t.centroid;r.x=r.x*n+i.x*(1-n),r.y=r.y*n+i.y*(1-n)}function y(e){var t=f[e[0]],n=f[e[1]];return t.bounds.mergeBounds(n.bounds),t.area+=n.area,t.ids=t.ids.concat(n.ids),m(t,n),f[e[0]]=null,f[e[1]]=null,t.friends=v(t.friends.concat(n.friends)),t}function v(e){for(var t,n={},r=[],i=0;i<e.length;i++)(t=e[i])in n==!1&&null!==l[t]&&(r.push(t),n[t]=!0);return r}function b(e,t,n){for(var r,i,a=0,o=e.length;a<o;a++)i=e[a],x((r=l[i]).ids,t)&&(l[i]=_(r,t,n))}function _(e,t,n){var r,i=e.ids[0],a=e.ids[1];return t[0]!=i&&t[1]!=i||(i=n),t[0]!=a&&t[1]!=a||(a=n),i==a?null:(e.ids=[i,a],(r=w(e))in h?null:(h[r]=!0,e.score=g(e),e.score<0?null:e))}function x(e,t){return e[0]===t[0]||e[0]===t[1]||e[1]===t[0]||e[1]===t[1]}function w(e){var t=e.ids[0],n=e.ids[1];return n<t&&(t=n,n=e.ids[0]),t+","+n}}(e,n,r);return vi(e,r.id_field||"cluster",i),e},pp.colorizer=function(e){var t;e.name||bt("Missing required name= parameter"),t=e.name,/^(stroke|stroke-width|stroke-dasharray|stroke-opacity|fill|fill-opacity|opacity|r|class)$/.test(t)&&bt('"'+e.name+'" is a reserved name'),i("defs")[e.name]=KE(e)};var QE=Object.freeze({__proto__:null,getColorizerFunction:KE});function eM(e,t,n,r){var i=t.data.getRecords(),a=rM(e,t,n,r),o=function(e,t){var n=t.data.getRecords();return function(t){var r=n[t];return!!r&&nM(r[e])}}(e,t),s={},u=0;return t.shapes.forEach(function(e,t){if(o(t)){var n=a(t);n.group&&function(e,t){var n,r=t[e.group];if(!r)return void(t[e.group]={shapes:[e.shape],weights:e.weights,values:e.values});r.shapes.push(e.shape);for(var i=0,a=e.values.length;i<a;i++)n=r.values.indexOf(e.values[i]),r.weights[n]+=e.weights[i]}(n,s)}}),Object.keys(s).forEach(function(t){var n,r,a=s[t],o=tM(a);n=a.shapes,r=o,n.forEach(function(t){u++,i[t][e]=r})}),u>0&&(u+=eM(e,t,n,r)),u}function tM(e){var t=Math.max.apply(null,e.weights),n=e.weights.indexOf(t);return e.values[n]}function nM(e){return!e&&0!==e}function rM(e,t,n,r){var i,a=n.isPlanar(),o=t.data.getRecords();function s(t,r){var s,u,c=o[t][e];nM(c)||(s=fr.calcPathLen([r],n,!a),-1==(u=i.values.indexOf(c))?(i.values.push(c),i.weights.push(s)):i.weights[u]+=s)}return function(e){return i={shape:e,weights:[],values:[],group:""},r(e,s),i.group=i.values.concat().sort().join("~"),i}}pp.comment=function(e){},pp.dashlines=function(e,t,n){var r=Ia(t),a=i("defs");zi(e),a.splitFeature=function(e,t){var n=t.dash_length?ah(t.dash_length,e):0,r=t.gap_length?ah(t.gap_length,e):0;n>0==!1&&bt("Missing required dash-length parameter");r>=0==0&&bt("Invalid gap-length option");var i=function(e,t,n,r){var i,a,o,s,u=!!r.planar,c=X_(u?null:e),f=Na(e)?gn:cn;function l(e){i&&a.push(e),n>0&&(o=s*((i=!i)?t:n))}return function(e){var u,h,p,d=0,g=e[0],m=[g];s=r.scaled?function(e,t,n){var r=n/(e+t),i=Math.floor(r),a=Math.ceil(r),o=n/(i*(e+t)),s=n/(a*(e+t)),u=s;o<1/s&&i>0&&(u=o);return u}(t,n,function(e,t){for(var n=0,r=1,i=e.length;r<i;r++)n+=t(e[r-1][0],e[r-1][1],e[r][0],e[r][1]);return n}(e,f)):1,o=s*((i=!(n>0))?t:n),i||(o*=.5),a=[];for(var y=1,v=e.length;y<v;y++)if(p=g,g=e[y],!((u=f(p[0],p[1],g[0],g[1]))<=0)){for(;d+u>=o;)(h=(o-d)/u)>.999&&y==v-1&&(h=1),p=h<1?c(p[0],p[1],g[0],g[1],h):g,m.push(p),l(m),m=h<1?[p]:[],d=0,u*=1-h;m.push(g),d+=u}return d>0&&m.length>1&&l(m),a}}(e,n,r,t);return function(e){var t=e.geometry;return t?("LineString"==t.type&&(t.type="MultiLineString",t.coordinates=[t.coordinates]),"MultiLineString"!=t.type&&vt("Unexpected geometry:",t.type),t.coordinates=t.coordinates.reduce(function(e,t){try{var n=i(t);e=e.concat(n)}catch(e){throw console.error(e),e}return e},[]),e):e}}(r,n),pp.evaluateEachFeature(e,t,"this.geojson = splitFeature(this.geojson)",n),delete a.splitFeature},pp.dataFill=function(e,n,r){var i=r.field;i||bt("Missing required field= parameter"),Pi(e,i),"polygon"!=e.geometry_type&&bt("Target layer must be polygon type");var a,o,s,u=FS(e,n),c=(s=e.data.getRecords().map(function(e){return nM(e[i])}),function(e){return s[e]});a=eM(i,e,n,u),function(e,t,n,r,i){var a=rM(e,t,n,r),o=t.data.getRecords(),s=0;t.shapes.forEach(function(t,n){if(i(n)){var r=a(n);if(!(r.values.length<2)){var u=o[n][e],c=tM(r);u!=c&&(o[n][e]=c,s++)}}})}(i,e,n,u,c),r.contiguous&&(o=function(e,t,n,r,i){var a=t.data.getRecords(),o={},s=new Uint8Array(t.shapes.length),u=null,c=0,f=i.weight_field||null;f&&Pi(t,f);t.shapes.forEach(function(e,t){h(t)}),Object.keys(o).forEach(function(e){var t,n=o[e];n.length<2||(t=function(e){var t=-1/0,n=-1;return e.forEach(function(e,r){e.weight>t&&(n=r,t=e.weight)}),n}(n),-1!=t&&n.filter(function(e,n){return n!=t}).forEach(l))}),c>0&&eM(e,t,n,r);return c;function l(t){c++,t.shapes.forEach(function(t){a[t][e]=null})}function h(i){if(1!=s[i]){var c=a[i][e],l=!1;if(!nM(c)){if(u){if(c!=u.value)return}else l=!0,u={value:c,shapes:[],weight:0},c in o==!1&&(o[c]=[]),o[c].push(u);u.weight+=f?a[i][f]:fr.getShapeArea(t.shapes[i],n),u.shapes.push(i),s[i]=1,r(i).forEach(h),l&&(u=null)}}}}(i,e,n,u,r)),xt("Filled",a,"empty polygons"+t.pluralSuffix(a)),o>0&&xt("Removed",o,"non-contiguous polygon group"+t.pluralSuffix(o))};function iM(e,t){var n=ki(e),r={layer_name:e.name,geometry_type:e.geometry_type,feature_count:n,null_shape_count:0,null_data_count:e.data?cM(e.data.getRecords()):n};return e.shapes&&e.shapes.length>0&&(r.null_shape_count=function(e){for(var t=0,n=0;n<e.length;n++)e[n]&&0!==e[n].length||t++;return t}(e.shapes),r.bbox=Ji(e,t.arcs).toArray(),r.proj4=da(t)),r.source_file=Di(0,t)||null,r.attribute_data=aM(e),r}function aM(e,t){if(!e.data||0===e.data.size()||0===e.data.getFields().length)return null;var n=ui(e.data.getFields(),"ascending"),r=void 0===t?"first_value":"value";return n.map(function(n){return{field:n,[r]:e.data.getReadOnlyRecordAt(t||0)[n]}})}function oM(e){if(!e)return"Attribute data: [none]\n";var n="first_value"in e[0]?"first_value":"value",r=[],i=[];e.forEach(function(e){i.push(e.field),r.push(e[n])});var a=r.reduce(function(e,n){return t.isNumber(n)&&(e=Math.max(e,lM(n))),e},0),o=["Field"].concat(i),s=r.reduce(function(e,t){return e.push(hM(t,a)),e},["first_value"==n?"First value":"Value"]),u=fM(o),c=fM(s),f=(t.rpad("",u+2,"-")+"+"+t.rpad("",c+2,"-")).substr(0,50)+"\n",l="";return o.forEach(function(e,n){var r=sM(e);l+=" "+e+t.rpad("",u-r," ")+" | "+s[n]+"\n",0===n&&(l+=f)}),"\nAttribute data\n"+f+l+f}function sM(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=uM(e.charCodeAt(n));return t}function uM(e){return e>=4352&&(e<=4447||9001==e||9002==e||e>=11904&&e<=42191&&12351!=e||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141)?2:1}function cM(e){for(var t=0,n=0;n<e.length;n++)e[n]||t++;return t}function fM(e){return e.reduce(function(e,t){var n=sM(t);return n>e?n:e},0)}function lM(e){return t.isNumber(e)?(t.formatNumber(e)+".").indexOf("."):0}function hM(e,n){var r;return r=t.isNumber(e)?t.lpad("",n-lM(e)," ")+t.formatNumber(e):t.isString(e)?function(e){var t={"\n":"\\n","\r":"\\r","\t":"\\t"};return e=e.replace(/[\r\t\n]/g,function(e){return e in t?t[e]:""}),"'"+e+"'"}(e):t.isDate(e)?t.formatDateISO(e)+" (Date)":t.isObject(e)?JSON.stringify(e):String(e),"string"!=typeof r&&(r="["+typeof e+"]"),r}pp.info=function(e,n){var r=Gh(e).map(function(e){return iM(e.layer,e.dataset)});n.save_to&&zf([{filename:n.save_to+(n.save_to.endsWith(".json")?"":".json"),content:JSON.stringify(r,null,2)}],n);if(n.to_layer)return{info:{},layers:[{name:n.name||"info",data:new di(r)}]};xt(function(e){var n="";return e.forEach(function(e,r){var i="Layer: "+(e.layer_name||"[unnamed layer]"),a=oM(e.attribute_data),o=function(e){return Math.max.apply(null,e.split("\n").map(function(e){return sM(e)}))}(a),s=Math.min(Math.max(i.length,o),50);n+="\n",n+=t.lpad("",s,"=")+"\n",n+=i+"\n",n+=t.lpad("",s,"-")+"\n",n+=function(e){var n="";n+="Type: "+(e.geometry_type||"tabular data")+"\n",n+=t.format("Records: %,d\n",e.feature_count),e.null_shape_count>0&&(n+=t.format("Nulls: %'d",e.null_shape_count)+"\n");e.geometry_type&&e.feature_count>e.null_shape_count&&(n+="Bounds: "+e.bbox.join(",")+"\n",n+="CRS: "+e.proj4+"\n");return n+="Source: "+(e.source_file||"n/a")+"\n",n}(e),n+=a}),n}(r))},pp.printInfo=pp.info;var pM=Object.freeze({__proto__:null,formatAttributeTableInfo:oM,formatTableValue:hM,getAttributeTableInfo:aM,getLayerInfo:iM});function dM(e,t){if(e&&e.length>0){var n=Gh(e).reduce(function(e,t){var n=function(e){var t=iM(e.layer,e.dataset);function n(t){var n=Kv(t);n.layers[0].name=e.layer.name,Co(e.layer,e.dataset,n)}function r(){return{type:"FeatureCollection",features:wd(e.layer,e.dataset,{rfc7946:!0},!0)}}return t.layer=e.layer,t.dataset=e.dataset,Object.defineProperty(t,"geojson",{set:n,get:r}),t}(t);return e.push(n),t.layer.name&&(e[t.layer.name]=n),e},[]);Object.defineProperty(t,"targets",{value:n}),1==n.length&&Object.defineProperty(t,"target",{value:n[0]})}}function gM(e,t,n){return function(e,t,n){var r=n.layer||n.target||null,a=t.findCommandTargets(r),o=1==a.length&&1==a[0].layers.length;0===a.length&&r&&bt("Layer not found:",r);var s,u=i("defs")||{};s=o?Yh(a[0].layers[0],a[0].dataset.arcs):function(e){var t={},n=Wh(e);return Oh(t,{name:r,data:r,type:r,size:r,empty:r,bbox:r}),t.field_exists=r,t.field_type=r,t.field_includes=r,t;function r(){throw Error(`This expression requires a single target layer; Received ${n} layers.`)}}(a);dM(a,s),s.global=u;var c=ep(e,n);return s.layer_exists=function(e,n){try{if(t.findCommandTargets(e,n).length>0)return!0}catch(e){}return!1},s.file_exists=function(e){return Lf.isFile(e)},function(){try{return c.call(s,u,s)}catch(t){bt(t.name,"in expression ["+e+"]:",t.message)}}}(e,t,n)}function mM(e,n){var r=function(e,t){var n,r,i,a={isMax:function(e){return e===r.max},isMin:function(e){return e===r.min},isMode:function(e){return r.modes.indexOf(e)>-1}};return Object.defineProperty(a,"target",{get:function(){return i},enumerable:!0}),n=ap(e,{data:t},null,{context:a}),function(e,t,a){return r=a,i=t,n(e)}}(n,e),i=null;return function(e){return t.some(["isMax","isMin","isMode"],function(t){return e.indexOf(t)>-1})}(n)&&(i=function(e,t){var n,r,i,a,o;function s(){r=-1/0,i=1/0,n=null}return a={isMax:function(e){e>r&&(r=e)},isMin:function(e){e<i&&(i=e)},isMode:function(e){n||(n=[]),n.push(e)}},o=ap(e,{data:t},null,{context:a,no_return:!0}),function(e){var t;s();for(var a=0;a<e.length;a++)o(e[a]);return t=n?lp(n):null,{max:r,min:i,modes:t?t.modes:null,margin:t?t.margin:null}}}(n,e)),function(e,t){var n,a,o=i?i(e):null,s=[];for(a=0;a<e.length;a++)Ch(n=r(e[a],t,o),'"where" expression must return true or false'),!0===n&&s.push(e[a]);return s}}pp.define=function(e,t){t.expression||bt("Missing an assignment expression");var n=i("defs");ap(t.expression,{},null,{no_warn:!0,no_return:!0})(null,n)},pp.dissolve2=function(e,t,n){return e.forEach(Ri),Vp(t,n),e.map(function(e){return wi(e)?pd(e,t,n):e})};var yM=Object.freeze({__proto__:null,getJoinFilter:mM});function vM(e,t,n,r){return bM({data:e},t,n,r)}function bM(e,n,r,i){var a=e.data;n==a&&(n=n.clone());var o,s,u,c,f,l,h,p,d,g,m,y,v,b=!!i.duplication,_=n.getRecords(),x=a.getRecords(),w=i.prefix||"",S=[],A=EM(a.getFields(),n.getFields(),i),E=i.sum_fields||[],M=t.difference(A,E),I=new Uint32Array(_.length),k=0,C=0,P=[],O=0,N={};for(b&&(i.calc&&bt("duplication and calc options cannot be used together"),y=a.clone().getRecords(),v=e.shapes||[]),i.where&&(l=mM(n,i.where)),i.calc&&(h=bp(n,i.calc)),g=x.length,p=0;p<g;p++){for(u=x[p],(c=r(p))&&l&&(O+=c.length,O-=(c=l(c,u)).length),d=0,f=0,m=c?c.length:0;d<m;d++)o=_[s=c[d]],f>0&&b&&(u=Hr(y[p]),x.push(u),v.push(Ir(v[p]))),0===f||b?M.length>0&&wM(u,o,M,w):1==f&&(M.length>0&&!w&&AM(u,o,M,P),C++),E.length>0&&SM(u,o,E,w),I[s]++,f++;h&&h(c,u),f>0?k++:u&&(i.unmatched&&S.push(t.extend({},u)),xM(u,M,E,w))}return function(e,n,r,i,a,o,s){var u=n-e;if(e>0==!1)return void xt("No records could be joined");xt(t.format("Joined data from %'d source record%s to %'d target record%s",r,t.pluralSuffix(r),e,t.pluralSuffix(e))),u>0&&xt(t.format("%d target record%s received no data",u,t.pluralSuffix(u)));r<i&&xt(t.format("%d/%d source records could not be joined",i-r,i));a>0&&xt(t.format("%d/%d source records were skipped",a,i));o>0&&(xt(t.format("%d/%d target records were matched by multiple source records (many-to-one relationship)",o,n)),s.length>0&&xt(t.format("Inconsistent values were found in field%s [%s] during many-to-one join. Values in the first joining record were used.",t.pluralSuffix(s.length),s.join(","))))}(k,g,function(e){for(var t=0,n=0,r=e.length;n<r;n++)e[n]>0&&t++;return t}(I),_.length,O,C,P),i.unjoined&&(N.unjoined={name:"unjoined",data:new di(_.filter(function(e,t){return 0===I[t]}))}),i.unmatched&&(N.unmatched={name:"unmatched",data:new di(S)}),N}function _M(e){e.forEach(function(e){/:(str|num)/.test(e)&&bt("Unsupported use of type hints. Use string-fields= or field-types= options instead")})}function xM(e,t,n,r){wM(e,{},t,r),SM(e,{},n,r)}function wM(e,t,n,r){var i,a;r=r||"";for(var o=0,s=n.length;o<s;o++)a=r+(i=n[o]),Object.prototype.hasOwnProperty.call(t,i)?e[a]=t[i]:Object.prototype.hasOwnProperty.call(e,a)||(e[a]=null)}function SM(e,t,n,r){var i,a;r=r||"";for(var o=0;o<n.length;o++)e[a=r+(i=n[o])]=(e[a]||0)+(t[i]||0)}function AM(e,t,n,r){for(var i,a=0,o=n.length;a<o;a++)e[i=n[a]]!==t[i]&&-1===r.indexOf(i)&&r.push(i)}function EM(e,n,r){var i;if(r.fields?r.fields.indexOf("*")>-1?i=n:_M(i=r.fields):r.calc?i=[]:(i=n,r.keys&&(i=t.difference(i,[r.keys[1]]))),!r.force&&!r.prefix){var a=t.intersection(i,e);a.length>0&&(xt('Same-named fields not joined without the "force" flag:',a),i=t.difference(i,a))}return i}var MM=Object.freeze({__proto__:null,findCollisionFields:AM,getFieldsToJoin:EM,joinTableToLayer:bM,joinTables:vM,updateUnmatchedRecord:xM,validateFieldNames:_M});function IM(){return new kM("max")}function kM(e){var n,r,i,a=t.expandoBuffer(Int32Array),o=t.expandoBuffer(Int32Array),s="max"==e?function(e,t){var i=r[e],a=r[t];return n[i]<n[a]}:function(e,t){var i=r[e],a=r[t],o=n[i],s=n[a];return o>s||o===s&&i>a},u=0;function c(e){for(var t=h(e);t>e;)f(e,t),t=h(e=t)}function f(e,t){var n=r[e];l(e,r[t]),l(t,n)}function l(e,t){i[t]=e,r[e]=t}function h(e){var t=2*e+1,n=t+1,r=u;return t<r&&s(e,t)&&(e=t),n<r&&s(e,n)&&(e=n),e}this.init=function(e){var t;for(n=e,u=e.length,r=a(u),i=o(u),t=0;t<u;t++)l(t,t);for(t=u-2>>1;t>=0;t--)c(t)},this.size=function(){return u},this.updateValue=function(e,t){var r=i[e];n[e]=t,r>=0&&r<u||vt("Out-of-range heap index."),c(function(e){var t;for(;e>0&&!s(e,t=e-1>>1);)f(e,t),e=t;return e}(r))},this.popValue=function(){return n[this.pop()]},this.getValue=function(e){return n[e]},this.peek=function(){return r[0]},this.peekValue=function(){return n[r[0]]},this.pop=function(){var e;return u<=0&&vt("Tried to pop from an empty heap."),e=r[0],l(0,r[--u]),c(0),e}}function CM(e,t,n,r){return 0===n?[]:0===r.evenness?function(e,t,n){for(var r=t.getMultiShapeBounds(e),i=[],a=0;a<n;a++)i.push(PM(e,t,r));return i}(e,t,n):function(e,t,n,r){var i=r.evenness>=0?Math.min(r.evenness,1):1,a=fr.getPlanarShapeArea(e,t);if(a>0==!1)return[];var o=t.getMultiShapeBounds(e),s=Math.round(n*o.area()/a);r.progressive&&(s=Math.ceil(s/6));for(var u=new NM(o,s,i),c=[],f=0;f<n;f++)c.push(OM(e,t,u));return u.done(),c}(e,t,n,r)}function PM(e,t,n){for(var r,i,a=0;++a<100;)if(Cn(r=n.xmin+Math.random()*n.width(),i=n.ymin+Math.random()*n.height(),e,t))return[r,i];return null}function OM(e,t,n){for(var r,i=0;++i<100;)if((r=n.getPoint())&&Cn(r[0],r[1],e,t))return r;return null}function NM(e,n,r){var i,a,o,s=e.xmin,u=e.ymin,c=e.width(),f=e.height(),l=.9*n*(.5*(r-1)+1),h=Math.round(Math.sqrt(l*c/f))||1,p=Math.ceil(h*f/c),d=c,g=h*p,m=-1,y=function(e){for(var t=[],n=0;n<e;n++)t.push([]);return t}(g),v=d/h*.7*r;function b(){var e;for(i||(i=t.range(g),t.shuffle(i));++m<g;)if(T(e=O(i[m])))return e}function _(e){var t=function(e){var t=z(e),n=R(e)*h+t;return n}(e);return y[t].push(e),e}function x(e,t,n){var r=D(t,n);if(-1!=r){var i=a[r],s=o.getValue(r);P(e,i)<s*s&&w(r)}}function w(e){var t=S(e);o.updateValue(e,t)}function S(e){var t=F(e),n=A(j(e),t,0,0,1);return a[e]=n,n.pop()}function A(e,t,n,r,i){for(var a,o,s,u,c,f=Math.pow(3,i),l=0,h=0;h<3;h++)for(var p=0;p<3;p++)(c=I(l,s=E(e,t,n+h,r+p,f),e,t))>l&&(l=c,u=s,a=h,o=p);return 2==i?(u.push(l),u):A(e,t,3*(n+a),3*(r+o),i+1)}function E(e,t,n,r,i){return[((n+.5)/i+e)/h*c+s,((r+.5)/i+t)/p*f+u]}this.done=function(){},this.getPoint=function(){return 1===r?function(){var e=b();if(e)return _(e);a||function(){var e=[];a=[];for(var t=0;t<g;t++)e.push(S(t));(o=new IM).init(e)}();return function(){var e=o.peek(),t=a[e];return _(t),function(e,t){var n=F(t),r=j(t);w(t),x(e,r+1,n),x(e,r,n+1),x(e,r-1,n),x(e,r,n-1),x(e,r+1,n+1),x(e,r-1,n+1),x(e,r-1,n-1),x(e,r+1,n-1)}(t,e),v=o.peekValue(),t}()}():0===r?N():function(){var e=Math.ceil(Math.pow(g,.8)),t=10*g,n=0,r=b();if(r)return _(r);for(;n++<t;){if(T(r=N()))return _(r);n%e===0&&(v*=.9)}return null}()};var M=[[0,0],[0,-1],[-1,0],[1,0],[0,1],[-1,1],[1,-1],[-1,-1],[1,1]];function I(e,t,n,r){for(var i,a,o,s=1/0,u=0;u<9;u++){if((a=C(t,n+(i=M[u])[0],r+i[1]))<e*e)return 0;a<s&&(s=a)}return o=Math.sqrt(s),o=Math.min(o,k(t,n,r))}function k(e,t,n){if(t>0&&n>0&&t<h-1&&n<p-1)return 1/0;var r=e[0],i=e[1];return 3*Math.min(r-s,s+c-r,i-u,u+f-i)}function C(e,t,n){for(var r,i=1/0,a=D(t,n),o=a>-1?y[a]:[],s=0;s<o.length;s++)(r=P(e,o[s]))<i&&(i=r);return i}function P(e,t){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function O(e){var t=F(e),n=j(e);return[(Math.random()+n)/h*c+s,(Math.random()+t)/p*f+u]}function N(){return O(Math.floor(Math.random()*g))}function T(e){var t=z(e),n=R(e);return!(L(e,t,n)||function(e,t,n){return k(e,t,n)<v}(e,t,n)||L(e,t+1,n)||L(e,t,n+1)||L(e,t-1,n)||L(e,t,n-1)||L(e,t+1,n+1)||L(e,t-1,n+1)||L(e,t-1,n-1)||L(e,t+1,n-1))}function L(e,t,n){var r=D(t,n);return-1!=r&&function(e,t,n){for(var r=n*n,i=0;i<t.length;i++)if(P(e,t[i])<r)return!0;return!1}(e,y[r],v)}function z(e){var t=e[0]-s,n=Math.floor(t/c*h);return n<0&&(n=0),n>=h&&(n=h-1),n}function R(e){var t=e[1]-u,n=Math.floor(t/f*p);return n<0&&(n=0),n>=p&&(n=p-1),n}function D(e,t){return e<0||t<0||e>=h||t>=p?-1:t*h+e}function j(e){return e%h}function F(e){return Math.floor(e/h)}}function TM(e,t,n){var r={},i=n.save_as||"fill",a=n.colors||n.values;if(a?(r[i]=a[e],r.r=n.r||1.3):n.r&&(r.r=n.r),n.copy_fields)for(var o=0;o<n.copy_fields.length;o++)r[n.copy_fields[o]]=t[n.copy_fields[o]];return r}function LM(e){return e.includes("this.geojson")||e.includes("this.geometry")||e.includes("this.feature")}function zM(e,n){var r={},i=wd(Bi(e),n,{rfc7946:!0},!0),a=[];return r.get=function(e){return e>0&&(i[e-1]=null),i[e]},r.getGeometry=function(e){return e>0&&(i[e-1]=null),i[e]?i[e].geometry:null},r.setGeometry=function(e,n){t.isString(e)&&(e=JSON.parse(e));var a={type:"Feature",properties:i[n]?i[n].properties:null,geometry:e||null};r.set(a,n)},r.set=function(e,n){var r;t.isString(e)&&(e=JSON.parse(e)),e&&("GeometryCollection"==e.type?r=e.geometries.map(e=>_d.toFeature(e)):"FeatureCollection"==e.type?r=e.features:e=_d.toFeature(e),r?a=a.concat(r):a.push(e))},r.done=function(){if(0!==a.length)return Kv({type:"FeatureCollection",features:a})},r}function RM(e,t,n){var r=new qt(e),i="point"==t.geometry_type?function(e){return function(t){return e.containsPoint(t[0],t[1])?t:null}}(r):function(e,t){var n=e.toArray(),r=n[0],i=n[1],a=n[2],o=n[3];return function(n){if(!e.intersects(t.getSimpleShapeBounds(n)))return null;var s,u,c,f,l=!1,h=t.getShapeIter(n);for(h.hasNext()&&(s=h.x,u=h.y);h.hasNext();)if(c=s,f=u,!BE(s=h.x,u=h.y,c,f,r,i,a,o)){if(GE(s,u,c,f,r,i,a,o)){l=!0;break}if(fr.segmentIntersection(r,o,a,o,s,u,c,f)||fr.segmentIntersection(r,i,a,i,s,u,c,f)||fr.segmentIntersection(r,i,r,o,s,u,c,f)||fr.segmentIntersection(a,i,a,o,s,u,c,f)){l=!0;break}}return!l&&fr.testPointInRing(r,i,n,t)&&(l=!0),l?n:null}}(r,n);return i}function DM(e,t,n){var r=RM(e,t,n);return function(e){var n=t.shapes[e];if(!n)return!1;for(var i=0;i<n.length;i++)if(r(n[i]))return!0;return!1}}pp.divide=function(e,n,r,i){e.forEach(zi);var a=jE(e,n,r,i),o=Vp(a,i),s=a.layers.pop();Ri(s),n.arcs=a.arcs,e.forEach(function(e){!function(e,n,r,i){var a,o,s,u=new Vf(n.shapes,r.arcs),c=e.data?e.data.getRecords():[],f=[],l=[],h=[];function p(e,t,n){for(var r,i,u=0;u<e.length;u++)i=t[u],-1==(r=o.indexOf(i))?(o.push(i),a.push([e[u]]),s.push(n[u])):a[r].push(e[u])}function d(e){return e.sort().join(",")}function g(e){for(var t,n,r,i,a=[],o=[],s=[],c=null,f=0,l=e.length;f<l;f++)i=e[f],(n=d(t=u.findShapesEnclosingArc(Yt(i))))===c?r.push(i):(r=[i],a.push(r),o.push(n),s.push(t)),c=n;p(a,o,s)}e.shapes.forEach(function(e,n){var r=c[n]||{};if(!e)return f.push(null),void l.push(r);a=[],o=[],s=[],Cr(e,g),a.forEach(function(e,n){f.push(e),l.push(n>0?t.extend({},r):r),h.push(s[n])})}),e.shapes=f,e.data=new di(l),vM(e.data,n.data,function(e){return h[e]||[]},i)}(e,s,o,i)})},pp.dots=function(e,n,r){Ri(e),Array.isArray(r.fields)||bt("Missing required fields parameter"),_i(e)&&(r.fields.forEach(function(t,n){Pi(e,t)}),(r.copy_fields||[]).forEach(function(t){Pi(e,t)})),Array.isArray(r.colors)&&r.colors.forEach(_h);var i=e.data?e.data.getRecords():[],a=[],o=[];e.shapes.forEach(function(e,s){var u=i[s];if(u)for(var c=function(e,n,r,i){var a={shapes:[],attributes:[]};if(!e)return a;var o=i.fields.map(function(e){var t=r[e]||0;return i.per_dot>0&&(t=Math.round(t/i.per_dot)),t}),s=function(e){var t=[];return e.forEach(function(e,n){for(;e-- >0;)t.push(n)}),t}(o),u=function(e,n,r,i){for(var a=e.length>1?fy(e,n):[e],o=function(e,n,r){if(1===e.length)return[r];var i=e.map(function(e){return fr.getPlanarShapeArea(e,n)}),a=t.sum(i),o=r;return i.map(function(e,t){var n=e/a,r=Math.round(o*n);return o-=r,a-=e,r})}(a,n,r),s=[],u=0;u<a.length;u++)s=s.concat(CM(a[u],n,o[u],i));return s}(e,n,s.length,i);t.shuffle(s);for(var c,f,l,h,p=-1,d=!!i.multipart,g=0;g<u.length;g++)(l=u[g])&&(c=s[g],3===l.length&&i.debug&&(c=l.pop()),d&&c==p||(p=c,a.shapes.push(f=[]),h=TM(c,r,i),a.attributes.push(h)),f.push(l));return a}(e,n,u,r),f=0,l=c.shapes.length;f<l;f++)a.push(c.shapes[f]),o.push(c.attributes[f])});var s={geometry_type:"point",shapes:a,data:new di(o)};return Ui(s,e,null,r),[s]},pp.drop2=function(e,t,n){t.forEach(function(t){pp.drop(e,t.layers,t.dataset,n)})},pp.drop=function(e,t,n,r){var i=!1;t.forEach(function(t){var a=t.data&&r.fields,o=a&&Qr(a,t.data.getFields()),s=!a&&!r.geometry&&!r.holes||o&&r.geometry;r.geometry&&(i|=wi(t),delete t.shapes,delete t.geometry_type),r.holes&&"polygon"==t.geometry_type&&ad(t,n.arcs),s?e.deleteLayer(t,n):o?delete t.data:a&&r.fields.forEach(t.data.deleteField,t.data)}),i&&Io(n)},pp.filterGeom=function(e,t,n){xi(e)||bt("Layer is missing geometry"),n.bbox&&function(e,t,n){var r=RM(n.bbox,e,t);Pr(e.shapes,r)}(e,t,n),pp.filterFeatures(e,t,{remove_empty:!0,verbose:!1})};var jM=Object.freeze({__proto__:null,findShapesIntersectingBBox:function(e,t,n){for(var r=DM(e,t,n),i=[],a=0;a<t.shapes.length;a++)r(a)&&i.push(a);return i},getBBoxIntersectionTest:DM});function FM(e){var t=new Set(e);return function(e){return t.has(e)}}function UM(e,t){return e&&t?function(n){return e(n)&&t(n)}:e||t}pp.filterFeatures=function(e,n,r){var i,a=e.data?e.data.getRecords():null,o=e.shapes||null,s=ki(e),u=o?[]:null,c=a?[]:null,f=Fi(e,r),l=!!r.invert;return r.expression&&(i=ap(r.expression,e,n)),r.ids&&(i=UM(i,FM(r.ids))),r.remove_empty&&(i=UM(i,function(e,t){var n=e.shapes;if("polygon"==e.geometry_type)return function(e,t){return function(n){return!!e[n]&&fr.getPlanarShapeArea(e[n],t)>0}}(n,t);return function(e){return!!n[e]}}(e,n))),r.bbox&&(i=UM(i,DM(r.bbox,e,n))),i||bt("Missing a filter criterion"),t.repeat(s,function(e){var t=i(e);Ch(t),l&&(t=!t),!0===t&&(o&&u.push(o[e]||null),a&&c.push(a[e]||null))}),f.shapes=u,f.data=c?new di(c):null,r.no_replace&&(f=Bi(f)),!1===r.verbose||r.quiet||xt(t.format("Retained %,d of %,d features",ki(f),s)),f},pp.evaluateEachFeature=function(e,t,n,r){var i,a,o=ki(e),s=t.arcs,u=n||"",c={no_return:!0,geojson_editor:LM(u)?zM(e,t):null};o>0&&!e.data&&(e.data=new di(o)),r&&r.where&&(a=ap(r.where,e,s)),r&&r.ids&&(a=UM(a,FM(r.ids))),i=ap(u,e,s,c);for(var f=0;f<o;f++)a&&!a(f)||i(f);var l=c.geojson_editor?c.geojson_editor.done():null;l&&Co(e,t,l)};var BM={};function GM(e){"function"!=typeof e.command&&bt('Expected "command" parameter function'),e.target||bt('Missing required "target" parameter'),["layer","layers"].includes(e.target)||bt("Unrecognized command target type:",e.target)}function qM(e,t){var n,r=[],i=[],a=[],o=0;return e.forEach(function(e,u){!function(e,t){var u,c,f,l,h=!0,p=0;n=0;for(;e.hasNext();){if(!1===t(s,u=e.x,c=e.y,f,l,p++)){h=!1;break}f=u,l=c}h&&1==n&&(xt("An invalid arc was created"),h=!1);if(h)r.push(n);else{for(;n-- >0;)i.pop(),a.pop();r.push(0),o++}}(e,t)}),e.updateVertexData(r,i,a),o;function s(e){e&&(i.push(e[0]),a.push(e[1]),n++)}}function VM(e){var t=[],n=[];function r(e,t){for(var r=0;r<t.length;r++)e.push([n.length]),n.push(t[r])}function i(t){for(var n=[],r=e.arcs.getShapeIter(t);r.hasNext();)n.push([r.x,r.y]);return n}this.done=function(){e.layers=t,n.length&&(e.arcs=new Wa(n),Ka(e))},this.editLayer=function(n,a){var o=n.geometry_type;if(e.layers.indexOf(n)!=t.length&&vt("Layer was edited out-of-order"),o){var s=n.shapes.map(function(e,t){for(var n,s,u=[],c=0,f=e?e.length:0;c<f;c++)s="point"==o?e[c]:i(e[c]),n=a(s,c,e),Array.isArray(n)&&("point"==o?u.push(n):"polygon"!=o&&"polyline"!=o||r(u,n||[]));return u.length>0?u:null});t.push(Object.assign(n,{shapes:s}))}else t.push(n)}}function $M(e,t,n){if(function(e){for(var t,n,r,i=0,a=1,o=e.length;a<o;a++)n=e[a-1],r=e[a],(t=fr.distanceSq(n[0],n[1],r[0],r[1]))>i&&(i=t);return Math.sqrt(i)}(e)<t)return e;n||(n=JM(t));for(var r,i,a=[e[0]],o=1,s=e.length;o<s;o++)r=e[o-1],i=e[o],fr.distance2D(r[0],r[1],i[0],i[1])>t+1e-4&&WM(a,n(r,i)),a.push(i);return a}function JM(e){return function(t,n){for(var r=[],i=fr.distance2D(t[0],t[1],n[0],n[1]),a=Math.round(i/e)-1,o=(n[0]-t[0])/(a+1),s=(n[1]-t[1])/(a+1),u=1;u<=a;u++)r.push([t[0]+o*u,t[1]+s*u]);return r}}function WM(e,t){for(var n=0;n<t.length;n++)e.push(t[n])}function ZM(e,n){var r,i=function(e,n){var r=hr(e),i=e.getBounds(),a=function(e,n,r){for(var i=[.1,.2,.3,.4,.5,.6,.7,.8,.9],a=[],o=0;o<i.length;o++)for(var s=0;s<i.length;s++)a.push([i[o],i[s]]);var u=a.map(function(t){var i=e.xmin+e.width()*t[0],a=e.ymin+e.height()*t[1],o=r(i,a),s=r(i+n[0],a+n[1]);return o&&s?fr.distance2D(o[0],o[1],s[0],s[1]):1/0}).filter(function(e){return e<1/0});return u.length>0?t.findMedian(u):1/0}(i,r,n),o=function(e,t){var n=t(e.centerX(),e.centerY()),r=t(e.centerX(),e.ymin),i=t(e.xmax,e.centerY()),a=n&&r&&i?(fr.distance2D(n[0],n[1],r[0],r[1])+fr.distance2D(n[0],n[1],i[0],i[1]))/5e3:1/0;return a}(i,n),s=Math.min(a,o);s==1/0&&vt("Densification error");return s}(e,n),a=i*i*25;return qM(e,function(e,t,o,s,u,c){var f=r;if(!(r=n(t,o)))return!1;c>0&&fr.distanceSq(r[0],r[1],f[0],f[1])>a&&YM(s,u,f[0],f[1],t,o,r[0],r[1],n,i).forEach(e);e(r)})}function YM(e,t,n,r,i,a,o,s,u,c,f){var l=(e+i)/2,h=(t+a)/2,p=u(l,h);if(p)return f=f||[],fr.pointSegDistSq2(p[0],p[1],n,r,o,s)>c*c*.25&&fr.distance2D(e,t,i,a)>.01&&(YM(e,t,n,r,l,h,p[0],p[1],u,c,f),f.push(p),YM(l,h,p[0],p[1],i,a,o,s,u,c,f)),f}function HM(e){return!(!e||4!=e.length)&&(!e.some(isNaN)&&(e[0]<=e[2]!=0&&e[1]<=e[3]!=0))}function XM(e,t){if(t.width){e.data||Wi(e);var n=e.data.getRecords()[0]||{};n.width=eh(t.width),n.type="frame"}}function KM(e,t,n){var r=ia(e);return n.offset&&(e=function(e,t,n){var r=uh(e,n,t);return t.padBounds(r[0],r[1],r[2],r[3]),t}(n.offset,e,t)),e.area()>0==!1?null:(n.aspect_ratio&&(e=QM(n.aspect_ratio,e)),r&&(e=aa(e)),e)}function QM(e,t){var n,r,i=String(e).split(",").map(parseFloat),a=t.width()/t.height();return 1==i.length?i.push(i[0]):i[0]>i[1]&&i.reverse(),n=i[0],r=i[1],n||r?(n||(n=-1/0),r||(r=1/0),a<n?t.fillOut(n):a>r&&t.fillOut(r),t):t}function eI(e,t){var n=t||{},r=mi(e);return n.interval>0&&(r=$M(r,n.interval)),{type:"Polygon",coordinates:[r]}}pp.registerCommand=function(e,n){var r={name:e,options:n.options||[]};r.options.push({name:"target"}),t.defaults(r,n),GM(r),BM[e]=r},pp.runExternalCommand=function(e,t){var n=e.name,r=BM[n];r||bt("Unsupported command:",n);var i,a=r.target,o=function(e,t,n){var r=new Av,i=r.command(e);(t.options||[]).forEach(function(e){i.option(e.name,e)});var a=r.parseArgv(["-"+e].concat(n));return a[0]}(n,r,e._),s=t.findCommandTargets(o.target||"*"),u=s[0];u||bt("Missing a target"),"layer"==a&&(1!=u.layers.length||s.length>1)&&bt("This command only supports targeting a single layer"),s.length>1&&bt("Targetting layers from multiple datasets is not supported"),"layer"==a?i=r.command(u.layers[0],u.dataset,o.options):"layers"==a&&(i=r.command(u.layers,u.dataset,o.options)),i&&function(e,t,n,r){e.dataset&&e.layers&&e.layers.length>0!=!1||bt("Invalid command output");e.dataset==t.dataset&&bt("External commands are not currently allowed to modify input datasets");e.dataset.layers.length!=e.layers.length&&bt("Currently not supported: targetting a subset of output layers");r.no_replace||t.layers.forEach(function(e){n.deleteLayer(e,t.dataset)});n.addDataset(e.dataset)}(i,u,t,o)},pp.rectangles=function(e,n,r){var i,a=Ma(n),o=e.data?e.data.getRecords():null;r.bbox?i=function(e,t,n){for(var r,i=ap(e,t,n.arcs,{}),a=ki(t),o=[],s=0;s<a;s++)HM(r=i(s))||bt("Invalid bbox value (expected a GeoJSON-type bbox):",r),o.push(eI(r));return o}(r.bbox,e,n):(xi(e)||bt("Layer is missing geometric shapes"),i=function(e,t,n){var r=Ma(t);return e.shapes.map(function(i){var a="point"==e.geometry_type?$t(i):t.arcs.getMultiShapeBounds(i);return(a=KM(a,r.crs,n))?eI(a.toArray(),n):null})}(e,n,r));var s={type:"FeatureCollection",features:i.map(function(e,n){var i=o&&o[n]||null;return i&&r.no_replace&&(i=t.extend({},i)),{type:"Feature",properties:i,geometry:e}})},u=Kv(s,{});Ea(u,a);var c=to(n,[u]);return Ui(c[0],e,null,r),c},pp.rectangle2=function(e,t){if(1!=e.layers.length||!t.width||!Ai(e.layers[0],e.dataset.arcs)){var n=e.layers.map(function(n){var r=pp.rectangle({layer:n,dataset:e.dataset},t);return Ui(r.layers[0],n,null,t),t.no_replace||(r.layers[0].name=n.name||r.layers[0].name),r});return to(e.dataset,n)}XM(e.layers[0],t)},pp.rectangle=function(e,t){var n,r;t.bbox?(n=new qt(t.bbox),r=e&&Ma(e.dataset)||ia(n)&&wa("wgs84")||{}):e&&(n=Ji(e.layer,e.dataset.arcs),r=Ma(e.dataset)),(n=n&&KM(n,r.crs,t))&&n.hasBounds()||bt("Missing rectangle extent");var i=Kv({type:"Feature",properties:{},geometry:eI(n.toArray(),t)},{});return XM(i.layers[0],t),i.layers[0].name=t.name||"rectangle",Ea(i,r),i};var tI=Object.freeze({__proto__:null,applyAspectRatio:QM,bboxToPolygon:eI});function nI(e){return e||(e=["0"]),1==e.length?[e[0],e[0],e[0],e[0]]:(4!=e.length&&bt("List of offsets should have 4 values"),e)}pp.frame=function(e,n,r){var i,a,o,s;(r.width&&(i=eh(r.width))>0==!1&&bt("Invalid width parameter:",r.width),r.height&&(a=eh(r.height))>0==!1&&bt("Invalid height parameter:",r.height),i||a||(i=800,xt("Using default 800px frame width")),r.aspect_ratio&&(r.aspect_ratio>0==!1&&bt("Invalid aspect-ratio parameter:",r.aspect_ratio),a?i||(i=Bl(a*r.aspect_ratio,1)):a=Bl(i/r.aspect_ratio,1)),r.bbox)?s=r.bbox:(ka(t.pluck(n,"dataset"),"Targets include both projected and unprojected coordinates"),s=function(e){var t=Gh(e),n=t.reduce(function(e,t){return e.mergeBounds(Ji(t.layer,t.dataset.arcs))},new qt);return n.hasBounds()?n.toArray():null}(n),s||bt("Command target is missing geographical bounds"));!function(e,n){var r=function(e){return nI(e).map(e=>e.includes("%")?t.parsePercent(e):0)}(n),i=r[0],a=r[1],o=r[2],s=r[3],u=(e[2]-e[0])/(1-i-o),c=(e[3]-e[1])/(1-s-a);e[0]-=i*u,e[1]-=a*c,e[2]+=o*u,e[3]+=s*c}(s,r.offset||r.offsets),function(e,t,n,r){var i,a,o=function(e){return nI(e).map(e=>e.includes("%")?0:eh(e))}(r),s=o[0],u=o[1],c=o[2],f=o[3];t&&n&&function(e,t,n){var r=0,i=0,a=e[2]-e[0],o=e[3]-e[1];t/n>a/o?r=o*t/n-a:i=a*n/t-o;e[0]-=r/2,e[1]-=i/2,e[2]+=r/2,e[3]+=i/2}(e,t,n);a=e[2]-e[0],e[3],e[1],i=t?a/(t-s-c):a/(n-f-u);e[0]-=i*s,e[1]-=i*u,e[2]+=i*c,e[3]+=i*f}(s,i,a,r.offset||r.offsets),s[3]-s[1]>0!=!1&&s[2]-s[0]>0!=!1||bt("Frame has a collapsed bbox"),o=(s[2]-s[0])/(s[3]-s[1]),i?a||(a=Bl(i/o,1)):i=Bl(a*o,1);var u=Kv({type:"Feature",properties:{type:"frame",width:i,height:a},geometry:eI(s)});n.length>0&&Ea(u,Ma(n[0].dataset));u.layers[0].name=r.name||"frame",e.addDataset(u)};var rI=Object.freeze({__proto__:null,getAspectRatioArg:function(e,t){return t.split(",").map(function(t){var n=Number(t),r=Number(e);return t?r/n:""}).reverse().join(",")}});function iI(e,t){return function(n){return fr.countVerticesInPath(n,t)<=e}}function aI(e,t,n){for(var r=0,i=e.length;r<i;r++)if(n.arcIntersectsBBox(Yt(e[r]),t))return!0;return!1}function oI(e,t,n){for(var r,i,a=n.getSimpleShapeBbox(e),o=0,s=t.length;o<s;o++)if((r=t[o])&&r!=e&&aI(r,a,n)&&(i=n.getVertex(r[0],0),fr.testPointInRing(i.x,i.y,e,n)))return!0;return!1}function sI(e){return(e||[]).reduce(function(e,n){var r=n.split("="),i=t.trimQuotes(r[0]),a=r.length>1?t.trimQuotes(r[1]):i;return a&&i||bt("Invalid name assignment:",n),e[a]=i,e},{})}function uI(e){var t=Object.keys(e);return function(n){for(var r,i={},a=0,o=t.length;a<o;a++)r=t[a],i[e[r]]=n[r];return i}}function cI(e,t,n,r){var i=hI(e,t,n,r);return lI(e,n),bM(e,n.data,i,r)}function fI(e,t,n,r){var i=pI(e,t,n);return lI(e,t),bM(e,t.data,i,r)}function lI(e,t){e.data||(e.data=new di(e.shapes.length)),t.data||bt("Can't join a layer that is missing attribute data")}function hI(e,t,n,r){var i=pI(n,e,t),a=[],o=!!r.first_match;return n.shapes.forEach(function(e,t){for(var n,r=i(t),s=r?r.length:0,u=0;u<s&&((n=r[u])in a?a[n].push(t):a[n]=[t],!o);u++);}),function(e){return a[e]||null}}function pI(e,t,n,r){var i=new Vf(t.shapes,n),a=e.shapes;return function(e){var t=a[e],n=t?i.findEnclosingShapes(t[0]):[];return n.length>0?n:null}}pp.filterIslands=function(e,n,r){var i=t.extend({sliver_control:0},r),a=n.arcs,o=0;"polygon"==e.geometry_type&&(i.min_area||i.min_vertices?(o+=function(e,t,n){var r=0,i=new Uint8Array(t.size());dr(e.shapes,i);var a=function(e,a,o){if(1==e.length&&1===i[Yt(e[0])]&&(!n||n(e))&&!oI(e,o,t))return r++,null};return Pr(e.shapes,a),r}(e,a,i.min_area?lh(e,n,i).filter:iI(i.min_vertices,a)),i.remove_empty&&pp.filterFeatures(e,a,{remove_empty:!0,verbose:!1}),xt(t.format("Removed %'d island%s",o,t.pluralSuffix(o)))):xt("Missing a criterion for filtering islands; use min-area or min-vertices"))},pp.filterIslands2=function(e,n,r){var i=t.extend({sliver_control:0},r),a=n.arcs,o=0;"polygon"==e.geometry_type&&(i.min_area||i.min_vertices?(o+=function(e,t,n){var r=0,i=new Uint8Array(t.size());dr(e.shapes,i);var a=function(e,a,o){if(1==e.length&&1===i[Yt(e[0])]&&(!n||n(e))&&!oI(e,o,t))return r++,null};return Pr(e.shapes,a),r}(e,a,i.min_area?lh(e,n,i).filter:iI(i.min_vertices,a)),i.remove_empty&&pp.filterFeatures(e,a,{remove_empty:!0,verbose:!1}),xt(t.format("Removed %'d island%s",o,t.pluralSuffix(o)))):xt("Missing a criterion for filtering islands; use min-area or min-vertices"))},pp.filterFields=function(e,t,n){var r=e.data;if(Oi(r,t=t||[]),r){var i=sI(t);n.invert&&(i=function(e,t){return t.reduce(function(t,n){return n in e||(t[n]=n),t},{})}(i,r.getFields())),e.data.update(uI(i))}},pp.renameFields=function(e,n){var r=sI(n);Oi(e.data,Object.keys(r)),t.defaults(r,sI(e.data.getFields())),e.data.update(uI(r))},pp.filterPoints=function(e,n,r){Li(e),r.group_interval>0==!1&&bt("Expected a positive group_interval parameter");for(var i,a,o,s,u,c,f=j_(n,r.group_interval),l=Jt(e),h=P_.from(l).triangles,p=new Uint8Array(l.length),d=0,g=h.length;d<g;d+=3)s=h[d],u=h[d+1],c=h[d+2],i=l[s],a=l[u],o=l[c],f(i,a)&&f(a,o)&&f(i,o)&&(p[s]=1,p[u]=1,p[c]=1);!function(e,n){var r=e.data?e.data.getRecords():null,i=e.shapes||null,a=ki(e),o=i?[]:null,s=r?[]:null;t.repeat(a,function(e){var t=n(e);Ch(t),!0===t&&(i&&o.push(i[e]||null),r&&s.push(r[e]||null))}),e.shapes=o,e.data=s?new di(s):null}(e,function(e){return 1==p[e]})};var dI=Object.freeze({__proto__:null,getPolygonToPointsFunction:hI,joinPointsToPolygons:cI,joinPolygonsToPoints:fI,prepJoinLayers:lI});function gI(e,t){return t*Math.PI/180*function(e){return e.a*Math.sqrt(1-(e.es||0))}(e)}function mI(e){return e.params.proj.param}function yI(e){return!vI(e,"cassini,gnom,bertin1953,chamb,ob_tran,tpeqd,healpix,rhealpix,ocea,omerc,tmerc,etmerc,nicol")&&!function(e){return vI(e,"aeqd,gnom,laea,mil_os,lee_os,gs48,alsk,gs50,nsper,tpers,ortho,qsc,stere,ups,sterea")}(e)}function vI(e,t){return t.split(",").includes(mI(e))}function bI(e,t,n){var r=function(e,t){var n=_I(e,t);return function(e,t){return n([e,t])}}(t,n);e.layers.filter(Si).forEach(function(e){JI(e,r)}),e.arcs&&WI(e.arcs,r)}function _I(e,t){var n=(e[0]||0)*an,r=(e[1]||0)*an,i=(e[2]||0)*an;return function(e){return e[0]*=an,e[1]*=an,(t?wI:xI)(e,n,r,i),e[0]*=on,e[1]*=on,e}}function xI(e,t,n,r){return 0!=t&&SI(e,t),0===n&&0===r||AI(e,n,r,!1),e}function wI(e,t,n,r){return 0===n&&0===r||AI(e,n,r,!0),0!=t&&SI(e,-t),e}function SI(e,t){var n=e[0]+t;n>Math.PI?n-=2*Math.PI:n<-Math.PI&&(n+=2*Math.PI),e[0]=n}function AI(e,t,n,r){var i,a=Math.cos(t),o=Math.sin(t),s=Math.cos(n),u=Math.sin(n),c=Math.cos(e[1]),f=Math.cos(e[0])*c,l=Math.sin(e[0])*c,h=Math.sin(e[1]);r?(i=h*s-l*u,e[0]=Math.atan2(l*s+h*u,f*a+i*o),e[1]=Math.asin(i*a-f*o)):(i=h*a+f*o,e[0]=Math.atan2(l*s-i*u,f*a-h*o),e[1]=Math.asin(i*s+l*u))}function EI(e,t){Na(Ia(e))||bt("Command requires a lat-long dataset."),Array.isArray(t.rotation)&&t.rotation.length||bt("Invalid rotation parameter");var n=_I(t.rotation,t.invert),r=new VM(e);e.arcs&&e.arcs.flatten(),e.layers.forEach(function(e){var i=e.geometry_type;r.editLayer(e,function(e,t,n){var r;if("point"==e)return function(e){return e.forEach(t),e};if("polyline"==e)return function(e){return(e=$M(e,.5)).forEach(t),kx(e)};if("polygon"==e)return function(e,i,a){var o,s;if(!function(e){for(var t=0,n=e.length;t<n;t++)if(!Mx(e[t]))return!1;return!0}(e)?(e.forEach(Sx),(e=$M(e=Ix(e),.5,(s=JM(o=.5),function(e,t){var n;return n=Ax(e)||Ax(t)?[]:Ex(e,t)?function(e,t,n){var r,i,a=[],o=e[1]<t[1];e[0]!=t[0]&&vt("Expected an edge segment"),o?(r=e[1],i=t[1]):(r=t[1],i=e[1]);for(var s=Math.floor(r/n)*n+n;s<i;)a.push([e[0],s]),s+=n;return o||a.reverse(),a}(e,t,o):Lx(e,t)?[]:s(e,t),n}))).forEach(t)):e=$M(e,.5),0===i&&(r=[]),!(e.length<4))return xx(e[0],_x(e))||vt("Open polygon ring"),r.push(e),i==a.length-1?n.debug?r:Px(r):void 0;Ct("Short ring",e)};return null}(i,n,t))}),r.done(),t.debug||(Ka(e),$I(e))}function MI(e,t){for(var n=t.arcs,r=pr(e.shapes,n),i=[],a=[],o=0,s=n.size();o<s;o++)r(o)&&(i.push({arcid:o}),a.push([[o]]));return{geometry_type:"polyline",data:new di(i),shapes:a}}function II(e,t){for(var n,r=t.arcs,i={type:"FeatureCollection",features:[]},a=pr(e.shapes,r),o=0,s=r.size();o<s;o++)a(n=o)&&r.forEachArcSegment(n,u);function u(e,t,r,a){var o=r[e],s=a[e],u=r[t],c=a[t];i.features.push({type:"Feature",properties:{arc:n,i1:e,i2:t,x1:o,y1:s,x2:u,y2:c},geometry:{type:"LineString",coordinates:[[o,s],[u,c]]}})}var c=io([t,Kv(i,{})]);return t.arcs=c.arcs,c.layers.pop()}function kI(e){var t=[];return Wt(e,function(e){t.push(e.concat())}),{type:"LineString",coordinates:t}}function CI(e,n,r){var i,a=(r=r||{}).each?function(e,t,n){var r,i=DS(t,n)(o),a=sp(e,t,n);function o(e,t){a(e,t,r)}return function(e,t){return r=e,i(t[0][0]),e}}(r.each,e,n):null,o=DS(e,n,{where:r.where}),s=t.isArray(r.fields)?r.fields:[],u=0,c=[],f=[];return s.length>0&&!e.data&&bt("Missing a data table"),l(function(e,t){return NI(e,t(function(e,t){return-1==t?String(e):null}))}(e.shapes,o),"outer"),s.forEach(function(t){var n=e.data.getRecords();Pi(e,t),l(NI(e.shapes,o(function(e,r){var i=n[e],a=n[r];return i&&a&&i[t]!==a[t]?e+"-"+r:null})),t)}),l(OI(e.shapes,o),"inner"),Ui(i=PI(c,f),e,null,r),i;function l(e,n){var r=e.map(function(e,t){var r={RANK:u,TYPE:n};return a&&a(r,e),r});c=t.merge(e,c),f=t.merge(r,f),u++}}function PI(e,t){return{geometry_type:"polyline",shapes:e,data:t?new di(t):null}}function OI(e,t){return NI(e,t(function(e,t){return t>-1?e+"-"+t:null}))}function NI(e,t){var n,r=[],i={},a=null,o=null;return wr(e,function(e){var s,u,c=e.arcId,f=t(c);f&&(u=f in i?i[f]:null,s=f==o&&e.shapeId==a.shapeId&&e.partId==a.partId,u?s?u[u.length-1].push(c):u.push([c]):(u=[[c]],i[f]=u,r.push(u)),e.i==n.arcs.length-1&&u.length>1&&u[0][0]==n.arcs[0]&&(u[0]=u.pop().concat(u[0])));a=e,o=f},function(e){n=e}),r}pp.fuzzyJoin=function(e,n,r,i){var a=r?r.layer:null;a&&Si(a)||bt("Missing a point layer to join from"),Pi(a,i.field),Ri(e),i.dedup_points&&pp.uniq(a,null,{expression:'this.x + "~" + this.y + "~" + this.properties['+JSON.stringify(i.field)+"]",verbose:!1}),function(e,n,r,i){var a=i.field,o=hI(e,n,r,{first_match:!0}),s=function(e,t){var n=e.data.getRecords();return function(e){for(var r,i=[],a=0;a<e.length;a++)r=n[e[a]],i.push(r[t]);return i}}(r,a),u=[],c=[],f=[];if(e.shapes.forEach(function(e,t){var l=o(t)||[],h=lp(s(l),!0),p=h.margin>0?h.modes[0]:null;null===p&&h.modes.length>1&&(p=function(e,t,n,r,i,a){var o=e.map(function(){return 0});n.forEach(function(n){var s=t.shapes[n],u=t.data.getRecordAt(n)[r],c=e.indexOf(u);if(-1!==c){var f=function(e,t,n){var r=e[0];return fr.getPointToShapeDistance(r[0],r[1],t,n)}(s,i,a);o[c]+=f}});var s=Math.max.apply(null,o);return e[o.indexOf(s)]}(h.modes,r,l,a,e,n)),f[t]=h.count||0,i.no_dropouts&&c.push(h),u.push(p)}),vi(e,"join-count",f),vi(e,a,u),pp.dataFill(e,n,{field:a,weight_field:"join-count",contiguous:i.contiguous}),i.no_dropouts){var l=function(e,n,r){var i=ai(n.data.getRecords(),r),a=ai(e.data.getRecords(),r);return t.difference(i,a)}(e,r,a);l.length>0&&function(e,n,r,i){var a=e.data.getRecords(),o=[],s=[];r.map(function(e){var t=function(e,t){var n=-1,r=0;return t.forEach(function(t,i){var a=t.values.indexOf(e),o=a>-1?t.counts[a]:0;o>r&&(n=i,r=o)}),n}(e,i);t>-1&&-1===s.indexOf(t)?(a[t][n]=e,s.push(t)):o.push(e)}),xt("Restored",s.length,"dropout value"+t.pluralSuffix(s.length)),o.length>0&&xt("Failed to restore dropout value(s):",o.join(", "))}(e,a,l,c)}}(e,n,a,i)},pp.rotate=EI,pp.lines=function(e,n,r){return(r=r||{}).callouts?(Ti(e),function(e,t,n){var r=e.data?e.data.getRecords():null,i=Ji(e).width()/50,a=function(e){return[e,[e[0]+i,e[1]]]},o={type:"FeatureCollection",features:e.shapes.map(function(e,t){return{type:"Feature",properties:r?r[t]:null,geometry:{type:"MultiLineString",coordinates:e.map(a)}}})},s=Kv(o),u=to(t,[s]);return Ui(u[0],e.name,null,n),u}(e,n,r)):"point"==e.geometry_type?function(e,n,r){var i=r.groupby?function(e,n,r){var i,a=[],o=xp([n],e.data),s=t.defaults({fields:[n]},r),u=Sp(e.data.getRecords(),o,s);return e.shapes.forEach(function(e,t){var n=o(t);n in a==!1&&(a[n]=[]),a[n].push(e)}),i=a.map(function(e,t){return{type:"Feature",properties:u[t],geometry:e.length>1?kI(e):null}}),{type:"FeatureCollection",features:i}}(e,r.groupby,r):kI(e.shapes),a=Kv(i),o=to(n,[a]);return Ui(o[0],e,null,r),o}(e,n,r):r.segments?[II(e,n)]:r.arcs?[MI(e,n)]:"polygon"==e.geometry_type?CI(e,n.arcs,r):void Ri(e,"Command requires a polygon or point layer")};var TI=Object.freeze({__proto__:null,createLineLayer:PI,extractInnerLines:OI,polygonsToLines:CI});function LI(e,t,n){var r;return vI(t,"stere,sterea,ups,ortho,gnom,laea,nsper,tpers,geos,nicol")||n.clip_angle||t.clip_angle?r=function(e,t,n){var r=n.clip_angle||t.clip_angle||function(e){var t=mI(e);if("nsper"==t||"geos"==t)return function(e){var t=parseFloat(e.params.h.param);if(!t||t<0)return 0;var n=180*Math.acos(e.a/(e.a+t))/Math.PI;return n*=.995}(e);if("tpers"==t)return xt("Automatic clipping is not supported for the Tilted Perspective projection"),0;return{gnom:60,laea:179,ortho:89.85,nicol:89.85,stere:142,sterea:142,ups:10.5}[t]||0}(t);if(!r)return null;Mt(`Using clip angle of ${+r.toFixed(2)} degrees`);var i=function(e,t){return gI(e,t)}(e,r),a=function(e){var t=180/Math.PI;return[e.lam0*t,e.phi0*t]}(t);t.clip_angle=r;var o=Fx(a,i,0,n);return Kv(o)}(e,t,n):(function(e){return vI(e,"merc,bertin1953")}(t)||n.clip_bbox)&&(r=RI(t,n)),r||null}function zI(e,t,n){var r=LI(e,t,n);return r||(r=RI(t,{clip_bbox:[-180,-90,180,90]})),VI(r,e,t,{no_clip:!1,quiet:!0}),r}function RI(e,t){var n=t.clip_bbox||DI(e),r=function(e){var t=mI(e);if("bertin1953"==t)return[-16.5,-42];if(("tmerc"==t||"utm"==t||"etmerc"==t)&&0!==e.lam0)return[180*e.lam0/Math.PI];return null}(e);n||vt("Missing expected clip bbox.");var i=Kv(eI(n,t=Object.assign({interval:.5},t)));return r&&EI(i,{rotation:r,invert:!0}),i}function DI(e){var t=.001,n=[-179,-90,179,90];return{tmerc:n,utm:n,etmerc:n,merc:[-180,-89,180,89],lcc:[-180,-89,180,89],bertin1953:[-180+t,-90+t,180-t,90-t]}[mI(e)]}function jI(e,n,r,i){if(!Na(n)||i.no_clip)return!1;var a,o,s,u=function(e,t,n){var r=oa(180*n.lam0/Math.PI);if(e.arcs&&(i=n,yI(i)&&0!==i.lam0)&&function(e,t){var n=0;return e.arcs.forEachSegment(function(e,r,i,a){var o=i[e],s=i[r];(o<=t&&s>=t||o>=t&&s<=t)&&n++}),n>0}(e,r))return function(e,t){var n=e.layers.filter(wi);if(0===n.length)return;var r=1e-8,i=[t-r,-91,t+r,91],a=Kv(eI(i,{interval:.5}));$E(n,a,e,"erase")}(e,r),ho(e),!0;var i;return!1}(e,0,r),c=!1,f=(vI(o=r,"merc,lcc")&&(s=DI(o)),s);return f?function(e,n){No(e,function(e,r){return[t.clamp(e,n[0],n[2]),t.clamp(r,n[1],n[3])]})}(e,f):a=function(e,t,n){return LI(e,t,n)}(n,r,i),a&&(c=function(e,t){var n=e.layers.filter(function(n){return xi(n)&&!function(e,t,n){var r=Ji(e,t.arcs),i=!1;return n.layers[0].shapes.forEach(function(e,t){i=i||kn(r,e,n.arcs)}),i}(n,e,t)});if(n.length>0)return $E(n,t,e,"clip"),!0;return!1}(e,a)),u||c}function FI(e,t){var n,r,i,a,o;return e in s("mproj").internal.pj_list==!1?e:(i=["lcc","aea"].includes(e),a=["tmerc","etmerc"].includes(e),n="+proj="+e,(i||a)&&(r=function(e){Na(Ia(e))||bt("Expected unprojected data");return wo(e).toArray()}(t),o=$l(r),xt(`Converted "${e}" to "${n+=" "+(a?BI(r,o):UI(r,o))}"`)),n)}function UI(e,t){var n=(e[0]+e[2])/2,r=e[3]-e[1],i=e[1]+1/6*r,a=e[1]+5/6*r;return`+lon_0=${n.toFixed(t)} +lat_1=${i.toFixed(t)} +lat_2=${a.toFixed(t)}`}function BI(e,t){var n=(e[0]+e[2])/2,r=(e[1]+e[3])/2;return`+lon_0=${n.toFixed(t)} +lat_0=${r.toFixed(t)}`}var GI=Object.freeze({__proto__:null,expandProjDefn:FI,getCenterParams:BI,getConicParams:UI});function qI(e,t){var n,r,i={};return/\.prj$/i.test(e)?((n=Xb(e,{}))&&(i.prj=n.info.prj,i.crs=Ra(i.prj)),i):t&&(r=t.findSingleLayer(e))?Ma(n=r.dataset):wa(e)}function VI(e,t,n,r){var i=ha(t,n),a=0,o=0,s=jI(e,t,n,r);e.layers.forEach(function(e){Si(e)&&(o+=JI(e,i))}),e.arcs&&(a=r.densify?ZM(e.arcs,i):ZI(e.arcs,i)),s&&$I(e),a>0&&!r.quiet&&xt(`Removed ${a} ${1==a?"path":"paths"} containing unprojectable vertices.`),o>0&&!r.quiet&&xt(`Removed ${o} unprojectable ${1==o?"point":"points"}.`),e.info.crs=n}function $I(e){vd(e.layers.filter(e=>"polygon"==e.geometry_type),e,{allow_overlaps:!0,rebuild_topology:!0,no_arc_dissolve:!0,quiet:!0,verbose:!1}),ho(e)}function JI(e,t){var n=0;return Pr(e.shapes,function(e){var r=t(e[0],e[1]);return r||n++,r}),n}function WI(e,t){for(var n,r=e.getVertexData(),i=r.xx,a=r.yy,o=r.zz,s=e.getRetainedInterval(),u=0,c=i.length;u<c;u++)(n=t(i[u],a[u]))||vt("Unprojectable point:",i[u],a[u]),i[u]=n[0],a[u]=n[1];e.updateVertexData(r.nn,i,a,o),e.setRetainedInterval(s)}function ZI(e,t){return qM(e,function(e,n,r,i,a,o){var s=t(n,r);if(!s)return!1;e(s)})}pp.proj=function(e,n,r){var i,a;r.init&&((i=qI(r.init,n)).crs||bt("Unknown projection source:",r.init),Ea(e,i)),r.match?a=qI(r.match,n):r.crs&&(a=wa(FI(r.crs,e))),a&&function(e,n,r){var i=qc(),a=[],o={info:e.info||{}};n.crs||bt("Missing projection data");if(!Ao(e))return void Ea(e,n);var s=Ma(e);s.crs||bt("Unable to project -- source coordinate system is unknown");if(ya(s.crs,n.crs))return void xt("Source and destination CRS are the same");e.arcs&&(e.arcs.flatten(),o.arcs=i?e.arcs.getCopy():e.arcs);o.layers=e.layers.map(function(e){return i&&(a.push(e),e=Gi(e)),e}),VI(o,s.crs,n.crs,r||{}),Ea(o,n),e.arcs=o.arcs,a.forEach(function(e,n){t.extend(e,o.layers[n])})}(e,a,r)};var YI=Object.freeze({__proto__:null,cleanProjectedPathLayers:$I,fetchCrsInfo:qI,projectArcs:WI,projectArcs2:ZI,projectDataset:VI,projectPointLayer:JI});function HI(e,n,r){var i=r.interval||10;Math.round(i)==i&&i>0!=!1||bt("Invalid interval:",i),e.lam0,Math.PI;var a=i>10?1:.5,o=i,s=i,u=Math.round(360/o),c=Math.round(180/s)+1,f=t.range(u,-180+o,o),l=t.range(c,-90,s),h=[],p=[],d=function(e){return yI(e)}(e)?function(e){var t=function(e){return 0===e.lam0?180:oa(180*e.lam0/Math.PI)}(e),n=2e-8;return 180==t?[-180,180]:[t-n,t+n]}(e):null;return f.forEach(function(e){d&&(g(e,d[0])||g(e,d[1]))||m(e,e%90==0)}),d&&!n&&(m(d[0],!0),m(d[1],!0)),l.forEach(function(e){!function(e){var t=$M([[-180,e],[180,e]],a);p.push(KI(t,{type:"parallel",value:e}))}(e)}),{type:"FeatureCollection",features:h.concat(p)};function g(e,t){return Math.abs(e-t)<i/5}function m(e,t){var n=s<=15?s:0;y(e,-90+n,90-n),t&&n>0&&(y(e,-90,-90+n),y(e,90-n,90))}function y(e,t,n){var r=$M([[e,t],[e,n]],a);h.push(KI(r,{type:"meridian",value:XI(e)}))}}function XI(e){return+e.toFixed(3)||0}function KI(e,t){return{type:"Feature",properties:t,geometry:{type:"LineString",coordinates:e}}}function QI(e){return ak(e).length>0}function ek(e){var t=rk(e);t.active=!0,t.complete=!0}function tk(e){rk(e).active=!1}function nk(e){return rk(e).complete}function rk(e){var t=ak(e);return t[t.length-1]}function ik(e){var t=ak(e);return 0===t.length||t.every(e=>e.active)}function ak(e){return e.control=e.control||{stack:[]},e.control.stack}function ok(e,t){!nk(e)&&function(e,t){return!t.expression||gM(t.expression,e,t)()}(e.catalog,t)?ek(e):tk(e)}function sk(e,n,r,i){var a=jE([e],n,r,i),o=Vp(a,i),s=a.layers.pop();n.arcs=a.arcs,lI(e,s);var u=new fd({shapes:e.shapes.concat(s.shapes)},o,{flat:!1}),c=t.extend({},i);c.min_overlap_area&&(c.min_overlap_area=ih(c.min_overlap_area,Ia(n)));var f=function(e,n,r,i){var a,o,s,u=function(e,t){return function(n){for(var r,i=[],a=0;a<n.length;a++)(r=n[a]-e)>=0&&r<t&&i.push(r);return i}}(e.shapes.length,n.shapes.length);i.largest_overlap&&(a=function(e,n){var r=e.shapes.length;return function(e,i){var a=n.getTileIdsByShapeId(e),o=0,s=-1;return i.forEach(function(e,i){var u=n.getTileIdsByShapeId(e+r),c=fk(t.intersection(a,u),n);c>=o&&(s=e,o=c)}),-1==s&&vt("Geometry error"),[s]}}(e,r));i.min_overlap_pct&&(s=function(e,n,r){r.nodes.arcs;var i=n.shapes.length;return function(n,a){var o=r.getTileIdsByShapeId(n),s=fk(o,r);return a.filter(function(n,a){var u=r.getTileIdsByShapeId(n+i);return(fk(t.intersection(o,u),r)/s||0)>=e})}}(i.min_overlap_pct,e,r));i.min_overlap_area&&(o=function(e,n,r){r.nodes.arcs;var i=n.shapes.length;return function(n,a){var o=r.getTileIdsByShapeId(n);return a.filter(function(n,a){var s=r.getTileIdsByShapeId(n+i);return fk(t.intersection(o,s),r)>=e})}}(i.min_overlap_area,e,r));return function(e){for(var n,c=r.getTileIdsByShapeId(e),f=[],l=0;l<c.length;l++)n=r.getSourceIdsByTileId(c[l]),n=u(n),f=f.length>0?f.concat(n):n;return(f=t.uniq(f)).length>1&&i.largest_overlap&&(f=a(e,f)),o&&(f=o(e,f)),s&&(f=s(e,f)),f}}(e,s,u,c),l=bM(e,s.data,f,c);return i.interpolate&&(i.duplication&&bt("duplication and interpolate options cannot be used together"),function(e,t,n,r){var i=function(e,t,n,r){var i=r.planar?fr.getPlanarShapeArea:fr.getShapeArea,a=e.shapes.length,o=n.mosaic,s=n.nodes.arcs,u=o.map(function(e,t){return{area:i(e,s),weights:null,sourceIds:null}});return t.shapes.forEach(function(e,t){for(var r,o,c=n.getTileIdsByShapeId(t+a),f=i(e,s),l=0;l<c.length;l++)o=(r=u[c[l]]).area/f,r.weights||(r.weights=[],r.sourceIds=[]),r.weights.push(o),r.sourceIds.push(t)}),u}(e,t,n,r),a=r.interpolate,o=t.data.getRecords(),s=[],u=[];a.forEach(function(e){var t=ei(e,o);"number"==t?s.push(e):"string"==t||"boolean"==t?u.push(e):xt(`"${e}" field appears to contain ${t}-type data. No interpolation method is available.`)}),e.data.getRecords().forEach(function(e,t){var r,c,f=n.getTileIdsByShapeId(t),l=[];for(r=0;r<f.length;r++)l.push(i[f[r]]);for(r=0;r<s.length;r++)e[c=a[r]]=uk(c,l,o);for(r=0;r<u.length;r++)e[c=a[r]]=ck(c,l,o)})}(e,s,u,i)),l}function uk(e,t,n){for(var r,i,a=0,o=0;o<t.length;o++)if((r=t[o]).sourceIds)for(var s=0;s<r.sourceIds.length;s++)i=n[r.sourceIds[s]],a+=r.weights[s]*i[e];return a}function ck(e,t,n){for(var r,i,a,o=[],s=[],u=0;u<t.length;u++)if((i=t[u]).sourceIds)for(var c=0;c<i.sourceIds.length;c++)r=n[i.sourceIds[c]][e],-1==(a=s.indexOf(r))?(s.push(r),o.push(i.area)):o[a]+=i.area;var f=Math.max.apply(null,o),l=o.indexOf(f);return-1==l?null:s[l]}function fk(e,t){for(var n=t.nodes.arcs,r=0,i=0;i<e.length;i++)r+=fr.getShapeArea(t.mosaic[e[i]],n);return r}function lk(e,t,n){if(!e)return null;var r=e.map(function(e){return function(e,t){var n=bn(e,t,!1)/2,r=0,i=null;xr(e,t,function(e,t,a,o){var s=a[e],u=o[e],c=a[t],f=o[t];if(!i){if(n>0==!1)return[s,u];var l,h=cn(s,u,c,f);r+h>=n&&(i=[(1-(l=(n-r)/h))*s+l*c,(1-l)*u+l*f]),r+=h}}),i||Ct("[findPathMidpoint()] defective path:",e);return i}(e,t)});return r}function hk(e,t,n){var r=!t.isPlanar(),i=e?1==e.length?e[0]:function(e,t,n){var r=0,i=null;return e.forEach(function(e){var a=fr.calcPathLen(e,t,n);a>r&&(r=a,i=e)}),i}(e,t,r):null;if(!i)return null;var a=t.getSimpleShapeBounds(i);return sl(a.centerX(),a.centerY(),[i],t,r)}function pk(e,t,n){var r=n.inner?zh:fr.getShapeCentroid;return e.shapes.map(function(e){var n=r(e,t);return n?[[n.x,n.y]]:null})}function dk(e){var n;if(t.isFiniteNumber(e))return e;if(t.isString(e)&&""!==e){if(n=+e,t.isFiniteNumber(n))return n;if(n=Mh(e),t.isFiniteNumber(n))return n}return NaN}function gk(e){var n=/^(lng|long?|longitude|x)$/i;return t.find(e,function(e){return n.test(e)})}function mk(e){var n=/^(lat|latitude|y)$/i;return t.find(e,function(e){return n.test(e)})}function yk(e,t){return e||bt("Layer is missing a data table"),t.x&&t.y&&e.fieldExists(t.x)&&e.fieldExists(t.y)||bt("Missing x,y data fields"),e.getRecords().map(function(e){var n=dk(e[t.x]),r=dk(e[t.y]);return isNaN(n)||isNaN(r)?null:[[n,r]]})}pp.graticule=function(e,t){var n,r,i=t.name||t.polygon&&"polygon"||"graticule";return e&&!Ta(e)?((r=Ma(e)).crs||bt("Coordinate system is unknown, unable to create a graticule"),n=t.polygon?function(e,t){var n=Sa("wgs84");return zI(n,e,t)}(r.crs,t):function(e,t){var n=Sa("wgs84"),r=function(e,t,n){var r=LI(e,t,n);return r&&(VI(r,e,t,{no_clip:!1,quiet:!0}),r.layers[0].geometry_type="polyline"),r||null}(n,e,{}),i=Kv(HI(e,!!r,t));VI(i,n,e,{no_clip:!1}),r&&(i=function(e,t){var n=io([e,t]),r=n.layers.pop(),i=n.layers[0],a=i.data.getRecords();return r.shapes.forEach(function(e){i.shapes.push(e),a.push({type:"outline",value:null})}),n}(i,r));return Ka(i),vd(i.layers,i,{verbose:!1}),i}(r.crs,t),Ea(n,r)):(n=t.polygon?function(e){var t=Sa("wgs84");return zI(t,t,e)}(t):function(e){var t=Sa("wgs84"),n=Kv(HI(t,!1,e));return n}(t),Ea(n,wa("wgs84"))),n.layers[0].name=i,n},pp.printHelp=function(e){Et(Mv().getHelpMessage(e.command))},pp.if=function(e,t){!function(e){ak(e).push({active:!1,complete:!ik(e)})}(e),ok(e,t)},pp.elif=function(e,t){QI(e)||bt("-elif command must be preceded by an -if command."),ok(e,t)},pp.else=function(e){QI(e)||bt("-else command must be preceded by an -if command."),nk(e)?tk(e):ek(e)},pp.endif=function(e){QI(e)||bt("-endif command must be preceded by an -if command."),function(e){ak(e).pop()}(e)},pp.ignore=function(e,t,n){n.empty&&Ci(e)&&_t("Layer is empty, stopping processing")},pp.include=function(e){var n,r,a;if(e.file||bt("Missing name of a JS file to load"),Lf.checkFileExists(e.file,e.input),"string"==typeof(n=Lf.readFile(e.file,"utf8",e.input))){/^\s*\{[\s\S]*\}\s*$/.test(n)||bt("Expected a JavaScript object containing key:value pairs");try{(a=np()).require=require,r=Function("ctx","with(ctx) {return ("+n+");}").call({},a)}catch(e){bt(e.name,"in JS source:",e.message)}}else"object"==typeof n&&(r=n);t.extend(i("defs"),r)},pp.inlay=function(e,t,n,r){var i=jE(e,n,t,r),a=i.layers[i.layers.length-1];Ri(a),e.forEach(Ri);var o={layer:Bi(a),dataset:i},s=pp.eraseLayers(e,o,i,r).map(function(e){var t=Bi(a),n=pp.mergeLayers([e,t],{force:!0})[0];return n.name=e.name,n});return n.arcs=i.arcs,s},pp.innerlines=function(e,t,n){n=n||{},Ri(e);var r=DS(e,t,{where:n.where}),i=OI(e.shapes,r),a=PI(i,null);return 0===i.length&&xt("No shared boundaries were found"),Ui(a,e,null,n),a},pp.inspect=function(e,n,r){var i,a=function(e,n,r){var i,a=ki(e),o=[];r.expression||bt("Missing a JS expression for selecting a feature");return i=ap(r.expression,e,n),t.repeat(a,function(e){var t=i(e);Ch(t,"Expression must return true or false"),!0===t&&o.push(e)}),o}(e,n,r);i=1==a.length?function(e,n,r){var i="Feature "+e+"\n";return i+=function(e,n,r){var i,a,o=n.shapes?n.shapes[e]:null,s=n.geometry_type;if(!o||!s)return"Geometry: [null]\n";a="Geometry\n Type: "+s+"\n","point"==s?a+=" Points: "+o.length+"\n":"polyline"==s?a+=" Parts: "+o.length+"\n":"polygon"==s&&(i=function(e,t){for(var n,r={rings:e.length,cw:0,ccw:0,area:0},i=0;i<e.length;i++)(n=fr.getPlanarPathArea(e[i],t))>0?r.cw++:n<0&&r.ccw++,r.area+=n;t.isPlanar()||(r.sph_area=fr.getSphericalShapeArea(e,t));return r}(o,r),a+=t.format(" Rings: %d cw, %d ccw\n",i.cw,i.ccw),a+=" Planar area: "+i.area+"\n",i.sph_area&&(a+=" Spherical area: "+i.sph_area+" sq. meters\n"));return a}(e,n,r),i+=oM(aM(n,e)),i}(a[0],e,n):t.format("Expression matched %d feature%s. Select one feature for details",a.length,t.pluralSuffix(a.length)),xt(i)},pp.createPointLayer=function(e,n,r){var i=Fi(e,r),a=n.arcs;r.intersections?(!function(e){var t=e.getFilteredPointCount(),n=e.size(),r=t-n,i=Ol(e),a=Math.ceil(i/10),o=10*i,s=Nl(e);console.log("points:",t,"arcs:",n,"segs:",r),[a,i,o,s].forEach(function(t){console.time(t+" stripes"),Il(e,{stripes:t}),console.timeEnd(t+" stripes")})}(a),i=e):r.interpolated?i.shapes=function(e,t,n){var r,i=oh(n.interval,Ia(t));i>0==!1&&bt("Invalid interpolation interval:",n.interval);"polyline"!=e.geometry_type&&bt("Expected a polyline layer");return e.shapes.map(function(e,t){return r=[],e&&e.forEach(a),r.length>0?r:null});function a(e){var n=function(e,t,n){var r,i,a,o,s,u=t.getShapeIter(e),c=t.isPlanar()?fr.distance2D:fr.greatCircleDistance,f=[],l=0;u.hasNext()&&(f.push([u.x,u.y]),r=u.x,i=u.y);for(;u.hasNext();){for(a=c(r,i,u.x,u.y);l+a>=n;)o=(n-l)/a,s=H_(r,i,u.x,u.y,o),l=0,f.push(s),a=c(r=s[0],i=s[1],u.x,u.y);l+=a,r=u.x,i=u.y}l>0&&f.push([r,i]);return f}(e,t.arcs,i);r=r.concat(n)}}(e,n,r):r.vertices?i.shapes=function(e,t){var n,r;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],r={},(e||[]).forEach(a),n.length>0?n:null});function i(e){var t=e.x+"~"+e.y;t in r==!1&&(r[t]=!0,n.push([e.x,e.y]))}function a(e){for(var n=t.getShapeIter(e);n.hasNext();)i(n)}}(e,a):r.vertices2?i.shapes=function(e,t){var n;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],(e||[]).forEach(r),n.length>0?n:null});function r(e){for(var r=t.getShapeIter(e);r.hasNext();)n.push([r.x,r.y])}}(e,a):r.endpoints?i.shapes=function(e,t){var n,r;"polygon"!=e.geometry_type&&"polyline"!=e.geometry_type&&bt("Expected a polygon or polyline layer");return e.shapes.map(function(e,t){return n=[],r={},(e||[]).forEach(a),n.length>0?n:null});function i(e){var t=e.x+"~"+e.y;t in r==!1&&(r[t]=!0,n.push([e.x,e.y]))}function a(e){for(var n=0;n<e.length;n++)i(t.getVertex(e[n],0)),i(t.getVertex(e[n],-1))}}(e,a):r.x||r.y?i.shapes=yk(e.data,r):"polygon"==e.geometry_type?i.shapes=pk(e,a,r):r.midpoints?(zi(e),i.shapes=function(e,t){return e.shapes.map(function(e){return lk(e,t)})}(e,a)):"polyline"==e.geometry_type?i.shapes=function(e,t){return e.shapes.map(function(e){var n=hk(e,t);return n?[[n.x,n.y]]:null})}(e,a):e.geometry_type?bt("Expected a polygon or polyline layer"):i.shapes=function(e){var t=e?e.getFields():[],n={x:gk(t),y:mk(t)};return yk(e,n)}(e.data),i.geometry_type="point";var o=i.shapes.reduce(function(e,t){return t||e++,e},0);return o>0&&xt(t.format("%,d of %,d points are null",o,i.shapes.length)),e.data&&(i.data=r.no_replace?e.data.clone():e.data),i};var vk=Object.freeze({__proto__:null,coordinateFromValue:dk,findXField:gk,findYField:mk,pointsFromPolygons:pk});function bk(e,t){return{geometry_type:"point",shapes:pk(e,t.arcs,{inner:!0}),data:e.data}}function _k(e,t,n,r){return r.point_method?function(e,t,n,r){var i,a,o=n.layer,s=n.dataset;return e.shapes.length>o.shapes.length?(a=fI(i=bk(e,t),o,s.arcs,r),e.data=i.data):(i=bk(o,s),a=cI(e,t.arcs,i,r)),a}(e,t,n,r):sk(e,t,n,r)}function xk(e,t){return{geometry_type:"point",shapes:e.shapes.map(function(e){return lk(e,t.arcs)}),data:e.data}}function wk(e){e.point_method||bt('The "point-method" flag is required for polyline-polygon joins')}class Sk{constructor(e=[],t=Ak){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,r=t[e];for(;e>0;){const i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=t[r];const o=r+1;if(o<this.length&&n(t[o],a)<0&&(r=o,a=t[o]),n(a,i)>=0)break;t[e]=a,e=r}t[e]=i}}function Ak(e,t){return e<t?-1:e>t?1:0}var Ek=Math.PI/180;function Mk(e,t,n,r){var i=r.minLng,a=r.maxLng,o=r.minLat,s=r.maxLat;if(e>=i&&e<=a)return t<o?kk((t-o)*Ek):t>s?kk((t-s)*Ek):0;var u=Math.min(kk((e-i)*Ek),kk((e-a)*Ek)),c=function(e,t){var n=1-2*t;return n<=0?e>0?90:-90:Math.atan(Math.tan(e*Ek)/n)/Ek}(t,u);return c>o&&c<s?Ck(u,n,t,c):Math.min(Ck(u,n,t,o),Ck(u,n,t,s))}function Ik(e,t){return e.dist-t.dist}function kk(e){var t=Math.sin(e/2);return t*t}function Ck(e,t,n,r){return t*Math.cos(r*Ek)*e+kk((n-r)*Ek)}function Pk(e,t,n,r,i){return Ck(kk((e-n)*Ek),i,t,r)}function Ok(e,t,n){Li(e);var r=Jt(e),i=n.max_distance?ah(n.max_distance,t):.001,a=function(e,t,n){var r=!!t&&Na(t),i=t&&t.to_meter||1;if(r)return function(t){return function(e,t,n,r,i){var a=1,o=[];void 0===r&&(r=1/0),void 0!==i&&(a=kk(i/6371));for(var s,u,c,f=new Sk([],Ik),l={left:0,right:e.ids.length-1,axis:0,minLng:-180,minLat:-90,maxLng:180,maxLat:90},h=Math.cos(n*Ek);l;){if((s=l.right)-(u=l.left)<=e.nodeSize)for(var p=u;p<=s;p++)c=e.points[e.ids[p]],f.push({i:e.ids[p],item:c,dist:Pk(t,n,e.coords[2*p],e.coords[2*p+1],h)});else{var d=u+s>>1,g=e.coords[2*d],m=e.coords[2*d+1];c=e.points[e.ids[d]],f.push({i:e.ids[d],item:c,dist:Pk(t,n,g,m,h)});var y=(l.axis+1)%2,v={left:u,right:d-1,axis:y,minLng:l.minLng,minLat:l.minLat,maxLng:0===l.axis?g:l.maxLng,maxLat:1===l.axis?m:l.maxLat,dist:0},b={left:d+1,right:s,axis:y,minLng:0===l.axis?g:l.minLng,minLat:1===l.axis?m:l.minLat,maxLng:l.maxLng,maxLat:l.maxLat,dist:0};v.dist=Mk(t,n,h,v),b.dist=Mk(t,n,h,b),f.push(v),f.push(b)}for(;f.length&&f.peek().item;){var _=f.pop();if(_.dist>a)return o;if(o.push(_.i),o.length===r)return o}l=f.pop()}return o}(e,t[0],t[1],1/0,n/1e3)};return function(t){return e.within(t[0],t[1],n/i)}}(new(s("kdbush"))(r),t,i),o=new Ml(r.length);this.lookupByMultiPoint=function(e){var t,n,r,i,s=[];for(n=0,i=e?e.length:0;n<i;n++)for(t=e[n],s=a(t),r=0;r<s.length;r++)o.setId(s[r]);return s=o.getIds(),o.clear(),s}}function Nk(e,t,n,r){var i=function(e,t,n,r){var i=e.shapes,a=new Ok(t,n,r);return function(e){var t=a.lookupByMultiPoint(i[e]);return t.length>0?t:null}}(e,t,n,r);return lI(e,t),bM(e,t.data,i,r)}function Tk(e,t,n){var r=n.keys,i=r[0],a=r[1],o=function(e,t,n,r){e||bt("Target layer is missing an attribute table");n||bt("Source layer is missing an attribute table");var i,a,o=e.getRecords(),s=n.getRecords(),u=function(e,t){for(var n,r={},i=0,a=e.length;i<a;i++)(n=e[i][t])in r==!1?r[n]=i:Array.isArray(r[n])?r[n].push(i):r[n]=[r[n],i];return r}(s,r);if(0==s.length)return function(e){return[]};Pi(n,r,"External table is missing a field named:"),Pi(e,t,"Target layer is missing key field:"),i=ei(r,n.getRecords()),a=ei(t,o),Lk(r,i),Lk(t,a),i!=a&&bt("Join keys have mismatched data types:",a,"and",i);return function(e){var n=o[e],r=n?n[t]:null,i=null;return n&&r in u&&(i=u[r],Array.isArray(i)||(i=[i])),i}}(e.data,i,t,a);return _M(r),bM(e,t,o,n)}function Lk(e,t){t&&"object"!=t||bt("["+e+"] field has an unsupported data type. Expected string or number.")}pp.join=function(e,n,r,i){var a,o,s;r&&r.dataset||bt("Missing a joinable data source"),i.keys?(2!=i.keys.length&&bt("Expected two key fields: a target field and a source field"),r.layer.data||bt("Source layer is missing attribute data"),s=Tk(e,r.layer.data,i)):(r.layer.data||Wi(r.layer),ka([n,r.dataset]),a=r.layer.geometry_type,o=e.geometry_type,"point"==a&&"polygon"==o?s=cI(e,n.arcs,r.layer,i):"polygon"==a&&"point"==o?s=fI(e,r.layer,r.dataset.arcs,i):"point"==a&&"point"==o?s=Nk(e,r.layer,Ia(n),i):"polygon"==a&&"polygon"==o?s=_k(e,n,r,i):"polyline"==a&&"polygon"==o?s=function(e,t,n,r){wk(r);var i=xk(n.layer,n.dataset);return cI(e,t.arcs,i,r)}(e,n,r,i):"polygon"==a&&"polyline"==o?s=function(e,t,n,r){wk(r);var i=xk(e,t),a=fI(i,n.layer,n.dataset.arcs,r);return e.data=i.data,a}(e,n,r,i):bt(t.format("Unable to join %s geometry to %s geometry",a||"null",o||"null"))),s.unmatched&&n.layers.push(s.unmatched),s.unjoined&&n.layers.push(s.unjoined)};var zk=Object.freeze({__proto__:null,joinAttributesToFeatures:Tk});function Rk(e,t,n){var r="hex2"!=n.type,i=t*Math.sqrt(3)/2,a=function(e,t){var n=r?e[2]-e[0]:e[3]-e[1],i=Math.ceil((2*n+t)/(3*t)),a=Math.ceil(i/2),o=Math.floor(i/2);return[a,o]}(e,t),o=function(e,t){var n=r?e[3]-e[1]:e[2]-e[0],i=Math.ceil(1+2*n/(t*Math.sqrt(3))),a=Math.ceil(i/2),o=Math.floor(i/2);return[a,o]}(e,t),s=function(){var n=function(e){return r?[e[0],e[2]]:[e[1],e[3]]}(e),i=n[1]-n[0],o=(1.5*(a[0]+a[1])*t+.5*t-i)/2,s=n[0]-o+t;return s}(),u=function(){var t=function(e){return r?[e[1],e[3]]:[e[0],e[2]]}(e),n=t[1]-t[0],a=((o[0]+o[1]+1)*i-n)/2,s=t[0]-a+i;return s}();function c(e,t){var n=o[0]+o[1],r=Math.floor(e/2)*n,i=e%2==1;return i&&(r+=o[1]),r+=t,(e<0||t<0)&&vt("negative grid index"),(i&&t>=o[1]||!i&&t>=o[0])&&vt("out-of-bounds minor axis index"),(i&&e>=a[1]||!i&&e>=a[0])&&vt("out-of-bounds major axis index"),r}function f(e){var t=o[0]+o[1],n=Math.floor(e/t),r=2*n,i=e-n*t;return i>=o[0]&&(r++,i-=o[0]),[r,i]}function l(e,n){var[r,a]=function(e,n){var r=s-1.5*t,a=u-i+0,o=Math.floor((e-r)/(1.5*t)),c=Math.floor((n-a)/i),f=Dk(o)!=Dk(c),l=r+1.5*o*t+.5*t,h=l+.5*t,p=a+c*i,d=p+i,g=f?or(l,p,h,d,e,n):or(h,p,l,d,e,n),m=g>0?o-1:o,y=Math.floor(c/2);return[m,y]}(e,n);return c(r,a)}function h(e){var[t,n]=f(e);return p(t,n)}function p(e,n){var r=Dk(e)?i:0;return[s+1.5*e*t,u+r+n*i*2]}function d(e,n,r){var[a,o]=p(e,n);return[a-(r?t:t/2),o-(r?0:i)]}function g(e){var[t,n]=f(e),r=Dk(t)?0:-1,i=d(t,n,!1);return[i,d(t,n,!1),d(t,n,!0),d(t,n+1,!1),d(t+1,n+1+r,!0),d(t+1,n+1+r,!1),d(t+1,n+r,!0),i]}return function(e,t,n){n.type,n.aligned}(0,0,n),{cells:function(){return o[0]*a[0]+o[1]*a[1]},colRowToIdx:c,idxToColRow:f,pointToIdx:function(e){return r?l(e[0],e[1]):l(e[1],e[0])},idxToPoint:function(e){var t=h(e);return r?t:jk(t)},idxToBBox:function(e){var n=function(e){var n=h(e);return[n[0]-t,n[1]-i,n[0]+t,n[1]+i]}(e);return r?n:[n[1],n[0],n[3],n[2]]},makeCellPolygon:function(e,t){var n={type:"Polygon",coordinates:[g(e)]};return r||function(e){for(var t=0,n=e?e.coordinates.length:0;t<n;t++)e.coordinates[t].forEach(jk)}(n),n},forEachNeighbor:function(e,t,n){var r;r=Dk(e)?0:-1,n(e,t+1),n(e+1,t+r+1),n(e+1,t+r),n(e,t-1),n(e-1,t+r+1)}}}function Dk(e){return e%2!=0}function jk(e){return e[1],e[1]=e[0],e[0]=e[1],e}function Fk(e,t,n){return[(Math.floor(e/n)-1)*n,(Math.ceil(t/n)+1)*n]}function Uk(e,t,n){var r=t-e,i=(Math.ceil(r/n)*n-r)/2+n;return[e-i,t+i]}function Bk(e,t,n){var r=n&&n.aligned?function(e,t){var n=Fk(e[0],e[2],t),r=Fk(e[1],e[3],t);return[n[0],r[0],n[1],r[1]]}(e,t):function(e,t){var n=Uk(e[0],e[2],t),r=Uk(e[1],e[3],t);return[n[0],r[0],n[1],r[1]]}(e,t),i=r[0],a=r[1],o=r[2]-i,s=r[3]-a,u=Math.round(o/t),c=Math.round(s/t);function f(e,t){return e<0||t<0||e>=u||t>=c?-1:t*u+e}function l(e){return[e%u,Math.floor(e/u)]}function h(e){var[n,r]=l(e);return[i+(n+.5)*t,a+(r+.5)*t]}function p(e){var n=l(e);return[i+n[0]*t,a+n[1]*t,i+(n[0]+1)*t,a+(n[1]+1)*t]}return{cells:function(){return u*c},colRowToIdx:f,pointToIdx:function(e){var t=function(e){var t=e[0]-i;return Math.floor(t/o*u)}(e),n=function(e){var t=e[1]-a;return Math.floor(t/s*c)}(e);return f(t,n)},idxToColRow:l,idxToBBox:p,idxToPoint:h,makeCellPolygon:function(e,t){var n=t.circles?function(e,t){var n=h(e),r=t.cell_margin>0?t.cell_margin:1e-6,i=t.interval/2*(1-r),a=t.vertices||20;return Bx(n,i,a,K_)}(e,t):function(e,t){var n=p(e),r=t.interval*(t.cell_margin||0),i=n[0]+r,a=n[1]+r,o=n[2]-r,s=n[3]-r;return[[i,a],[i,s],[o,s],[o,a],[i,a]]}(e,t);return{type:"Polygon",coordinates:[n]}},forEachNeighbor:function(e,t,n){n(e+1,t+1),n(e+1,t),n(e+1,t-1),n(e,t+1),n(e,t-1),n(e-1,t+1),n(e-1,t),n(e-1,t-1)}}}function Gk(e,n,r){var i={},a=n?Ia(n):null;return r.interval?i.interval=oh(r.interval,a):bt("Missing required interval option"),r.bbox?i.bbox=r.bbox:n?(n=t.defaults({layers:e},n),i.bbox=wo(n).toArray()):bt("Missing grid bbox"),i.width=i.bbox[2]-i.bbox[0],i.height=i.bbox[3]-i.bbox[1],i.type=r.type||"square",i}function qk(e){var t=[];return e.forEach(function(e){e.forEach(function(e){t.push({type:"Point",coordinates:e})})}),{type:"GeometryCollection",geometries:t}}function Vk(e){var t,n,r,i,a,o,s,u,c,f,l=[],h=e.length-2;for(s=0;s<h;s++)for(u=(f=s%2==0)?0:2,c=f?0:-1;t=e[s][u],n=e[s+1][u+c],r=e[s+2][u],i=e[s+2][u+1],a=e[s+1][u+2+c],o=e[s][u+1],i&&a;u+=3)l.push({type:"Polygon",coordinates:[[t,n,r,i,a,o,t]]});return{type:"GeometryCollection",geometries:l}}function $k(e){for(var t,n,r=e.interval,i=Math.sqrt(3)*r/2,a=r/2,o=e.width+2*r,s=e.height+2*i,u=-i,c=[];u<s;){for(t=c.length%2==0?0:-a,n=[],c.push(n);t<o;)n.push([t,u]),t+=r;u+=i}return c}function Jk(e){for(var t,n,r=0,i=[],a=e.interval,o=e.width+a,s=e.height+a;r<s;){for(t=0,n=[],i.push(n);t<o;)n.push([t,r]),t+=a;r+=a}return i}function Wk(e,t){var n=function(e){var t={Point:r,Polygon:n};return e.geometries.reduce(function(e,n){var r=(0,t[n.type])(n);return e?(i(e,r[0],r[1]),i(e,r[2],r[3]),e):r},null);function n(e){return e.coordinates[0].reduce(function(e,t){return e?(i(e,t[0],t[1]),e):[t[0],t[1],t[0],t[1]]},null)}function r(e){var t=e.coordinates;return[t[0],t[1],t[0],t[1]]}function i(e,t,n){t<e[0]&&(e[0]=t),n<e[1]&&(e[1]=n),t>e[2]&&(e[2]=t),n>e[3]&&(e[3]=n)}}(e);!function(e,t,n){e.geometries.forEach(function(e){"Point"==e.type&&(e.coordinates=[e.coordinates[0]+t,e.coordinates[1]+n]),"Polygon"==e.type&&(e.coordinates[0]=e.coordinates[0].map(function(e){return[e[0]+t,e[1]+n]}))})}(e,(t[2]+t[0])/2-(n[2]+n[0])/2,(t[3]+t[1])/2-(n[3]+n[1])/2)}function Zk(e,t,n,r){var i=cn(e[0],e[1],n[0],n[1]);if(i>=t+r)return 0;var a=t*t,o=r*r,s=(a-o+i*i)/(2*i),u=i-s;return i<=Math.abs(t-r)?Math.PI*Math.min(a,o):a*Math.acos(s/t)-s*Math.sqrt(a-s*s)+o*Math.acos(u/r)-u*Math.sqrt(o-u*u)}function Yk(e,t,n){var r=Ca,i=new Ml(t.cells()),a=new r(e.length),o=[];return e.forEach(function(e){var r=function(e,t){return[e[0]-t,e[1]-t,e[0]+t,e[1]+t]}(e,n);!function(e,t,n){var r=n.pointToIdx(e),[i,a]=n.idxToColRow(r);Hk(i,a,n,t),n.forEachNeighbor(i,a,function(e,r){Hk(e,r,n,t)})}(e,i,t),a.add.apply(a,r)}),a.finish(),function(e){if(!i.hasId(e))return o;var n=t.idxToBBox(e);return a.search.apply(a,n)}}function Hk(e,t,n,r){var i=n.colRowToIdx(e,t);i>-1&&r.setId(i)}function Xk(e){var t=e.interval*Math.sqrt(1/Math.PI);return e.radius>0?e.radius:t}function Kk(e,t,n){for(var r,i,a=[],o=0,s=0;s<e.length;s++)(r=t[s])>0!=!1&&(o+=r,a.push(e[s]));return i={weight:o},n&&n(a,i),i}function Qk(e,t,n,r,i){for(var a,o=[],s=t*Math.sqrt(1/Math.PI),u=t*t,c=0;c<r.length;c++)a=Zk(e,s,n[r[c]],i)/u,o.push(a);return o}pp.mosaic=function(e,t,n){var r=e[0];(!r||e.length>1)&&bt("Command takes a single target layer"),Ri(r);var i=Vp(t,n);i.setArcFilter(pr(r.shapes,i.arcs));var a,o=new fd(r,i,{flat:!1}),s=o.mosaic,u={name:"name"in r?r.name:void 0,shapes:s,geometry_type:"polygon"};return n.calc&&(r.data||Wi(r),a=Ap(r.data.getRecords(),o.getSourceIdsByTileId,s.length,n),u.data=new di(a)),[u]},pp.polygonGrid=function(e,n,r){Aa(n);var i=function(e){var n,r;"square"==e.type?n=function(e){for(var t,n,r,i,a=[],o=0,s=e.length-1;o<s;o++)for(var u=0,c=e[o].length-1;u<c;u++)t=e[o][u],n=e[o+1][u],r=e[o+1][u+1],i=e[o][u+1],a.push({type:"Polygon",coordinates:[[t,n,r,i,t]]});return{type:"GeometryCollection",geometries:a}}(Jk(e)):"hex"==e.type?n=Vk($k(e)):"hex2"==e.type?(n=Vk($k(function(e){var n=e.bbox;return t.defaults({width:e.height,height:e.width,bbox:[n[1],n[0],n[3],n[2]]},e)}(e))),n.geometries.forEach(function(e){e.coordinates[0]=e.coordinates[0].map(function(e){return[e[1],e[0]]})})):bt("Unsupported grid type");return Wk(n,e.bbox),Ka(r=Kv(n,{})),r}(Gk(e,n,r));return i.info=yo(n.info),Ui(i.layers[0],null,"grid",r),r.debug&&i.layers.push(pp.pointGrid2(e,n,r)),i},pp.polygonGrid2=function(e,t,n){Aa(t);var r=function(e,t){var n,r;"square"==e.type?r=Bk(e.bbox,e.interval,t):"hex"==e.type?r=Rk(e.bbox,e.interval,t):bt("Unsupported grid type");for(var i=[],a=0,o=r.cells();a<o;a++)i.push({type:"Feature",properties:null,geometry:r.makeCellPolygon(a,t)});return Ka(n=Kv({type:"FeatureCollection",features:i},{})),n}(Gk(e,t,n),n);return r.info=yo(t.info),Ui(r.layers[0],null,"grid",n),r},pp.pointGrid2=function(e,t,n){var r,i=Gk(e,t,n);"square"==i.type?r=qk(Jk(i)):"hex"==i.type?r=qk($k(i)):bt("Unsupported grid type"),Wk(r,i.bbox);var a=Kv(r,{});return n.name&&(a.layers[0].name=n.name),a.layers[0]},pp.pointGrid=function(e,t){var n,r,i=function(e,t){var n={},r=e?Ia(e):null;t.interval?n.interval=oh(t.interval,r):t.rows>0&&t.cols>0&&(n.rows=t.rows,n.cols=t.cols);t.bbox?n.bbox=t.bbox:n.bbox=e?wo(e).toArray():[-180,-90,180,90];return n}(e,t),a=(n=function(e){var t,n,r,i,a,o,s,u,c,f=e.bbox,l=f[2]-f[0],h=f[3]-f[1],p=[];for(e.interval>0?(i=e.interval,a=e.interval,n=Math.round(l/i)-1,r=Math.round(h/a)-1,o=f[0]+(l-n*i)/2,s=f[1]+(h-r*a)/2):e.rows>0&&e.cols>0&&(i=l/(n=e.cols),a=h/(r=e.rows),o=f[0]+i/2,s=f[1]+a/2),i>0!=0&&a>0!=0||bt("Invalid grid parameters"),c=s;c<=f[3];){for(u=o,p.push(t=[]);u<=f[2];)t.push([u,c]),u+=i;c+=a}return p}(i),r=[],n.forEach(function(e,t){for(var n=0;n<e.length;n++)r.push([e[n]])}),{geometry_type:"point",shapes:r});return Ui(a,null,"grid",t),a},pp.pointToGrid=function(e,t,n){e.forEach(Ti),n.interval>0==!1&&bt("Expected a non-negative interval parameter"),n.radius;var r=wo(t).toArray(),i=[t],a=e.map(function(e){qi(e)>0&&bt("This command requires single points");var t=function(e,t,n){for(var r,i,a=Jt(e),o=n.interval,s=Bk(t,o,n),u=Xk(n),c=Yk(a,s,u),f={type:"FeatureCollection",features:[]},l=n.calc?bp(e.data,n.calc):null,h=0,p=s.cells();h<p;h++)(r=c(h)).length&&(i=Kk(r,Qk(s.idxToPoint(h),o,a,r,u),l)).weight>.05!=!1&&(i.id=h,f.features.push({type:"Feature",properties:i,geometry:s.makeCellPolygon(h,n)}));return Kv(f,{})}(e,r,n),a=t.layers[0];return i.push(t),Ui(a,e,"grid",n),a}),o=io(i);return Ka(o),t.arcs=o.arcs,a};var eC=Object.freeze({__proto__:null,calcCellProperties:Kk,calcWeights:Qk,getPointCircleRadius:Xk});function tC(e,t,n){var r=n.gap_tolerance?oh(n.gap_tolerance,Ia(t)):0,i=t.arcs,a=pr(e.shapes,i),o=new lo(t.arcs,a),s=function(e,t){return e.findDanglingEndpoints().filter(function(n){return fr.calcPathLen([n.arc],e.arcs)>t})}(o,r);if(0===s.length)return o;var u=function(e,t){for(var n=[],r=0,i=e.size();r<i;r++)n.push(t(r)?[[r]]:null);return n}(i,a),c=new Vf(u,i),f=s.reduce(function(e,t){var n=function(e,t,n,r){var i=Yt(e.arc),a=null;return t.forEach(function(t){var o;t!=i&&(Yt(t)>=n.size()||(o=fr.getPointToPathInfo(e.point[0],e.point[1],[t],n))&&o.distance<=r&&(!a||o.distance<a.distance)&&(a=o))}),a}(t,c.findPointEnclosureCandidates(t.point,r),i,r);return n&&e.push(function(e,t,n){var r=n.getVertex(t,-1),i=[r.x,r.y],a=n.getVertex(t,-2),o=[a.x,a.y],s=e.segment[0],u=e.segment[1],c=fr.findClosestPointOnSeg(i[0],i[1],s[0],s[1],u[0],u[1]);f=c,l=s,h=u,f[0]==l[0]&&f[1]==l[1]||f[0]==h[0]&&f[1]==h[1]||(c=function(e,t){var n=fr.distance2D(e[0],e[1],t[0],t[1]),r=(n+1e-6)/n;return[e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1])]}(o,c),fr.segmentIntersection(o[0],o[1],c[0],c[1],s[0],s[1],u[0],u[1])||(c=function(e,t,n){return fr.distance2D(e[0],e[1],t[0],t[1])<fr.distance2D(e[0],e[1],n[0],n[1])?t:n}(o,s,u)));var f,l,h;return{arc:t,point:c}}(n,t.arc,i)),e},[]);return t.arcs=function(e,t){var n=e.getVertexData();return t.forEach(function(t){var r=e.indexOfVertex(t.arc,-1);n.xx[r]=t.point[0],n.yy[r]=t.point[1]}),e.updateVertexData(n.nn,n.xx,n.yy,n.zz),e}(i,f),Vp(t,{})}async function nC(e,n,r){dM(n,r=r||np());var a=i("defs")||{};r.global=a,t.extend(r,r.global);var o=await async function(e,t){var n=function(e){var t=[];return iC(e).forEach(function(e,n){n%2==1&&t.push(e.substring(1,e.length-1))}),t}(e).map(e=>rC(e,t)),r=await Promise.all(n);return function(e,t){var n=iC(e);return n.reduce(function(e,n,r){return e+=r%2==1?t.length?t.shift():"":n},"")}(e,r)}(e,r);return function(e,t){var n=/([$_a-z][$_a-z0-9]*)\(/gi;return Array.from(e.matchAll(n)).some(e=>e[1]in t)}(o,r)&&(o=await rC(o,r)),o}async function rC(e,t){var n;try{n=Function("ctx","with(ctx) {return ("+e+");}").call({},t)}catch(e){bt(e.name,"in JS source:",e.message)}return n}function iC(e){for(var t,n=0,r=[],i="",a=0,o=e.length;a<o;a++)"{"==(t=e.charAt(a))&&(0==n&&(r.push(i),i=""),n++),i+=t,"}"==t&&(--n<0?n++:0==n&&aC(i)?i=r.pop()+i:0==n&&(r.push(i),i=""));return r.push(i),r}function aC(e){try{JSON.parse(e)}catch(e){return!1}return!0}function oC(e){return Array.isArray(e)&&t.isObject(e[0])?e.map(function(e){return{name:e.name,options:Object.assign({},e.options)}}):(t.isString(e)&&(e=gv(e)),Mv().parseArgv(e))}function sC(e){var t=e.replace(/^mapshaper\b/,"").trim();return Mv(),t=t.split(/\n+/g).map(function(e){return/^[a-z][\w-]*/i.exec(e=e.trim())&&(e="-"+e),e}).join(" ")}pp.polygons=function(e,t,n){return e.forEach(zi),n.no_cuts||Vp(t,n),e.map(function(e){return"polyline"!=e.geometry_type&&bt("Expected a polyline layer"),n.from_rings?function(e,t){var n=t.arcs,r=0;Pr(e.shapes,function(e){return fr.pathIsClosed(e,n)?e:(r++,null)}),r>0&&xt("Removed",r,"open "+(1==r?"ring":"rings"));return e.geometry_type="polygon",$f(e,n),e}(e,t):function(e,t,n){var r;r=n.no_cuts?new lo(t.arcs):tC(e,t,n);r.setArcFilter(pr(e.shapes,r.arcs));var i=td(r);return{geometry_type:"polygon",name:e.name,shapes:i.mosaic}}(e,t,n)})},pp.print=function(e){Et(e||"")},pp.renameLayers=function(e,n,r){n&&n.join("").indexOf("=")>-1?function(e,n){var r=function(e){return(e||[]).reduce(function(e,n){var r=n.split("="),i=t.trimQuotes(r[0]),a=t.trimQuotes(r[1]||"");return a||bt("Invalid name assignment:",n),e[a]=i,e},{})}(e);n.forEachLayer(function(e){r[e.name]&&(e.name=r[e.name])})}(n,r):function(e,t){var n=e&&e.length||0,r="",i="";t.forEach(function(a,o){o<n&&(r=e[o]),r&&n<t.length&&o>=n-1&&(i=(i||0)+1),a.name=r+i})}(n,e)},pp.require=async function(e){var t,n,r,a=i("defs");e.module||bt("Missing module name or path to module"),Lf.isFile(e.module)?t=e.module:Lf.isFile(e.module+".js")?t=e.module+".js":n=e.module;try{if((r=await import(t?s("url").pathToFileURL(t):n)).default&&(r=r.default),"function"==typeof r){var o=r(zP);o&&function(e){try{return GM(e),!0}catch(e){}return!1}(o)&&pp.registerCommand(o.name,o)}}catch(e){r||bt("Unable to load external module:",e.message,At(e))}n||e.alias?a[e.alias||n]=r:Object.assign(a,r)};var uC=Object.freeze({__proto__:null,parseCommands:oC,parseConsoleCommands:function(e){var t=oC(sC(e));return t.forEach(function(e){["i","include","require","external"].includes(e.name)&&bt("The "+e.name+" command cannot be run in the web console.")}),t},standardizeConsoleCommands:sC});function cC(e){return"i"==e||"join"==e||"erase"==e||"clip"==e||"include"==e}function fC(e){var t=2*e.size(),n=new lo(e).size();return e.getPointCount()-t+n}pp.run=async function(e,n,r){var i,a,o;r.expression||bt("Missing expression parameter"),(o=np()).io=function(){async function e(e,r){return t.isPromise(r)&&(r=await r),n._cache[e]=r,e}var n={_cache:{},addInputFile:e,ifile:e};return n}(),(i=await nC(r.expression,n,o))&&!t.isString(i)&&bt("Expected a string containing mapshaper commands; received:",i),i&&(xt(`command: [${Ut(i,150)}]`),(a=oC(i)).forEach(function(e){cC(e.name)&&(e.options.input=o.io._cache)}),await t.promisify(yP)(a,e))},pp.shape=function(e,t){var n,r;return t.coordinates?n=function(e){var t,n,r,i,a=[],o=e.offsets||[],s=e.coordinates;s.length>=2==!1&&bt("Invalid coordinates parameter.");for(n=0;n<s.length;n+=2)r=s[n],i=s[n+1],a.push([r,i]);for(n=0;n<o.length;n+=2)r+=o[n],i+=o[n+1],a.push([r,i]);_d.pathIsRing(a)?t="Polygon":e.closed&&a.length>=3?(t="Polygon",a.push(a[0])):t="LineString";return{type:t,coordinates:"Polygon"==t?[a]:a}}(t):"circle"==t.type?n=function(e){e.radius>0==!1&&e.radius_angle>0==!1&&bt("Missing required radius parameter.");var t=e.center||[0,0],n=e.radius||gI(Sa("wgs84"),e.radius_angle);return Fx(t,n,0,{geometry_type:e.geometry||"polygon"})}(t):"rectangle"==t.type&&t.bbox?n=function(e){var t=e.bbox,n=t[0],r=t[1],i=t[2],a=t[3],o=.5,s=[],u="polyline"==e.geometry?"LineString":"Polygon";return c(n,r,n,a),c(n,a,i,a),c(i,a,i,r),c(i,r,n,r),s.push([n,r]),{type:u,coordinates:"Polygon"==u?[s]:s};function c(e,t,n,r){for(var i=n-e,a=r-t,u=Math.ceil(Math.max(Math.abs(i)/o,Math.abs(a)/o)),c=i/u,f=a/u,l=0;l<u;l++)s.push([e+l*c,t+l*f])}}(t):bt("Missing coordinates parameter"),r=Kv(n,{}),t.rotation&&bI(r,t.rotation),r.layers[0].name=t.name||t.type||"shape",r};var lC={};function hC(e,n){var r=NC(n),i={dp:"Ramer-Douglas-Peucker",visvalingam:"Visvalingam",weighted_visvalingam:"Weighted Visvalingam"}[r]||"Unknown",a=PC(e,n),o=function(e,n){var r,i=n?function(e,t,n,r,i,a){var o=[],s=[],u=[];return fr.convLngLatToSph([e,n,i],[t,r,a],o,s,u),fr.pointSegDistSq3D(o[0],s[0],u[0],o[1],s[1],u[1],o[2],s[2],u[2])}:fr.pointSegDistSq,a=n?fr.signedAngleSph:fr.signedAngle,o=0,s=0,u=0,c=0,f=0,l=-1,h=-1,p=[],d=[],g=e.getVertexData().zz;return e.forEachSegment(function(e,t,n,r){var m,y,v,b,_,x,w,S,A;if(m=n[e],y=r[e],v=n[t],b=r[t],e==h&&((S=a(n[l],r[l],m,y,v,b))>Math.PI&&(S=2*Math.PI-S),isNaN(S)||d.push(180*S/Math.PI)),l=e,h=t,g[e]<1/0&&s++,!((w=t-e-1)<1))if(o+=w,m==v&&y==b)u++;else{for(_=0;++e<t;)A=i(n[e],r[e],m,y,v,b),_=Math.max(_,A);x=Math.sqrt(_),f+=x,p.push(x),c=Math.max(c,x)}}),r={angleMean:0,displacementMean:0,displacementMax:c,collapsedRings:u,removed:o,retained:s,uniqueCount:fC(e),removableCount:o+s},d.length>0&&(r.angleMean=t.sum(d)/d.length,r.angleQuartiles=[t.findValueByPct(d,.75),t.findValueByPct(d,.5),t.findValueByPct(d,.25)]),p.length>0&&(r.displacementMean=f/p.length,r.displacementQuartiles=[t.findValueByPct(p,.75),t.findValueByPct(p,.5),t.findValueByPct(p,.25)]),r}(e,a),s=(o.removed+o.collapsedRings)/o.uniqueCount||0,u=o.removed/o.removableCount||0,c=o.angleQuartiles,f=o.displacementQuartiles,l=["Simplification statistics"];l.push(t.format("Method: %s (%s) %s",i,a?"spherical":"planar","weighted_visvalingam"==r?"(weighting="+lC.getWeightCoefficient(n)+")":"")),l.push(t.format("Removed vertices: %,d",o.removed+o.collapsedRings)),l.push(t.format(" %.1f% of %,d unique coordinate locations",100*s,o.uniqueCount)),l.push(t.format(" %.1f% of %,d filterable coordinate locations",100*u,o.removableCount)),l.push(t.format("Simplification threshold: %.4f %s",e.getRetainedInterval(),a?"meters":"")),l.push(t.format("Collapsed rings: %,d",o.collapsedRings)),l.push("Displacement statistics"),l.push(t.format(" Mean displacement: %.4f",o.displacementMean)),l.push(t.format(" Max displacement: %.4f",o.displacementMax)),f&&l.push(t.format(" Quartiles: %.2f, %.2f, %.2f",f[0],f[1],f[2])),l.push("Vertex angle statistics"),l.push(t.format(" Mean angle: %.2f degrees",o.angleMean)),c&&l.push(t.format(" Quartiles: %.2f, %.2f, %.2f",c[0],c[1],c[2])),xt(l.join("\n "))}function pC(e){var n,r=Il(e),i=dC(e,r),a=r.length,o=i.length,s=a>o?a-o:0;a>0&&(n=t.format("Repaired %'i intersection%s",s,t.pluralSuffix(s)),o>0&&(n+=t.format("; %'i intersection%s could not be repaired",o,t.pluralSuffix(o))),xt(n))}function dC(e,t){for(;gC(e,t)>0;)t=Il(e);return t}function gC(e,n){var r,i,a,o,s=e.getVertexData(),u=e.getRetainedInterval(),c=0,f=0;for(i=mC(n,u,s.zz),t.sortOn(i,"z",!0);i.length>0;)for(1==(r=bC(a=i.pop(),u,s.xx,s.yy,s.zz)).length&&(r=vC(r[0],u,s.zz),c++),o=0;o<r.length;o++)yC(i,r[o]);return++f>5e5?(Mt("Caught an infinite loop at intersection:",a),0):c}function mC(e,t,n){return e.reduce(function(e,r){var i=function(e,t,n){var r,i=vr(n,t,e.a[0],e.a[1]),a=vr(n,t,e.b[0],e.b[1]);r=-1==i&&-1==a?null:-1==a||-1!=i&&n[i]>n[a]?{a:e.a,b:e.b,z:n[i]}:{a:e.b,b:e.a,z:n[a]};return r}(r,t,n);return null!==i&&e.push(i),e},[])}function yC(e,t){for(var n=e.length;n>0&&!(e[n-1].z<=t.z);)e[n]=e[n-1],n--;e[n]=t}function vC(e,t,n){for(var r=[],i=e.a[0],a=e.a[1],o=e.z,s=i+1;s<=a;s++)n[s]!=o&&s!=a||(r.push({a:[i,s],b:e.b,z:o}),s!=a&&(n[s]=t),i=s);return r.length<2&&vt("Error in unwindIntersection()"),r}function bC(e,t,n,r,i){var a=function(e,t,n,r,i){var a=_C(e.a,t,n,r,i);return a=a.concat(_C(e.b,t,n,r,i)),a}(e,t,n,r,i);return mC(Tl(a,n,r),t,i)}function _C(e,t,n,r,i){var a,o,s,u=[];e[0]<=e[1]?(a=e[0],o=e[1]):(a=e[1],o=e[0]),s=a;for(var c=a+1;c<=o;c++)i[c]>=t&&(n[s]<n[c]?u.push(s,c):u.push(c,s),s=c);return u}lC.getArcCalculator=function(e,n){var r=new kM,i=t.expandoBuffer(Int32Array),a=t.expandoBuffer(Int32Array),o=n?function(t,n,r,i,a,o){return e(i[t],a[t],o[t],i[n],a[n],o[n],i[r],a[r],o[r])}:function(t,n,r,i,a){return e(i[t],a[t],i[n],a[n],i[r],a[r])};return function(e,t,s,u){var c,f,l,h,p=e.length,d=i(p),g=a(p),m=-1/0;for(u&&!n?vt("[visvalingam] Received z-axis data for 2D simplification"):!u&&n?vt("[visvalingam] Missing z-axis data for 3D simplification"):e.length>t.length&&vt("[visvalingam] Incompatible data arrays:",e.length,t.length),l=0;l<p;l++)h=l+1,c=(f=l-1)<0||h>=p?1/0:o(f,l,h,t,s,u),e[l]=c,g[l]=h,d[l]=f;for(r.init(e);r.size()>0&&(c=e[l=r.pop()])!==1/0;)c<m?e[l]=m:m=c,f=d[l],h=g[l],f>0&&(c=o(d[f],f,h,t,s,u),r.updateValue(f,c)),h<p-1&&(c=o(f,h,g[h],t,s,u),r.updateValue(h,c)),g[f]=h,d[h]=f}},lC.standardMetric=fr.triangleArea,lC.standardMetric3D=fr.triangleArea3D,lC.getWeightedMetric=function(e){var t=lC.getWeightFunction(e);return function(e,n,r,i,a,o){var s=fr.triangleArea(e,n,r,i,a,o),u=fr.cosine(e,n,r,i,a,o);return t(u)*s}},lC.getWeightedMetric3D=function(e){var t=lC.getWeightFunction(e);return function(e,n,r,i,a,o,s,u,c){var f=fr.triangleArea3D(e,n,r,i,a,o,s,u,c),l=fr.cosine3D(e,n,r,i,a,o,s,u,c);return t(l)*f}},lC.getWeightCoefficient=function(e){return e&&t.isNumber(e&&e.weighting)?e.weighting:.7},lC.getWeightFunction=function(e){var t=lC.getWeightCoefficient(e);return function(e){return-e*t+1}},lC.weight=function(e){return.7*-e+1},lC.getEffectiveAreaSimplifier=function(e){var t=e?lC.standardMetric3D:lC.standardMetric;return lC.getPathSimplifier(t,e)},lC.getWeightedSimplifier=function(e,t){var n=t?lC.getWeightedMetric3D(e):lC.getWeightedMetric(e);return lC.getPathSimplifier(n,t)},lC.getPathSimplifier=function(e,t){return lC.scaledSimplify(lC.getArcCalculator(e,t))},lC.scaledSimplify=function(e){return function(t,n,r,i){e(t,n,r,i);for(var a=1,o=t.length-1;a<o;a++)t[a]=.65*Math.sqrt(t[a])}};var xC=Object.freeze({__proto__:null,postSimplifyRepair:pC,repairIntersections:dC}),wC={};function SC(e,t){t.forEach(function(t){"polygon"==t.geometry_type&&function(e,t){t.forEach(function(t){AC(e,t)})}(e,t.shapes)})}function AC(e,t){for(var n,r,i=0,a=t?t.length:0,o=0;o<a;o++)(r=e.getSimpleShapeBounds(t[o]).area())>i&&(n=t[o],i=r);n&&0!==n.length?function(e,t){var n,r=e.getRetainedInterval(),i=1e-10;e.setRetainedInterval(1/0),n=fr.getPlanarPathArea(t,e);for(;n<=i;){if(0===EC(e,t)){Mt("[protectMultiRing()] Failed on ring:",t);break}n=fr.getPlanarPathArea(t,e)}e.setRetainedInterval(r)}(e,n):Mt("[protectShape()] Invalid shape:",t)}function EC(e,t){for(var n,r,i,a,o,s,u=0,c=e.getVertexData(),f=0;f<t.length;f++)(r=t[f])<0&&(r=~r),s=(o=c.ii[r])+c.nn[r]-1,-1!=(i=vr(c.zz,1/0,o,s))&&(a=c.zz[i])>u&&(u=a,n=r);return u>0?(s=(o=c.ii[n])+c.nn[n]-1,MC(c.zz,u,1/0,o,s)):0}function MC(e,t,n,r,i){for(var a=0,o=r;o<=i;o++)e[o]===t&&(e[o]=n,a++);return a}wC.metricSq3D=fr.pointSegDistSq3D,wC.metricSq=fr.pointSegDistSq,wC.calcArcData=function(e,t,n,r){var i=e.length,a=!!r;e[0]=e[i-1]=1/0,i>2&&function i(o,s,u,c){var f,l,h=t[o],p=n[o],d=t[s],g=n[s];a&&(f=r[o],l=r[s]);for(var m,y=0,v=0,b=0,_=0,x=o+1;x<s;x++)(m=a?wC.metricSq3D(t[x],n[x],r[x],h,p,f,d,g,l):wC.metricSq(t[x],n[x],h,p,d,g))>=y&&(y=m,v=x);c<y&&(y=c);v-o>1&&(b=i(o,v,u+1,y));s-v>1&&(_=i(v,s,u+1,y));1==u&&h==d&&p==g&&(y=Math.max(b,_));return e[v]=Math.sqrt(y),y}(0,i-1,1,Number.MAX_VALUE)};var IC=Object.freeze({__proto__:null,keepEveryPolygon:SC,protectShape:AC,replaceInArray:MC});function kC(e,n){var r=e.arcs;n.keep_shapes&&SC(r,e.layers),!n.no_repair&&r.getRetainedInterval()>0&&pC(r),n.stats&&hC(r,n),e.info=t.defaults({simplify:n},e.info)}function CC(e,n){return n=n||{},t.defaults({method:NC(n),spherical:PC(e.arcs,n)},n)}function PC(e,t){return!t.planar&&!e.isPlanar()}function OC(e,n){var r=function(e){var t;"dp"==e.method?t=wC.calcArcData:"visvalingam"==e.method?t=lC.getEffectiveAreaSimplifier(e.spherical):"weighted_visvalingam"==e.method?t=lC.getWeightedSimplifier(e,e.spherical):bt("Unsupported simplify method:",e.method);return t}(n);e.setThresholds(new Float64Array(e.getPointCount())),n.spherical?(!function(e,n){var r=t.expandoBuffer(Float64Array),i=t.expandoBuffer(Float64Array),a=t.expandoBuffer(Float64Array);e.forEach3(function(e,t,o,s){var u=e.length,c=r(u),f=i(u),l=a(u);fr.convLngLatToSph(e,t,c,f,l),n(o,c,f,l)})}(e,r),LC(e)):function(e,t){e.forEach3(function(e,n,r,i){t(r,e,n)})}(e,r),n.lock_box&&function(e){var t=e.getBounds();t.padBounds(-1e-14,-1e-14,-1e-14,-1e-14),TC(e,t.toArray(),!0)}(e)}function NC(e){var t=e.method;return(!t||"weighted"==t||"visvalingam"==t&&e.weighting)&&(t="weighted_visvalingam"),t}function TC(e,t,n){var r=e.getBounds().toArray();!0!==fr.containsBounds(t,r)&&e.forEach3(function(e,r,i){for(var a,o,s=n?1/0:0,u=0,c=i.length;u<c;u++)a=e[u],o=r[u],(a>=t[2]||a<=t[0]||o<=t[1]||o>=t[3])&&(0===s&&(s=zC(i)),i[u]!==1/0&&(i[u]=s))})}function LC(e){TC(e,ra(1e-12),!1)}function zC(e){for(var t,n=0,r=0,i=e.length;r<i;r++)(t=e[r])>n&&t<1/0&&(n=t);return n}function RC(e){var n,r,i;return t.isNumber(e)?(r=e,i=e):t.isString(e)&&(n=e.split(/[x ,]/),r=Number(n[0])||0,i=2==n.length?Number(n[1])||0:r),r>=0&&i>=0&&r+i>0||bt("Invalid simplify resolution:",e),[r,i]}function DC(e,t,n,r){return 0!==e&&n/r>e/t||0===t?n/e:r/t}function jC(e,t,n){return DC(e,t,fr.degreesToMeters(n.width())*Math.cos(n.centerY()*fr.D2R),fr.degreesToMeters(n.height()))}function FC(e,t,n){var r=Ia(t);return PC(t.arcs,n)?ah(e,r):oh(e,r)}function UC(e,t,n){var r,i=RC(e),a=t.getBounds();return r=PC(t,n)?jC(i[0],i[1],a):DC(i[0],i[1],a.width(),a.height()),r*=.5}pp.simplify=function(e,n){var r=e.arcs;if(r&&0!==r.size()){if(OC(r,n=CC(e,n)),n.percentage||0===n.percentage)r.setRetainedPct(t.parsePercent(n.percentage));else if(n.interval||0===n.interval)r.setRetainedInterval(FC(n.interval,e,n));else if(n.resolution)r.setRetainedInterval(UC(n.resolution,r,n));else{if(n.presimplify)return;bt("Missing a simplification amount")}kC(e,n)}};var BC=Object.freeze({__proto__:null,calcPlanarInterval:DC,calcSphericalInterval:jC,convertSimplifyInterval:FC,convertSimplifyResolution:UC,finalizeSimplification:kC,getSimplifyMethod:NC,getStandardSimplifyOpts:CC,parseSimplifyResolution:RC,protectWorldEdges:LC,simplifyPaths:OC,useSphericalSimplify:PC});function GC(e,t){var n;return t?e.data&&e.data.fieldExists(t)?function(n){var r=e.data.getRecords()[n];return r?qC(r[t]):""}:(e={name:e.name,data:e.data},n=ap(t,e,null),function(e){return qC(n(e))}):function(t){return(e&&e.name||"split")+"-"+(t+1)}}function qC(e){return String(e)}pp.sortFeatures=function(e,n,r){var i=ki(e),a=!r.descending,o=ap(r.expression,e,n),s=[];t.repeat(i,function(e){s.push(o(e))});var u=t.getSortedIds(s,a);e.shapes&&t.reorderArray(e.shapes,u),e.data&&t.reorderArray(e.data.getRecords(),u)},pp.snap=function(e,n){var r,i=0,a=0,o=e.dataset,s=o.arcs,u=s&&s.getBounds();u&&u.hasBounds()||bt("Dataset is missing path data"),s.flatten(),n.fix_geometry&&(r=s&&Dl(s)),n.precision?Hl(o,n.precision):i=n.interval?oh(n.interval,Ia(o)):Bn(u.toArray()),i>0&&n.endpoints?(a=Vn(s,i),xt(t.format("Snapped %s endpoint%s",a,t.pluralSuffix(a)))):i>0&&(a=qn(s,i),xt(t.format("Snapped %s point%s",a,t.pluralSuffix(a)))),(a>0||n.precision)&&(r&&r(s),s.dedupCoords(),Ka(o))},pp.splitLayer=function(e,n,r){var i,a,o,s=r||{},u=s.no_replace?Bi(e):e,c=u.data?u.data.getRecords():null,f=u.shapes,l={},h=[],p=ki(u);return s.ids?(a=s.ids,o=new Set(a),i=function(e){return o.has(e)?"1":"2"}):i=GC(u,n),0===p?[u]:(t.repeat(p,function(e){var t,n=i(e);n in l==!1?(l[n]=h.length,t={geometry_type:u.geometry_type,name:n,data:c?new di:null,shapes:f?[]:null},h.push(t)):t=h[l[n]],f&&t.shapes.push(f[e]),c&&t.data.getRecords().push(c[e])}),h)};var VC=Object.freeze({__proto__:null,getSplitNameFunction:GC});pp.stop=function(e){!function(e){e.stopped=!0}(e)},pp.svgStyle=function(e,t,n){var r;0!==ki(e)&&(e.data||Wi(e),n.where&&(r=ap(n.where,e,t.arcs)),n.clear&&e.data.getFields().filter(cg).forEach(e.data.deleteField,e.data),Object.keys(n).forEach(function(t){var i=t.replace("_","-");if(cg(i)){var a=pg(n[t].trim(),i,e);bi(e).getRecords().forEach(function(e,t){r&&!r(t)?i in e==!1&&(e[i]=void 0):e[i]=a(t)})}}))};var $C=Vl(.01);function JC(e){return e.fill||"magenta"}function WC(e,t){return"polyline"==e.type?e.stroke=function(e){return e.stroke||e.fill||"magenta"}(t):e.fill=JC(t),t.opacity&&(e.opacity=t.opacity),e}function ZC(e){return 0===e.radius||0===e.length||0===e.r?0:e.radius||e.length||e.r||5}function YC(e,n){var r=e&&t.isNumber(e[0]),i=!r&&e&&Array.isArray(e[0]);if(r)return n(e);for(var a=0;a<e.length;a++)i&&YC(e[a],n)}function HC(e){YC(e,function(e){e[1]=-e[1]})}function XC(e,t,n){YC(e,function(e){e[0]=e[0]*t+n[0],e[1]=e[1]*t+n[1]})}function KC(e,t){if(t){var n=m_(t,1,[0,0],[0,0]);YC(e,function(e){var t=n(e[0],e[1]);e[0]=t[0],e[1]=t[1]})}}function QC(e,t){var n="stick"==t,r=e.direction||0,i=e["stem-taper"]||0,a=e["stem-curve"]||0,o=function(e,t){var n=function(e){var t=(r=e["head-angle"]||40,1/Math.tan(Math.PI*r/180/2)/2),n={stemWidth:e["stem-width"]||2,stemLen:e["stem-length"]||0,headWidth:e["head-width"],headLen:e["head-length"]};var r;0===n.headWidth?n.headLen=0:n.headWidth>0==!1&&(n.headLen>0?n.headWidth=n.headLen/t:0===n.headLen?n.headWidth=0:n.headWidth=3*n.stemWidth);n.headLen>=0==!1&&(n.headLen=n.headWidth*t);return n}(e),r=Math.max(e.radius||e.length||e.r||0),i=Math.max(r,n.headLen,0),a=1;i>=0&&(a=function(e,t,n){var r=n["min-stem-ratio"]>=0?n["min-stem-ratio"]:0,i=n["stem-length"]||0,a=1-r,o=t/e,s=1;o>a?s=a/o:i+t>e&&(s=e/(i+t));return s||0}(i,n.headLen,e),n.stemWidth*=a,n.headWidth*=a,n.headLen*=a,n.stemLen=t?r:i-n.headLen);n.headWidth<n.stemWidth&&n.headWidth>0&&bt("Arrow head must be at least as wide as the stem.");return n}(e,n);if(!o)return null;var s,u,c,f=o.stemLen,l=o.headLen,h=n?Math.max(f,l):f+l,p=o.headWidth/2,d=o.stemWidth/2,g=d*(1-i);if(a){r>0&&(a=-a);var m=Math.abs(a)/180*Math.PI,y=a>0?1:-1,v=g*Math.cos(m),b=g*Math.sin(m)*-y;if(u=f*Math.sin(m/2)*y,c=f*Math.cos(m/2),n)s=eP(-v,-b,u,c);else{var _=eP(-v,-b,-d+u,c),x=eP(v,b,d+u,c);s=_.concat(x.reverse())}}else u=0,c=f,s=n?[[0,0],[0,f]]:[[-g,0],[g,0]];return n?(s=[s],l>0&&s.push([[-p+u,f-l],[u,f],[p+u,f-l]])):(s.push([d+u,c]),l>0&&s.push([p+u,c],[u,l+c],[-p+u,c]),s.push([-d+u,c],s[0].concat()),s=[s]),"end"==e.anchor?XC(s,1,[-u,-h]):"middle"==e.anchor&&XC(s,1,[.5*-u,.5*-c-.25*h]),KC(s,r),e.flipped&&HC(s),s}function eP(e,t,n,r){if(t>r)return[[e*r/t,r]];for(var i=n-e,a=r-t,o=a-(a*a-i*i)/(2*a),s=Math.sqrt(i*i+a*a)/2,u=Math.PI-2*Math.asin(s/o),c=180*u/Math.PI,f=o/Math.tan(u/2),l=n>e?1:-1,h=Math.round(c/5)+2,p=u/(h+1),d=[[n,r]],g=1;g<=h;g++){var m=g*p/2,y=Math.sin(m),v=y*f*2,b=y*v,_=Math.cos(m)*v;d.push([n-b*l,r-_])}return d.push([e,t]),d}function tP(e){var t,n,r=ZC(e),i=+e.sides||function(e){return{circle:72,triangle:3,square:4,pentagon:5,hexagon:6,heptagon:7,octagon:8,nonagon:9,decagon:10}[e]||4}(e.type),a=i%2==1,o=[];if(r>0==!1)return null;i>=3==!1&&bt(`Invalid number of sides (${i})`),("b"==e.orientation||e.flipped||e.rotated)&&(a=!a),n=a?0:.5;for(var s=0;s<i;s++)t=(s+n)/i*360,o.push(K_(0,0,t,r));return o.push(o[0].concat()),[o]}function nP(e){var t,n,r=ZC(e),i=e.points||e.sides&&e.sides/2||5,a=2*i,o=function(e){var t=360/e,n=function(e){var t=1,n=Math.ceil(e/2)-2,r=Math.floor((n+t)/2);return function(e,t){var n=360/e,r=n*(t+1);return 180-r}(e,r)}(e),r=Math.PI/180*t/2,i=Math.PI/180*n/2,a=Math.tan(i)/(Math.tan(i)+Math.tan(r))/Math.cos(r);return a}(i)*r,s="b"==e.orientation||e.flipped||e.rotated?0:1,u=[];if(r>0==!1)return null;i<5&&bt(`Invalid number of points for a star (${i})`);for(var c=0;c<a;c++)n=c%2==0?o:r,t=(c+s)/a*360,u.push(K_(0,0,t,n));return u.push(u[0].concat()),[u]}function rP(e){var n=Array.isArray(e)?e:mv(e);return t.genericSort(n,!0),t.uniq(n)}function iP(e,t,n){var r;return"MultiPolygon"==n||"Polygon"==n?r={type:"polygon",coordinates:"Polygon"==n?e:Cg(e)}:"LineString"==n||"MultiLineString"==n?r={type:"polyline","stroke-width":t["stroke-width"]||2,coordinates:"LineString"==n?[e]:e}:vt("Unsupported type:",n),WC(r,t),function(e){YC(e,function(e){e[0]=$C(e[0]),e[1]=$C(e[1])})}(r.coordinates),r}pp.symbols=function(e,n,r){Li(e);var i,a=r.no_replace?Bi(e):e,o=!!r.geographic;o&&(Aa(n),i=r.pixel_scale||function(e){var t=Ji(e);return(t.width()||t.height()||1e3)/800}(a));var s,u,c=bi(a).getRecords(),f=lg(a,r),l=a.shapes.map(function(e,n){if(!e)return null;var a=f(n),s=c[n]||{};if(o||"circle"!=a.type)if(o||"ring"!=a.type){var u,l="Polygon";if("arrow"==a.type&&"stick"==r.arrow_style?(u=function(e){return QC(e,"stick")}(a),l="MultiLineString"):"arrow"==a.type?u=function(e){return QC(e,"standard")}(a):"ring"==a.type?(u=function(e){for(var n,r,i=rP(e.radii||"2"),a=[],o=t.isOdd(i.length),s=0;s<i.length;s++)n=tP({type:"circle",radius:i[s]}),(!o||s>0)&&(r=n,(n=tP({type:"circle",radius:i[++s]})).push(r[0])),a.push(n);return a}(a),l="MultiPolygon"):u="star"==a.type?nP(a):tP(a),!u)return null;if(KC(u,+a.rotation||0),o||HC(u),+r.scale&&XC(u,+r.scale,[0,0]),o)return XC(u,i,e[0]),a.fill&&(s.fill=a.fill),a.stroke&&(s.stroke=a.stroke),a.opacity&&(s.opacity=a.opacity),function(e,t){return{type:t,coordinates:e}}(u,l);s["svg-symbol"]=iP(u,a,l)}else s["svg-symbol"]=function(e,n){var r=+n.scale||1,i=rP(e.radii||"2").map(function(e){return e*r}),a=t.isOdd(i.length),o=JC(e),s=n.opacity||void 0,u=[];a&&u.push({type:"circle",fill:o,opacity:s,r:i.shift()});for(var c=0;c<i.length;c+=2)u.push({type:"circle",fill:"none",stroke:o,opacity:s,"stroke-width":ql(i[c+1]-i[c]),r:ql(.5*i[c+1]+.5*i[c])});return{type:"group",parts:u}}(a,r);else s["svg-symbol"]=function(e,t){var n=ZC(e);return+t.scale&&(n*=+t.scale),WC({type:"circle",r:n},e)}(a,r)});return o?(u=function(e,t){var n=e.map(function(e,n){return t[n],{type:"Feature",properties:t[n]||null,geometry:e}});return Kv({type:"FeatureCollection",features:n})}(l,c),(s=Po(e,n,u,r)).data=a.data):s=a,[s]};var aP=Object.freeze({__proto__:null});function oP(e,t,n){for(var r,i=0;i<e.length;i++)if((r=e[i])>=t&&r<t+n)return r-t;return-1}function sP(e,t,n){for(var r=0;r<t.length;r++)e.push(n?n[t[r]]:null)}function uP(e,t,n){return ap(e,t,n)}function cP(e,n,r){var i,a,o,s,u,c=mp(e,n,r),f=[];return Ch(c,"Expression must evaluate to true or false"),c?(a=Ji(e,n),i=function(e,n,r){var i,a,o=e.data?e.data.getRecords():null,s=e.shapes;i={geometry_type:e.geometry_type,shapes:[],data:o?[]:null},a={geometry_type:e.geometry_type,shapes:[],data:o?[]:null};var u=r&&r.width()>r.height(),c=s.map(function(e){var t=n.getMultiShapeBounds(e);return u?t.centerX():t.centerY()}),f=t.range(c.length);f.sort(function(e,t){return c[e]-c[t]}),f.forEach(function(e,t){var n=t<s.length/2?i:a;n.shapes.push(s[e]),o&&n.data.push(o[e])}),o&&(i.data=new di(i.data),a.data=new di(a.data));return[i,a]}(e,n,a),(o=i[0]).shapes.length>1&&o.shapes.length<e.shapes.length?t.merge(f,cP(o,n,r)):f.push(o),(s=i[1]).shapes.length>1&&s.shapes.length<e.shapes.length?t.merge(f,cP(s,n,r)):f.push(s)):f.push(e),u=GC(e),f.forEach(function(n,r){n.name=u(r),t.defaults(n,e)}),f}async function fP(e,n){var r,i,a,o,s,u,c,f,l,h,p=e.name,d=e.options;if(function(e,t){return!!function(e){return!0===e.stopped}(t)||!function(e){return["if","elif","else","endif"].includes(e)}(e)&&!ik(t)}(p,n))return g(null);if("comment"==p)return pp.comment(d),g(null);n||(n=new u_),n.startCommand(e);try{ed.start(),"rename-layers"==p?c=(s=n.catalog.findCommandTargets(d.target||"*")).reduce(function(e,t){return e.concat(t.layers)},[]):"o"==p?s=n.catalog.findCommandTargets(d.target||d.combine_layers&&"*"):!function(e){return"rotate"==e||"info"==e||"proj"==e||"require"==e||"drop"==e||"target"==e||"if"==e||"elif"==e||"else"==e||"endif"==e||"run"==e||"i"==e||"snap"==e||"frame"==e||"comment"==e}(p)?((s=n.catalog.findCommandTargets(d.target)).length>1&&("merge-layers"==p||"union"==p)&&(s=ro(s,n.catalog)),1==s.length?(f=(u=s[0].dataset).arcs,c=s[0].layers,n.catalog.setDefaultTarget(c,u)):s.length>1&&bt("This command does not support targetting layers from different datasets")):s=n.catalog.findCommandTargets(d.target),0===s.length&&(d.target&&bt(t.format("Missing target: %s\nAvailable layers: %s",d.target,o_(n.catalog))),function(e){return"graticule"==e||"i"==e||"help"==e||"point-grid"==e||"shape"==e||"rectangle"==e||"frame"==e||"require"==e||"run"==e||"define"==e||"include"==e||"print"==e||"comment"==e||"if"==e||"elif"==e||"else"==e||"endif"==e||"stop"==e||"add-shape"==e||"scalebar"==e}(p)||bt("No data is available")),d.source&&(r=r_(t_(d.source,s),n.catalog,d)),"add-shape"==p?(u||(c=(u={info:{},layers:[]}).layers,n.catalog.addDataset(u)),a=pp.addShape(c,u,d)):"affine"==p?pp.affine(c,u,d):"alpha-shapes"==p?a=f_(pp.alphaShapes,c,u,d):"buffer"==p?a=f_(pp.buffer,c,u,d):"data-fill"==p?f_(pp.dataFill,c,f,d):"cluster"==p?f_(pp.cluster,c,f,d):"calc"==p?i=pp.calc(c,f,d):"check-geometry"==p?f_(pp.checkGeometry,c,u,d):"classify"==p?f_(pp.classify,c,u,d):"clean"==p?pp.cleanLayers(c,u,d):"clip"==p?a=pp.clipLayers(c,r,u,d):"colorizer"==p?a=pp.colorizer(d):"dashlines"==p?f_(pp.dashlines,c,u,d):"define"==p?pp.define(n.catalog,d):"dissolve"==p?a=f_(pp.dissolve,c,f,d):"dissolve2"==p?a=pp.dissolve2(c,u,d):"divide"==p?pp.divide(c,u,r,d):"dots"==p?a=f_(pp.dots,c,f,d):"drop"==p?pp.drop2(n.catalog,s,d):"each"==p?f_(pp.evaluateEachFeature,c,u,d.expression,d):"erase"==p?a=pp.eraseLayers(c,r,u,d):"explode"==p?a=f_(pp.explodeFeatures,c,f,d):"filter"==p?a=f_(pp.filterFeatures,c,f,d):"filter-fields"==p?f_(pp.filterFields,c,d.fields,d):"filter-geom"==p?f_(pp.filterGeom,c,f,d):"filter-islands"==p?f_(pp.filterIslands,c,u,d):"filter-islands2"==p?f_(pp.filterIslands2,c,u,d):"filter-points"==p?f_(pp.filterPoints,c,u,d):"filter-slivers"==p?f_(pp.filterSlivers,c,u,d):"frame"==p?pp.frame(n.catalog,s,d):"fuzzy-join"==p?f_(pp.fuzzyJoin,c,f,r,d):"graticule"==p?n.catalog.addDataset(pp.graticule(u,d)):"grid"==p?i=pp.polygonGrid(c,u,d):"grid2"==p?i=pp.polygonGrid2(c,u,d):"help"==p?pp.printHelp(e.options):"i"==p?(d.replace&&(n.catalog=new a_),(u=await pp.importFiles(n.catalog,e.options))&&(a=u.layers)):"if"==p||"elif"==p?pp[p](n,d):"else"==p||"endif"==p?pp[p](n):"ignore"==p?f_(pp.ignore,c,u,d):"include"==p?pp.include(d):"info"==p?i=pp.info(s,d):"inlay"==p?a=pp.inlay(c,r,u,d):"inspect"==p?f_(pp.inspect,c,f,d):"innerlines"==p?a=f_(pp.innerlines,c,f,d):"join"==p?f_(pp.join,c,u,r,d):"lines"==p?a=f_(pp.lines,c,u,d):"merge-layers"==p?a=pp.mergeAndFlattenLayers(c,u,d):"mosaic"==p?a=pp.mosaic(c,u,d):"o"==p?(o=await Ay(n.catalog,s,d),d.final&&(n.catalog=new a_),await zf(o,d)):"point-grid"==p?(a=[pp.pointGrid(u,d)],u||n.catalog.addDataset({layers:a})):"point-to-grid"==p?a=pp.pointToGrid(c,u,d):"points"==p?a=f_(pp.createPointLayer,c,u,d):"polygons"==p?a=pp.polygons(c,u,d):"print"==p?pp.print(e._.join(" ")):"proj"==p?(await la(d),n.resumeCommand(),s.forEach(function(e){pp.proj(e.dataset,n.catalog,d)})):"rectangle"==p?r||d.bbox||0===s.length?n.catalog.addDataset(pp.rectangle(r||s?.[0],d)):a=pp.rectangle2(s[0],d):"rectangles"==p?a=f_(pp.rectangles,c,u,d):"rename-fields"==p?f_(pp.renameFields,c,d.fields):"rename-layers"==p?pp.renameLayers(c,d.names,n.catalog):"require"==p?await pp.require(d):"rotate"==p?s.forEach(function(e){pp.rotate(e.dataset,d)}):"run"==p?await pp.run(n,s,d):"scalebar"==p?pp.scalebar(n.catalog,d):"shape"==p?n.catalog.addDataset(pp.shape(u,d)):"shapes"==p?a=f_(pp.shapes,c,u,d):"simplify"==p?d.variable?pp.variableSimplify(c,u,d):pp.simplify(u,d):"slice"==p?a=pp.sliceLayers(c,r,u,d):"snap"==p?function(e,n){var r=t.toArray(arguments).slice(2);n.forEach(function(t){e.apply(null,[t].concat(r))&&vt("Unexpected output from command")})}(pp.snap,s,d):"sort"==p?f_(pp.sortFeatures,c,f,d):"split"==p?a=f_(pp.splitLayer,c,d.expression,d):"stop"==p?pp.stop(n):"split-on-grid"==p?a=f_(pp.splitLayerOnGrid,c,f,d):"stitch"==p?pp.stitch(u):"style"==p?f_(pp.svgStyle,c,u,d):"symbols"==p?a=f_(pp.symbols,c,u,d):"subdivide"==p?a=f_(pp.subdivideLayer,c,f,d.expression):"target"==p?pp.target(n.catalog,d):"union"==p?a=pp.union(c,u,d):"uniq"==p?f_(pp.uniq,c,f,d):pp.runExternalCommand(e,n.catalog),"name"in d&&a&&a.forEach(function(e){e.name=d.name}),i?(n.catalog.addDataset(i),a=i.layers,c&&!d.no_replace&&c.forEach(function(e){n.catalog.deleteLayer(e,u)})):a&&u&&a!=u.layers&&(d.no_replace?(l=a,h=c||[],t.some(h,function(e){return l.indexOf(e)>-1})&&vt("Command returned invalid output"),u.layers=u.layers.concat(a)):(ko(u,c,a),("clip"==p||"erase"==p||"rectangle"==p||"rectangles"==p||"filter"==p&&d.cleanup)&&!d.no_cleanup&&ho(u)),d.apart?n.catalog.setDefaultTargets(vo(u,a).map(function(e){return{dataset:e,layers:e.layers.concat()}})):n.catalog.setDefaultTarget(a,u)),u&&Mo(u)}catch(e){return g(e)}return g(null);function g(e){if(n.endCommand(),Mt("-",ed.stop()),e)throw e;return n}}pp.target=function(e,t){var n=(t.type||"").toLowerCase().replace("linestring","polyline"),r=t.target||"*",i=e.findCommandTargets(r,n);n&&-1=="polygon,polyline,point".split(",").indexOf(n)&&bt("Invalid layer type:",t.type),0===i.length&&bt("No layers were matched (pattern: "+r+(n?" type: "+n:"")+")"),(t.name||""===t.name)&&(i[0].layers[0].name=t.name),t.combine?i=function(e,t){var n=[],r=[];e.forEach(function(e){n.push(e.dataset),t.removeDataset(e.dataset),r=r.concat(e.layers)});var i=io(n);return t.addDataset(i),[{dataset:i,layers:r}]}(i,e):t.isolate&&(i=function(e,t){var n=[];e.forEach(function(e){n.push(e.dataset),e.layers.forEach(function(n){t.removeLayer(n,e.dataset)})})}(i,e)),e.setDefaultTargets(i)},pp.union=function(e,n,r){e.length<2&&bt("Command requires at least two target layers"),e.forEach(Ri);var i=Vp(n,r),a=[],o=[],s=[];e.forEach(function(e,t){var n=e.data?e.data.getFields():[];r.fields&&(n=r.fields.indexOf("*")>1?n:n.filter(function(e){return r.fields.indexOf(e)>-1})),s.push({layer:e,fields:n,records:e.data?e.data.getRecords():null,offset:o.length,size:e.shapes.length}),a=a.concat(n),o=o.concat(e.shapes)});var u=t.uniqifyNames(a,function(e,t){return e+"_"+t}),c=new fd({shapes:o},i,{flat:!1}),f=c.mosaic,l=f.map(function(e,t){for(var n,r,i,a=c.getSourceIdsByTileId(t),o=[],f=0,l=s.length;f<l;f++)i=-1==(r=oP(a,(n=s[f]).offset,n.size))||null===n.records?null:n.records[r],sP(o,n.fields,i);return function(e,t){for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}(u,o)});return[{name:"union",geometry_type:"polygon",shapes:f,data:new di(l)}]},pp.uniq=function(e,n,r){var i=ki(e),a=ap(r.expression,e,n),o=r.max_count||1,s={},u=[],c=!!r.verbose,f=!!r.invert,l=!!r.index,h=e.data?e.data.getRecords():null,p=function(e,t){return u[t]};t.repeat(i,function(e){var n,r=a(e),i=r in s?s[r]+1:1,p=i<=o;l?(p=!0,(n=h&&h[e])&&(n.index=i)):f&&(p=!p),u[e]=p,s[r]=i,c&&!p&&xt(t.format("Removing feature %i key: [%s]",e,r))}),e.shapes&&(e.shapes=e.shapes.filter(p)),h&&(e.data=new di(h.filter(p))),!1!==r.verbose&&xt(t.format("Retained %,d of %,d features",ki(e),i))},pp.variableSimplify=function(e,n,r){var i,a,o=e[0],s=n.arcs;1!=e.length&&bt("Variable simplification requires a single target layer"),wi(o)||bt("Target layer is missing path data"),OC(s,r=CC(n,r)),r.interval?i=function(e,t,n,r){var i=ap(e,t,n.arcs);return function(e){return FC(i(e),n,r)}}(r.interval,o,n,r):r.percentage?i=function(e,n,r){var i=uP(e,n,r.arcs),a=qa(r.arcs);return function(e){var n=i(e),r=t.parsePercent(n);return a(r)}}(r.percentage,o,n):r.resolution?i=function(e,t,n,r){var i=uP(e,t,n.arcs);return function(e){return UC(i(e),n.arcs,r)}}(r.resolution,o,n,r):bt("Missing a simplification expression"),a=function(e,n,r){var i,a=new Float64Array(n.size()),o=-1;t.initializeArray(a,o),e.shapes.forEach(function(e,t){i=r(t),br(e||[],c)});for(var s=0,u=a.length;s<u;s++)a[s]==o&&(a[s]=0);return a;function c(e){var t=e<0?~e:e,n=a[t];(n>i||n==o)&&(a[t]=i)}}(o,s,i),function(e,t){e.getVertexData().zz,e.forEach2(function(e,n,r,i,a,o){for(var s=t[e],u=1;u<r-1;u++)o[n+u]>=s&&(o[n+u]=1/0)})}(s,a),s.setRetainedInterval(1e20),kC(n,r),s.flatten()},pp.splitLayerOnGrid=function(e,n,r){var i,a=e.shapes,o=e.geometry_type,s=!!r.id_field,u=r.id_field||"__split__",c=function(e,n,r){var i=e.xmin,a=e.ymin,o=e.width(),s=e.height();r>0!=!1&&n>0!=!1||bt("Invalid grid parameters");o>0!=!1&&s>0!=!1||(n=1,r=1);return function(e){var u=Math.floor((e.centerX()-i)/o*n),c=Math.floor((e.centerY()-a)/s*r);return u=t.clamp(u,0,n-1)||0,"r"+(c=t.clamp(c,0,r-1)||0)+"c"+u}}(Ji(e,n),r.cols,r.rows);return o||bt("Layer has no geometry"),e.data||(e.data=new di(a.length)),i=e.data.getRecords(),e.shapes.forEach(function(e,t){var r="point"==o?Vt([e]):n.getMultiShapeBounds(e),a=r.hasBounds()?c(r):"";(i[t]=i[t]||{})[u]=a}),s?e:pp.splitLayer(e,u).filter(function(e){var t=e.data.getRecordAt(0)[u];return e.name=t,e.data.deleteField(u),!!t})},pp.subdivideLayer=function(e,t,n){return cP(e,t,n)};var lP="0.6.113";function hP(e){var t=gP.apply(null,arguments);if(mP(e,t,function(e){t.callback(e)}),t.promise)return t.promise}function pP(e){var n=gP.apply(null,arguments),r=n.callback,i=n.output=[];if(mP(e,n,function(e){return e?r(e):n.legacy?r(null,function(e){if(e.length>1)return t.pluck(e,"content");if(1==e.length)return e[0].content;return null}(i)):r(null,function(e){return e.reduce(function(e,t){return e[t.filename]=t.content,e},{})}(i))}),n.promise)return n.promise}function dP(e){var t,n=gP.apply(null,arguments),r=s("path").join("/Users/zhang/code/emap/node_modules/mapshaper","bin/mapshaper"),i=parseFloat(n.options.xl)||8;if(i<1||i>64)return Nt(t=new Error("Unsupported heap size:"+i+"GB")),n.callback(t),n.promise;yt()||(e+=" -quiet");var a=Math.round(1e3*i),o=[`"${ht.execPath}"`,"--max-old-space-size="+a,`"${r}"`,e].join(" "),u=s("child_process").exec(o,{},function(e,t,r){n.callback(e)});return u.stdout.pipe(ht.stdout),u.stderr.pipe(ht.stderr),n.promise?n.promise:void 0}function gP(e,n,r){var i={options:{}};return t.isFunction(n)?i.callback=n:t.isFunction(r)?(i.callback=r,i.legacy=n&&null!=hf(n),i.input=n):i.promise=new Promise(function(e,t){i.callback=function(n,r){n?t(n):e(r)}}),!i.legacy&&t.isObject(n)&&(n.xl?i.options=n:i.input=n),i}function mP(e,n,r){var i,a=n.output||null,o=n.input;try{i=oC(e)}catch(e){return Nt(e),r(e)}if(n.legacy&&(xt("Warning: deprecated input format"),i=function(e,n){var r=t.find(e,function(e){return"i"==e.name}),i=t.find(e,function(e){return"o"==e.name});r||(r={name:"i",options:{}},e.unshift(r));r.options.files=["__input__"],r.options.input={__input__:n},i||e.push({name:"o",options:{}});return e}(i,o),o=null),0===i.length)return r(new Tt("No commands to run"));if(0===(i=bP(i)).length)return c(null);i.forEach(function(e){cC(e.name)&&o&&(e.options.input=o),a&&("o"==e.name||"info"==e.name&&e.options.save_to)&&(e.options.output=a)});var s=i[i.length-1];qc()||"o"!=s.name||(s.options.final=!0);var u=function(e){var n=e[0],r=n.options;if("i"!=n.name||r.stdin||r.merge_files||r.combine_files||!r.files||r.files.length<2)return[e];return r.files.map(function(n){var i=[{name:"i",options:t.defaults({files:[n],replace:!0},r)}];return i.push.apply(i,e.slice(1)),i})}(i);function c(e,t){t&&QI(t)&&xt("Warning: -if command is missing a matching -endif"),(e=vP(e))&&Nt(e),r(e,t)}t.reduceAsync(u,null,function(e,t,n){yP(t,new u_,function(e,t){e=vP(e),n(e,t)})},c)}function yP(e,n,r){if(n||(n=new u_),e=function(e,t){var n={VERBOSE:!1,QUIET:!1,DEBUG:!1},r=t.filter(function(e){if("verbose"==e.name)n.VERBOSE=!0;else if("quiet"==e.name)n.QUIET=!0;else{if("debug"!=e.name)return!0;n.DEBUG=!0}return!1});return e.initSettings(n),r}(n,e),qc()||function(){var e=/^--max-old-space-size=([0-9]+)$/,t=ht.execArgv.find(function(t){return e.test(t)});t&&xt("Allocating",e.exec(t)[1]/1e3,"GB of heap memory")}(),0===(e=bP(e)).length)return r(null);t.reduceAsync(e,n,function(e,t,n){fP(t,e).then(function(e){n(null,e)}).catch(function(e){n(e)})},r)}function vP(e){return e&&"NonFatalError"==e.name?(Nt(e),null):e}function bP(e){return e.filter(function(e){if("version"==e.name)Et(lP);else if("encodings"==e.name)Zr();else if("colors"==e.name)_E(),Et("Built-in color schemes (from d3):"),Et("Categorical\n"+Rt(bE.categorical)),Et("\nSequential\n"+Rt(bE.sequential)),Et("\nDiverging\n"+Rt(bE.diverging)),Et("\nMulti-hue/rainbow\n"+Rt(bE.rainbow));else{if("projections"!=e.name)return!0;La()}return!1})}var _P=Object.freeze({__proto__:null,applyCommands:pP,runAndRemoveInfoCommands:bP,runCommands:hP,runCommandsXL:dP,runParsedCommands:yP,testCommands:function(e,t){mP(e,{},function(e,n){var r,i=n?n.catalog.getDefaultTargets():[];!e&&i.length>0&&(r=i[0].dataset),t(e,r)})}}),xP=Vl(.01);function wP(e){return" "+xP(e[0])+" "+xP(e[1])}function SP(e){return e.length>2&&"C"==e[2]}function AP(e){if(0===e.length)return"";var t,n,r,i="M",a=!1;for(n=0,r=e.length;n<r;n++)SP(t=e[n])?(i+=" C"+wP(t)+wP(e[++n])+wP(e[++n]),a=!0):a?(i+=" L"+wP(t),a=!1):i+=wP(t);return i}var EP=Object.freeze({__proto__:null,stringifyLineStringCoords:AP,stringifyPolygonCoords:function(e){for(var t=[],n=0;n<e.length;n++)t.push(AP(e[n])+" Z");return t.length>0?t.join(" "):""}});function MP(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}function IP(e,t,n){var r=n[0],i=n[2];return e>i[0]?(t>i[1]?4:t>=r[1]&&5)||6:e>=r[0]?(t>i[1]?3:t>=r[1]&&8)||7:(t>i[1]?2:t>=r[1]&&1)||0}function kP(e){return 0==e||2==e||4==e||6==e}function CP(e,t){return t<8&&t>=0?(t+8-2*e)%8:t}function PP(e,t,n){e.push(function(e,t){if(kP(e))return t[e/2].concat();vt("Invalid corner sector:",e)}(t,n))}function OP(e,t,n,r){var i,a,o=t?IP(t[0],t[1],r):-1,s=IP(n[0],n[1],r);8==o&&8==s?e.push(n):o==s||(-1==o?8==s?e.push(n):kP(s)&&PP(e,s,r):8==o?(TP(e,t,n,r),kP(s)&&PP(e,s,r)):8==s?(TP(e,t,n,r),e.push(n)):(r=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3];return 0===e?t=[n,r,i,a]:1==e?t=[r,i,a,n]:2==e?t=[i,a,n,r]:3==e?t=[a,n,r,i]:vt("Invalid rotation number"),t}(i=(a=o)>1&&a<8?Math.floor(a/2):0,r),o=CP(i,o),s=CP(i,s),0==o?0===s||1===s||7===s||(2==s||6==s?PP(e,s,r):3==s?TP(e,t,n,r)||PP(e,2,r):4==s?(TP(e,t,n,r)||(fr.orient2D(t[0],t[1],n[0],n[1],r[0][0],r[0][1])>1?PP(e,6,r):PP(e,2,r)),PP(e,s,r)):5==s&&(TP(e,t,n,r)||PP(e,6,r))):1==o?2==s||0===s?PP(e,s,r):3==s?TP(e,t,n,r)||PP(e,2,r):4==s?(TP(e,t,n,r)||PP(e,2,r),PP(e,4,r)):5==s?TP(e,t,n,r):6==s?(TP(e,t,n,r)||PP(e,0,r),PP(e,6,r)):7==s&&(TP(e,t,n,r)||PP(e,0,r)):vt("Sector error")))}function NP(e,t,n,r,i){var a=fr.segmentIntersection(t[0],t[1],n[0],n[1],r[0],r[1],i[0],i[1]);a&&e.push(a)}function TP(e,t,n,r){var i=[];return NP(i,t,n,r[0],r[1]),NP(i,t,n,r[0],r[3]),NP(i,t,n,r[1],r[2]),NP(i,t,n,r[2],r[3]),i.length>0&&(e.push.apply(e,i),!0)}var LP={};LP.svg=Object.assign({},hm,EP,Tg,Rg,Gg),Object.assign(LP,{Job:u_,Dbf:Tm,DbfReader:Rv,DouglasPeucker:wC,parseGeoJSON:hb,geojson:_d,json:{parse:function(e){var t=Lb(k(e)?new Ty(e):e,0);yb(t);var n=Sb(t);return yb(t),t.peek()!=ib&&db(t.peek(),t.index()),n}},ShpType:ay,topojson:uy,Visvalingam:lC,ArcCollection:Wa,Bounds:qt,clipIterByBounds:function(e,t){for(var n,r,i,a,o=[],s=function(e){return[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin]]}(t);e.hasNext();)OP(o,r,n=[e.x,e.y],s),r=n,i||(i=n);return(a=MP(i,n))&&o.length>0&&!MP(o[0],o[o.length-1])&&o.push(o[0].concat()),(a&&o.length<4||o.length<2)&&(o=[]),o},CommandParser:Av,DataTable:di,editArcs:qM,Heap:kM,IdLookupIndex:function(e){var t=new Uint32Array(e);this.setId=function(n,r){n>=0&&r>=0&&r<e-1?t[n]=r+1:vt("Invalid value")},this.hasId=function(e){return this.getId(e)>-1},this.getId=function(n){return n>=0&&n<e?t[n]-1:-1}},NodeCollection:lo,parseDMS:Mh,formatDMS:kh,PathIndex:Vf,PolygonIndex:qf,ShpReader:Vv,Transform:Gt}),Object.assign(LP,Uh,jS,go,tn,VE,Nm,vp,hp,s_,XE,DE,QE,ta,Mp,To,pi,Fv,iy,sv,Vy,ev,Yr,hy,Py,ip,cp,jf,e_,$o,zy,Mf,jM,rI,$d,om,ax,Td,nb,Hc,Gb,pM,Qp,zk,_p,yM,MM,Fb,_y,IC,sa,Zi,TI,Bt,uo,hd,Sv,Sy,FE,cf,Yb,uC,fo,Hf,Al,dl,Yv,Bp,Mr,dI,vk,eC,Zt,Tp,md,sd,nd,BS,q_,cd,TE,xC,YI,Da,GI,tI,yi,Xl,_P,em,cr,Rl,Ga,Tr,Gv,sy,Xv,BC,Lh,Ja,gh,Yn,i_,VC,Vc,o,Qf,Pm,_g,aP,Zh,my,ab,eo,fh,ng,gm,ul,Tf);var zP={runCommands:hP,applyCommands:pP,runCommandsXL:dP,enableLogging:mt};Object.assign(zP,{cli:Lf,cmd:pp,geom:fr,utils:t,internal:LP}),e.exports?e.exports=zP:"object"==typeof window&&window&&(window.mapshaper=zP)}()}(pt);var Pa=t(pt.exports);export{Pa as default};
|